@instructure/quiz-core 20.9.0 → 20.9.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 (97) hide show
  1. package/es/building/components/layout/Sidebar/SidebarItem/presenter.js +16 -22
  2. package/es/building/components/layout/Sidebar/SidebarItem/styles.js +11 -0
  3. package/es/building/components/layout/Sidebar/SidebarItem/theme.js +4 -2
  4. package/es/building/components/layout/Sidebar/Stimulus/presenter.js +17 -23
  5. package/es/building/components/layout/Sidebar/Stimulus/styles.js +11 -0
  6. package/es/building/components/layout/Sidebar/Stimulus/theme.js +4 -2
  7. package/es/building/components/layout/Sidebar/presenter.js +42 -38
  8. package/es/building/components/layout/Sidebar/styles.js +28 -0
  9. package/es/building/components/layout/Sidebar/theme.js +4 -2
  10. package/es/building/components/layout/header/BuildingButtons/presenter.js +33 -39
  11. package/es/building/components/layout/header/BuildingButtons/styles.js +21 -0
  12. package/es/building/components/layout/header/BuildingButtons/theme.js +4 -2
  13. package/es/building/components/resources/ActionButtons/presenter.js +29 -27
  14. package/es/building/components/resources/ActionButtons/styles.js +33 -0
  15. package/es/building/components/resources/ActionButtons/theme.js +4 -2
  16. package/es/building/components/resources/AddToBankOptions/index.js +11 -15
  17. package/es/building/components/resources/AddToBankOptions/styles.js +11 -0
  18. package/es/building/components/resources/AddToBankOptions/theme.js +4 -2
  19. package/es/building/components/resources/DeleteStimulusModal/presenter.js +38 -44
  20. package/es/building/components/resources/DeleteStimulusModal/styles.js +22 -0
  21. package/es/building/components/resources/DeleteStimulusModal/theme.js +4 -2
  22. package/es/building/components/resources/ItemFeedbackModal/presenter.js +23 -28
  23. package/es/building/components/resources/ItemFeedbackModal/styles.js +14 -0
  24. package/es/building/components/resources/ItemFeedbackModal/theme.js +4 -2
  25. package/es/common/components/layout/header/Timer/presenter.js +30 -37
  26. package/es/common/components/layout/header/Timer/styles.js +27 -0
  27. package/es/common/components/layout/header/Timer/theme.js +4 -2
  28. package/es/common/components/layout/sidebar/PositionSummary/index.js +17 -25
  29. package/es/common/components/layout/sidebar/PositionSummary/styles.js +28 -0
  30. package/es/common/components/layout/sidebar/PositionSummary/theme.js +4 -2
  31. package/es/common/components/layout/sidebar/Sidebar/index.js +88 -94
  32. package/es/common/components/layout/sidebar/Sidebar/styles.js +117 -0
  33. package/es/common/components/layout/sidebar/Sidebar/theme.js +4 -8
  34. package/es/common/components/layout/sidebar/SidebarItem/presenter.js +52 -52
  35. package/es/common/components/layout/sidebar/SidebarItem/styles.js +59 -0
  36. package/es/common/components/layout/sidebar/SidebarItem/theme.js +4 -2
  37. package/es/common/components/layout/sidebar/Stimulus/presenter.js +39 -36
  38. package/es/common/components/layout/sidebar/Stimulus/styles.js +33 -0
  39. package/es/common/components/layout/sidebar/Stimulus/theme.js +4 -2
  40. package/es/common/components/shared/InteractionTypes/presenter.js +27 -33
  41. package/es/common/components/shared/InteractionTypes/styles.js +17 -0
  42. package/es/common/components/shared/InteractionTypes/theme.js +4 -2
  43. package/es/common/components/shared/drag_and_drop/DragAndDropZone/index.js +40 -30
  44. package/es/common/components/shared/drag_and_drop/DragAndDropZone/styles.js +41 -0
  45. package/es/common/components/shared/drag_and_drop/DragAndDropZone/theme.js +4 -2
  46. package/es/common/components/shared/file_selector/FileSelector.js +11 -14
  47. package/es/common/components/shared/file_selector/styles.js +12 -0
  48. package/es/common/components/shared/file_selector/theme.js +4 -2
  49. package/lib/building/components/layout/Sidebar/SidebarItem/presenter.js +15 -23
  50. package/lib/building/components/layout/Sidebar/SidebarItem/styles.js +19 -0
  51. package/lib/building/components/layout/Sidebar/SidebarItem/theme.js +6 -3
  52. package/lib/building/components/layout/Sidebar/Stimulus/presenter.js +16 -24
  53. package/lib/building/components/layout/Sidebar/Stimulus/styles.js +19 -0
  54. package/lib/building/components/layout/Sidebar/Stimulus/theme.js +6 -3
  55. package/lib/building/components/layout/Sidebar/presenter.js +40 -41
  56. package/lib/building/components/layout/Sidebar/styles.js +38 -0
  57. package/lib/building/components/layout/Sidebar/theme.js +6 -3
  58. package/lib/building/components/layout/header/BuildingButtons/presenter.js +32 -40
  59. package/lib/building/components/layout/header/BuildingButtons/styles.js +29 -0
  60. package/lib/building/components/layout/header/BuildingButtons/theme.js +6 -3
  61. package/lib/building/components/resources/ActionButtons/presenter.js +28 -30
  62. package/lib/building/components/resources/ActionButtons/styles.js +44 -0
  63. package/lib/building/components/resources/ActionButtons/theme.js +6 -3
  64. package/lib/building/components/resources/AddToBankOptions/index.js +10 -16
  65. package/lib/building/components/resources/AddToBankOptions/styles.js +19 -0
  66. package/lib/building/components/resources/AddToBankOptions/theme.js +6 -3
  67. package/lib/building/components/resources/DeleteStimulusModal/presenter.js +37 -46
  68. package/lib/building/components/resources/DeleteStimulusModal/styles.js +30 -0
  69. package/lib/building/components/resources/DeleteStimulusModal/theme.js +6 -3
  70. package/lib/building/components/resources/ItemFeedbackModal/presenter.js +19 -27
  71. package/lib/building/components/resources/ItemFeedbackModal/styles.js +22 -0
  72. package/lib/building/components/resources/ItemFeedbackModal/theme.js +6 -3
  73. package/lib/common/components/layout/header/Timer/presenter.js +29 -39
  74. package/lib/common/components/layout/header/Timer/styles.js +35 -0
  75. package/lib/common/components/layout/header/Timer/theme.js +6 -3
  76. package/lib/common/components/layout/sidebar/PositionSummary/index.js +16 -26
  77. package/lib/common/components/layout/sidebar/PositionSummary/styles.js +36 -0
  78. package/lib/common/components/layout/sidebar/PositionSummary/theme.js +6 -3
  79. package/lib/common/components/layout/sidebar/Sidebar/index.js +85 -97
  80. package/lib/common/components/layout/sidebar/Sidebar/styles.js +128 -0
  81. package/lib/common/components/layout/sidebar/Sidebar/theme.js +5 -9
  82. package/lib/common/components/layout/sidebar/SidebarItem/presenter.js +51 -55
  83. package/lib/common/components/layout/sidebar/SidebarItem/styles.js +69 -0
  84. package/lib/common/components/layout/sidebar/SidebarItem/theme.js +6 -3
  85. package/lib/common/components/layout/sidebar/Stimulus/presenter.js +38 -37
  86. package/lib/common/components/layout/sidebar/Stimulus/styles.js +41 -0
  87. package/lib/common/components/layout/sidebar/Stimulus/theme.js +6 -3
  88. package/lib/common/components/shared/InteractionTypes/presenter.js +26 -36
  89. package/lib/common/components/shared/InteractionTypes/styles.js +25 -0
  90. package/lib/common/components/shared/InteractionTypes/theme.js +6 -3
  91. package/lib/common/components/shared/drag_and_drop/DragAndDropZone/index.js +40 -33
  92. package/lib/common/components/shared/drag_and_drop/DragAndDropZone/styles.js +51 -0
  93. package/lib/common/components/shared/drag_and_drop/DragAndDropZone/theme.js +6 -3
  94. package/lib/common/components/shared/file_selector/FileSelector.js +10 -15
  95. package/lib/common/components/shared/file_selector/styles.js +20 -0
  96. package/lib/common/components/shared/file_selector/theme.js +6 -3
  97. package/package.json +10 -10
