@instructure/quiz-core 20.11.3-rc.19 → 20.11.3-rc.20

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 (23) hide show
  1. package/es/building/components/resources/quizEntry/QuizEntry/index.js +2 -1
  2. package/es/building/components/resources/quizEntry/QuizEntry/presenter.js +23 -29
  3. package/es/building/components/resources/quizEntry/QuizEntry/quizEntryPresenterWrapper.js +39 -0
  4. package/es/building/components/resources/quizEntry/QuizEntry/styles.js +23 -0
  5. package/es/building/components/resources/quizEntry/QuizEntry/theme.js +4 -2
  6. package/es/common/components/resources/stimulus/Stimulus/presenter.js +40 -50
  7. package/es/common/components/resources/stimulus/Stimulus/styles.js +58 -0
  8. package/es/common/components/resources/stimulus/Stimulus/theme.js +4 -2
  9. package/es/common/components/resources/stimulus/StimulusEdit/presenter.js +37 -46
  10. package/es/common/components/resources/stimulus/StimulusEdit/styles.js +46 -0
  11. package/es/common/components/resources/stimulus/StimulusEdit/theme.js +4 -2
  12. package/lib/building/components/resources/quizEntry/QuizEntry/index.js +3 -1
  13. package/lib/building/components/resources/quizEntry/QuizEntry/presenter.js +22 -30
  14. package/lib/building/components/resources/quizEntry/QuizEntry/quizEntryPresenterWrapper.js +51 -0
  15. package/lib/building/components/resources/quizEntry/QuizEntry/styles.js +33 -0
  16. package/lib/building/components/resources/quizEntry/QuizEntry/theme.js +6 -3
  17. package/lib/common/components/resources/stimulus/Stimulus/presenter.js +38 -52
  18. package/lib/common/components/resources/stimulus/Stimulus/styles.js +70 -0
  19. package/lib/common/components/resources/stimulus/Stimulus/theme.js +6 -3
  20. package/lib/common/components/resources/stimulus/StimulusEdit/presenter.js +36 -47
  21. package/lib/common/components/resources/stimulus/StimulusEdit/styles.js +54 -0
  22. package/lib/common/components/resources/stimulus/StimulusEdit/theme.js +6 -3
  23. package/package.json +9 -9
@@ -14,6 +14,7 @@ import { DropTargetCreator } from "../../../../../common/components/shared/drag_
14
14
  import { QuizEntry as QuizEntryPresenter } from "./presenter.js";
15
15
  import { SHOULD_CLONE_ITEM, QUIZ_ENTRY_GUID_SUFFIX, QUIZ_ENTRY_REF } from '@instructure/quiz-common';
16
16
  import { getActiveQuiz } from "../../../../../common/selectors/quizzes.js";
17
+ import quizEntryPresenterWrapper from "./quizEntryPresenterWrapper.js";
17
18
  export var mapStateToProps = function mapStateToProps(state, props) {
18
19
  var activeQuiz = getActiveQuiz(state);
19
20
  var quizId = activeQuiz.id;
@@ -67,5 +68,5 @@ var dispatchToProps = {
67
68
  setUi: set,
68
69
  showError: showError
69
70
  };
70
- export var QuizEntry = compose(connect(mapStateToProps, dispatchToProps), makeEditable, DropTargetCreator(QUIZ_ENTRY_REF))(QuizEntryPresenter);
71
+ export var QuizEntry = compose(connect(mapStateToProps, dispatchToProps), makeEditable, DropTargetCreator(QUIZ_ENTRY_REF))(quizEntryPresenterWrapper(QuizEntryPresenter));
71
72
  export default QuizEntry;
@@ -7,13 +7,14 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
7
 
8
8
  var _dec, _class, _class2, _temp;
9
9
 
10
- import React, { Component } from 'react';
10
+ /** @jsx jsx */
11
+ import { Component } from 'react';
11
12
  import PropTypes from 'prop-types';
12
13
  import { List } from 'immutable';
13
14
  import ImmutablePropTypes from 'react-immutable-proptypes';
14
15
  import pick from 'lodash/pick';
15
16
  import partial from 'lodash/partial';
16
- import { themeable } from '@instructure/ui-themeable';
17
+ import { withStyle, jsx } from '@instructure/emotion';
17
18
  import t from '@instructure/quiz-i18n/es/format-message';
18
19
  import WarningWrapper from "../../../../../common/components/resources/WarningWrapper/index.js";
19
20
  import { propsForItemBankEntryEditPrompt, propsForStimulusBankEntryEditPrompt, propsForBankEntryUnauthorizedEdit, propsForItemVersioningWrapper, propsForBankEntryVersioningWrapper } from "../../../../../common/util/warningHelpers.js";
@@ -30,17 +31,9 @@ import { BUILD_TRAY_OPEN, PARENT_TYPE_QUIZ, REGRADE_MODAL, SHOULD_CLONE_ITEM } f
30
31
  import QuizEntryShow from "../QuizEntryShow/index.js";
31
32
  import QuizEntryEdit from "../QuizEntryEdit/index.js";
32
33
  import Stimulus from "../../../../../common/components/resources/stimulus/Stimulus/index.js";
33
- var styles = {
34
- componentId: 'erzHq',
35
- template: function template(theme) {
36
- return "\n\n.erzHq_cjWK{border-top:".concat(theme.footerBorderWidth || 'inherit', " solid ").concat(theme.footerBorderColor || 'inherit', ";font-size:").concat(theme.footerFontSize || 'inherit', ";overflow:auto;padding:").concat(theme.footerPadding || 'inherit', "}\n\n.erzHq_fpkp{display:none}\n\n@media print{.erzHq_fpkp{display:inherit}.erzHq_dcyh{display:none}}");
37
- },
38
- 'footer': 'erzHq_cjWK',
39
- 'sampleItems': 'erzHq_fpkp',
40
- 'bankItem': 'erzHq_dcyh'
41
- };
42
- import theme from "./theme.js";
43
- export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
34
+ import generateStyle from "./styles.js";
35
+ import generateComponentTheme from "./theme.js";
36
+ export var QuizEntry = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
44
37
  _inherits(QuizEntry, _Component);
45
38
 
46
39
  var _super = _createSuper(QuizEntry);
@@ -67,7 +60,7 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
67
60
  };
