@instructure/quiz-core 20.5.1 → 20.5.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 (19) hide show
  1. package/es/common/components/resources/sessionItemResult/ResultStimulus/index.js +36 -47
  2. package/es/common/components/resources/sessionItemResult/ResultStimulus/styles.js +69 -0
  3. package/es/common/components/resources/sessionItemResult/ResultStimulus/theme.js +4 -2
  4. package/es/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +60 -62
  5. package/es/common/components/resources/sessionItemResult/SessionItemResult/styles.js +50 -0
  6. package/es/common/components/resources/sessionItemResult/SessionItemResult/theme.js +4 -2
  7. package/es/common/components/resources/sessionItemResult/SessionItemResultsList/index.js +18 -23
  8. package/es/common/components/resources/sessionItemResult/SessionItemResultsList/styles.js +17 -0
  9. package/es/common/components/resources/sessionItemResult/SessionItemResultsList/theme.js +4 -2
  10. package/lib/common/components/resources/sessionItemResult/ResultStimulus/index.js +35 -48
  11. package/lib/common/components/resources/sessionItemResult/ResultStimulus/styles.js +79 -0
  12. package/lib/common/components/resources/sessionItemResult/ResultStimulus/theme.js +6 -3
  13. package/lib/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +57 -64
  14. package/lib/common/components/resources/sessionItemResult/SessionItemResult/styles.js +60 -0
  15. package/lib/common/components/resources/sessionItemResult/SessionItemResult/theme.js +6 -3
  16. package/lib/common/components/resources/sessionItemResult/SessionItemResultsList/index.js +17 -24
  17. package/lib/common/components/resources/sessionItemResult/SessionItemResultsList/styles.js +25 -0
  18. package/lib/common/components/resources/sessionItemResult/SessionItemResultsList/theme.js +6 -3
  19. package/package.json +10 -10
@@ -5,31 +5,16 @@ 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
- import { themeable } from '@instructure/ui-themeable';
12
+ import { withStyle, jsx } from '@instructure/emotion';
12
13
  import { RichContentRenderer } from '@instructure/quiz-rce';
13
14
  import t from '@instructure/quiz-i18n/es/format-message';
14
- var styles = {
15
- componentId: 'fcFqb',
16
- template: function template(theme) {
17
- return "\n\n.fcFqb_bGBk{border-bottom:".concat(theme.rootBorderWidth || 'inherit', " solid ").concat(theme.rootBorderColor || 'inherit', ";overflow:hidden}\n\n.fcFqb_pJNU{border:").concat(theme.instructionsBorderWidth || 'inherit', " solid ").concat(theme.instructionsBorderColor || 'inherit', ";padding:").concat(theme.instructionsPaddingTopBottom || 'inherit', " ").concat(theme.instructionsPaddingLeftRight || 'inherit', "}\n\n.fcFqb_dEpm{font-weight:").concat(theme.instructionsHeaderFontWeight || 'inherit', ";padding-bottom:").concat(theme.instructionsHeaderPadding || 'inherit', "}\n\n.fcFqb_pypk{background-color:").concat(theme.infoBackgroundColor || 'inherit', ";height:100%;overflow:scroll;padding:").concat(theme.infoPaddingTopBottom || 'inherit', " ").concat(theme.infoPaddingLeftRight || 'inherit', "}\n\n.fcFqb_fsuY{padding-bottom:").concat(theme.headerPaddingBottom || 'inherit', ";padding-top:").concat(theme.headerPaddingTop || 'inherit', "}\n\n.fcFqb_nvdO{font-size:").concat(theme.titleFontSize || 'inherit', ";font-weight:").concat(theme.titleFontWeight || 'inherit', "}\n\n.fcFqb_JelF{padding:").concat(theme.itemsPadding || 'inherit', ";width:50%}\n\n.fcFqb_boAJ{flex:1 1 auto}\n\n.fcFqb_bbyJ{display:flex;flex-direction:row}\n\n.fcFqb_eNQJ{width:50%}\n\n@media screen and (--phoneBreakPoint){.fcFqb_bbyJ{flex-direction:column}.fcFqb_JelF,.fcFqb_eNQJ{width:100%}.fcFqb_pJNU{padding:").concat(theme.phoneInstructionsPaddingTopBottom || 'inherit', " ").concat(theme.phoneInstructionsPaddingLeftRight || 'inherit', "}.fcFqb_pypk{padding:").concat(theme.phoneInfoPadding || 'inherit', "}.fcFqb_eGWt{border-bottom:").concat(theme.phoneConnectingLinesBorderWidth || 'inherit', " dotted;border-color:").concat(theme.phoneConnectingLinesBorderColor || 'inherit', ";border-left:").concat(theme.phoneConnectingLinesBorderWidth || 'inherit', " dotted;flex:0 0 1rem;height:2rem;margin-right:").concat(theme.phoneConnectingLinesMargin || 'inherit', ";margin-top:").concat(theme.phoneConnectingLinesMargin || 'inherit', ";width:1.5rem}}");
18
- },
19
- 'root': 'fcFqb_bGBk',
20
- 'instructions': 'fcFqb_pJNU',
21
- 'instructionsHeader': 'fcFqb_dEpm',
22
- 'info': 'fcFqb_pypk',
23
- 'header': 'fcFqb_fsuY',
24
- 'title': 'fcFqb_nvdO',
25
- 'items': 'fcFqb_JelF',
26
- 'stimulusItem': 'fcFqb_boAJ',
27
- 'stimulusGroup': 'fcFqb_bbyJ',
28
- 'stimulusInfo': 'fcFqb_eNQJ',
29
- 'connectingLines': 'fcFqb_eGWt'
30
- };
31
- import theme from "./theme.js";
32
- export var ResultStimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
15
+ import generateStyle from "./styles.js";
16
+ import generateComponentTheme from "./theme.js";
17
+ export var ResultStimulus = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
33
18
  _inherits(ResultStimulus, _Component);