@@ -0,0 +1,117 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+
4
+ var generateStyle = function generateStyle(componentTheme, props) {
5
+ var _commonContainer;
6
+
7
+ var mq = "@media screen and (".concat(componentTheme.phoneBreakPoint, ")");
8
+ var mp = '@media print';
9
+ return {
10
+ sidebar: _objectSpread(_objectSpread(_defineProperty({
11
+ boxSizing: 'border-box',
12
+ width: componentTheme.sidebarWidthClosed,
13
+ backgroundColor: componentTheme.sidebarBackgroundColor,
14
+ border: "".concat(componentTheme.sidebarBorderWidth, " solid ").concat(componentTheme.sidebarBorderColor),
15
+ color: componentTheme.sidebarColor,
16
+ height: '100%',
17
+ overflow: 'hidden',
18
+ position: 'relative',
19
+ zIndex: componentTheme.sidebarZIndex,
20
+ transition: "".concat(componentTheme.sidebarTransitionDuration, " ease")
21
+ }, mq, {
22
+ position: 'absolute',
23
+ width: 0
24
+ }), props.sidebarOpen && _defineProperty({
25
+ width: componentTheme.sidebarWidthOpen,
26
+ opacity: 1
27
+ }, mq, {
28
+ width: '100vw',
29
+ maxWidth: '100vw'
30
+ })), {}, {
31
+ description: _objectSpread({
32
+ color: componentTheme.descriptionFontColor,
33
+ display: 'none',
34
+ fontSize: componentTheme.descriptionFontSize
35
+ }, props.sidebarOpen && {
36
+ cursor: 'pointer',
37
+ display: 'inline-block'
38
+ }),
39
+ actionableInfo: _objectSpread({
40
+ borderBottom: "".concat(componentTheme.sidebarHeaderBorderWidth, " solid ").concat(componentTheme.sidebarHeaderBorderColor),
41
+ borderRight: "".concat(componentTheme.actionableInfoBorderWidth, " solid ").concat(componentTheme.sidebarBackgroundColor),
42
+ textAlign: 'center',
43
+ ':hover': {
44
+ borderRight: "".concat(componentTheme.actionableInfoBorderWidth, " solid ").concat(componentTheme.actionableInfoHoverBorderColor)
45
+ }
46
+ }, props.sidebarOpen && {
47
+ textAlign: 'inherit'
48
+ })
49
+ }),
50
+
51
+ /* Decrease z-index when RCE editor is in fullscreen mode */
52
+ globalStyles: {
53
+ sidebar: {
54
+ zIndex: 0
55
+ }
56
+ },
57
+ sidebarWrapper: {
58
+ display: 'flex',
59
+ flexDirection: 'column',
60
+ height: '100%'
61
+ },
62
+ sidebarContent: {
63
+ overflowY: 'auto',
64
+ overflowX: 'hidden'
65
+ },
66
+ headerSpacing: {
67
+ display: 'flex',
68
+ flexDirection: 'row',
69
+ padding: componentTheme.headerSpacingPadding,
70
+ flexShrink: 0,
71
+ h2: {
72
+ paddingTop: '0.3em'
73
+ }
74
+ },
75
+ headerBottomBorder: {
76
+ borderBottom: "solid ".concat(componentTheme.sidebarHeaderBorderWidth),
77
+ borderColor: componentTheme.sidebarHeaderBorderColor
78
+ },
79
+ iconWrapper: _objectSpread({
80
+ marginLeft: 'auto'
81
+ }, !props.sidebarOpen && {
82
+ display: 'block',
83
+ margin: 'auto'
84
+ }),
85
+ pinnedSection: {
86
+ width: '100%',
87
+ backgroundColor: componentTheme.pinnedSectionBackgroundColor,
88
+ headerSpacing: {
89
+ flexGrow: 1
90
+ }
91
+ },
92
+ questionNavigatorPadding: _objectSpread({
93
+ paddingTop: componentTheme.questionNavigatorPadding
94
+ }, !props.sidebarOpen && {
95
+ display: 'none'
96
+ }),
97
+ buttonWrapper: _objectSpread({
98
+ button: {
99
+ paddingLeft: componentTheme.pinnedQuestionSpacing,
100
+ paddingBottom: componentTheme.pinnedQuestionSpacing,
101
+ fontSize: componentTheme.pinnedQuestionFontSize,
102
+ display: 'block'
103
+ }
104
+ }, !props.sidebarOpen && {
105
+ display: 'none'
106
+ }),
107
+ commonContainer: (_commonContainer = {
108
+ height: '100%'
109
+ }, _defineProperty(_commonContainer, mq, {
110
+ position: 'relative'
111
+ }), _defineProperty(_commonContainer, mp, {
112
+ display: 'none'
113
+ }), _commonContainer)
114
+ };
115
+ };
116
+
117
+ export default generateStyle;
@@ -1,5 +1,6 @@
1
1
  import { alpha } from '@instructure/ui-color-utils';