68
61
 
69
62
  _this.renderItemBankingOptions = function () {
70
- return /*#__PURE__*/React.createElement(AddToBankOptions, {
63
+ return jsx(AddToBankOptions, {
71
64
  displayPosition: _this.props.displayPosition,
72
65
  entryType: _this.props.quizEntry.entryType,
73
66
  guid: _this.props.guid,
@@ -99,10 +92,10 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
99
92
  interactionTypeName: entryMutable.interactionType.name
100
93
  });
101
94
 
102
- return /*#__PURE__*/React.createElement("div", {
95
+ return jsx("div", {
103
96
  key: index,
104
- className: styles.sampleItems
105
- }, /*#__PURE__*/React.createElement(QuizEntryShow, overrideProps, /*#__PURE__*/React.createElement(ItemShow, _this.propsForItem(item))));
97
+ css: _this.props.styles.sampleItems
98
+ }, jsx(QuizEntryShow, overrideProps, jsx(ItemShow, _this.propsForItem(item))));
106
99
  };
107
100
 
108
101
  _this.bankEntryWarningWrapperProps = function () {
@@ -196,7 +189,7 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
196
189
  var quizEntryProps = this.quizEntryProps();
197
190
  var propsForWrapperFunc = quizEntry.isArchivedBankEntry ? propsForBankEntryVersioningWrapper : propsForItemVersioningWrapper;
198
191
  var propsForItemVersioning = propsForWrapperFunc(entry.isImmutable() || quizEntry.isArchivedBankEntry, shouldClone, partial(this.props.setUi, SHOULD_CLONE_ITEM), this.props.switchOffEditing, isEditing, quizEntry.isArchivedBankEntry ? 'info' : 'warning');
199
- return /*#__PURE__*/React.createElement(QuizEntryComponent, quizEntryProps, /*#__PURE__*/React.createElement(WarningWrapper, propsForItemVersioning, /*#__PURE__*/React.createElement(ItemComponent, itemProps)));
192
+ return jsx(QuizEntryComponent, quizEntryProps, jsx(WarningWrapper, propsForItemVersioning, jsx(ItemComponent, itemProps)));
200
193
  }
201
194
  }, {
202
195
  key: "renderBank",
@@ -210,9 +203,9 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
210
203
  name: bank.title
211
204
  };
212
205
  var sampleItems = this.props.quizEntry.sampleItems;
213
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
214
- className: styles.bankItem
215
- }, /*#__PURE__*/React.createElement(QuizEntryComponent, Object.assign({}, this.props, bankProps), /*#__PURE__*/React.createElement(QuizEntryBankComponent, Object.assign({}, this.props, bankProps)))), sampleItems.map(this.renderPrintableItemBankSample));
206
+ return jsx("div", null, jsx("div", {
207
+ css: this.props.styles.bankItem
208
+ }, jsx(QuizEntryComponent, Object.assign({}, this.props, bankProps), jsx(QuizEntryBankComponent, Object.assign({}, this.props, bankProps)))), sampleItems.map(this.renderPrintableItemBankSample));
216
209
  }