34
19
 
35
20
  var _super = _createSuper(ResultStimulus);
@@ -46,11 +31,12 @@ export var ResultStimulus = (_dec = themeable(theme, styles), _dec(_class = (_te
46
31
  var instructions = this.props.stimulus.instructions;
47
32
 
48
33
  if (instructions) {
49
- return /*#__PURE__*/React.createElement("div", {
50
- className: styles.instructions
51
- }, /*#__PURE__*/React.createElement("div", {
52
- className: styles.instructionsHeader
53
- }, t('Instructions')), /*#__PURE__*/React.createElement("div", null, instructions));
34
+ return jsx("div", {
35
+ "data-testId": "instructions",
36
+ css: this.props.styles.instructions
37
+ }, jsx("div", {
38
+ css: this.props.styles.instructionsHeader
39
+ }, t('Instructions')), jsx("div", null, instructions));
54
40
  }
55
41
  }
56
42
  }, {
@@ -58,13 +44,13 @@ export var ResultStimulus = (_dec = themeable(theme, styles), _dec(_class = (_te
58
44
  value: function renderStimulusInfo() {
59
45
  var title = this.props.stimulus.title;
60
46
  var body = this.props.stimulus.body;
61
- return /*#__PURE__*/React.createElement("div", {
62
- className: styles.info
63
- }, /*#__PURE__*/React.createElement("div", {
64
- className: styles.header
65
- }, /*#__PURE__*/React.createElement("div", {
66
- className: styles.title
67
- }, title)), /*#__PURE__*/React.createElement(RichContentRenderer, {
47
+ return jsx("div", {
48
+ css: this.props.styles.info
49
+ }, jsx("div", {
50
+ css: this.props.styles.header
51
+ }, jsx("div", {
52
+ css: this.props.styles.title
53
+ }, title)), jsx(RichContentRenderer, {
68
54
  content: body
69
55
  }));
70
56
  }
@@ -74,26 +60,27 @@ export var ResultStimulus = (_dec = themeable(theme, styles), _dec(_class = (_te
74
60
  var _this = this;
75
61
 
76
62
  return this.props.sessionItem.getNestedEntries().toArray().map(function (sessionItem, i) {
77
- return /*#__PURE__*/React.createElement("div", {
63
+ return jsx("div", {
78
64
  key: sessionItem.position
79
- }, /*#__PURE__*/React.createElement("div", {
80
- className: styles.connectingLines
81
- }), /*#__PURE__*/React.createElement("div", {
82
- className: styles.stimulusItem
65
+ }, jsx("div", {
66
+ css: _this.props.styles.connectingLines
67
+ }), jsx("div", {
68
+ "data-testid": "stimulus-item",
69
+ css: _this.props.styles.stimulusItem
83
70
  }, _this.props.renderItem(sessionItem, i !== 0)));
84
71
  });
85
72
  }
86
73
  }, {
87
74
  key: "render",
88
75
  value: function render() {
89
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
90
- className: styles.root
91
- }, this.renderStimulusInstructions(), /*#__PURE__*/React.createElement("div", {
92
- className: styles.stimulusGroup
93
- }, /*#__PURE__*/React.createElement("div", {
94
- className: styles.stimulusInfo
95
- }, this.renderStimulusInfo()), /*#__PURE__*/React.createElement("div", {
96
- className: styles.items
76
+ return jsx("div", null, jsx("div", {
77
+ css: this.props.styles.root
78
+ }, this.renderStimulusInstructions(), jsx("div", {
79
+ css: this.props.styles.stimulusGroup
80
+ }, jsx("div", {
81
+ css: this.props.styles.stimulusInfo
82
+ }, this.renderStimulusInfo()), jsx("div", {
83
+ css: this.props.styles.items
97
84
  }, this.renderStimulusItems()))));
98
85
  }
99
86
  }]);
@@ -103,6 +90,8 @@ export var ResultStimulus = (_dec = themeable(theme, styles), _dec(_class = (_te
103
90
  }(Component), _class2.propTypes = {
104
91
  stimulus: ImmutablePropTypes.record.isRequired,
105
92
  sessionItem: ImmutablePropTypes.record.isRequired,
106
- renderItem: PropTypes.func.isRequired
93
+ renderItem: PropTypes.func.isRequired,
94
+ // eslint-disable-next-line react/require-default-props,react/forbid-prop-types
95
+ styles: PropTypes.object
107
96
  }, _temp)) || _class);
108
97
  export default ResultStimulus;
@@ -0,0 +1,69 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+
3
+ var generateStyle = function generateStyle(componentTheme) {
4
+ var mq = "screen and (".concat(componentTheme.phoneBreakPoint, ")");
5
+ return {
6
+ root: {
7
+ borderBottom: "".concat(componentTheme.rootBorderWidth, " solid ").concat(componentTheme.rootBorderColor),
8
+ overflow: 'hidden'
9
+ },
10
+ instructions: _defineProperty({
11
+ padding: "".concat(componentTheme.instructionsPaddingTopBottom, " ").concat(componentTheme.instructionsPaddingLeftRight),
12
+ border: "".concat(componentTheme.instructionsBorderWidth, " solid ").concat(componentTheme.instructionsBorderColor)
13
+ }, mq, {
14
+ padding: "".concat(componentTheme.phoneInstructionsPaddingTopBottom, " ").concat(componentTheme.phoneInstructionsPaddingLeftRight)
15
+ }),
16
+ instructionsHeader: {
17
+ paddingBottom: componentTheme.instructionsHeaderPadding,
18
+ fontWeight: componentTheme.instructionsHeaderFontWeight
19
+ },
20
+ info: _defineProperty({
21
+ padding: "".concat(componentTheme.infoPaddingTopBottom, " ").concat(componentTheme.infoPaddingLeftRight),
22
+ backgroundColor: componentTheme.infoBackgroundColor,
23
+ height: '100%',
24
+ overflow: 'scroll'
25
+ }, mq, {
26
+ padding: componentTheme.phoneInfoPadding
27
+ }),
28
+ header: {
29
+ paddingTop: componentTheme.headerPaddingTop,
30
+ paddingBottom: componentTheme.headerPaddingBottom
31
+ },
32
+ title: {
33
+ fontSize: componentTheme.titleFontSize,
34
+ fontWeight: componentTheme.titleFontWeight
35
+ },
36
+ items: _defineProperty({
37
+ padding: componentTheme.itemsPadding,
38
+ width: '50%'
39
+ }, mq, {
40
+ width: '100%'
41
+ }),
42
+ stimulusItem: {
43
+ flex: '1 1 auto'
44
+ },
45
+ stimulusGroup: _defineProperty({
46
+ display: 'flex',
47
+ flexDirection: 'row'
48
+ }, mq, {
49
+ flexDirection: 'column'
50
+ }),
51
+ stimulusInfo: _defineProperty({
52
+ width: '50%'
53
+ }, mq, {
54
+ width: '100%'
55
+ }),
56
+ connectingLines: _defineProperty({}, mq, {
57
+ flex: '0 0 1rem',
58
+ borderLeft: "".concat(componentTheme.phoneConnectingLinesBorderWidth, " dotted"),
59
+ borderBottom: "".concat(componentTheme.phoneConnectingLinesBorderWidth, " dotted"),
60
+ borderColor: componentTheme.phoneConnectingLinesBorderColor,
61
+ marginrTop: componentTheme.phoneConnectingLinesMargin,
62
+ marginRight: componentTheme.phoneConnectingLinesMargin,
63
+ height: '2rem',
64
+ width: '1.5rem'
65
+ })
66
+ };
67
+ };
68
+
69
+ 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
  typography = _ref.typography,
4
4
  borders = _ref.borders,
@@ -29,4 +29,6 @@ export default function generator(_ref) {
29
29
  phoneConnectingLinesBorderColor: colors.tiara,
30
30
  phoneConnectingLinesMargin: spacing.small
31
31
  };
32
- }
32
+ };
33
+
34
+ export default generateComponentTheme;
@@ -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,42 +5,28 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
5
 
7
6
  var _dec, _class, _class2, _temp;
8
7
 
8
+ /** @jsx jsx */
9
+
9
10
  /* eslint "jsx-a11y/click-events-have-key-events": "warn" */
10
- import React, { Component } from 'react';
11
+ import { Component } from 'react';
11
12
  import PropTypes from 'prop-types';
12
13
  import ImmutablePropTypes from 'react-immutable-proptypes';
13
- import classNames from 'classnames';
14
14
  import { Alert } from '@instructure/ui-alerts';
15
15
  import { Text } from '@instructure/ui-text';
16
16
  import { Heading } from '@instructure/ui-heading';
17
17
  import { View } from '@instructure/ui-view';
18
18
  import { PresentationContent } from '@instructure/ui-a11y-content';
19
- import { themeable } from '@instructure/ui-themeable';
20
- import { RichContentRenderer } from '@instructure/quiz-rce';
19
+ import { withStyle, jsx } from '@instructure/emotion';
20
+ import { RichContentRendererEmotion } from '@instructure/quiz-rce';
21
21
  import t from '@instructure/quiz-i18n/es/format-message';
22
22
  import PositionBox from "../../positionBox/PositionBox.js";
23
23
  import { COMPONENT_RESULT } from '@instructure/quiz-common';
24
24
  import componentForItem from "../../../../util/componentForItem.js";
25
25
  import CustomPropTypes from "../../../../util/CustomPropTypes.js";
26
26
  import keyboardClickable from "../../../../util/keyboardClickable.js";
27
- var styles = {
28
- componentId: 'cQHeE',
29
- template: function template(theme) {
30
- return "\n\n.cQHeE_bvdE{padding:".concat(theme.sessionItemResultPadding || 'inherit', "}\n\n.cQHeE_ebwZ{border-top:solid ").concat(theme.topBorderWidth || 'inherit', " ").concat(theme.topBorderColor || 'inherit', "}\n\n.cQHeE_czRh{margin:").concat(theme.resultMargin || 'inherit', "}\n\n.cQHeE_cwte{color:").concat(theme.pointsColor || 'inherit', ";font-size:").concat(theme.pointFontSize || 'inherit', "}\n\n.cQHeE_cSuF{font-size:").concat(theme.questionFontSize || 'inherit', "}\n\n.cQHeE_fqsT{align-items:center;display:flex}\n\n.cQHeE_cgkp{border-color:").concat(theme.itemFeedbackWrapperBorderColor || 'inherit', ";border-radius:").concat(theme.itemFeedbackWrapperBorderRadius || 'inherit', ";border-style:").concat(theme.itemFeedbackWrapperStyle || 'inherit', ";border-width:").concat(theme.itemFeedbackWrapperBorderWidth || 'inherit', ";font-size:").concat(theme.itemFeedbackWrapperFontSize || 'inherit', ";margin-top:").concat(theme.itemFeedbackWrapperMargin || 'inherit', ";padding:").concat(theme.itemFeedbackWrapperPadding || 'inherit', ";white-space:pre-wrap}\n\n.cQHeE_dpDn{padding-bottom:").concat(theme.textPaddingBottom || 'inherit', ";padding-left:").concat(theme.textPaddingLeft || 'inherit', "}\n\n.cQHeE_couS{color:").concat(theme.itemFeedbackLabelColor || 'inherit', ";font-size:").concat(theme.itemFeedbackLabelFontSize || 'inherit', ";margin-bottom:").concat(theme.itemFeedbackMargin || 'inherit', "}\n\n.cQHeE_bcAI{font-size:").concat(theme.itemFeedbackTextSize || 'inherit', ";margin-top:").concat(theme.itemFeedbackTextMargin || 'inherit', "}");
31
- },
32
- 'sessionItemResult': 'cQHeE_bvdE',
33
- 'topBorder': 'cQHeE_ebwZ',
34
- 'result': 'cQHeE_czRh',
35
- 'points': 'cQHeE_cwte',
36
- 'question': 'cQHeE_cSuF',
37
- 'sessionItemResultHeader': 'cQHeE_fqsT',
38
- 'itemFeedbackWrapper': 'cQHeE_cgkp',
39
- 'textPadding': 'cQHeE_dpDn',
40
- 'itemFeedbackLabel': 'cQHeE_couS',
41
- 'itemFeedbackText': 'cQHeE_bcAI'
42
- };
43
- import theme from "./theme.js";
44
- export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
27
+ import generateStyle from "./styles.js";
28
+ import generateComponentTheme from "./theme.js";
29
+ export var SessionItemResult = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
45
30
  _inherits(SessionItemResult, _Component);
46
31
 
47
32
  var _super = _createSuper(SessionItemResult);
@@ -71,6 +56,16 @@ export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (
71
56
  }
72
57
 
73
58
  _createClass(SessionItemResult, [{
59
+ key: "componentDidMount",
60
+ value: function componentDidMount() {
61
+ this.props.makeStyles();
62
+ }
63
+ }, {
64
+ key: "componentDidUpdate",
65
+ value: function componentDidUpdate() {
66
+ this.props.makeStyles();
67
+ }
68
+ }, {
74
69
  key: "position",
75
70
  value: function position() {
76
71
  return this.props.sessionItem.position;
@@ -93,38 +88,38 @@ export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (
93
88
  }, {
94
89
  key: "renderRegradeAlert",
95
90
  value: function renderRegradeAlert() {
96
- return /*#__PURE__*/React.createElement(Alert, {
91
+ return jsx(Alert, {
97
92
  variant: "warning",
98
93
  margin: "medium"
99
- }, /*#__PURE__*/React.createElement(PresentationContent, null, t('This question has been regraded.')));
94
+ }, jsx(PresentationContent, null, t('This question has been regraded.')));
100
95
  }
101
96
  }, {
102
97
  key: "renderUnscorableAlert",
103
98
  value: function renderUnscorableAlert() {
104
99
  // If they can edit grader feedback they should see the teacher message
105
100
  var message = this.props.editGraderFeedback ? t('There was a problem grading this question.') : t('There was a problem grading this question. Please inform your instructor.');
106
- return /*#__PURE__*/React.createElement(Alert, {
101
+ return jsx(Alert, {
107
102
  variant: "warning",
108
103
  margin: "medium"
109
- }, /*#__PURE__*/React.createElement(PresentationContent, null, message));
104
+ }, jsx(PresentationContent, null, message));
110
105
  }
111
106
  }, {
112
107
  key: "renderRegradePoints",
113
108
  value: function renderRegradePoints() {
114
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(View, {
109
+ return jsx("div", null, jsx(View, {
115
110
  as: "span",
116
111
  size: "small",
117
112
  margin: "small"
118
- }, /*#__PURE__*/React.createElement(Text, {
113
+ }, jsx(Text, {
119
114
  color: "secondary"
120
115
  }, t("Previous score { possible, plural,\n one {{points, number} / # point}\n other {{points, number} / # points}\n }", {
121
116
  points: this.props.sessionItemResult.regradeInfo.get('originalScore') || 0,
122
117
  possible: this.props.sessionItemResult.regradeInfo.get('originalPointsPossible')
123
- }))), /*#__PURE__*/React.createElement(View, {
118
+ }))), jsx(View, {
124
119
  as: "span",
125
120
  size: "small",
126
121
  margin: "small"
127
- }, /*#__PURE__*/React.createElement(Text, {
122
+ }, jsx(Text, {
128
123
  color: "warning"
129
124
  }, t("Regrade score { possible, plural,\n one {{points, number} / # point}\n other {{points, number} / # points}\n }", {
130
125
  points: this.props.sessionItemResult.regradeInfo.get('newScore') || 0,
@@ -134,8 +129,8 @@ export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (
134
129
  }, {
135
130
  key: "renderHeader",
136
131
  value: function renderHeader() {
137
- return /*#__PURE__*/React.createElement("div", {
138
- className: styles.sessionItemResultHeader
132
+ return jsx("div", {
133
+ css: this.props.styles.sessionItemResultHeader
139
134
  }, this.renderResultPosition(), !this.props.restrictQuantitativeData && (this.hasRegradeInfo() ? this.renderRegradePoints() : this.renderPoints()));
140
135
  }
141
136
  }, {
@@ -166,7 +161,7 @@ export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (
166
161
  });
167
162
  }
168
163
 
169
- return /*#__PURE__*/React.createElement(PositionBox, {
164
+ return jsx(PositionBox, {
170
165
  position: position,
171
166
  headingLevel: "h3",
172
167
  headingText: positionText
@@ -175,21 +170,22 @@ export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (
175
170
  }, {
176
171
  key: "renderPoints",
177
172
  value: function renderPoints() {
178
- return /*#__PURE__*/React.createElement("div", {
179
- className: classNames('fs-mask', styles.points)
173
+ return jsx("div", {
174
+ css: this.props.styles.points,
175
+ className: "fs-mask"
180
176
  }, this.pointsDisplayText);
181
177
  }
182
178
  }, {
183
179
  key: "renderFeedbackBox",
184
180
  value: function renderFeedbackBox(feedbackContent, formattedFeedbackTitle) {
185
181
  if (feedbackContent) {
186
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Heading, {
182
+ return jsx("div", null, jsx(Heading, {
187
183
  level: "h4",
188
184
  margin: "xx-small small"
189
- }, formattedFeedbackTitle), /*#__PURE__*/React.createElement("div", {
190
- className: styles.textPadding
191
- }, /*#__PURE__*/React.createElement(RichContentRenderer, {
192
- customStyles: styles.itemFeedbackText,
185
+ }, formattedFeedbackTitle), jsx("div", {
186
+ css: this.props.styles.textPadding
187
+ }, jsx(RichContentRendererEmotion, {
188
+ customStyles: this.props.styles.itemFeedbackText,
193
189
  content: feedbackContent
194
190
  })));
195
191
  }
@@ -207,12 +203,12 @@ export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (
207
203
  var showFeedback = correctFeedback || incorrectFeedback || neutralFeedback || graderFeedback;
208
204
 
209
205
  if (showAnswerFeedback || showFeedback) {
210
- return /*#__PURE__*/React.createElement("div", {
211
- className: styles.itemFeedbackWrapper
212
- }, /*#__PURE__*/React.createElement(Heading, {
206
+ return jsx("div", {
207
+ css: this.props.styles.itemFeedbackWrapper
208
+ }, jsx(Heading, {
213
209
  level: "h3",
214
210
  margin: "xx-small small medium"
215
- }, t('Feedback')), /*#__PURE__*/React.createElement("div", {
211
+ }, t('Feedback')), jsx("div", {
216
212
  "data-automation": "sdk-answer-feedback-results-view"
217
213
  }, this.props.shouldRenderAnswerFeedback && answerFeedback), correctFeedback, incorrectFeedback, neutralFeedback, graderFeedback);
218
214
  }
@@ -224,16 +220,16 @@ export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (
224
220
 
225
221
  if (!this.props.hideGraderFeedback && graderFeedback.content) {
226
222
  if (this.props.editGraderFeedback) {
227
- return /*#__PURE__*/React.createElement("div", {
223
+ return jsx("div", {
228
224
  role: "button",
229
225
  onClick: this.props.editGraderFeedback,
230
226
  onKeyDown: keyboardClickable,
231
- className: styles.itemFeedbackWrapper,
227
+ css: this.props.styles.itemFeedbackWrapper,
232
228
  tabIndex: "0"
233
- }, /*#__PURE__*/React.createElement("div", {
234
- className: styles.itemFeedbackLabel
235
- }, t('Feedback from grader')), /*#__PURE__*/React.createElement(RichContentRenderer, {
236
- customStyles: styles.itemFeedbackText,
229
+ }, jsx("div", {
230
+ css: this.props.styles.itemFeedbackLabel
231
+ }, t('Feedback from grader')), jsx(RichContentRendererEmotion, {
232
+ customStyles: this.props.styles.itemFeedbackText,
237
233
  content: graderFeedback.content
238
234
  }));
239
235
  } else {
@@ -261,11 +257,11 @@ export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (
261
257
  var simpleResultsModifications = itemResultsModifications && itemResultsModifications.toJS() || {};
262
258
  var simpleSessionItem = sessionItem.toJS();
263
259
  var simpleSessionItemResult = sessionItemResult.toJS();
264
- return /*#__PURE__*/React.createElement("div", {
265
- className: styles.result
266
- }, /*#__PURE__*/React.createElement("div", {
267
- className: styles.question
268
- }, /*#__PURE__*/React.createElement(ResultInteraction, {
260
+ return jsx("div", {
261
+ css: this.props.styles.result
262
+ }, jsx("div", {
263
+ css: this.props.styles.question
264
+ }, jsx(ResultInteraction, {
269
265
  appContainer: appContainer,
270
266
  itemBody: simpleItem.itemBody,
271
267
  itemId: simpleSessionItem.id // needed for input group name
@@ -280,11 +276,8 @@ export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (
280
276
  }, {
281
277
  key: "render",
282
278
  value: function render() {
283
- var _classNames;
284
-
285
- var classes = classNames((_classNames = {}, _defineProperty(_classNames, styles.sessionItemResult, true), _defineProperty(_classNames, styles.topBorder, this.props.shouldRenderTopBorder), _classNames));
286
- return /*#__PURE__*/React.createElement("div", {
287
- className: classes
279
+ return jsx("div", {
280
+ css: this.props.styles.sessionItemResult
288
281
  }, this.regraded() ? this.renderRegradeAlert() : null, this.unscorable() ? this.renderUnscorableAlert() : null, this.renderHeader(), this.renderSessionItemResult());
289
282
  }
290
283
  }, {
@@ -349,7 +342,12 @@ export var SessionItemResult = (_dec = themeable(theme, styles), _dec(_class = (
349
342
  sessionItem: ImmutablePropTypes.record.isRequired,
350
343
  sessionItemResult: ImmutablePropTypes.record.isRequired,
351
344
  shouldRenderAnswerFeedback: PropTypes.bool,
352
- shouldRenderTopBorder: PropTypes.bool
345
+ // eslint-disable-next-line react/no-unused-prop-types
346
+ shouldRenderTopBorder: PropTypes.bool,
347
+ // used in styles.js
348
+ // eslint-disable-next-line react/require-default-props,react/forbid-prop-types
349
+ styles: PropTypes.object,
350
+ makeStyles: PropTypes.func
353
351
  }, _class2.defaultProps = {
354
352
  editGraderFeedback: null,
355
353
  hideGraderFeedback: false,
@@ -0,0 +1,50 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+
3
+ var generateStyle = function generateStyle(componentTheme, props) {
4
+ return {
5
+ sessionItemResult: _objectSpread({
6
+ padding: componentTheme.sessionItemResultPadding
7
+ }, props.shouldRenderTopBorder && {
8
+ borderTop: "solid ".concat(componentTheme.topBorderWidth, " ").concat(componentTheme.topBorderColor)
9
+ }),
10
+ result: {
11
+ margin: componentTheme.resultMargin
12
+ },
13
+ points: {
14
+ color: componentTheme.pointsColor,
15
+ fontSize: componentTheme.pointFontSize
16
+ },
17
+ question: {
18
+ fontSize: componentTheme.questionFontSize
19
+ },
20
+ sessionItemResultHeader: {
21
+ display: 'flex',
22
+ alignItems: 'center'
23
+ },
24
+ itemFeedbackWrapper: {
25
+ marginTop: componentTheme.itemFeedbackWrapperMargin,
26
+ padding: componentTheme.itemFeedbackWrapperPadding,
27
+ borderRadius: componentTheme.itemFeedbackWrapperBorderRadius,
28
+ fontSize: componentTheme.itemFeedbackWrapperFontSize,
29
+ whiteSpace: 'pre-wrap',
30
+ borderStyle: componentTheme.itemFeedbackWrapperStyle,
31
+ borderWidth: componentTheme.itemFeedbackWrapperBorderWidth,
32
+ borderColor: componentTheme.itemFeedbackWrapperBorderColor
33
+ },
34
+ textPadding: {
35
+ paddingLeft: componentTheme.textPaddingLeft,
36
+ paddingBottom: componentTheme.textPaddingBottom
37
+ },
38
+ itemFeedbackLabel: {
39
+ color: componentTheme.itemFeedbackLabelColor,
40
+ fontSize: componentTheme.itemFeedbackLabelFontSize,
41
+ marginBottom: componentTheme.itemFeedbackMargin
42
+ },
43
+ itemFeedbackText: {
44
+ marginTop: componentTheme.itemFeedbackTextMargin,
45
+ fontSize: componentTheme.itemFeedbackTextSize
46
+ }
47
+ };
48
+ };
49
+
50
+ 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
  typography = _ref.typography,
4
4
  colors = _ref.colors,
@@ -27,4 +27,6 @@ export default function generator(_ref) {
27
27
  textPaddingLeft: spacing.small,
28
28
  textPaddingBottom: spacing.small
29
29
  };
30
- }
30
+ };
31
+
32
+ export default generateComponentTheme;
@@ -5,27 +5,20 @@ 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 { Heading } from '@instructure/ui-heading';
12
- import { themeable } from '@instructure/ui-themeable';
13
+ import { withStyle, jsx } from '@instructure/emotion';
13
14
  import t from '@instructure/quiz-i18n/es/format-message';
14
15
  import CustomPropTypes from "../../../../util/CustomPropTypes.js";
15
16
  import SessionItemResult from "../SessionItemResult/index.js";
16
17
  import ResultStimulus from "../ResultStimulus/index.js";
17
18
  import generateDisplayPositions from "../../../../util/generateDisplayPositions.js";
18
- var styles = {
19
- componentId: 'tONnG',
20
- template: function template(theme) {
21
- return "\n\n.tONnG_fnuh{margin:".concat(theme.sessionItemResultsListHeaderWrapperMarginTopBottom || 'inherit', " ").concat(theme.sessionItemResultsListHeaderWrapperMarginLeftRight || 'inherit', ";text-align:left}\n\n[dir=ltr] .tONnG_fnuh,[dir=rtl] .tONnG_fnuh{text-align:left}\n\n.tONnG_crKU{font-size:").concat(theme.sessionItemResultsListHeaderFontSize || 'inherit', "}\n\n.tONnG_cMxE{border-bottom:solid ").concat(theme.sessionItemResultsListBorderWidth || 'inherit', " ").concat(theme.sessionItemResultsListBorderColor || 'inherit', ";margin-top:").concat(theme.sessionItemResultsListMargin || 'inherit', "}");
22
- },
23
- 'sessionItemResultsListHeaderWrapper': 'tONnG_fnuh',
24
- 'sessionItemResultsListHeader': 'tONnG_crKU',
25
- 'sessionItemResultsList': 'tONnG_cMxE'
26
- };
27
- import theme from "./theme.js";
28
- export var SessionItemResultsList = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
19
+ import generateStyle from "./styles.js";
20
+ import generateComponentTheme from "./theme.js";
21
+ export var SessionItemResultsList = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
29
22
  _inherits(SessionItemResultsList, _Component);
30
23
 
31
24
  var _super = _createSuper(SessionItemResultsList);
@@ -42,7 +35,7 @@ export var SessionItemResultsList = (_dec = themeable(theme, styles), _dec(_clas
42
35
  _this = _super.call.apply(_super, [this].concat(args));
43
36
 
44
37
  _this.renderSessionItem = function (sessionItem, shouldRenderTopBorder) {
45
- return /*#__PURE__*/React.createElement(SessionItemResult, {
38
+ return jsx(SessionItemResult, {
46
39
  appContainer: _this.props.appContainer,
47
40
  key: sessionItem.id,
48
41
  restrictQuantitativeData: _this.props.restrictQuantitativeData,
@@ -65,7 +58,7 @@ export var SessionItemResultsList = (_dec = themeable(theme, styles), _dec(_clas
65
58
  key: "renderItem",
66
59
  value: function renderItem(sessionItem) {
67
60
  if (sessionItem.isStimulus) {
68
- return /*#__PURE__*/React.createElement(ResultStimulus, {
61
+ return jsx(ResultStimulus, {
69
62
  key: sessionItem.id,
70
63
  renderItem: this.renderSessionItem,
71
64
  stimulus: sessionItem.stimulusRecord,
@@ -78,15 +71,15 @@ export var SessionItemResultsList = (_dec = themeable(theme, styles), _dec(_clas
78
71
  }, {
79
72
  key: "render",
80
73
  value: function render() {
81
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
82
- className: styles.sessionItemResultsListHeaderWrapper
83
- }, /*#__PURE__*/React.createElement("div", {
84
- className: styles.sessionItemResultsListHeader,
74
+ return jsx("div", null, jsx("div", {
75
+ css: this.props.styles.sessionItemResultsListHeaderWrapper
76
+ }, jsx("div", {
77
+ css: this.props.styles.sessionItemResultsListHeader,
85
78
  "data-automation": "sdk-session-item-results-list-header"
86
- }, /*#__PURE__*/React.createElement(Heading, {
79
+ }, jsx(Heading, {
87
80
  level: "h2"
88
- }, t('Your Answers:')))), /*#__PURE__*/React.createElement("div", {
89
- className: styles.sessionItemResultsList
81
+ }, t('Your Answers:')))), jsx("div", {
82
+ css: this.props.styles.sessionItemResultsList
90
83
  }, this.renderItems()));
91
84
  }
92
85
  }]);
@@ -96,7 +89,9 @@ export var SessionItemResultsList = (_dec = themeable(theme, styles), _dec(_clas
96
89
  }(Component), _class2.propTypes = {
97
90
  appContainer: CustomPropTypes.selectors.isRequired,
98
91
  restrictQuantitativeData: PropTypes.bool,
99
- sessionItems: ImmutablePropTypes.list.isRequired
92
+ sessionItems: ImmutablePropTypes.list.isRequired,
93
+ // eslint-disable-next-line react/require-default-props,react/forbid-prop-types
94
+ styles: PropTypes.object
100
95
  }, _class2.defaultProps = {
101
96
  restrictQuantitativeData: false
102
97
  }, _temp)) || _class);
@@ -0,0 +1,17 @@
1
+ var generateStyle = function generateStyle(componentTheme) {
2
+ return {
3
+ sessionItemResultsListHeaderWrapper: {
4
+ textAlign: 'left',
5
+ margin: "".concat(componentTheme.sessionItemResultsListHeaderWrapperMarginTopBottom, " ").concat(componentTheme.sessionItemResultsListHeaderWrapperMarginLeftRight)
6
+ },
7
+ sessionItemResultsListHeader: {
8
+ fontSize: componentTheme.sessionItemResultsListHeaderFontSize
9
+ },
10
+ sessionItemResultsList: {
11
+ marginTop: componentTheme.sessionItemResultsListMargin,
12
+ borderBottom: "solid ".concat(componentTheme.sessionItemResultsListBorderWidth, " ").concat(componentTheme.sessionItemResultsListBorderColor)
13
+ }
14
+ };
15
+ };
16
+
17
+ 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
  typography = _ref.typography,
4
4
  colors = _ref.colors,
@@ -11,4 +11,6 @@ export default function generator(_ref) {
11
11
  sessionItemResultsListBorderColor: colors.tiara,
12
12
  sessionItemResultsListBorderWidth: borders.widthSmall
13
13
  };
14
- }
14
+ };
15
+
16
+ export default generateComponentTheme;