@instructure/quiz-core 20.11.5-rc.0 → 20.11.5-rc.2

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 (49) hide show
  1. package/es/banks/components/BankEntryRow/presenter.js +3 -3
  2. package/es/building/components/resources/ItemFeedbackModal/presenter.js +2 -2
  3. package/es/building/components/resources/quiz/instructions/Show/index.js +4 -4
  4. package/es/building/components/resources/quiz/title/Show/index.js +2 -2
  5. package/es/building/components/resources/quizEntry/QuizEntryShow/presenter.js +2 -2
  6. package/es/common/components/resources/quiz/instructions/Instructions.js +2 -2
  7. package/es/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +3 -3
  8. package/es/common/components/resources/stimulus/StimulusShow/index.js +2 -2
  9. package/es/common/components/shared/{overlayEmotion → overlay}/index.js +9 -9
  10. package/{lib/common/components/shared/overlayEmotion → es/common/components/shared/overlay}/styles.js +7 -10
  11. package/es/common/components/shared/overlay/theme.js +4 -2
  12. package/es/reporting/components/MetricsListItem/index.js +13 -19
  13. package/es/reporting/components/MetricsListItem/styles.js +12 -0
  14. package/es/reporting/components/MetricsListItem/theme.js +0 -3
  15. package/es/reporting/components/itemAnalysis/AnswerFrequencySummary/index.js +33 -61
  16. package/es/reporting/components/itemAnalysis/AnswerFrequencySummary/styles.js +45 -0
  17. package/es/reporting/components/itemAnalysis/AnswerFrequencySummary/theme.js +4 -2
  18. package/es/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +4 -4
  19. package/es/reporting/components/quizAnalysis/QuizAnalysisOverview.js +9 -9
  20. package/es/reporting/components/resources/QuizAndItemAnalysis/presenter.js +46 -50
  21. package/es/reporting/components/resources/QuizAndItemAnalysis/styles.js +18 -0
  22. package/es/reporting/components/resources/QuizAndItemAnalysis/theme.js +4 -2
  23. package/lib/banks/components/BankEntryRow/presenter.js +4 -4
  24. package/lib/building/components/resources/ItemFeedbackModal/presenter.js +1 -1
  25. package/lib/building/components/resources/quiz/instructions/Show/index.js +2 -2
  26. package/lib/building/components/resources/quiz/title/Show/index.js +1 -1
  27. package/lib/building/components/resources/quizEntry/QuizEntryShow/presenter.js +1 -1
  28. package/lib/common/components/resources/quiz/instructions/Instructions.js +1 -1
  29. package/lib/common/components/resources/sessionItemResult/SessionItemResult/presenter.js +2 -2
  30. package/lib/common/components/resources/stimulus/StimulusShow/index.js +1 -1
  31. package/lib/common/components/shared/{overlayEmotion → overlay}/index.js +9 -9
  32. package/{es/common/components/shared/overlayEmotion → lib/common/components/shared/overlay}/styles.js +18 -3
  33. package/lib/common/components/shared/overlay/theme.js +6 -3
  34. package/lib/reporting/components/MetricsListItem/index.js +12 -22
  35. package/lib/reporting/components/MetricsListItem/styles.js +20 -0
  36. package/lib/reporting/components/MetricsListItem/theme.js +1 -10
  37. package/lib/reporting/components/itemAnalysis/AnswerFrequencySummary/index.js +32 -64
  38. package/lib/reporting/components/itemAnalysis/AnswerFrequencySummary/styles.js +56 -0
  39. package/lib/reporting/components/itemAnalysis/AnswerFrequencySummary/theme.js +6 -3
  40. package/lib/reporting/components/itemAnalysis/ItemAnalysisRow/presenter.js +4 -4
  41. package/lib/reporting/components/quizAnalysis/QuizAnalysisOverview.js +9 -9
  42. package/lib/reporting/components/resources/QuizAndItemAnalysis/presenter.js +45 -54
  43. package/lib/reporting/components/resources/QuizAndItemAnalysis/styles.js +26 -0
  44. package/lib/reporting/components/resources/QuizAndItemAnalysis/theme.js +6 -3
  45. package/package.json +9 -9
  46. package/es/common/components/shared/overlay/Overlay.js +0 -85
  47. package/es/common/components/shared/overlayEmotion/theme.js +0 -12
  48. package/lib/common/components/shared/overlay/Overlay.js +0 -95
  49. package/lib/common/components/shared/overlayEmotion/theme.js +0 -20
@@ -22,18 +22,18 @@ import { PresentationContent } from '@instructure/ui-a11y-content';
22
22
  import { Alert } from '@instructure/ui-alerts';
23
23
  import { withStyle, jsx } from '@instructure/emotion';
