@instructure/quiz-core 20.3.0 → 20.3.1-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 (37) hide show
  1. package/es/common/components/PrintFontSizeModal/presenter.js +19 -22
  2. package/es/common/components/PrintFontSizeModal/styles.js +13 -0
  3. package/es/common/components/PrintFontSizeModal/theme.js +4 -2
  4. package/es/common/components/alerts/presenter.js +20 -24
  5. package/es/common/components/alerts/styles.js +24 -0
  6. package/es/common/components/alerts/theme.js +4 -2
  7. package/es/common/components/shared/CardEmotion/CardContent/index.js +3 -3
  8. package/es/common/components/shared/CardEmotion/CardWrapper/index.js +3 -3
  9. package/es/common/components/shared/CardEmotion/index.js +2 -2
  10. package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +55 -56
  11. package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/styles.js +53 -0
  12. package/es/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/theme.js +4 -2
  13. package/es/reporting/components/resources/ReportCard/index.js +18 -23
  14. package/es/reporting/components/resources/ReportCard/styles.js +24 -0
  15. package/es/reporting/components/resources/ReportCard/theme.js +4 -2
  16. package/es/reporting/components/resources/ReportList/index.js +15 -21
  17. package/es/reporting/components/resources/ReportList/styles.js +19 -0
  18. package/es/reporting/components/resources/ReportList/theme.js +4 -2
  19. package/lib/common/components/PrintFontSizeModal/presenter.js +18 -24
  20. package/lib/common/components/PrintFontSizeModal/styles.js +21 -0
  21. package/lib/common/components/PrintFontSizeModal/theme.js +6 -3
  22. package/lib/common/components/alerts/presenter.js +19 -25
  23. package/lib/common/components/alerts/styles.js +34 -0
  24. package/lib/common/components/alerts/theme.js +6 -3
  25. package/lib/common/components/shared/CardEmotion/CardContent/index.js +3 -3
  26. package/lib/common/components/shared/CardEmotion/CardWrapper/index.js +3 -3
  27. package/lib/common/components/shared/CardEmotion/index.js +2 -2
  28. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/presenter.js +54 -59
  29. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/styles.js +64 -0
  30. package/lib/reporting/components/resources/NewQuizAndItemAnalysis/ReportCard/theme.js +6 -3
  31. package/lib/reporting/components/resources/ReportCard/index.js +17 -24
  32. package/lib/reporting/components/resources/ReportCard/styles.js +34 -0
  33. package/lib/reporting/components/resources/ReportCard/theme.js +6 -3
  34. package/lib/reporting/components/resources/ReportList/index.js +14 -22
  35. package/lib/reporting/components/resources/ReportList/styles.js +27 -0
  36. package/lib/reporting/components/resources/ReportList/theme.js +6 -3
  37. package/package.json +10 -10
@@ -5,24 +5,19 @@ 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 { Modal, ModalHeader, ModalBody, ModalFooter } from '@instructure/quiz-common';
11
12
  import { Heading } from '@instructure/ui-heading';
12
13
  import { Button, CloseButton } from '@instructure/ui-buttons';
13
- import { themeable } from '@instructure/ui-themeable';
14
- var styles = {
15
- componentId: 'ccksF',
16
- template: function template(theme) {
17
- return "\n\n.ccksF_fatK{border-bottom:solid ".concat(theme.separatorBorderWidth || 'inherit', ";border-color:").concat(theme.separatorColor || 'inherit', ";margin:").concat(theme.separatorMargin || 'inherit', " 0;padding:0;width:100%}");
18
- },
19
- 'separator': 'ccksF_fatK'
20
- };
21
- import theme from "./theme.js";
14
+ import { withStyle, jsx } from '@instructure/emotion';
15
+ import generateStyle from "./styles.js";
16
+ import generateComponentTheme from "./theme.js";
22
17
  import t from '@instructure/quiz-i18n/es/format-message';
23
18
  import { RadioInputGroup, RadioInput } from '@instructure/ui-radio-input';
24
19
  import { Checkbox } from '@instructure/ui-checkbox';
25
- export var PrintFontSizeModal = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
20
+ export var PrintFontSizeModal = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
26
21
  _inherits(PrintFontSizeModal, _Component);
27
22
 
28
23
  var _super = _createSuper(PrintFontSizeModal);