2
- export default function generator(_ref) {
2
+
3
+ var generateComponentTheme = function generateComponentTheme(_ref) {
3
4
  var colors = _ref.colors,
4
5
  spacing = _ref.spacing,
5
6
  typography = _ref.typography,
@@ -34,11 +35,6 @@ export default function generator(_ref) {
34
35
  focusBorderColor: colors.brand,
35
36
  focusOutlineColor: alpha(colors.brand, 50)
36
37
  };
37
- }
38
+ };
38
39
 
39
- generator.canvas = function (variables) {
40
- return {
41
- focusBorderColor: variables['ic-brand-primary'],
42
- focusOutlineColor: alpha(variables['ic-brand-primary'], 50)
43
- };
44
- };
40
+ 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,36 +5,20 @@ 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 ImmutablePropTypes from 'react-immutable-proptypes';
12
- import classNames from 'classnames';
13
12
  import { AccessibleContent } from '@instructure/ui-a11y-content';
14
13
  import { Link } from '@instructure/ui-link';
15
14
  import { Flex } from '@instructure/ui-flex';
16
- import { themeable } from '@instructure/ui-themeable';
15
+ import { withStyle, jsx } from '@instructure/emotion';
17
16
  import PositionSummary from "../PositionSummary/index.js";
18
17
  import t from '@instructure/quiz-i18n/es/format-message';