24
24
  import { BUILD_TRAY_POSITION, COPY_MOVE_BANK_ENTRY_MODAL, SET_EDIT_BUTTON_FOCUS, withI18nSupport } from '@instructure/quiz-common';
25
- import { RichContentRendererEmotion } from '@instructure/quiz-rce';
25
+ import { RichContentRenderer } from '@instructure/quiz-rce';
26
26
  import { extractTextFromHtml } from '@instructure/quiz-interactions';
27
27
  import t from '@instructure/quiz-i18n/es/format-message';
28
28
  import CopyMoveBankEntryModal from "../CopyMoveBankEntryModal/index.js";
29
29
  import ExpandButton from "../../../common/components/shared/ExpandButton/index.js";
30
30
  import QuizEntry from "../../../common/records/QuizEntry.js";
31
- import Overlay from "../../../common/components/shared/overlay/Overlay.js";
32
31
  import ItemShow from "../../../common/components/resources/item/ItemShow/index.js";
33
32
  import StimulusShowInfo from "../../../common/components/resources/stimulus/StimulusShowInfo/index.js";
34
33
  import TagDisplay from "../../../common/components/shared/TagDisplay/index.js";
35
34
  import generateStyle from "./styles.js";
36
35
  import generateComponentTheme from "./theme.js";
36
+ import Overlay from "../../../common/components/shared/overlay/index.js";
37
37
 
38
38
  var _ref2 = jsx("div", null);
39
39
 