@@ -109,18 +104,18 @@ export var PrintFontSizeModal = (_dec = themeable(theme, styles), _dec(_class =
109
104
  }, {
110
105
  key: "render",
111
106
  value: function render() {
112
- return /*#__PURE__*/React.createElement(Modal, {
107
+ return jsx(Modal, {
113
108
  open: this.props.isOpen,
114
109
  onDismiss: this.props.onCancel,
115
110
  onExited: this.props.onExited,
116
111
  size: "small",
117
112
  label: this.text.printQuiz
118
- }, /*#__PURE__*/React.createElement(ModalHeader, null, /*#__PURE__*/React.createElement(Heading, null, this.text.printQuiz), /*#__PURE__*/React.createElement(CloseButton, {
113
+ }, jsx(ModalHeader, null, jsx(Heading, null, this.text.printQuiz), jsx(CloseButton, {
119
114
  onClick: this.props.onCancel,
120
115
  placement: "end",
121
116
  offset: "medium",
122
117
  screenReaderLabel: this.text.close
123
- })), /*#__PURE__*/React.createElement(ModalBody, null, /*#__PURE__*/React.createElement(RadioInputGroup, {
118
+ })), jsx(ModalBody, null, jsx(RadioInputGroup, {
124
119
  onChange: this.handleFontSizeChange,
125
120
  name: "print-font-size",
126
121
  value: this.state.selectedFontSize,
@@ -128,7 +123,7 @@ export var PrintFontSizeModal = (_dec = themeable(theme, styles), _dec(_class =
128
123
  description: t('Text size'),
129
124
  "data-automation": "print-font-size-modal-radio-group"
130
125
  }, this.sizes.map(function (size) {
131
- var label = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, size.label), " ", /*#__PURE__*/React.createElement("p", {
126
+ var label = jsx("div", null, jsx("span", null, size.label), " ", jsx("p", {
132
127
  "aria-hidden": "true",
133
128
  style: {
134
129
  fontSize: "".concat(size.size, "rem"),
@@ -138,25 +133,25 @@ export var PrintFontSizeModal = (_dec = themeable(theme, styles), _dec(_class =
138
133
  }, t('Printed quiz question')));
139
134
  var key = "print-font-size-modal-radio-button-key-".concat(size.value);
140
135
  var dataAutomation = "print-font-size-modal-radio-button-".concat(size.value);
141
- return /*#__PURE__*/React.createElement(RadioInput, {
136
+ return jsx(RadioInput, {
142
137
  key: key,
143
138
  "data-automation": dataAutomation,
144
139
  inline: true,
145
140
  label: label,
146
141
  value: size.value
147
142
  });
148
- })), /*#__PURE__*/React.createElement("div", {
149
- className: styles.separator
150
- }), /*#__PURE__*/React.createElement(Checkbox, {
143
+ })), jsx("div", {
144
+ css: this.props.styles.separator
145
+ }), jsx(Checkbox, {
151
146
  label: this.text.rememberTextSizeSetting,
152
147
  checked: this.state.rememberTextSizeSetting,
153
148
  onChange: this.handleRememberFontSize
154
- })), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
149
+ })), jsx(ModalFooter, null, jsx(Button, {
155
150
  "data-automation": "sdk-print-font-size-cancel-button",
156
151
  color: "primary-inverse",
157
152
  onClick: this.props.onCancel,
158
153
  margin: "0 x-small 0 0"
159
- }, this.text.cancel), /*#__PURE__*/React.createElement(Button, {
154
+ }, this.text.cancel), jsx(Button, {
160
155
  "data-automation": "sdk-print-font-size-print-preview-button",
161
156
  color: "primary",
162
157
  onClick: this.handleSubmit,
@@ -172,7 +167,9 @@ export var PrintFontSizeModal = (_dec = themeable(theme, styles), _dec(_class =
172
167
  persistedPrintFontSize: PropTypes.string,
173
168
  onSubmit: PropTypes.func.isRequired,
174
169
  onCancel: PropTypes.func.isRequired,
175
- onExited: PropTypes.func.isRequired
170
+ onExited: PropTypes.func.isRequired,
171
+ // eslint-disable-next-line react/require-default-props,react/forbid-prop-types
172
+ styles: PropTypes.object
176
173
  }, _class2.defaultProps = {
177
174
  isOpen: false,
178
175
  persistedPrintFontSize: 'medium'
@@ -0,0 +1,13 @@
1
+ var generateStyle = function generateStyle(componentTheme) {
2
+ return {
3
+ separator: {
4
+ width: '100%',
5
+ margin: "".concat(componentTheme.separatorMargin, " 0"),
6
+ padding: 0,
7
+ borderBottom: "solid ".concat(componentTheme.separatorBorderWidth),
8
+ borderColor: componentTheme.separatorColor
9
+ }
10
+ };
11
+ };
12
+
13
+ export default generateStyle;
@@ -1,4 +1,4 @@
1
- export default function generator(_ref) {
1
+ var generateComponentTheme = function generateComponentTheme(_ref) {
2
2
  var colors = _ref.colors,
3
3
  borders = _ref.borders,
4
4
  spacing = _ref.spacing;
@@ -7,4 +7,6 @@ export default function generator(_ref) {
7
7
  separatorBorderWidth: borders.widthSmall,
8
8
  separatorMargin: spacing.medium
9
9
  };
10
- }
10
+ };
11
+
12
+ export default generateComponentTheme;
@@ -5,24 +5,18 @@ 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 ImmutablePropTypes from 'react-immutable-proptypes';
11
12
  import partial from 'lodash/partial';
12
13
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
13
14
  import { Alert } from '@instructure/ui-alerts';
14
- import { themeable } from '@instructure/ui-themeable';
15
+ import { withStyle, jsx } from '@instructure/emotion';
15
16
  import t from '@instructure/quiz-i18n/es/format-message';
16
- var styles = {
17
- componentId: 'cYPGH',
18
- template: function template(theme) {
19
- return "\n\n.cYPGH_ddjo{box-sizing:border-box;padding-left:".concat(theme.alertsPadding || 'inherit', ";padding-right:").concat(theme.alertsPadding || 'inherit', ";padding-top:").concat(theme.alertsTopPadding || 'inherit', ";pointer-events:none;position:fixed;width:100%;z-index:").concat(theme.alertsZIndex || 'inherit', "}\n\n.cYPGH_eVxh{pointer-events:auto}\n\n@media screen and (--phoneBreakPoint){.cYPGH_ddjo{padding:").concat(theme.alertsMobilePadding || 'inherit', "}}");
20
- },
21
- 'alerts': 'cYPGH_ddjo',
22
- 'alertHolder': 'cYPGH_eVxh'
23
- };
24
- import theme from "./theme.js";
25
- export var Alerts = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
17
+ import generateStyle from "./styles.js";
18
+ import generateComponentTheme from "./theme.js";
19
+ export var Alerts = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
26
20
  _inherits(Alerts, _Component);
27
21
 
28
22
  var _super = _createSuper(Alerts);
@@ -46,10 +40,10 @@ export var Alerts = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
46
40
  }
47
41
 
48
42
  if (alert.variant === 'stickyerror') {
49
- return /*#__PURE__*/React.createElement("div", {
43
+ return jsx("div", {
50
44
  key: alert.uuid,
51
- className: styles.alertHolder
52
- }, /*#__PURE__*/React.createElement(Alert, {
45
+ css: _this.props.styles.alertHolder
46
+ }, jsx(Alert, {
53
47
  variant: "error",
54
48
  onDismiss: closeAlert,
55
49
  renderCloseButtonLabel: t('Close'),
@@ -57,10 +51,10 @@ export var Alerts = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
57
51
  }, alert.message));
58
52
  }
59
53
 
60
- return /*#__PURE__*/React.createElement("div", {
54
+ return jsx("div", {
61
55
  key: alert.uuid,
62
- className: styles.alertHolder
63
- }, /*#__PURE__*/React.createElement(Alert, {
56
+ css: _this.props.styles.alertHolder
57
+ }, jsx(Alert, {
64
58
  variant: alert.variant,
65
59
  onDismiss: closeAlert,
66
60
  renderCloseButtonLabel: t('Close'),
@@ -74,7 +68,7 @@ export var Alerts = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
74
68
  _createClass(Alerts, [{
75
69
  key: "renderScreenreaderAlert",
76
70
  value: function renderScreenreaderAlert(alert) {
77
- return /*#__PURE__*/React.createElement(ScreenReaderContent, {
71
+ return jsx(ScreenReaderContent, {
78
72
  key: alert.uuid
79
73
  }, alert.message);
80
74
  }
@@ -91,16 +85,16 @@ export var Alerts = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
91
85
  });
92
86
 
93
87
  if (hasStickyErrors) {
94
- return /*#__PURE__*/React.createElement("div", {
95
- className: styles.alerts,
88
+ return jsx("div", {
89
+ css: this.props.styles.alerts,
96
90
  style: {
97
91
  zIndex: '99999'
98
92
  }
99
93
  }, this.renderAlerts());
100
94
  }
101
95
 
102
- return /*#__PURE__*/React.createElement("div", {
103
- className: styles.alerts
96
+ return jsx("div", {
97
+ css: this.props.styles.alerts
104
98
  }, this.renderAlerts());
105
99
  }
106
100
  }]);
@@ -109,7 +103,9 @@ export var Alerts = (_dec = themeable(theme, styles), _dec(_class = (_temp = _cl
109
103
  return Alerts;
110
104
  }(Component), _class2.propTypes = {
111
105
  removeAlert: PropTypes.func.isRequired,
112
- alerts: ImmutablePropTypes.list.isRequired
106
+ alerts: ImmutablePropTypes.list.isRequired,
107
+ // eslint-disable-next-line react/require-default-props,react/forbid-prop-types
108
+ styles: PropTypes.object
113
109
  }, _class2.defaultProps = {
114
110
  sidebarOpen: false
115
111
  }, _temp)) || _class);
@@ -0,0 +1,24 @@
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
+ alerts: _defineProperty({
7
+ position: 'fixed',
8
+ pointerEvents: 'none',
9
+ width: '100%',
10
+ boxSizing: 'border-box',
11
+ zIndex: componentTheme.alertsZIndex,
12
+ paddingLeft: componentTheme.alertsPadding,
13
+ paddingRight: componentTheme.alertsPadding,
14
+ paddingTop: componentTheme.alertsTopPadding
15
+ }, mq, {
16
+ padding: componentTheme.alertsMobilePadding
17
+ }),
18
+ alertHolder: {
19
+ pointerEvents: 'auto'
20
+ }
21
+ };
22
+ };
23
+
24
+ export default generateStyle;
@@ -1,4 +1,4 @@
1
- export default function generator(_ref) {
1
+ var generateComponentTheme = function generateComponentTheme(_ref) {
2
2
  var breakpoints = _ref.breakpoints,
3
3
  spacing = _ref.spacing;
4
4
  return {
@@ -8,4 +8,6 @@ export default function generator(_ref) {
8
8
  alertsZIndex: '7777',
9
9
  phoneBreakPoint: "max-width: ".concat(breakpoints.medium)
10
10
  };
11
- }
11
+ };
12
+
13
+ export default generateComponentTheme;
@@ -31,7 +31,7 @@ export var CardContent = (_dec = withStyle(generateStyle, generateComponentTheme
31
31
  return jsx(View, {
32
32
  as: "div"
33
33
  }, jsx("div", Object.assign({
34
- css: _objectSpread(_objectSpread({}, this.props.styles.content), this.props.style)
34
+ css: _objectSpread(_objectSpread({}, this.props.styles.content), this.props.customStyles)
35
35
  }, omit(this.props, Object.keys(CardContent.propTypes))), this.props.children));
36
36
  }
37
37
  }]);
@@ -40,9 +40,9 @@ export var CardContent = (_dec = withStyle(generateStyle, generateComponentTheme
40
40
  return CardContent;
41
41
  }(Component), _class2.propTypes = {
42
42
  children: PropTypes.node.isRequired,
43
- style: PropTypes.object,
43
+ customStyles: PropTypes.object,
44
44
  styles: PropTypes.object
45
45
  }, _class2.defaultProps = {
46
- style: {}
46
+ customStyles: {}
47
47
  }, _temp)) || _class);
48
48
  export default CardContent;
@@ -31,7 +31,7 @@ export var CardWrapper = (_dec = withStyle(generateStyle, generateComponentTheme
31
31
  as: "div",
32
32
  height: "100%"
33
33
  }, jsx("div", {
34
- css: _objectSpread(_objectSpread({}, this.props.styles.wrapper), this.props.style)
34
+ css: _objectSpread(_objectSpread({}, this.props.styles.wrapper), this.props.customStyles)
35
35
  }, this.props.children));
36
36
  }
37
37
  }]);
@@ -40,9 +40,9 @@ export var CardWrapper = (_dec = withStyle(generateStyle, generateComponentTheme
40
40
  return CardWrapper;
41
41
  }(Component), _class2.propTypes = {
42
42
  children: PropTypes.node.isRequired,
43
- style: PropTypes.object,
43
+ customStyles: PropTypes.object,
44
44
  styles: PropTypes.object
45
45
  }, _class2.defaultProps = {
46
- style: {}
46
+ customStyles: {}
47
47
  }, _temp)) || _class);
48
48
  export default CardWrapper;
@@ -16,13 +16,13 @@ export function Card(_ref) {
16
16
  }
17
17
  Card.propTypes = {
18
18
  children: PropTypes.node.isRequired,
19
- style: PropTypes.object,
19
+ customStyles: PropTypes.object,
20
20
  wrapperClassName: PropTypes.object,
21
21
  wrapped: PropTypes.bool
22
22
  };
23
23
  Card.defaultProps = {
24
24
  wrapped: false,
25
- style: null,
25
+ customStyles: null,
26
26
  wrapperClassName: null
27
27
  };
28
28
  export default Card;
@@ -1,4 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
4
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
@@ -6,37 +5,25 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
5
 
7
6
  var _dec, _class, _class2, _temp;
8
7
 
9
- import React, { Component } from 'react';
8
+ /** @jsx jsx */
9
+ import { Component } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import t from '@instructure/quiz-i18n/es/format-message';
12
12
  import { Text } from '@instructure/ui-text';
13
13
  import { Link } from '@instructure/ui-link';
14
14
  import { Flex } from '@instructure/ui-flex';
15
15
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
16
- import { themeable } from '@instructure/ui-themeable';
17
- import Card from "../../../../../common/components/shared/Card/index.js";
18
- var styles = {
19
- componentId: 'ebhXI',
20
- template: function template(theme) {
21
- return "\n\n.ebhXI_bqdH{column-gap:26px;display:flex;justify-content:flex-start;padding-bottom:".concat(theme.metricsPadding || 'inherit', ";row-gap:8px}\n\n.ebhXI_PFlN{display:inline-flex;flex-direction:column;margin:").concat(theme.cardMargin || 'inherit', ";padding:").concat(theme.cardPadding || 'inherit', ";width:").concat(theme.cardWidth || 'inherit', "}\n\n.ebhXI_dJIh{height:").concat(theme.cardHeight || 'inherit', "}\n\n.ebhXI_eWEX{align-items:flex-end;align-self:flex-end;display:flex;height:100%;justify-content:flex-end}\n\n.ebhXI_blRb{max-width:160px;padding-right:10px}\n\n.ebhXI_bxzy{border-bottom:1px solid ").concat(theme.quizSummaryBorderBottomColor || 'inherit', ";margin-bottom:15px;padding-bottom:15px}\n\n.ebhXI_dKIc{padding-bottom:15px}\n\n@media only screen and (max-width:25rem){.ebhXI_dJIh{height:auto}.ebhXI_PFlN{max-width:").concat(theme.cardWidth || 'inherit', ";width:auto}.ebhXI_bqdH{flex-wrap:wrap}}");
22
- },
23
- 'metricsContainer': 'ebhXI_bqdH',
24
- 'reportCard': 'ebhXI_PFlN',
25
- 'emptyReportCard': 'ebhXI_dJIh',
26
- 'emptyCardBodyContainer': 'ebhXI_eWEX',
27
- 'dateContainer': 'ebhXI_blRb',
28
- 'quizAnalysisSummary': 'ebhXI_bxzy',
29
- 'titleContainer': 'ebhXI_dKIc'
30
- };
31
- import theme from "./theme.js";
32
- import classnames from 'classnames';
16
+ import { withStyle, jsx } from '@instructure/emotion';
17
+ import Card from "../../../../../common/components/shared/CardEmotion/index.js";
18
+ import generateStyle from "./styles.js";
19
+ import generateComponentTheme from "./theme.js";
33
20
  import AnalysisMetric from "../AnalysisMetric/index.js";
34
21
  import Spinner from "../../../../../common/components/shared/spinner/Spinner.js";
35
22
  import { AnalysisUpdateDate } from "../AnalysisUpdateDate/index.js";
36
23
  import { itemAnalysisPropType, quizAnalysisPropType } from "../propTypes.js";
37
24
  import { csvFormat } from "../exportFormats.js";
38
25
  import { ExportButton } from "../ExportButton/index.js";
39
- export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
26
+ export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
40
27
  _inherits(NewQuizAndItemAnalysisReportCardPresenter, _Component);
41
28
 
42
29
  var _super = _createSuper(NewQuizAndItemAnalysisReportCardPresenter);
@@ -69,19 +56,19 @@ export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = themeable(theme,
69
56
  var _quizAnalysis$scores, _quizAnalysis$scores2, _quizAnalysis$scores3;
70
57
 
71
58
  var quizAnalysis = _this.props.quizAnalysis;
72
- return /*#__PURE__*/React.createElement("div", {
73
- className: styles.metricsContainer
74
- }, /*#__PURE__*/React.createElement(AnalysisMetric, {
59
+ return jsx("div", {
60
+ css: _this.props.styles.metricsContainer
61
+ }, jsx(AnalysisMetric, {
75
62
  metricKey: "highscore",
76
63
  label: t('High Score'),
77
64
  value: (_quizAnalysis$scores = quizAnalysis.scores) === null || _quizAnalysis$scores === void 0 ? void 0 : _quizAnalysis$scores.max_percentage,
78
65
  suffix: "%"
79
- }), /*#__PURE__*/React.createElement(AnalysisMetric, {
66
+ }), jsx(AnalysisMetric, {
80
67
  metricKey: "lowscore",
81
68
  label: t('Low Score'),
82
69
  value: (_quizAnalysis$scores2 = quizAnalysis.scores) === null || _quizAnalysis$scores2 === void 0 ? void 0 : _quizAnalysis$scores2.min_percentage,
83
70
  suffix: "%"
84
- }), /*#__PURE__*/React.createElement(AnalysisMetric, {
71
+ }), jsx(AnalysisMetric, {
85
72
  metricKey: "meanscore",
86
73
  label: t('Mean Score'),
87
74
  value: (_quizAnalysis$scores3 = quizAnalysis.scores) === null || _quizAnalysis$scores3 === void 0 ? void 0 : _quizAnalysis$scores3.mean_percentage,
@@ -94,31 +81,31 @@ export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = themeable(theme,
94
81
  quizAnalysis = _this$props.quizAnalysis,
95
82
  itemAnalyses = _this$props.itemAnalyses,
96
83
  href = _this$props.href;
97
- return /*#__PURE__*/React.createElement("div", {
98
- className: styles.quizAnalysisSummary
99
- }, _this.renderMetrics(), /*#__PURE__*/React.createElement(Flex, {
84
+ return jsx("div", {
85
+ css: _this.props.styles.quizAnalysisSummary
86
+ }, _this.renderMetrics(), jsx(Flex, {
100
87
  direction: "row",
101
88
  justifyItems: "space-between"
102
- }, /*#__PURE__*/React.createElement("div", {
103
- className: styles.dateContainer
104
- }, /*#__PURE__*/React.createElement(AnalysisUpdateDate, {
89
+ }, jsx("div", {
90
+ css: _this.props.styles.dateContainer
91
+ }, jsx(AnalysisUpdateDate, {
105
92
  date: quizAnalysis.created_timestamp,
106
93
  multiline: true
107
- })), quizAnalysis && itemAnalyses && /*#__PURE__*/React.createElement(Link, {
94
+ })), quizAnalysis && itemAnalyses && jsx(Link, {
108
95
  href: href,
109
96
  "data-automation": "sdk-new-ia-report-card-view-report-button"
110
- }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('View Quiz and Item Analysis Report')), /*#__PURE__*/React.createElement(Text, {
97
+ }, jsx(ScreenReaderContent, null, t('View Quiz and Item Analysis Report')), jsx(Text, {
111
98
  size: "small",
112
99
  "aria-hidden": "true"
113
100
  }, t('View Report')))));
114
101
  };
115
102
 
116
103
  _this.renderSpinner = function (mainText) {
117
- return /*#__PURE__*/React.createElement("div", {
118
- className: styles.emptyCardBodyContainer
119
- }, /*#__PURE__*/React.createElement(Flex, {
104
+ return jsx("div", {
105
+ css: _this.props.styles.emptyCardBodyContainer
106
+ }, jsx(Flex, {
120
107
  direction: "row"
121
- }, /*#__PURE__*/React.createElement(Flex.Item, null, /*#__PURE__*/React.createElement(Spinner, {
108
+ }, jsx(Flex.Item, null, jsx(Spinner, {
122
109
  size: "x-small",
123
110
  color: "brand",
124
111
  minHeight: "0",
@@ -129,11 +116,11 @@ export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = themeable(theme,
129
116
  };
130
117
 
131
118
  _this.renderGenerateReportButton = function () {
132
- return /*#__PURE__*/React.createElement(Link, {
119
+ return jsx(Link, {
133
120
  onClick: _this.handleGeneration,
134
121
  role: "button",
135
122
  "data-automation": "sdk-new-ia-report-card-generate-report-button"
136
- }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('Generate Quiz and Item Analysis Report')), /*#__PURE__*/React.createElement(Text, {
123
+ }, jsx(ScreenReaderContent, null, t('Generate Quiz and Item Analysis Report')), jsx(Text, {
137
124
  size: "small",
138
125
  "aria-hidden": "true"
139
126
  }, t('Generate Report')));
@@ -143,19 +130,19 @@ export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = themeable(theme,
143
130
  var _this$props2 = _this.props,
144
131
  generationInProgress = _this$props2.generationInProgress,
145
132
  analysisError = _this$props2.analysisError;
146
- return /*#__PURE__*/React.createElement("div", {
147
- className: styles.emptyCardBodyContainer
148
- }, /*#__PURE__*/React.createElement(Flex, {
133
+ return jsx("div", {
134
+ css: _this.props.styles.emptyCardBodyContainer
135
+ }, jsx(Flex, {
149
136
  direction: "row",
150
137
  justifyItems: "space-between"
151
- }, /*#__PURE__*/React.createElement(Flex.Item, {
138
+ }, jsx(Flex.Item, {
152
139
  shouldShrink: true,
153
140
  size: analysisError && !generationInProgress ? '40%' : null
154
- }, analysisError && !generationInProgress && /*#__PURE__*/React.createElement(Text, {
141
+ }, analysisError && !generationInProgress && jsx(Text, {
155
142
  size: "x-small",
156
143
  weight: "bold",
157
144
  color: "danger"
158
- }, analysisError)), /*#__PURE__*/React.createElement(Flex.Item, {
145
+ }, analysisError)), jsx(Flex.Item, {
159
146
  shouldShrink: analysisError && !generationInProgress
160
147
  }, generationInProgress ? _this.renderSpinner(t('Generation In Progress')) : _this.renderGenerateReportButton())));
161
148
  };
@@ -164,7 +151,7 @@ export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = themeable(theme,
164
151
  var _this$props3 = _this.props,
165
152
  quizAnalysis = _this$props3.quizAnalysis,
166
153
  generationInProgress = _this$props3.generationInProgress;
167
- return /*#__PURE__*/React.createElement(ExportButton, {
154
+ return jsx(ExportButton, {
168
155
  quizAnalysis: quizAnalysis,
169
156
  generationInProgress: generationInProgress,
170
157
  handleExport: _this.handleExport
@@ -176,31 +163,41 @@ export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = themeable(theme,
176
163
  name = _this$props4.name,
177
164
  exportEnabled = _this$props4.exportEnabled,
178
165
  fetchInProgress = _this$props4.fetchInProgress;
179
- return /*#__PURE__*/React.createElement("div", {
180
- className: styles.titleContainer
181
- }, /*#__PURE__*/React.createElement(Flex, {
166
+ return jsx("div", {
167
+ css: _this.props.styles.titleContainer
168
+ }, jsx(Flex, {
182
169
  direction: "row",
183
170
  wrap: "wrap",
184
171
  justifyItems: "space-between"
185
- }, /*#__PURE__*/React.createElement(Flex.Item, null, /*#__PURE__*/React.createElement(Text, {
172
+ }, jsx(Flex.Item, null, jsx(Text, {
186
173
  size: "medium",
187
174
  weight: "bold"
188
- }, name)), exportEnabled && !fetchInProgress && /*#__PURE__*/React.createElement(Flex.Item, null, _this.renderExport())));
175
+ }, name)), exportEnabled && !fetchInProgress && jsx(Flex.Item, null, _this.renderExport())));
189
176
  };
190
177
 
191
178
  return _this;
192
179
  }
193
180
 
194
181
  _createClass(NewQuizAndItemAnalysisReportCardPresenter, [{
182
+ key: "componentDidMount",
183
+ value: function componentDidMount() {
184
+ this.props.makeStyles();
185
+ }
186
+ }, {
187
+ key: "componentDidUpdate",
188
+ value: function componentDidUpdate() {
189
+ this.props.makeStyles();
190
+ }
191
+ }, {
195
192
  key: "render",
196
193
  value: function render() {
197
194
  var _this$props5 = this.props,
198
195
  fetchInProgress = _this$props5.fetchInProgress,
199
196
  quizAnalysis = _this$props5.quizAnalysis,
200
- analysisError = _this$props5.analysisError;
201
- var reportCardStyles = classnames(styles.reportCard, _defineProperty({}, styles.emptyReportCard, !quizAnalysis && !analysisError));
202
- return /*#__PURE__*/React.createElement(Card, {
203
- className: reportCardStyles
197
+ styles = _this$props5.styles;
198
+ return jsx(Card, {
199
+ css: styles.reportCard,
200
+ customStyles: styles.reportCard
204
201
  }, this.renderReportCardHeader(), !fetchInProgress && quizAnalysis && this.renderQuizAnalysisSummary(), fetchInProgress && this.renderSpinner(), !fetchInProgress && this.renderReportCardFooter());
205
202
  }
206
203
  }]);
@@ -217,7 +214,9 @@ export var NewQuizAndItemAnalysisReportCardPresenter = (_dec = themeable(theme,
217
214
  analysisError: PropTypes.string,
218
215
  generateReports: PropTypes.func.isRequired,
219
216
  exportReports: PropTypes.func.isRequired,
220
- exportEnabled: PropTypes.bool.isRequired
217
+ exportEnabled: PropTypes.bool.isRequired,
218
+ styles: PropTypes.object,
219
+ makeStyles: PropTypes.func
221
220
  }, _class2.defaultProps = {
222
221
  name: void 0,
223
222
  href: void 0,
@@ -0,0 +1,53 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+
4
+ var generateStyle = function generateStyle(componentTheme, props) {
5
+ var msMaxWidth = 'max-width: 25rem';
6
+ var mq = "@media only screen and (".concat(msMaxWidth, ")");
7
+ return {
8
+ metricsContainer: _defineProperty({
9
+ paddingBottom: componentTheme.metricsPadding,
10
+ display: 'flex',
11
+ justifyContent: 'flex-start',
12
+ columnGap: '26px',
13
+ rowGap: '8px'
14
+ }, mq, {
15
+ flexWrap: 'wrap'
16
+ }),
17
+ reportCard: _objectSpread(_defineProperty({
18
+ width: componentTheme.cardWidth,
19
+ padding: componentTheme.cardPadding,
20
+ margin: componentTheme.cardMargin,
21
+ display: 'inline-flex',
22
+ flexDirection: 'column'
23
+ }, mq, {
24
+ width: 'initial',
25
+ maxWidth: componentTheme.cardWidth
26
+ }), !props.quizAnalysis && !props.analysisError && _defineProperty({
27
+ height: componentTheme.cardHeight
28
+ }, mq, {
29
+ height: 'initial'
30
+ })),
31
+ emptyCardBodyContainer: {
32
+ display: 'flex',
33
+ justifyContent: 'flex-end',
34
+ alignItems: 'flex-end',
35
+ alignSelf: 'flex-end',
36
+ height: '100%'
37
+ },
38
+ dateContainer: {
39
+ maxWidth: '160px',
40
+ paddingRight: '10px'
41
+ },
42
+ quizAnalysisSummary: {
43
+ borderBottom: "1px solid ".concat(componentTheme.quizSummaryBorderBottomColor),
44
+ paddingBottom: '15px',
45
+ marginBottom: '15px'
46
+ },
47
+ titleContainer: {
48
+ paddingBottom: '15px'
49
+ }
50
+ };
51
+ };
52
+
53
+ 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
  return {
@@ -9,4 +9,6 @@ export default function generator(_ref) {
9
9
  cardMargin: spacing.xSmall,
10
10
  quizSummaryBorderBottomColor: colors.tiara
11
11
  };
12
- }
12
+ };
13
+
14
+ export default generateComponentTheme;