19
18
  import { RichContentRenderer } from '@instructure/quiz-rce';
20
- var styles = {
21
- componentId: 'cwwgG',
22
- template: function template(theme) {
23
- return "\n\n.cwwgG_kQJA{border-bottom:".concat(theme.bottomBorderWidth || 'inherit', " solid ").concat(theme.bottomBorderColor || 'inherit', ";border-right:").concat(theme.hoverBorderWidth || 'inherit', " solid ").concat(theme.borderColor || 'inherit', "}\n\n.cwwgG_kQJA:hover{border-right:").concat(theme.hoverBorderWidth || 'inherit', " solid ").concat(theme.hoverBorderColor || 'inherit', "}\n\n.cwwgG_cdGL{color:").concat(theme.infoHeaderColor || 'inherit', ";display:flex;font-size:").concat(theme.infoHeaderFontSize || 'inherit', "}\n\n.cwwgG_ecuB{width:60%}\n\n.cwwgG_echV{width:40%}\n\n.cwwgG_doeu{font-size:").concat(theme.numberFontSize || 'inherit', ";font-weight:").concat(theme.numberFontWeight || 'inherit', "}\n\n.cwwgG_doeu,.cwwgG_esVF{color:").concat(theme.darkTextColor || 'inherit', "}\n\n.cwwgG_esVF{font-size:").concat(theme.itemBodyFontSize || 'inherit', ";margin-top:").concat(theme.itemBodyMarginTop || 'inherit', ";overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n\n.cwwgG_fBqo{cursor:pointer;position:relative}\n\n.cwwgG_eQGE{margin:0 ").concat(theme.sidebarClosedMargin || 'inherit', ";padding:").concat(theme.sidebarClosedPadding || 'inherit', " 0;text-align:center}\n\n[dir=ltr] .cwwgG_eQGE,[dir=rtl] .cwwgG_eQGE{text-align:center}\n\n.cwwgG_csre{display:flex;justify-content:flex-end}\n\n.cwwgG_cRFW{border-bottom:none}\n\n.cwwgG_eNNp{padding:").concat(theme.sidebarIsOpenPadding || 'inherit', "}\n\n.cwwgG_eNNp.cwwgG_cRFW{margin-left:10%}\n\n.cwwgG_eNNp .cwwgG_fBqo{font-size:").concat(theme.sidebarIsOpenMainTextFontSize || 'inherit', ";margin-top:").concat(theme.mainTextPaddingTop || 'inherit', "}");
24
- },
25
- 'sidebarItem': 'cwwgG_kQJA',
26
- 'infoHeader': 'cwwgG_cdGL',
27
- 'interactionType': 'cwwgG_ecuB',
28
- 'pointsPossible': 'cwwgG_echV',
29
- 'displayNumber': 'cwwgG_doeu',
30
- 'itemBody': 'cwwgG_esVF',
31
- 'mainText': 'cwwgG_fBqo',
32
- 'sidebarClosed': 'cwwgG_eQGE',
33
- 'pinWrapper': 'cwwgG_csre',
34
- 'inStimulus': 'cwwgG_cRFW',
35
- 'sidebarIsOpen': 'cwwgG_eNNp'
36
- };
37
- import theme from "./theme.js";
38
- export var SidebarItem = (_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 SidebarItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
39
22
  _inherits(SidebarItem, _Component);
40
23
 
41
24
  var _super = _createSuper(SidebarItem);
@@ -69,6 +52,19 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
69
52
  }
70
53
 