@@ -271,7 +271,7 @@ export var BankEntryRow = (_dec = withStyle(generateStyle, generateComponentThem
271
271
  // or title plain text
272
272
 
273
273
  if (itemOrStimulus.itemBody) {
274
- return jsx(RichContentRendererEmotion, {
274
+ return jsx(RichContentRenderer, {
275
275
  customStyles: this.props.styles.stem,
276
276
  content: itemOrStimulus.itemBody
277
277
  });
@@ -12,7 +12,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
12
12
  import { Button, CloseButton } from '@instructure/ui-buttons';
13
13
  import { Heading } from '@instructure/ui-heading';
14
14
  import { withStyle, jsx } from '@instructure/emotion';
15
- import { RichContentRendererEmotion, RichContentInput, RCE_THREE_LINES_HEIGHT } from '@instructure/quiz-rce';
15
+ import { RichContentRenderer, RichContentInput, RCE_THREE_LINES_HEIGHT } from '@instructure/quiz-rce';
16
16
  import t from '@instructure/quiz-i18n/es/format-message';
17
17
  import { Modal, ModalHeader, ModalBody, ModalFooter, ITEM_FEEDBACK_MODAL_FEEDBACK, XSMALL_SIDE_MARGIN } from '@instructure/quiz-common';
18
18
  import generateStyle from "./styles.js";
@@ -97,7 +97,7 @@ export var ItemFeedbackModal = (_dec = withStyle(generateStyle, generateComponen
97
97
  }, {
98
98
  key: "renderContent",
99
99
  value: function renderContent() {
100
- return jsx("div", null, jsx(RichContentRendererEmotion, {
100
+ return jsx("div", null, jsx(RichContentRenderer, {
101
101
  customStyles: this.props.styles.itemStem,
102
102
  content: this.props.item.itemBody
103
103
  }), this.renderRichContentInput('correct', t('For a correct answer')), this.renderRichContentInput('incorrect', t('For an incorrect answer')), this.renderRichContentInput('neutral', t('Provide general feedback (regardless of answer)')));
@@ -9,8 +9,8 @@ var _dec, _class, _class2, _temp;
9
9
  import { Component } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import { withStyle, jsx } from '@instructure/emotion';
12
- import { RichContentRendererEmotion } from '@instructure/quiz-rce';
13
- import OverlayEmotion from "../../../../../../common/components/shared/overlayEmotion/index.js";
12
+ import { RichContentRenderer } from '@instructure/quiz-rce';
13
+ import Overlay from "../../../../../../common/components/shared/overlay/index.js";
14
14
  import makeScrollable from "../../../../../../common/components/shared/functionality/makeScrollable.js";
15
15
  import generateStyle from "./styles.js";
16
16
  import generateComponentTheme from "./theme.js";
@@ -48,14 +48,14 @@ export var QuizInstructionsShow = (_dec = withStyle(generateStyle, generateCompo
48
48
  value: function render() {
49
49
  return jsx("span", {
50
50
  "data-automation": "sdk-quiz-instructions-show-wrapper"
51
- }, jsx(OverlayEmotion, {
51
+ }, jsx(Overlay, {
52
52
  wrapperStyles: this.props.styles.instructionsShowWrapper,
53
53
  onClick: this.switchOnEditing,
54
54
  tabIndex: "-1",
55
55
  hideOverlay: this.props.contentLocked
56
56
  }, jsx("div", {
57
57
  "data-automation": "instructions-show-text"
58
- }, jsx(RichContentRendererEmotion, {
58
+ }, jsx(RichContentRenderer, {
59
59
  customStyles: this.props.styles.instructionsShowText,
60
60
  content: this.props.instructions || t('Add Instructions...')
61
61
  }))));
@@ -11,7 +11,7 @@ import PropTypes from 'prop-types';
11
11
  import { withStyle, jsx } from '@instructure/emotion';
12
12
  import { TruncateText } from '@instructure/ui-truncate-text';
13
13
  import { Text } from '@instructure/ui-text';
14
- import OverlayEmotion from "../../../../../../common/components/shared/overlayEmotion/index.js";
14
+ import Overlay from "../../../../../../common/components/shared/overlay/index.js";
15
15
  import makeScrollable from "../../../../../../common/components/shared/functionality/makeScrollable.js";
16
16
  import generateStyle from "./styles.js";
17
17
  import generateComponentTheme from "./theme.js"; // ====================================
@@ -49,7 +49,7 @@ export var QuizTitleShow = (_dec = withStyle(generateStyle, generateComponentThe
49
49
  value: function render() {
50
50
  return jsx("span", {
51
51
  "data-automation": "sdk-quiz-title-show-wrapper"
52
- }, jsx(OverlayEmotion, {
52
+ }, jsx(Overlay, {
53
53
  wrapperStyles: this.props.styles.titleShowWrapper,
54
54
  onClick: this.switchOnEditing,
55
55
  tabIndex: "-1",
@@ -19,7 +19,7 @@ import { TOP } from '@instructure/quiz-common';
19
19
  import t from '@instructure/quiz-i18n/es/format-message';
20
20
  import { convertFITBtoRich } from "../../../../../common/util/fitbCopyHelper.js";
21
21
  import Item from "../../../../../common/records/Item.js";
22
- import OverlayEmotion from "../../../../../common/components/shared/overlayEmotion/index.js";
22
+ import Overlay from "../../../../../common/components/shared/overlay/index.js";
23
23
  import ActionButtons from "../../ActionButtons/index.js";
24
24
  import { ItemTypes, dragSource, collectDrag } from "../../../../../common/components/shared/drag_and_drop/dragAndDropUtils.js";
25
25
  import PositionBox from "../../../../../common/components/resources/positionBox/PositionBox.js";
@@ -262,7 +262,7 @@ var QuizEntryShow = (_dec = withStyle(generateStyle, generateComponentTheme), _d
262
262
  var shouldLockQuizEntry = lockBlueprintContentEnabled && isContentLockedByBlueprint; // Overlay gets tabIndex === "-1" so that the drag handle is tabbable before
263
263
  // the Overlay get focus and opens the quizEntry in edit mode
264
264
 
265
- return jsx(OverlayEmotion, {
265
+ return jsx(Overlay, {
266
266
  onClick: this.editingOn,
267
267
  wrapperStyles: this.props.styles.quizEntryWrapper,
268
268
  tabIndex: "-1",
@@ -12,7 +12,7 @@ import { Component } from 'react';
12
12
  import ImmutablePropTypes from 'react-immutable-proptypes';
13
13
  import PropTypes from 'prop-types';
14
14
  import { withStyle, jsx } from '@instructure/emotion';
15
- import { RichContentRendererEmotion } from '@instructure/quiz-rce';
15
+ import { RichContentRenderer } from '@instructure/quiz-rce';
16
16
  import makeScrollable from "../../../shared/functionality/makeScrollable.js"; // ================================
17
17
  // renders the quiz instructions on
18
18
  // the Preview and Take pages
@@ -38,7 +38,7 @@ export var QuizInstructions = (_dec = withStyle(generateStyle, generateComponent
38
38
  "data-testid": "instructionsWrapper",
39
39
  css: this.props.styles.wrapper,
40
40
  tabIndex: "-1"
41
- }, jsx(RichContentRendererEmotion, {
41
+ }, jsx(RichContentRenderer, {
42
42
  customStyles: this.props.styles.text,
43
43
  content: this.props.quiz.instructions
44
44
  }));
@@ -17,7 +17,7 @@ import { Heading } from '@instructure/ui-heading';
17
17
  import { View } from '@instructure/ui-view';
18
18
  import { PresentationContent } from '@instructure/ui-a11y-content';
19
19
  import { withStyle, jsx } from '@instructure/emotion';
20
- import { RichContentRendererEmotion } from '@instructure/quiz-rce';
20
+ import { RichContentRenderer } 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';
@@ -184,7 +184,7 @@ export var SessionItemResult = (_dec = withStyle(generateStyle, generateComponen
184
184
  margin: "xx-small small"
185
185
  }, formattedFeedbackTitle), jsx("div", {
186
186
  css: this.props.styles.textPadding
187
- }, jsx(RichContentRendererEmotion, {
187
+ }, jsx(RichContentRenderer, {
188
188
  customStyles: this.props.styles.itemFeedbackText,
189
189
  content: feedbackContent
190
190
  })));
@@ -228,7 +228,7 @@ export var SessionItemResult = (_dec = withStyle(generateStyle, generateComponen
228
228
  tabIndex: "0"
229
229
  }, jsx("div", {
230
230
  css: this.props.styles.itemFeedbackLabel
231
- }, t('Feedback from grader')), jsx(RichContentRendererEmotion, {
231
+ }, t('Feedback from grader')), jsx(RichContentRenderer, {
232
232
  customStyles: this.props.styles.itemFeedbackText,
233
233
  content: graderFeedback.content
234
234
  }));
@@ -18,7 +18,7 @@ import ActionButtons from "../../../../../building/components/resources/ActionBu
18
18
  import t from '@instructure/quiz-i18n/es/format-message';
19
19
  import generateStyle from "./styles.js";
20
20
  import generateComponentTheme from "./theme.js";
21
- import OverlayEmotion from "../../../shared/overlayEmotion/index.js";
21
+ import Overlay from "../../../shared/overlay/index.js";
22
22
 
23
23
  var _ref = jsx(IconBankLine, null);
24
24
 
@@ -55,7 +55,7 @@ export var StimulusShow = (_dec = withStyle(generateStyle, generateComponentThem
55
55
  }, {
56
56
  key: "render",
57
57
  value: function render() {
58
- return jsx(OverlayEmotion, {
58
+ return jsx(Overlay, {
59
59
  onClick: this.switchOnEditing,
60
60
  wrapperStyles: this.props.styles.stimulusWrapper,
61
61
  tabIndex: "-1",
@@ -22,18 +22,18 @@ import PropTypes from 'prop-types';
22
22
  import { withStyle, jsx, Global } from '@instructure/emotion';
23
23
  import generateStyle from "./styles.js";
24
24
  import generateComponentTheme from "./theme.js";
25
- var OverlayEmotion = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
26
- _inherits(OverlayEmotion, _Component);
25
+ var Overlay = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
26
+ _inherits(Overlay, _Component);
27
27
 
28
- var _super = _createSuper(OverlayEmotion);
28
+ var _super = _createSuper(Overlay);
29
29
 
30
- function OverlayEmotion() {
31
- _classCallCheck(this, OverlayEmotion);
30
+ function Overlay() {
31
+ _classCallCheck(this, Overlay);
32
32
 
33
33
  return _super.apply(this, arguments);
34
34
  }
35
35
 
36
- _createClass(OverlayEmotion, [{
36
+ _createClass(Overlay, [{
37
37
  key: "overlayDiv",
38
38
  value: function overlayDiv() {
39
39
  if (this.props.hideOverlay) {
@@ -71,8 +71,8 @@ var OverlayEmotion = (_dec = withStyle(generateStyle, generateComponentTheme), _
71
71
  }
72
72
  }]);
73
73
 
74
- OverlayEmotion.displayName = "OverlayEmotion";
75
- return OverlayEmotion;
74
+ Overlay.displayName = "Overlay";
75
+ return Overlay;
76
76
  }(Component), _class2.propTypes = {
77
77
  children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)]).isRequired,
78
78
  hideOverlay: PropTypes.bool,
@@ -87,4 +87,4 @@ var OverlayEmotion = (_dec = withStyle(generateStyle, generateComponentTheme), _
87
87
  wrapperStyles: {},
88
88
  ariaLabel: void 0
89
89
  }, _temp)) || _class);
90
- export default OverlayEmotion;
90
+ export default Overlay;
@@ -1,11 +1,7 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
7
2
 
8
3
  var generateStyle = function generateStyle(componentTheme) {
4
+ var printMq = '@media print';
9
5
  return {
10
6
  root: {
11
7
  position: 'relative',
@@ -19,13 +15,14 @@ var generateStyle = function generateStyle(componentTheme) {
19
15
  zIndex: componentTheme.overlayZIndex,
20
16
  height: '100%',
21
17
  width: '100%',
22
- '&:hover': {
18
+ '&:hover': _defineProperty({
23
19
  boxSizing: 'border-box',
24
20
  borderLeft: "".concat(componentTheme.overlayBarSize, " solid ").concat(componentTheme.overlayBarColor)
25
- }
21
+ }, printMq, {
22
+ borderLeft: 'none'
23
+ })
26
24
  }
27
25
  };
28
26
  };
29
27
 
30
- var _default = generateStyle;
31
- exports.default = _default;
28
+ 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
  overlayBarColor: colors.electric,
8
8
  overlayBarSize: '0.3rem'
9
9
  };
10
- }
10
+ };
11
+
12
+ export default generateComponentTheme;
@@ -6,22 +6,15 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
6
 
7
7
  var _dec, _class, _class2, _temp;
8
8
 
9
- import React, { Component } from 'react';
9
+ /** @jsx jsx */
10
+ import { Component } from 'react';
10
11
  import PropTypes from 'prop-types';
11
- import classNames from 'classnames';
12
12
  import { Metric } from '@instructure/ui-metric';
13
13
  import { ScreenReaderContent, PresentationContent } from '@instructure/ui-a11y-content';
14
- import { themeable } from '@instructure/ui-themeable';
14
+ import { withStyle, jsx } from '@instructure/emotion';
15
15
  import t from '@instructure/quiz-i18n/es/format-message';
16
- var styles = {
17
- componentId: 'fvWlS',
18
- template: function template(theme) {
19
- return "\n\n.fvWlS_bGBk{align-items:center;display:flex;flex-direction:row;justify-content:center}";
20
- },
21
- 'root': 'fvWlS_bGBk'
22
- };
23
- import theme from "./theme.js";
24
- export var MetricsListItem = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
16
+ import generateStyle from "./styles.js";
17
+ export var MetricsListItem = (_dec = withStyle(generateStyle, null), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
25
18
  _inherits(MetricsListItem, _Component);
26
19
 
27
20
  var _super = _createSuper(MetricsListItem);
@@ -35,19 +28,19 @@ export var MetricsListItem = (_dec = themeable(theme, styles), _dec(_class = (_t
35
28
  _createClass(MetricsListItem, [{
36
29
  key: "renderNoValue",
37
30
  value: function renderNoValue() {
38
- return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('No value')), /*#__PURE__*/React.createElement(PresentationContent, null, t('--')));
31
+ return jsx("span", null, jsx(ScreenReaderContent, null, t('No value')), jsx(PresentationContent, null, t('--')));
39
32
  }
40
33
  }, {
41
34
  key: "render",
42
35
  value: function render() {
43
- var names = classNames(styles.root, this.props.className);
36
+ var styles = [this.props.styles.root, this.props.customStyles];
44
37
  var _this$props = this.props,
45
38
  renderValue = _this$props.renderValue,
46
39
  renderLabel = _this$props.renderLabel,
47
40
  isGroupChild = _this$props.isGroupChild;
48
- return /*#__PURE__*/React.createElement("div", {
49
- className: names
50
- }, /*#__PURE__*/React.createElement(Metric, {
41
+ return jsx("div", {
42
+ css: styles
43
+ }, jsx(Metric, {
51
44
  renderLabel: renderLabel,
52
45
  renderValue: renderValue || this.renderNoValue(),
53
46
  isGroupChild: isGroupChild
@@ -58,8 +51,9 @@ export var MetricsListItem = (_dec = themeable(theme, styles), _dec(_class = (_t
58
51
  MetricsListItem.displayName = "MetricsListItem";
59
52
  return MetricsListItem;
60
53
  }(Component), _class2.propTypes = _objectSpread(_objectSpread({}, Metric.propTypes), {}, {
61
- className: PropTypes.string
54
+ customStyles: PropTypes.object,
55
+ styles: PropTypes.object
62
56
  }), _class2.defaultProps = {
63
- className: ''
57
+ customStyles: {}
64
58
  }, _temp)) || _class);
65
59
  export default MetricsListItem;
@@ -0,0 +1,12 @@
1
+ var generateStyle = function generateStyle() {
2
+ return {
3
+ root: {
4
+ display: 'flex',
5
+ flexDirection: 'row',
6
+ alignItems: 'center',
7
+ justifyContent: 'center'
8
+ }
9
+ };
10
+ };
11
+
12
+ export default generateStyle;
@@ -1,3 +0,0 @@
1
- export default function generator() {
2
- return {};
3
- }
@@ -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,41 +5,26 @@ 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
+ import PropTypes from 'prop-types';
10
11
  import ImmutablePropTypes from 'react-immutable-proptypes';
11
- import classNames from 'classnames';
12
12
  import { fromJS } from 'immutable';
13
13
  import { scaleLinear } from 'd3-scale';
14
14
  import { IconXSolid, IconCheckSolid } from '@instructure/ui-icons';
15
15
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
16
16
  import { Table } from '@instructure/ui-table';
17
- import { themeable } from '@instructure/ui-themeable';
17
+ import { withStyle, jsx } from '@instructure/emotion';
18
18
  import t from '@instructure/quiz-i18n/es/format-message';
19
19
  import { extractTextFromHtml } from '@instructure/quiz-interactions';
20
- import theme from "./theme.js";
21
- var styles = {
22
- componentId: 'deQQP',
23
- template: function template(theme) {
24
- return "\n\n@keyframes deQQP_dFUU{to{opacity:1;transform:translateZ(0)}}\n\n.deQQP_caGd{animation-duration:0.3s;animation-fill-mode:forwards;animation-name:deQQP_dFUU;opacity:0.01;transform:translateZ(0)}\n\n.deQQP_caGd td,.deQQP_caGd th{border-bottom-color:".concat(theme.contentCellBorderColor || 'inherit', ";padding-left:0.35rem;padding-right:0.35rem}\n\n.deQQP_ddmB td,.deQQP_ddmB th{padding-bottom:").concat(theme.answerRowCellPadding || 'inherit', ";padding-top:").concat(theme.answerRowCellPadding || 'inherit', ";white-space:nowrap}\n\n.deQQP_dOeq{background-color:").concat(theme.answerRowCorrectBackgroundColor || 'inherit', "}\n\n.deQQP_dOeq .deQQP_cLIq{color:").concat(theme.answerRowAnswerIconColor || 'inherit', "}\n\n.deQQP_dOeq .deQQP_ccwL,.deQQP_dOeq .deQQP_bFWU{font-weight:").concat(theme.answerRowCorrectTextFieldFontWeight || 'inherit', "}\n\n.deQQP_dOeq .deQQP_fKwc{background:").concat(theme.answerRowCorrectBarBackgroundColor || 'inherit', "}\n\ntd.deQQP_cLIq{color:").concat(theme.answerIconColor || 'inherit', ";font-size:").concat(theme.answerIconFontSize || 'inherit', ";width:1%}\n\nth.deQQP_bFWU{font-weight:").concat(theme.answerTextfieldFontWeight || 'inherit', ";max-width:12rem;overflow:hidden}\n\n.deQQP_fTiR{text-align:right;width:1%}\n\n[dir=ltr] .deQQP_fTiR,[dir=rtl] .deQQP_fTiR{text-align:right}\n\ntd.deQQP_fTiR{color:").concat(theme.respondentLinkColor || 'inherit', "}\n\ntd.deQQP_lHsH{color:").concat(theme.respondentLinkPresentColor || 'inherit', "}\n\n.deQQP_ccwL{text-align:right;width:1%}\n\n[dir=ltr] .deQQP_ccwL,[dir=rtl] .deQQP_ccwL{text-align:right}\n\ntd.deQQP_ccwL{padding-left:").concat(theme.answerRatioPaddingLeft || 'inherit', "}\n\ntd.deQQP_dEZf{border-bottom-color:transparent;height:2.3rem;min-width:7rem;padding:0;width:7rem}\n\n.deQQP_fKwc{background:").concat(theme.barBackgroundColor || 'inherit', ";height:100%;min-width:").concat(theme.barMinWidth || 'inherit', ";position:relative;transition:").concat(theme.barTransition || 'inherit', "}\n\n@media screen and (--phoneBreakPoint){th.deQQP_bFWU{max-width:0}th.deQQP_fTiR{max-width:3rem;overflow:hidden;text-overflow:ellipsis}}");
25
- },
26
- 'content': 'deQQP_caGd',
27
- 'contentAnimation': 'deQQP_dFUU',
28
- 'answerRow': 'deQQP_ddmB',
29
- 'answerRowCorrect': 'deQQP_dOeq',
30
- 'answerIcon': 'deQQP_cLIq',
31
- 'answerRatio': 'deQQP_ccwL',
32
- 'answerTextfield': 'deQQP_bFWU',
33
- 'bar': 'deQQP_fKwc',
34
- 'respondentLink': 'deQQP_fTiR',
35
- 'respondentLinkPresent': 'deQQP_lHsH',
36
- 'answerDistributionCell': 'deQQP_dEZf'
37
- };
38
-
39
- var _ref = /*#__PURE__*/React.createElement(IconCheckSolid, null);
40
-
41
- var _ref2 = /*#__PURE__*/React.createElement(IconXSolid, null);
42
-
43
- export var AnswerFrequencySummary = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
20
+ import generateComponentTheme from "./theme.js";
21
+ import generateStyle from "./styles.js";
22
+
23
+ var _ref = jsx(IconCheckSolid, null);
24
+
25
+ var _ref2 = jsx(IconXSolid, null);
26
+
27
+ export var AnswerFrequencySummary = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
44
28
  _inherits(AnswerFrequencySummary, _Component);
45
29
 
46
30
  var _super = _createSuper(AnswerFrequencySummary);
@@ -57,29 +41,16 @@ export var AnswerFrequencySummary = (_dec = themeable(theme, styles), _dec(_clas
57
41
  _this = _super.call.apply(_super, [this].concat(args));
58
42
 
59
43
  _this.renderAnswerTableRow = function (choiceInfo, choiceIndex) {
60
- var _classNames, _classNames2;
61
-
62
44
  var choiceSum = _this.props.itemAnalysis.choiceCountSum();
63
45
 
64
46
  var choiceBody = _this.renderChoiceBody(choiceInfo);
65
47
 
66
- var rowClassNames = classNames((_classNames = {}, _defineProperty(_classNames, styles.answerRow, true), _defineProperty(_classNames, styles.answerRowCorrect, _this.isCorrect(choiceInfo)), _classNames));
67
- var respondentClassNames = classNames((_classNames2 = {}, _defineProperty(_classNames2, styles.respondentLink, true), _defineProperty(_classNames2, styles.respondentLinkPresent, choiceInfo.get('choiceCount') > 0), _classNames2));
68
- return /*#__PURE__*/React.createElement(Table.Row, {
69
- key: choiceIndex,
70
- className: rowClassNames
71
- }, /*#__PURE__*/React.createElement(Table.Cell, {
72
- className: styles.answerIcon
73
- }, _this.isCorrect(choiceInfo) ? _ref : _ref2, /*#__PURE__*/React.createElement(ScreenReaderContent, null, _this.getBarTitle(choiceInfo))), /*#__PURE__*/React.createElement(Table.RowHeader, {
74
- className: styles.answerTextfield
75
- }, /*#__PURE__*/React.createElement("span", {
48
+ return jsx(Table.Row, {
49
+ key: choiceIndex
50
+ }, jsx(Table.Cell, null, _this.isCorrect(choiceInfo) ? _ref : _ref2, jsx(ScreenReaderContent, null, _this.getBarTitle(choiceInfo))), jsx(Table.RowHeader, null, jsx("span", {
51
+ "data-testid": "answer-textfield",
76
52
  title: choiceBody
77
- }, choiceBody)), /*#__PURE__*/React.createElement(Table.Cell, {
78
- className: respondentClassNames
79
- }, t.number(Math.floor(choiceInfo.get('choiceCount')))), /*#__PURE__*/React.createElement(Table.Cell, {
80
- className: styles.answerRatio
81
- }, choiceSum > 0 ? t.number(choiceInfo.get('choiceCount') / choiceSum, 'percent') : 0), /*#__PURE__*/React.createElement(Table.Cell, {
82
- className: styles.answerDistributionCell,
53
+ }, choiceBody)), jsx(Table.Cell, null, t.number(Math.floor(choiceInfo.get('choiceCount')))), jsx(Table.Cell, null, choiceSum > 0 ? t.number(choiceInfo.get('choiceCount') / choiceSum, 'percent') : 0), jsx(Table.Cell, {
83
54
  "aria-hidden": "true"
84
55
  }, _this.renderBarPlot(choiceInfo)));
85
56
  };
@@ -112,8 +83,10 @@ export var AnswerFrequencySummary = (_dec = themeable(theme, styles), _dec(_clas
112
83
  }, {
113
84
  key: "renderBarPlot",
114
85
  value: function renderBarPlot(choiceInfo) {
115
- return /*#__PURE__*/React.createElement("div", {
116
- className: styles.bar,
86
+ var barStyles = this.isCorrect(choiceInfo) ? [this.props.styles.barCorrect, this.props.styles.bar] : [this.props.styles.bar];
87
+ return jsx("div", {
88
+ "data-testid": "bar",
89
+ css: barStyles,
117
90
  style: this.getBarStyles(choiceInfo),
118
91
  alt: t('Graph bar'),
119
92
  title: this.getBarTitle(choiceInfo)
@@ -134,28 +107,27 @@ export var AnswerFrequencySummary = (_dec = themeable(theme, styles), _dec(_clas
134
107
  itemBody: t('(No answer)'),
135
108
  choiceCount: this.props.itemAnalysis.unansweredInfo()
136
109
  });
137
- return /*#__PURE__*/React.createElement("div", {
138
- className: styles.content,
110
+ return jsx("div", {
111
+ css: this.props.styles.content,
139
112
  "data-automation": "sdk-reporting-frequency-summary"
140
- }, /*#__PURE__*/React.createElement(Table, {
113
+ }, jsx(Table, {
141
114
  caption: t('Answer Frequency Summary')
142
- }, /*#__PURE__*/React.createElement(Table.Head, null, /*#__PURE__*/React.createElement(Table.Row, null, /*#__PURE__*/React.createElement(Table.ColHeader, {
115
+ }, jsx(Table.Head, null, jsx(Table.Row, null, jsx(Table.ColHeader, {
143
116
  id: "answer-frequency-summary-is-correct"
144
- }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('Is Correct?'))), /*#__PURE__*/React.createElement(Table.ColHeader, {
117
+ }, jsx(ScreenReaderContent, null, t('Is Correct?'))), jsx(Table.ColHeader, {
145
118
  id: "answer-frequency-sumary-answer"
146
- }, t('Answer')), /*#__PURE__*/React.createElement(Table.ColHeader, {
147
- id: "answer-frequency-summary-respondents",
148
- className: styles.respondentLink
149
- }, t('Respondents')), /*#__PURE__*/React.createElement(Table.ColHeader, {
150
- id: "answer-frequency-summary-answer-ratio",
151
- className: styles.answerRatio
152
- }, t('Percentage')))), /*#__PURE__*/React.createElement(Table.Body, null, choiceInfo.toArray().map(this.renderAnswerTableRow), this.renderAnswerTableRow(this.unansweredChoiceInfo, choiceInfo.size))));
119
+ }, t('Answer')), jsx(Table.ColHeader, {
120
+ id: "answer-frequency-summary-respondents"
121
+ }, t('Respondents')), jsx(Table.ColHeader, {
122
+ id: "answer-frequency-summary-answer-ratio"
123
+ }, t('Percentage')))), jsx(Table.Body, null, choiceInfo.toArray().map(this.renderAnswerTableRow), this.renderAnswerTableRow(this.unansweredChoiceInfo, choiceInfo.size))));
153
124
  }
154
125
  }]);
155
126
 
156
127
  AnswerFrequencySummary.displayName = "AnswerFrequencySummary";
157
128
  return AnswerFrequencySummary;
158
129
  }(Component), _class2.propTypes = {
159
- itemAnalysis: ImmutablePropTypes.record.isRequired
130
+ itemAnalysis: ImmutablePropTypes.record.isRequired,
131
+ styles: PropTypes.object
160
132
  }, _temp)) || _class);
161
133
  export default AnswerFrequencySummary;
@@ -0,0 +1,45 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+
3
+ function _templateObject() {
4
+ var data = _taggedTemplateLiteral(["\n to {\n opacity: 1;\n transform: translate3d(0, 0, 0);\n }"]);
5
+
6
+ _templateObject = function _templateObject() {
7
+ return data;
8
+ };
9
+
10
+ return data;
11
+ }
12
+
13
+ import { keyframes } from '@instructure/emotion';
14
+ var contentAnimation = keyframes(_templateObject());
15
+
16
+ var generateStyle = function generateStyle(componentTheme, props) {
17
+ var contentCellStyles = {
18
+ borderBottomColor: componentTheme.contentCellBorderColor,
19
+ paddingLeft: '0.35rem',
20
+ paddingRight: '0.35rem'
21
+ };
22
+ return {
23
+ content: {
24
+ opacity: '0.01',
25
+ transform: 'translate3d(0, 0, 0)',
26
+ animationName: contentAnimation,
27
+ animationFillMode: 'forwards',
28
+ animationDuration: '0.3s',
29
+ 'th': contentCellStyles,
30
+ 'td': contentCellStyles
31
+ },
32
+ bar: {
33
+ background: componentTheme.barBackgroundColor,
34
+ transition: componentTheme.barTransition,
35
+ position: 'relative',
36
+ minWidth: componentTheme.barMinWidth,
37
+ height: '100%'
38
+ },
39
+ barCorrect: {
40
+ background: componentTheme.answerRowCorrectBarBackgroundColor
41
+ }
42
+ };
43
+ };
44
+
45
+ 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
  colors = _ref.colors,
4
4
  spacing = _ref.spacing,
@@ -23,4 +23,6 @@ export default function generator(_ref) {
23
23
  phoneBreakPoint: "max-width: ".concat(breakpoints.medium),
24
24
  barTransition: "width ".concat(transitions.duration)
25
25
  };
26
- }
26
+ };
27
+
28
+ export default generateComponentTheme;
@@ -128,25 +128,25 @@ export var ItemAnalysisRow = (_dec = withStyle(generateStyle, generateComponentT
128
128
  key: "difficultyIndex",
129
129
  renderLabel: t('Difficulty Index'),
130
130
  renderValue: this.props.itemAnalysis.difficultyIndex(this.locale),
131
- css: this.props.styles.metric,
131
+ customStyles: this.props.styles.metric,
132
132
  isGroupChild: true
133
133
  }), jsx(MetricsListItem, {
134
134
  key: "discriminationIndex",
135
135
  renderLabel: t('Discrimination Index'),
136
136
  renderValue: this.props.itemAnalysis.discriminationIndex(this.locale),
137
- css: this.props.styles.metric,
137
+ customStyles: this.props.styles.metric,
138
138
  isGroupChild: true
139
139
  }), jsx(MetricsListItem, {
140
140
  key: "rpb",
141
141
  renderLabel: t('RPB'),
142
142
  renderValue: this.props.itemAnalysis.pointBiserial(this.locale),
143
- css: this.props.styles.metric,
143
+ customStyles: this.props.styles.metric,
144
144
  isGroupChild: true
145
145
  }), jsx(MetricsListItem, {
146
146
  key: "meanEarnedScore",
147
147
  renderLabel: t('Mean Earned Score'),
148
148
  renderValue: mean,
149
- css: this.props.styles.metric,
149
+ customStyles: this.props.styles.metric,
150
150
  isGroupChild: true
151
151
  }));
152
152
  }