217
210
  }, {
218
211
  key: "isOverridable",
@@ -243,9 +236,9 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
243
236
  var itemProps = this.propsForItem();
244
237
  var mergedItem = this.isEditing() ? this.props.workingQuizEntry.getItem() : itemProps.entry;
245
238
  var ItemComponent = this.isOverriding() ? ItemOverride : ItemShow;
246
- return /*#__PURE__*/React.createElement(QuizEntryComponent, quizEntryProps, /*#__PURE__*/React.createElement(WarningWrapper, Object.assign({}, bankEntryWarningWrapperProps, {
239
+ return jsx(QuizEntryComponent, quizEntryProps, jsx(WarningWrapper, Object.assign({}, bankEntryWarningWrapperProps, {
247
240
  disableChildren: this.isEditing() && !this.isOverridable()
248
- }), /*#__PURE__*/React.createElement(ItemComponent, Object.assign({}, itemProps, {
241
+ }), jsx(ItemComponent, Object.assign({}, itemProps, {
249
242
  entry: mergedItem,
250
243
  quizEntry: this.props.quizEntry
251
244
  }))), this.renderFooter());
@@ -253,7 +246,7 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
253
246
  }, {
254
247
  key: "renderStimulus",
255
248
  value: function renderStimulus(bankEntryWarningWrapperProps) {
256
- return /*#__PURE__*/React.createElement(Stimulus, {
249
+ return jsx(Stimulus, {
257
250
  bankEntryWarningWrapperProps: bankEntryWarningWrapperProps,
258
251
  childEntries: this.props.childEntries,
259
252
  displayPosition: this.props.displayPosition,
@@ -281,7 +274,7 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
281
274
  }, {
282
275
  key: "renderTags",
283
276
  value: function renderTags() {
284
- return /*#__PURE__*/React.createElement(TagDisplay, {
277
+ return jsx(TagDisplay, {
285
278
  tagAssociations: this.props.tagAssociations
286
279
  });
287
280
  }
@@ -297,8 +290,8 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
297
290
  return null;
298
291
  }
299
292
 
300
- return /*#__PURE__*/React.createElement("div", {
301
- className: styles.footer
293
+ return jsx("div", {
294
+ css: this.props.styles.footer
302
295
  }, this.renderTags());
303
296
  }
304
297
  }, {
@@ -327,7 +320,7 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
327
320
  }, {
328
321
  key: "render",
329
322
  value: function render() {
330
- return this.props.connectDropTarget( /*#__PURE__*/React.createElement("div", {
323
+ return this.props.connectDropTarget(jsx("div", {
331
324
  tabIndex: "-1"
332
325
  }, this.renderQuizEntryByType()));
333
326
  }
@@ -378,7 +371,8 @@ export var QuizEntry = (_dec = themeable(theme, styles), _dec(_class = (_temp =
378
371
  type: PropTypes.string,
379
372
  text: PropTypes.string
380
373
  }))),
381
- stimulusOrientation: PropTypes.string
374
+ stimulusOrientation: PropTypes.string,
375
+ styles: PropTypes.object
382
376
  }, _class2.defaultProps = {
383
377
  childEntries: List(),
384
378
  draggingAboveHalf: false,
@@ -0,0 +1,39 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React from 'react';
6
+
7
+ var isClassComponent = function isClassComponent(Component) {
8
+ return !!(typeof Component === 'function' && Component.prototype && Component.prototype.isReactComponent);
9
+ };
10
+
11
+ var quizEntryPresenterWrapper = function quizEntryPresenterWrapper(Component) {
12
+ if (isClassComponent(Component)) {
13
+ return Component;
14
+ }
15
+
16
+ return /*#__PURE__*/function (_React$Component) {
17
+ _inherits(ClassComponentWrapper, _React$Component);
18
+
19
+ var _super = _createSuper(ClassComponentWrapper);
20
+
21
+ function ClassComponentWrapper() {
22
+ _classCallCheck(this, ClassComponentWrapper);
23
+
24
+ return _super.apply(this, arguments);
25
+ }
26
+
27
+ _createClass(ClassComponentWrapper, [{
28
+ key: "render",
29
+ value: function render() {
30
+ return /*#__PURE__*/React.createElement(Component, this.props);
31
+ }
32
+ }]);
33
+
34
+ ClassComponentWrapper.displayName = "ClassComponentWrapper";
35
+ return ClassComponentWrapper;
36
+ }(React.Component);
37
+ };
38
+
39
+ export default quizEntryPresenterWrapper;
@@ -0,0 +1,23 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+
3
+ var generateStyle = function generateStyle(componentTheme) {
4
+ var mp = '@media print';
5
+ return {
6
+ footer: {
7
+ overflow: 'auto',
8
+ padding: componentTheme.footerPadding,
9
+ borderTop: "".concat(componentTheme.footerBorderWidth, " solid ").concat(componentTheme.footerBorderColor),
10
+ fontSize: componentTheme.footerFontSize
11
+ },
12
+ sampleItems: _defineProperty({
13
+ display: 'none'
14
+ }, mp, {
15
+ display: 'inherit'
16
+ }),
17
+ bankItem: _defineProperty({}, mp, {
18
+ display: 'none'
19
+ })
20
+ };
21
+ };
22
+
23
+ export default generateStyle;
@@ -1,4 +1,4 @@
1
- export default function generator(_ref) {
1
+ var generateComponentTheme = function generateComponentTheme(_ref) {
2
2
  var spacing = _ref.spacing,
3
3
  colors = _ref.colors,
4
4
  borders = _ref.borders,
@@ -9,4 +9,6 @@ export default function generator(_ref) {
9
9
  footerBorderColor: colors.tiara,
10
10
  footerFontSize: typography.fontSizeXSmall
11
11
  };
12
- }
12
+ };
13
+
14
+ 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,37 +5,24 @@ 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 { DragSource } from 'react-dnd';
12
12
  import { List, Map } from 'immutable';
13
- import classnames from 'classnames';
14
13
  import ImmutablePropTypes from 'react-immutable-proptypes';
15
- import { themeable } from '@instructure/ui-themeable';
14
+ import { withStyle, jsx } from '@instructure/emotion';
16
15
  import AddContentPopover from "../../quiz/AddContent/Popover/index.js";
17
16
  import StimulusEdit from "../StimulusEdit/index.js";
18
17
  import StimulusShow from "../StimulusShow/index.js";
19
18
  import DragAndDropZone from "../../../shared/drag_and_drop/DragAndDropZone/index.js";
20
19
  import { ItemTypes, dragSource, collectDrag } from "../../../../../common/components/shared/drag_and_drop/dragAndDropUtils.js";
21
- import wrapWithOutsideClick from "../../../shared/functionality/componentWithOutsideClick.js";
22
- import { DELETE_STIMULUS_DATA, LEFT } from '@instructure/quiz-common';
20
+ import wrapWithOutsideClickEmotion from "../../../shared/functionality/componentWithOutsideClickEmotion.js";
21
+ import { DELETE_STIMULUS_DATA } from '@instructure/quiz-common';
23
22
  import ConnectedQuizEntry from "../../../../../building/components/resources/quizEntry/QuizEntry/index.js";
24
- var styles = {
25
- componentId: 'fEUId',
26
- template: function template(theme) {
27
- return "\n\n.fEUId_dRGY{display:flex}\n\n.fEUId_cZDz{border-right:".concat(theme.leftPanelBorderWidth || 'inherit', " solid ").concat(theme.leftPanelBorderColor || 'inherit', "}\n\n.fEUId_cZDz,.fEUId_AmHx{box-sizing:border-box;max-height:105vh;overflow:auto}\n\n.fEUId_AmHx{margin-left:calc(").concat(theme.rightPanelPadding || 'inherit', "*-1);padding-left:").concat(theme.rightPanelPadding || 'inherit', "}\n\n.fEUId_duqv{display:none}\n\n.fEUId_ehcZ{transform:translateZ(0)}\n\n.fEUId_fPOQ{background-color:transparent;border:none;color:inherit;cursor:move;font-size:").concat(theme.dragAndDropHandleFontSize || 'inherit', ";height:0;margin:").concat(theme.dragAndDropHandleMargin || 'inherit', ";margin-top:0;position:relative;z-index:").concat(theme.dragAndDropHandleZIndex || 'inherit', "}\n\n.fEUId_eLmg{width:100%}\n\n.fEUId_dORw{width:50%}\n\n@media print{.fEUId_cZDz,.fEUId_AmHx{max-height:none}}");
28
- },
29
- 'stimulus': 'fEUId_dRGY',
30
- 'leftPanel': 'fEUId_cZDz',
31
- 'rightPanel': 'fEUId_AmHx',
32
- 'hidden': 'fEUId_duqv',
33
- 'stimulusWrapper': 'fEUId_ehcZ',
34
- 'dragAndDropHandle': 'fEUId_fPOQ',
35
- 'quizEntryWrapper': 'fEUId_eLmg',
36
- 'horizontallyAligned': 'fEUId_dORw'
37
- };
38
- import theme from "./theme.js";
39
- export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
23
+ import generateStyle from "./styles.js";
24
+ import generateComponentTheme from "./theme.js";
25
+ export var Stimulus = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
40
26
  _inherits(Stimulus, _Component);
41
27
 
42
28
  var _super = _createSuper(Stimulus);
@@ -68,6 +54,16 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
68
54
  }
69
55
 
70
56
  _createClass(Stimulus, [{
57
+ key: "componentDidMount",
58
+ value: function componentDidMount() {
59
+ this.props.makeStyles();
60
+ }
61
+ }, {
62
+ key: "componentDidUpdate",
63
+ value: function componentDidUpdate() {
64
+ this.props.makeStyles();
65
+ }
66
+ }, {
71
67
  key: "shouldDisableDragHandle",
72
68
  value: function shouldDisableDragHandle() {
73
69
  var _this$props = this.props,
@@ -92,12 +88,12 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
92
88
  return this.props.childEntries.toArray().map(function (childEntry, idx) {
93
89
  var displayPosition = nextDisplayPosition;
94
90
  nextDisplayPosition += childEntry.displayPositionSlots;
95
- return /*#__PURE__*/React.createElement("div", {
96
- className: styles.quizEntryWrapper,
91
+ return jsx("div", {
92
+ css: _this2.props.styles.quizEntryWrapper,
97
93
  key: childEntry.id
98
- }, /*#__PURE__*/React.createElement(ConnectedQuizEntry, Object.assign({}, _this2.props.propsForQuizEntry(childEntry, displayPosition), {
94
+ }, jsx(ConnectedQuizEntry, Object.assign({}, _this2.props.propsForQuizEntry(childEntry, displayPosition), {
99
95
  stimulusOrientation: _this2.props.stimulusOrientationEnabled ? _this2.props.stimulus.orientation : null
100
- })), !_this2.props.draggingOnBuild && !_this2.isQuizContentLocked() && /*#__PURE__*/React.createElement(AddContentPopover, {
96
+ })), !_this2.props.draggingOnBuild && !_this2.isQuizContentLocked() && jsx(AddContentPopover, {
101
97
  allowStimulusCreation: false,
102
98
  stimulusId: _this2.props.stimulus.id,
103
99
  parentEntryId: _this2.props.quizEntry.id,
@@ -112,9 +108,9 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
112
108
  value: function renderStimulusPanel() {
113
109
  var StimulusComponent = this.props.isEditing ? StimulusEdit : StimulusShow;
114
110
  var connectDragPreview = this.props.connectDragPreview;
115
- return connectDragPreview( /*#__PURE__*/React.createElement("div", {
111
+ return connectDragPreview(jsx("div", {
116
112
  "data-automation": "sdk-stimulus-LeftPanelShow"
117
- }, /*#__PURE__*/React.createElement(StimulusComponent, {
113
+ }, jsx(StimulusComponent, {
118
114
  bankEntryWarningWrapperProps: this.props.bankEntryWarningWrapperProps,
119
115
  connectDragSource: this.props.connectDragSource,
120
116
  displayPosition: this.props.displayPosition,
@@ -138,25 +134,17 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
138
134
  }, {
139
135
  key: "renderPanels",
140
136
  value: function renderPanels(propsForDnDZone) {
141
- var _classnames2;
142
-
143
- var _this$props3 = this.props,
144
- stimulus = _this$props3.stimulus,
145
- stimulusOrientationEnabled = _this$props3.stimulusOrientationEnabled;
146
- var shouldSetHorizontalOrientation = stimulus.orientation === LEFT || !stimulusOrientationEnabled;
147
- var stimulusPanelClass = classnames(styles.leftPanel, _defineProperty({}, styles.horizontallyAligned, shouldSetHorizontalOrientation));
148
- var itemsPanelClass = classnames((_classnames2 = {}, _defineProperty(_classnames2, styles.horizontallyAligned, shouldSetHorizontalOrientation), _defineProperty(_classnames2, styles.hidden, stimulus.isTemporary()), _defineProperty(_classnames2, styles.rightPanel, !stimulus.isTemporary()), _classnames2));
149
- return /*#__PURE__*/React.createElement("div", {
150
- className: classnames(_defineProperty({}, styles.stimulus, shouldSetHorizontalOrientation)),
137
+ return jsx("div", {
138
+ css: this.props.styles.stimulus,
151
139
  ref: this.props.dndRef,
152
140
  "data-automation": "sdk-stimulus"
153
- }, /*#__PURE__*/React.createElement("div", {
154
- className: stimulusPanelClass
155
- }, this.renderStimulusPanel()), /*#__PURE__*/React.createElement("div", {
156
- className: itemsPanelClass
157
- }, /*#__PURE__*/React.createElement("div", null), this.renderChildQuizEntries(), /*#__PURE__*/React.createElement(DragAndDropZone, Object.assign({}, propsForDnDZone, {
141
+ }, jsx("div", {
142
+ css: this.props.styles.leftPanel
143
+ }, this.renderStimulusPanel()), jsx("div", {
144
+ css: this.props.styles.itemPanel
145
+ }, jsx("div", null), this.renderChildQuizEntries(), jsx(DragAndDropZone, Object.assign({}, propsForDnDZone, {
158
146
  location: "in"
159
- })), this.props.childEntries.size === 0 && !this.isQuizContentLocked() && /*#__PURE__*/React.createElement(AddContentPopover, {
147
+ })), this.props.childEntries.size === 0 && !this.isQuizContentLocked() && jsx(AddContentPopover, {
160
148
  allowStimulusCreation: false,
161
149
  stimulusId: this.props.stimulus.id,
162
150
  parentEntryId: this.props.quizEntry.id,
@@ -174,13 +162,13 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
174
162
  draggingAboveHalf: this.props.draggingAboveHalf,
175
163
  dropIntoEmptyStimulus: this.props.dropIntoEmptyStimulus
176
164
  };
177
- return /*#__PURE__*/React.createElement("div", {
165
+ return jsx("div", {
178
166
  tabIndex: "-1"
179
- }, /*#__PURE__*/React.createElement(DragAndDropZone, Object.assign({}, propsForDnDZone, {
167
+ }, jsx("div", null, jsx(DragAndDropZone, Object.assign({}, propsForDnDZone, {
180
168
  location: "above"
181
- })), this.renderPanels(propsForDnDZone), /*#__PURE__*/React.createElement(DragAndDropZone, Object.assign({}, propsForDnDZone, {
169
+ })), this.renderPanels(propsForDnDZone), jsx(DragAndDropZone, Object.assign({}, propsForDnDZone, {
182
170
  location: "below"
183
- })));
171
+ }))));
184
172
  }
185
173
  }]);
186
174
 
@@ -215,7 +203,9 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
215
203
  switchOffEditing: PropTypes.func.isRequired,
216
204
  onEditStimulusToggle: PropTypes.func.isRequired,
217
205
  editStimulusToggle: PropTypes.bool.isRequired,
218
- stimulusOrientationEnabled: PropTypes.bool.isRequired
206
+ stimulusOrientationEnabled: PropTypes.bool.isRequired,
207
+ makeStyles: PropTypes.func,
208
+ styles: PropTypes.object
219
209
  }, _class2.defaultProps = {
220
210
  bankEntryWarningWrapperProps: function bankEntryWarningWrapperProps() {},
221
211
  childEntries: List([]),
@@ -231,4 +221,4 @@ export var Stimulus = (_dec = themeable(theme, styles), _dec(_class = (_temp = _
231
221
  scrollKey: '',
232
222
  isContentLockedByBlueprint: false
233
223
  }, _temp)) || _class);
234
- export default DragSource(ItemTypes.QUIZ_ENTRY, dragSource, collectDrag)(wrapWithOutsideClick(Stimulus));
224
+ export default DragSource(ItemTypes.QUIZ_ENTRY, dragSource, collectDrag)(wrapWithOutsideClickEmotion(Stimulus));
@@ -0,0 +1,58 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import { LEFT } from '@instructure/quiz-common';
4
+
5
+ var generateStyle = function generateStyle(componentTheme, props) {
6
+ var mp = '@media print';
7
+ var shouldSetHorizontalOrientation = props.stimulus.orientation === LEFT || !props.stimulusOrientationEnabled;
8
+ return {
9
+ stimulus: _objectSpread({}, shouldSetHorizontalOrientation && {
10
+ display: 'flex'
11
+ }),
12
+ leftPanel: _objectSpread(_objectSpread({
13
+ boxSizing: 'border-box',
14
+ maxHeight: '105vh',
15
+ overflow: 'auto',
16
+ borderRight: "".concat(componentTheme.leftPanelBorderWidth, " solid ").concat(componentTheme.leftPanelBorderColor)
17
+ }, shouldSetHorizontalOrientation && {
18
+ width: '50%'
19
+ }), {}, _defineProperty({}, mp, {
20
+ maxHeight: 'none'
21
+ })),
22
+ itemPanel: _objectSpread(_objectSpread(_objectSpread({}, shouldSetHorizontalOrientation && {
23
+ width: '50%'
24
+ }), props.stimulus.isTemporary() && {
25
+ display: 'none'
26
+ }), !props.stimulus.isTemporary() && _defineProperty({
27
+ boxSizing: 'border-box',
28
+ maxHeight: '105vh',
29
+ overflow: 'auto',
30
+ paddingLeft: componentTheme.rightPanelPadding,
31
+ marginLeft: "calc(".concat(componentTheme.rightPanelPadding, " * -1)")
32
+ }, mp, {
33
+ maxHeight: 'none'
34
+ })),
35
+ stimulusWrapper: {
36
+ transform: 'translate3d(0, 0, 0)'
37
+ /* for drag and drop preview to work */
38
+
39
+ },
40
+ dragAndDropHandle: {
41
+ cursor: 'move',
42
+ height: '0',
43
+ zIndex: componentTheme.dragAndDropHandleZIndex,
44
+ backgroundColor: 'transparent',
45
+ border: 'none',
46
+ color: 'inherit',
47
+ fontSize: componentTheme.dragAndDropHandleFontSize,
48
+ margin: componentTheme.dragAndDropHandleMargin,
49
+ marginTop: '0',
50
+ position: 'relative'
51
+ },
52
+ quizEntryWrapper: {
53
+ width: '100%'
54
+ }
55
+ };
56
+ };
57
+
58
+ 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,
@@ -12,4 +12,6 @@ export default function generator(_ref) {
12
12
  dragAndDropHandleFontSize: typography.fontSizeMedium,
13
13
  dragAndDropHandleMargin: spacing.xSmall
14
14
  };
15
- }
15
+ };
16
+
17
+ export default generateComponentTheme;
@@ -7,14 +7,15 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
7
7
 
8
8
  var _dec, _class, _class2, _temp;
9
9
 
10
- import React, { Component } from 'react';
10
+ /** @jsx jsx */
11
+ import { Component } from 'react';
11
12
  import PropTypes from 'prop-types';
12
13
  import ImmutablePropTypes from 'react-immutable-proptypes';
13
14
  import first from 'lodash/first';
14
15
  import partial from 'lodash/partial';
15
16
  import { Button } from '@instructure/ui-buttons';
16
17
  import { ToggleDetails } from '@instructure/ui-toggle-details';
17
- import { themeable } from '@instructure/ui-themeable';
18
+ import { withStyle, jsx } from '@instructure/emotion';
18
19
  import { FILE_UPLOAD_SUCCESS, SHOULD_CLONE_ITEM, DELETED_QUIZ_ENTRY } from '@instructure/quiz-common';
19
20
  import { propsForStimulusVersioningWrapper, propsForBankEntryVersioningWrapper } from "../../../../util/warningHelpers.js";
20
21
  import AddToBankModal from "../../../../../banks/components/AddToBankModal/index.js";
@@ -24,25 +25,12 @@ import CustomPropTypes from "../../../../../common/util/CustomPropTypes.js";
24
25
  import elementsForSelectors from "../../../../../common/util/ElementsForSelectors.js";
25
26
  import StimulusShowInfo from "../StimulusShowInfo/index.js";
26
27
  import StimulusEditInfo from "../StimulusEditInfo/index.js";
27
- import wrapWithOutsideClick from "../../../shared/functionality/componentWithOutsideClick.js";
28
+ import wrapWithOutsideClickEmotion from "../../../shared/functionality/componentWithOutsideClickEmotion.js";
28
29
  import ActionButtons from "../../../../../building/components/resources/ActionButtons/index.js";
29
- var styles = {
30
- componentId: 'eCUGW',
31
- template: function template(theme) {
32
- return "\n\n.eCUGW_dRGY{padding-bottom:".concat(theme.stimulusPadding || 'inherit', ";padding-top:").concat(theme.stimulusPadding || 'inherit', "}\n\n.eCUGW_cjWK{display:flex;justify-content:flex-end}\n\n.eCUGW_nqth{padding-left:").concat(theme.buttonWrapperPadding || 'inherit', "}\n\n.eCUGW_fsuY{align-items:center;display:flex;height:1rem;justify-content:space-between;padding-left:").concat(theme.headerPadding || 'inherit', ";padding-right:").concat(theme.headerPadding || 'inherit', "}\n\n.eCUGW_dMwa{height:100%;padding:").concat(theme.stimulusContentPadding || 'inherit', "}\n\n.eCUGW_ffXB{color:").concat(theme.stimulusLabelColor || 'inherit', ";font-size:").concat(theme.stimulusLabelFontSize || 'inherit', "}\n\n.eCUGW_fjJt{color:").concat(theme.stimulusButtonsColor || 'inherit', ";display:inline-flex;flex:0 0 auto;text-align:right;z-index:").concat(theme.stimulusButtonsZIndex || 'inherit', "}\n\n[dir=ltr] .eCUGW_fjJt,[dir=rtl] .eCUGW_fjJt{text-align:right}\n\n.eCUGW_fjJt button{background-color:transparent;background-color:initial}\n\n.eCUGW_fBJf{padding-top:").concat(theme.optionPadding || 'inherit', "}");
33
- },
34
- 'stimulus': 'eCUGW_dRGY',
35
- 'footer': 'eCUGW_cjWK',
36
- 'buttonWrapper': 'eCUGW_nqth',
37
- 'header': 'eCUGW_fsuY',
38
- 'stimulusContent': 'eCUGW_dMwa',
39
- 'stimulusLabel': 'eCUGW_ffXB',
40
- 'stimulusButtons': 'eCUGW_fjJt',
41
- 'optionWrapper': 'eCUGW_fBJf'
42
- };
43
- import theme from "./theme.js";
30
+ import generateStyle from "./styles.js";
31
+ import generateComponentTheme from "./theme.js";
44
32
  import t from '@instructure/quiz-i18n/es/format-message';
45
- export var StimulusEdit = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
33
+ export var StimulusEdit = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
46
34
  _inherits(StimulusEdit, _Component);
47
35
 
48
36
  var _super = _createSuper(StimulusEdit);
@@ -371,7 +359,7 @@ export var StimulusEdit = (_dec = themeable(theme, styles), _dec(_class = (_temp
371
359
  }, {
372
360
  key: "renderAddToBankModal",
373
361
  value: function renderAddToBankModal() {
374
- return /*#__PURE__*/React.createElement(AddToBankModal, {
362
+ return jsx(AddToBankModal, {
375
363
  label: t('Add to an Item Bank'),
376
364
  onAdd: this.handleAddToBank,
377
365
  onContinue: this.handleAddToBankContinue,
@@ -384,13 +372,13 @@ export var StimulusEdit = (_dec = themeable(theme, styles), _dec(_class = (_temp
384
372
  }, {
385
373
  key: "renderAddToBankOptions",
386
374
  value: function renderAddToBankOptions() {
387
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ToggleDetails, {
375
+ return jsx("div", null, jsx(ToggleDetails, {
388
376
  variant: "filled",
389
377
  key: "itemBanking",
390
378
  summary: t('Item Banking')
391
- }, /*#__PURE__*/React.createElement("div", {
392
- className: styles.optionWrapper
393
- }, /*#__PURE__*/React.createElement(AddToBankOptions, {
379
+ }, jsx("div", {
380
+ css: this.props.styles.optionWrapper
381
+ }, jsx(AddToBankOptions, {
394
382
  displayPosition: this.props.displayPosition,
395
383
  entryType: this.props.quizEntry.entryType,
396
384
  guid: this.props.guid,
@@ -403,13 +391,13 @@ export var StimulusEdit = (_dec = themeable(theme, styles), _dec(_class = (_temp
403
391
  }, {
404
392
  key: "renderStimulusEdit",
405
393
  value: function renderStimulusEdit() {
406
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
407
- className: styles.stimulus
408
- }, /*#__PURE__*/React.createElement("div", {
409
- className: styles.header
410
- }, /*#__PURE__*/React.createElement("div", {
411
- className: styles.stimulusLabel
412
- }, t('Stimulus')), /*#__PURE__*/React.createElement(ActionButtons, {
394
+ return jsx("div", null, jsx("div", {
395
+ css: this.props.styles.stimulus
396
+ }, jsx("div", {
397
+ css: this.props.styles.header
398
+ }, jsx("div", {
399
+ css: this.props.styles.stimulusLabel
400
+ }, t('Stimulus')), jsx(ActionButtons, {
413
401
  connectDragSource: this.props.connectDragSource,
414
402
  displayPosition: this.props.displayPosition,
415
403
  onDelete: this.handleDeleteStimulus,
@@ -418,25 +406,27 @@ export var StimulusEdit = (_dec = themeable(theme, styles), _dec(_class = (_temp
418
406
  shouldDisableDragHandle: true,
419
407
  shouldRenderEdit: false,
420
408
  shouldFocusOnMount: this.props.shouldFocusOnMount
421
- })), /*#__PURE__*/React.createElement("div", {
422
- className: styles.stimulusContent
423
- }, /*#__PURE__*/React.createElement(StimulusEditInfo, {
409
+ })), jsx("div", {
410
+ css: this.props.styles.stimulusContent
411
+ }, jsx(StimulusEditInfo, {
424
412
  errorsShowing: this.props.errorsShowing,
425
413
  guid: this.props.guid,
426
414
  stimulus: this.props.stimulus,
427
415
  isBankedContent: this.props.isBankedContent,
428
416
  setTitleRef: this.setTitleRef
429
- }), this.renderAddToBankOptions())), /*#__PURE__*/React.createElement("div", {
430
- className: styles.footer
431
- }, /*#__PURE__*/React.createElement("div", {
432
- className: styles.buttonWrapper
433
- }, /*#__PURE__*/React.createElement(Button, {
417
+ }), this.renderAddToBankOptions())), jsx("div", {
418
+ className: "footer",
419
+ css: this.props.styles.footer
420
+ }, jsx("div", {
421
+ css: this.props.styles.buttonWrapper
422
+ }, jsx(Button, {
434
423
  type: "button",
435
424
  onClick: this.onCancel,
436
425
  "data-automation": "sdk-stimulus-discardButton"
437
- }, t('Cancel'))), /*#__PURE__*/React.createElement("div", {
438
- className: styles.buttonWrapper
439
- }, /*#__PURE__*/React.createElement(Button, {
426
+ }, t('Cancel'))), jsx("div", {
427
+ className: "submitButtonWrapper",
428
+ css: this.props.styles.buttonWrapper
429
+ }, jsx(Button, {
440
430
  type: "button",
441
431
  color: "primary",
442
432
  disabled: !this.state.canSubmit,
@@ -449,7 +439,7 @@ export var StimulusEdit = (_dec = themeable(theme, styles), _dec(_class = (_temp
449
439
  this.stimulusEditInfoRef = null;
450
440
 
451
441
  if (this.props.isBankedContent) {
452
- return /*#__PURE__*/React.createElement(WarningWrapper, this.props.bankEntryWarningWrapperProps(), /*#__PURE__*/React.createElement(StimulusShowInfo, this.props));
442
+ return jsx(WarningWrapper, this.props.bankEntryWarningWrapperProps(), jsx(StimulusShowInfo, this.props));
453
443
  }
454
444
 
455
445
  var _this$props4 = this.props,
@@ -459,7 +449,7 @@ export var StimulusEdit = (_dec = themeable(theme, styles), _dec(_class = (_temp
459
449
  var propForWrapperFunc = quizEntry.isArchivedBankEntry ? propsForBankEntryVersioningWrapper : propsForStimulusVersioningWrapper;
460
450
  var propsForStimulusVersioning = propForWrapperFunc(needsWarning, this.props.shouldClone, partial(this.props.setUi, SHOULD_CLONE_ITEM), this.props.switchOffEditing, true, quizEntry.isArchivedBankEntry ? 'info' : 'warning');
461
451
  var hasWarningWrapper = needsWarning && !this.props.shouldClone;
462
- return /*#__PURE__*/React.createElement(WarningWrapper, propsForStimulusVersioning, hasWarningWrapper ? /*#__PURE__*/React.createElement(StimulusShowInfo, this.props) : this.renderStimulusEdit());
452
+ return jsx(WarningWrapper, propsForStimulusVersioning, hasWarningWrapper ? jsx(StimulusShowInfo, this.props) : this.renderStimulusEdit());
463
453
  }
464
454
  }]);
465
455
 
@@ -504,11 +494,12 @@ export var StimulusEdit = (_dec = themeable(theme, styles), _dec(_class = (_temp
504
494
  workingQuizEntry: ImmutablePropTypes.record.isRequired,
505
495
  workingStimulus: ImmutablePropTypes.record.isRequired,
506
496
  onEditToggle: PropTypes.func.isRequired,
507
- shouldFocusOnMount: PropTypes.bool.isRequired
497
+ shouldFocusOnMount: PropTypes.bool.isRequired,
498
+ styles: PropTypes.object
508
499
  }, _class2.defaultProps = {
509
500
  bankEntryWarningWrapperProps: function bankEntryWarningWrapperProps() {},
510
501
  errorsShowing: false,
511
502
  isBankedContent: false,
512
503
  nextQuizEntry: null
513
504
  }, _temp)) || _class);
514
- export default wrapWithOutsideClick(StimulusEdit);
505
+ export default wrapWithOutsideClickEmotion(StimulusEdit);