71
54
  _createClass(SidebarItem, [{
55
+ key: "componentDidMount",
56
+ value: function componentDidMount() {
57
+ this.props.makeStyles();
58
+ }
59
+ }, {
60
+ key: "componentDidUpdate",
61
+ value: function componentDidUpdate() {
62
+ this.props.makeStyles();
63
+ } // ============
64
+ // ACTIONS
65
+ // ============
66
+
67
+ }, {
72
68
  key: "getPointsText",
73
69
  // ============
74
70
  // HELPERS
@@ -91,14 +87,14 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
91
87
  sidebarOpen = _this$props.sidebarOpen;
92
88
 
93
89
  if (!sidebarOpen && quizEntry && quizEntry.sizeOfBank > 1) {
94
- return /*#__PURE__*/React.createElement(PositionSummary, {
90
+ return jsx(PositionSummary, {
95
91
  firstPosition: position,
96
92
  lastPosition: position + quizEntry.sizeOfBank - 1
97
93
  });
98
94
  }
99
95
 
100
- return /*#__PURE__*/React.createElement("span", {
101
- className: styles.displayNumber
96
+ return jsx("span", {
97
+ css: this.props.styles.displayNumber
102
98
  }, displayPosition);
103
99
  }
104
100
  }, {
@@ -113,7 +109,7 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
113
109
  }) : t('Navigate to question at position {displayPosition}', {
114
110
  displayPosition: displayPosition
115
111
  });
116
- return /*#__PURE__*/React.createElement(Link, {
112
+ return jsx(Link, {
117
113
  href: "#",
118
114
  size: "small",
119
115
  margin: "0 small",
@@ -122,16 +118,15 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
122
118
  onClick: this.scrollToItem,
123
119
  "data-automation-item-id": itemId,
124
120
  "data-automation": "sdk-sidebar-item-button"
125
- }, /*#__PURE__*/React.createElement(AccessibleContent, {
121
+ }, jsx(AccessibleContent, {
126
122
  alt: screenReaderContent
127
123
  }, this.renderPosition()));
128
124
  }
129
125
  }, {
130
126
  key: "renderClosed",
131
127
  value: function renderClosed() {
132
- var contentWrapperClasses = classNames(styles.sidebarItem, styles.sidebarClosed, _defineProperty({}, styles.inStimulus, this.props.inStimulus));
133
- return /*#__PURE__*/React.createElement("div", {
134
- className: contentWrapperClasses
128
+ return jsx("div", {
129
+ css: this.props.styles.sidebarItem
135
130
  }, this.renderButton());
136
131
  }
137
132
  }, {
@@ -140,32 +135,34 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
140
135
  var _this$props3 = this.props,
141
136
  children = _this$props3.children,
142
137
  itemName = _this$props3.itemName,
143
- inStimulus = _this$props3.inStimulus,
144
- pointsPossible = _this$props3.pointsPossible;
145
- var contentWrapperClasses = classNames(styles.sidebarItem, styles.sidebarIsOpen, _defineProperty({}, styles.inStimulus, inStimulus));
146
- return /*#__PURE__*/React.createElement("div", {
147
- className: contentWrapperClasses
148
- }, /*#__PURE__*/React.createElement(Flex, {
138
+ pointsPossible = _this$props3.pointsPossible,
139
+ styles = _this$props3.styles;
140
+ return jsx("div", {
141
+ className: "sidebarIsOpen",
142
+ css: styles.sidebarItem
143
+ }, jsx(Flex, {
149
144
  justifyItems: "space-between"
150
- }, /*#__PURE__*/React.createElement(Flex.Item, null, this.renderButton()), /*#__PURE__*/React.createElement(Flex.Item, {
145
+ }, jsx(Flex.Item, null, this.renderButton()), jsx(Flex.Item, {
151
146
  shouldGrow: true,
152
147
  shouldShrink: true,
153
148
  onClick: this.scrollToItem,
154
149
  tabIndex: "-1"
155
- }, /*#__PURE__*/React.createElement("div", {
156
- className: styles.mainText
157
- }, /*#__PURE__*/React.createElement("div", {
158
- className: styles.infoHeader
159
- }, /*#__PURE__*/React.createElement("div", {
160
- className: styles.interactionType
161
- }, itemName), /*#__PURE__*/React.createElement("div", {
162
- className: styles.pointsPossible
163
- }, this.getPointsText(pointsPossible || 0))), /*#__PURE__*/React.createElement("div", {
164
- className: styles.itemBody
165
- }, /*#__PURE__*/React.createElement(RichContentRenderer, {
150
+ }, jsx("div", {
151
+ css: this.props.styles.mainText
152
+ }, jsx("div", {
153
+ css: this.props.styles.infoHeader
154
+ }, jsx("div", {
155
+ className: "interactionType",
156
+ css: this.props.styles.interactionType
157
+ }, itemName), jsx("div", {
158
+ className: "pointsPossible",
159
+ css: this.props.styles.pointsPossible
160
+ }, this.getPointsText(pointsPossible || 0))), jsx("div", {
161
+ css: this.props.styles.itemBody
162
+ }, jsx(RichContentRenderer, {
166
163
  content: this.props.itemBody
167
- })))), /*#__PURE__*/React.createElement(Flex.Item, null, /*#__PURE__*/React.createElement("div", {
168
- className: styles.pinWrapper
164
+ })))), jsx(Flex.Item, null, jsx("div", {
165
+ css: this.props.styles.pinWrapper
169
166
  }, children))));
170
167
  }
171
168
  }, {
@@ -184,6 +181,7 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
184
181
  itemId: PropTypes.string.isRequired,
185
182
  itemBody: PropTypes.string,
186
183
  itemName: PropTypes.string.isRequired,
184
+ // eslint-disable-next-line react/no-unused-prop-types
187
185
  inStimulus: PropTypes.bool,
188
186
  isAnswered: PropTypes.bool,
189
187
  position: PropTypes.number.isRequired,
@@ -193,7 +191,9 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
193
191
  // not used on Take
194
192
  sidebarOpen: PropTypes.bool.isRequired,
195
193
  // from connect
196
- scrollToItem: PropTypes.func.isRequired
194
+ scrollToItem: PropTypes.func.isRequired,
195
+ styles: PropTypes.object,
196
+ makeStyles: PropTypes.func
197
197
  }, _class2.defaultProps = {
198
198
  children: null,
199
199
  inStimulus: false,
@@ -0,0 +1,59 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+
3
+ var generateStyle = function generateStyle(componentTheme, props) {
4
+ return {
5
+ sidebarItem: _objectSpread(_objectSpread(_objectSpread({
6
+ borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.borderColor),
7
+ borderBottom: "".concat(componentTheme.bottomBorderWidth, " solid ").concat(componentTheme.bottomBorderColor),
8
+ '&:hover': {
9
+ borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
10
+ },
11
+ padding: componentTheme.sidebarIsOpenPadding
12
+ }, props.inStimulus && {
13
+ borderBottom: 'none'
14
+ }), props.sidebarOpen && props.inStimulus && {
15
+ marginLeft: '10%'
16
+ }), !props.sidebarOpen && {
17
+ padding: "".concat(componentTheme.sidebarClosedPadding, " 0"),
18
+ margin: "0 ".concat(componentTheme.sidebarClosedMargin),
19
+ textAlign: 'center'
20
+ }),
21
+ infoHeader: {
22
+ fontSize: componentTheme.infoHeaderFontSize,
23
+ display: 'flex',
24
+ color: componentTheme.infoHeaderColor
25
+ },
26
+ interactionType: {
27
+ width: '60%'
28
+ },
29
+ pointsPossible: {
30
+ width: '40%'
31
+ },
32
+ displayNumber: {
33
+ color: componentTheme.darkTextColor,
34
+ fontSize: componentTheme.numberFontSize,
35
+ fontWeight: componentTheme.numberFontWeight
36
+ },
37
+ itemBody: {
38
+ fontSize: componentTheme.itemBodyFontSize,
39
+ color: componentTheme.darkTextColor,
40
+ whiteSpace: 'nowrap',
41
+ textOverflow: 'ellipsis',
42
+ overflow: 'hidden',
43
+ marginTop: componentTheme.itemBodyMarginTop
44
+ },
45
+ mainText: _objectSpread({
46
+ position: 'relative',
47
+ cursor: 'pointer'
48
+ }, props.sidebarOpen && {
49
+ fontSize: componentTheme.sidebarIsOpenMainTextFontSize,
50
+ marginTop: componentTheme.mainTextPaddingTop
51
+ }),
52
+ pinWrapper: {
53
+ display: 'flex',
54
+ justifyContent: 'flex-end'
55
+ }
56
+ };
57
+ };
58
+
59
+ export default generateStyle;
@@ -1,4 +1,4 @@
1
- export default function generator(_ref) {
1
+ var generateComponentTheme = function generateComponentTheme(_ref) {
2
2
  var borders = _ref.borders,
3
3
  colors = _ref.colors,
4
4
  typography = _ref.typography,
@@ -23,4 +23,6 @@ export default function generator(_ref) {
23
23
  sidebarIsOpenPadding: "".concat(spacing.small, " 0 ").concat(spacing.medium, " 0"),
24
24
  sidebarItemLogoFontSize: typography.fontSizeMedium
25
25
  };
26
- }
26
+ };
27
+
28
+ export default generateComponentTheme;
@@ -5,37 +5,28 @@ 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 { IconTextLeftLine } from '@instructure/ui-icons';
12
- import { themeable } from '@instructure/ui-themeable';
13
+ import { withStyle, jsx } from '@instructure/emotion';
13
14
  import { Link } from '@instructure/ui-link';
14
15
  import { Flex } from '@instructure/ui-flex';
15
16
  import { ScreenReaderContent } from '@instructure/ui-a11y-content';
16
17
  import Collection from "./Collection/index.js";
17
18
  import Title from "./Title/index.js";
18
19
  import Summary from "./Summary/index.js";
19
- var styles = {
20
- componentId: 'cqghd',
21
- template: function template(theme) {
22
- return "\n\n.cqghd_kQJA{border-bottom:".concat(theme.sidebarItemBorderWidth || 'inherit', " solid ").concat(theme.sidebarItemBorderColor || 'inherit', "}\n\n.cqghd_cESm{border-right:").concat(theme.hoverBorderWidth || 'inherit', " solid ").concat(theme.borderColor || 'inherit', ";padding:").concat(theme.sidebarClosedButtonPadding || 'inherit', ";text-align:center}\n\n[dir=ltr] .cqghd_cESm,[dir=rtl] .cqghd_cESm{text-align:center}\n\n.cqghd_cESm:hover{border-right:").concat(theme.hoverBorderWidth || 'inherit', " solid ").concat(theme.hoverBorderColor || 'inherit', "}\n\n.cqghd_faDl{border-right:").concat(theme.hoverBorderWidth || 'inherit', " solid ").concat(theme.borderColor || 'inherit', ";padding:").concat(theme.sidebarHeaderPadding || 'inherit', " 0}\n\n.cqghd_faDl:hover{border-right:").concat(theme.hoverBorderWidth || 'inherit', " solid ").concat(theme.hoverBorderColor || 'inherit', "}\n\n.cqghd_bTns{margin-left:5%}\n\n.cqghd_cdGL{color:").concat(theme.sidebarIsOpenInfoHeaderColor || 'inherit', ";font-size:").concat(theme.sidebarIsOpenInfoHeaderFontSize || 'inherit', ";margin-bottom:").concat(theme.sidebarIsOpenInfoHeaderMargin || 'inherit', ";padding-left:").concat(theme.sidebarIsOpenInfoHeaderPadding || 'inherit', "}");
23
- },
24
- 'sidebarItem': 'cqghd_kQJA',
25
- 'sidebarItemClosedButton': 'cqghd_cESm',
26
- 'stimulusHeader': 'cqghd_faDl',
27
- 'stimulusBody': 'cqghd_bTns',
28
- 'infoHeader': 'cqghd_cdGL'
29
- };
30
- import theme from "./theme.js";
20
+ import generateStyle from "./styles.js";
21
+ import generateComponentTheme from "./theme.js";
31
22
  import t from '@instructure/quiz-i18n/es/format-message';
32
23
  export var DISPLAY_AS_SUMMARY_LIMIT = 5;
33
24
 
34
- var _ref = /*#__PURE__*/React.createElement(IconTextLeftLine, {
25
+ var _ref = jsx(IconTextLeftLine, {
35
26
  color: "primary"
36
27
  });
37
28
 
38
- export var SidebarStimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
29
+ export var SidebarStimulus = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
39
30
  _inherits(SidebarStimulus, _Component);
40
31
 
41
32
  var _super = _createSuper(SidebarStimulus);
@@ -65,6 +56,16 @@ export var SidebarStimulus = (_dec = themeable(theme, styles), _dec(_class = (_t
65
56
  }
66
57
 
67
58
  _createClass(SidebarStimulus, [{
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
+ }, {
68
69
  key: "renderCollection",
69
70
  value: function renderCollection() {
70
71
  if (this.props.isDragging) {
@@ -77,7 +78,7 @@ export var SidebarStimulus = (_dec = themeable(theme, styles), _dec(_class = (_t
77
78
  isShowingItems = _this$props.isShowingItems,
78
79
  renderSidebarItem = _this$props.renderSidebarItem,
79
80
  sidebarOpen = _this$props.sidebarOpen;
80
- return /*#__PURE__*/React.createElement(Collection, {
81
+ return jsx(Collection, {
81
82
  firstPosition: displayPosition,
82
83
  isOver: isOver,
83
84
  isShowingItems: isShowingItems,
@@ -91,23 +92,23 @@ export var SidebarStimulus = (_dec = themeable(theme, styles), _dec(_class = (_t
91
92
  key: "renderButton",
92
93
  value: function renderButton() {
93
94
  var displayPosition = this.props.displayPosition;
94
- return /*#__PURE__*/React.createElement(Link, {
95
+ return jsx(Link, {
95
96
  href: "#",
96
97
  margin: "small",
97
98
  forceButtonRole: false,
98
99
  onClick: this.scrollToItem,
99
100
  renderIcon: _ref
100
- }, /*#__PURE__*/React.createElement(ScreenReaderContent, null, t('Navigate to stimulus at position { displayPosition }', {
101
+ }, jsx(ScreenReaderContent, null, t('Navigate to stimulus at position { displayPosition }', {
101
102
  displayPosition: displayPosition
102
103
  })));
103
104
  }
104
105
  }, {
105
106
  key: "renderClosed",
106
107
  value: function renderClosed() {
107
- return /*#__PURE__*/React.createElement("div", {
108
- className: styles.sidebarItem
109
- }, /*#__PURE__*/React.createElement("div", {
110
- className: styles.sidebarItemClosedButton
108
+ return jsx("div", {
109
+ css: this.props.styles.sidebarItem
110
+ }, jsx("div", {
111
+ css: this.props.styles.sidebarItemClosedButton
111
112
  }, this.renderButton()), this.renderCollection());
112
113
  }
113
114
  }, {
@@ -120,24 +121,24 @@ export var SidebarStimulus = (_dec = themeable(theme, styles), _dec(_class = (_t
120
121
  isShowingItems = _this$props2.isShowingItems,
121
122
  sidebarOpen = _this$props2.sidebarOpen,
122
123
  stimulus = _this$props2.stimulus;
123
- return /*#__PURE__*/React.createElement("div", {
124
- className: styles.sidebarItem
125
- }, /*#__PURE__*/React.createElement("div", {
126
- className: styles.stimulusHeader
127
- }, /*#__PURE__*/React.createElement("div", {
128
- className: styles.infoHeader
129
- }, t('Stimulus')), /*#__PURE__*/React.createElement("div", {
130
- className: styles.stimulusBody
131
- }, /*#__PURE__*/React.createElement(Flex, {
124
+ return jsx("div", {
125
+ css: this.props.styles.sidebarItem
126
+ }, jsx("div", {
127
+ css: this.props.styles.stimulusHeader
128
+ }, jsx("div", {
129
+ css: this.props.styles.infoHeader
130
+ }, t('Stimulus')), jsx("div", {
131
+ css: this.props.styles.stimulusBody
132
+ }, jsx(Flex, {
132
133
  justifyItems: "space-between"
133
- }, /*#__PURE__*/React.createElement(Flex.Item, null, this.renderButton()), /*#__PURE__*/React.createElement(Flex.Item, {
134
+ }, jsx(Flex.Item, null, this.renderButton()), jsx(Flex.Item, {
134
135
  shouldGrow: true,
135
136
  shouldShrink: true,
136
137
  onClick: this.scrollToItem,
137
138
  tabIndex: "-1"
138
- }, /*#__PURE__*/React.createElement(Title, {
139
+ }, jsx(Title, {
139
140
  title: stimulus.title
140
- })), /*#__PURE__*/React.createElement(Flex.Item, null, children)), /*#__PURE__*/React.createElement(Summary, {
141
+ })), jsx(Flex.Item, null, children)), jsx(Summary, {
141
142
  startPosition: displayPosition,
142
143
  isDragging: isDragging,
143
144
  isShowingItems: isShowingItems,
@@ -169,7 +170,9 @@ export var SidebarStimulus = (_dec = themeable(theme, styles), _dec(_class = (_t
169
170
  scrollToItem: PropTypes.func.isRequired,
170
171
  sidebarOpen: PropTypes.bool.isRequired,
171
172
  stimulus: ImmutablePropTypes.record.isRequired,
172
- stimulusParent: ImmutablePropTypes.record.isRequired
173
+ stimulusParent: ImmutablePropTypes.record.isRequired,
174
+ styles: PropTypes.object,
175
+ makeStyles: PropTypes.func
173
176
  }, _class2.defaultProps = {
174
177
  children: null,
175
178
  isDragging: false,
@@ -0,0 +1,33 @@
1
+ var generateStyle = function generateStyle(componentTheme) {
2
+ return {
3
+ sidebarItem: {
4
+ borderBottom: "".concat(componentTheme.sidebarItemBorderWidth, " solid ").concat(componentTheme.sidebarItemBorderColor)
5
+ },
6
+ sidebarItemClosedButton: {
7
+ borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.borderColor),
8
+ padding: componentTheme.sidebarClosedButtonPadding,
9
+ textAlign: 'center',
10
+ '&:hover': {
11
+ borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
12
+ }
13
+ },
14
+ stimulusHeader: {
15
+ padding: "".concat(componentTheme.sidebarHeaderPadding, " 0"),
16
+ borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.borderColor),
17
+ '&:hover:': {
18
+ borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
19
+ }
20
+ },
21
+ stimulusBody: {
22
+ marginLeft: '5%'
23
+ },
24
+ infoHeader: {
25
+ fontSize: componentTheme.sidebarIsOpenInfoHeaderFontSize,
26
+ color: componentTheme.sidebarIsOpenInfoHeaderColor,
27
+ marginBottom: componentTheme.sidebarIsOpenInfoHeaderMargin,
28
+ paddingLeft: componentTheme.sidebarIsOpenInfoHeaderPadding
29
+ }
30
+ };
31
+ };
32
+
33
+ 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
  spacing = _ref.spacing,
4
4
  borders = _ref.borders,
@@ -16,4 +16,6 @@ export default function generator(_ref) {
16
16
  sidebarIsOpenInfoHeaderMargin: spacing.xSmall,
17
17
  sidebarIsOpenInfoHeaderColor: colors.ash
18
18
  };
19
- }
19
+ };
20
+
21
+ export default generateComponentTheme;