@instructure/quiz-core 20.10.1-rc.0 → 20.10.1-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 (27) hide show
  1. package/es/building/components/resources/quiz/instructions/Edit/presenter.js +17 -24
  2. package/es/building/components/resources/quiz/instructions/Edit/styles.js +21 -0
  3. package/es/building/components/resources/quiz/instructions/Instructions/presenter.js +21 -28
  4. package/es/building/components/resources/quiz/instructions/Instructions/styles.js +33 -0
  5. package/es/building/components/resources/quiz/instructions/Show/index.js +16 -21
  6. package/es/building/components/resources/quiz/instructions/Show/styles.js +22 -0
  7. package/es/building/components/resources/quiz/title/Show/index.js +15 -19
  8. package/es/building/components/resources/quiz/title/Show/styles.js +16 -0
  9. package/es/building/components/resources/quiz/title/Show/theme.js +4 -2
  10. package/es/building/components/resources/quiz/title/Title/presenter.js +33 -31
  11. package/es/building/components/resources/quiz/title/Title/styles.js +39 -0
  12. package/es/common/components/shared/functionality/componentWithOutsideClickEmotion.js +85 -0
  13. package/es/common/components/shared/overlayEmotion/index.js +1 -0
  14. package/lib/building/components/resources/quiz/instructions/Edit/presenter.js +17 -26
  15. package/lib/building/components/resources/quiz/instructions/Edit/styles.js +29 -0
  16. package/lib/building/components/resources/quiz/instructions/Instructions/presenter.js +20 -29
  17. package/lib/building/components/resources/quiz/instructions/Instructions/styles.js +43 -0
  18. package/lib/building/components/resources/quiz/instructions/Show/index.js +14 -21
  19. package/lib/building/components/resources/quiz/instructions/Show/styles.js +30 -0
  20. package/lib/building/components/resources/quiz/title/Show/index.js +14 -20
  21. package/lib/building/components/resources/quiz/title/Show/styles.js +24 -0
  22. package/lib/building/components/resources/quiz/title/Show/theme.js +6 -3
  23. package/lib/building/components/resources/quiz/title/Title/presenter.js +32 -32
  24. package/lib/building/components/resources/quiz/title/Title/styles.js +50 -0
  25. package/lib/common/components/shared/functionality/componentWithOutsideClickEmotion.js +102 -0
  26. package/lib/common/components/shared/overlayEmotion/index.js +1 -0
  27. package/package.json +9 -9
@@ -5,31 +5,25 @@ 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 { Button } from '@instructure/ui-buttons';
11
- import { themeable } from '@instructure/ui-themeable';
12
+ import { withStyle, jsx } from '@instructure/emotion';
12
13
  import t from '@instructure/quiz-i18n/es/format-message';
13
- import wrapWithOutsideClick from "../../../../../../common/components/shared/functionality/componentWithOutsideClick.js";
14
14
  import CustomPropTypes from "../../../../../../common/util/CustomPropTypes.js";
15
15
  import elementsForSelectors from "../../../../../../common/util/ElementsForSelectors.js";
16
16
  import { INSTRUCTIONS_EDIT_ID } from '@instructure/quiz-common';
17
17
  import { RichContentInput } from '@instructure/quiz-rce';
18
- var styles = {
19
- componentId: 'evnrd',
20
- template: function template(theme) {
21
- return "\n\n.evnrd_dCmx{box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;min-height:4rem;padding:".concat(theme.instructionsEditWrapperPadding || 'inherit', ";position:relative;width:100%}\n\n.evnrd_cjWK{display:flex;justify-content:flex-end;margin-top:").concat(theme.footerTopMargin || 'inherit', "}");
22
- },
23
- 'instructionsEditWrapper': 'evnrd_dCmx',
24
- 'footer': 'evnrd_cjWK'
25
- };
26
- import theme from "./theme.js"; // ===================================
18
+ import generateStyle from "./styles.js";
19
+ import generateComponentTheme from "./theme.js";
20
+ import wrapWithOutsideClickEmotion from "../../../../../../common/components/shared/functionality/componentWithOutsideClickEmotion.js"; // ===================================
27
21
  // once editing is toggled this div
28
22
  // is rendered & has actions that
29
23
  // allow for canceling
30
24
  // ===================================
31
25
 
32
- var QuizInstructionsEdit = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
26
+ var QuizInstructionsEdit = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
33
27
  _inherits(QuizInstructionsEdit, _Component);
34
28
 
35
29
  var _super = _createSuper(QuizInstructionsEdit);
@@ -58,22 +52,20 @@ var QuizInstructionsEdit = (_dec = themeable(theme, styles), _dec(_class = (_tem
58
52
  }, {
59
53
  key: "render",
60
54
  value: function render() {
61
- return /*#__PURE__*/React.createElement("div", {
62
- className: styles.instructionsEditWrapper
63
- }, /*#__PURE__*/React.createElement(RichContentInput, {
55
+ return jsx("div", {
56
+ css: this.props.styles.instructionsEditWrapper
57
+ }, jsx(RichContentInput, {
64
58
  label: "",
65
59
  textareaId: INSTRUCTIONS_EDIT_ID,
66
- wrapperClassName: styles.instructionsEdit,
67
- textareaClassName: styles.instructionsEditInput,
68
60
  defaultContent: this.props.inputValue,
69
61
  onKeyUp: this.props.onInputChange,
70
62
  onChange: this.props.onInputChange
71
- }), /*#__PURE__*/React.createElement("div", {
72
- className: styles.footer
73
- }, /*#__PURE__*/React.createElement(Button, {
63
+ }), jsx("div", {
64
+ css: this.props.styles.footer
65
+ }, jsx(Button, {
74
66
  margin: "0 x-small",
75
67
  onClick: this.props.endEditing
76
- }, t('Cancel')), /*#__PURE__*/React.createElement(Button, {
68
+ }, t('Cancel')), jsx(Button, {
77
69
  color: "primary",
78
70
  onClick: this.props.saveAndPreview,
79
71
  "data-automation": "instructions-done"
@@ -88,6 +80,7 @@ var QuizInstructionsEdit = (_dec = themeable(theme, styles), _dec(_class = (_tem
88
80
  inputValue: PropTypes.string.isRequired,
89
81
  onInputChange: PropTypes.func.isRequired,
90
82
  saveAndPreview: PropTypes.func.isRequired,
91
- appContainer: CustomPropTypes.selectors.isRequired
83
+ appContainer: CustomPropTypes.selectors.isRequired,
84
+ styles: PropTypes.object
92
85
  }, _temp)) || _class);
93
- export default wrapWithOutsideClick(QuizInstructionsEdit);
86
+ export default wrapWithOutsideClickEmotion(QuizInstructionsEdit);
@@ -0,0 +1,21 @@
1
+ var generateStyle = function generateStyle(componentTheme) {
2
+ return {
3
+ instructionsEditWrapper: {
4
+ position: 'relative',
5
+ width: '100%',
6
+ minHeight: '4rem',
7
+ boxSizing: 'border-box',
8
+ padding: componentTheme.instructionsEditWrapperPadding,
9
+ display: 'flex',
10
+ flexDirection: 'column',
11
+ justifyContent: 'center'
12
+ },
13
+ footer: {
14
+ marginTop: componentTheme.footerTopMargin,
15
+ display: 'flex',
16
+ justifyContent: 'flex-end'
17
+ }
18
+ };
19
+ };
20
+
21
+ export default generateStyle;
@@ -5,31 +5,23 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
 
6
6
  var _dec, _class, _class2, _temp;
7
7
 
8
- import React, { Component } from 'react';
8
+ /** @jsx jsx */
9
+ import { Component } from 'react';
9
10
  import PropTypes from 'prop-types';
10
11
  import ImmutablePropTypes from 'react-immutable-proptypes';
11
12
  import { Heading } from '@instructure/ui-heading';
12
- import { themeable } from '@instructure/ui-themeable';
13
+ import { withStyle, jsx } from '@instructure/emotion';
13
14
  import QuizInstructionsEdit from "../Edit/index.js";
14
15
  import QuizInstructionsShow from "../Show/index.js";
15
16
  import EditButton from "../../editButton/EditButton.js";
16
- var styles = {
17
- componentId: 'bIKna',
18
- template: function template(theme) {
19
- return "\n\n.bIKna_qYhL{display:flex;justify-content:space-between}\n\n.bIKna_DlrZ{display:flex;flex-direction:column;flex-grow:1;min-width:0}\n\n.bIKna_blJt{color:".concat(theme.labelColor || 'inherit', ";font-size:").concat(theme.labelFontSize || 'inherit', ";padding:").concat(theme.labelPadding || 'inherit', ";padding-bottom:").concat(theme.labelBottomPadding || 'inherit', ";padding-left:").concat(theme.labelLeftPadding || 'inherit', "}\n\n.bIKna_UraS{align-self:flex-end;margin-right:").concat(theme.editButtonWrapperRightMargin || 'inherit', ";padding-top:").concat(theme.labelPadding || 'inherit', "}\n\n@media print{.bIKna_qYhL{display:none}}");
20
- },
21
- 'topRow': 'bIKna_qYhL',
22
- 'flexContainer': 'bIKna_DlrZ',
23
- 'label': 'bIKna_blJt',
24
- 'editButtonWrapper': 'bIKna_UraS'
25
- };
26
- import theme from "./theme.js";
17
+ import generateStyle from "./styles.js";
18
+ import generateComponentTheme from "./theme.js";
27
19
  import t from '@instructure/quiz-i18n/es/format-message'; // ======================================
28
20
  // renders the editable quiz instructions
29
21
  // input/display component
30
22
  // ======================================
31
23
 
32
- export var QuizInstructions = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
24
+ export var QuizInstructions = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
33
25
  _inherits(QuizInstructions, _Component);
34
26
 
35
27
  var _super = _createSuper(QuizInstructions);
@@ -144,7 +136,7 @@ export var QuizInstructions = (_dec = themeable(theme, styles), _dec(_class = (_
144
136
  return;
145
137
  }
146
138
 
147
- return /*#__PURE__*/React.createElement(QuizInstructionsEdit, {
139
+ return jsx(QuizInstructionsEdit, {
148
140
  endEditing: this.endEditing,
149
141
  inputValue: this.workingInstructions(),
150
142
  onInputChange: this.updateWorkingInstructions,
@@ -160,7 +152,7 @@ export var QuizInstructions = (_dec = themeable(theme, styles), _dec(_class = (_
160
152
  }
161
153
 
162
154
  var contentLocked = this.props.quiz.originalQuizLockedByBlueprint;
163
- return /*#__PURE__*/React.createElement(QuizInstructionsShow, {
155
+ return jsx(QuizInstructionsShow, {
164
156
  ref: this.setRef('instructionsPreview'),
165
157
  instructions: this.props.quiz.instructions,
166
158
  switchOnEditing: this.props.switchOnEditing,
@@ -171,19 +163,19 @@ export var QuizInstructions = (_dec = themeable(theme, styles), _dec(_class = (_
171
163
  }, {
172
164
  key: "render",
173
165
  value: function render() {
174
- return /*#__PURE__*/React.createElement("div", {
166
+ return jsx("div", {
175
167
  tabIndex: "-1",
176
- className: styles.topRow
177
- }, /*#__PURE__*/React.createElement("div", {
178
- className: styles.flexContainer
179
- }, /*#__PURE__*/React.createElement("div", {
180
- className: styles.label
181
- }, /*#__PURE__*/React.createElement(Heading, {
168
+ css: this.props.styles.topRow
169
+ }, jsx("div", {
170
+ css: this.props.styles.flexContainer
171
+ }, jsx("div", {
172
+ css: this.props.styles.label
173
+ }, jsx(Heading, {
182
174
  level: "h4",
183
175
  as: "h2"
184
- }, t('Instructions'))), /*#__PURE__*/React.createElement("div", null, this.editingRender(), this.showRender())), /*#__PURE__*/React.createElement("div", null, !this.props.isEditing && !this.isContentLocked() && /*#__PURE__*/React.createElement("div", {
185
- className: styles.editButtonWrapper
186
- }, /*#__PURE__*/React.createElement(EditButton, {
176
+ }, t('Instructions'))), jsx("div", null, this.editingRender(), this.showRender())), jsx("div", null, !this.props.isEditing && !this.isContentLocked() && jsx("div", {
177
+ css: this.props.styles.editButtonWrapper
178
+ }, jsx(EditButton, {
187
179
  screenreaderText: t('Edit Instructions'),
188
180
  scrollKey: this.props.scrollKey,
189
181
  onClick: this.toggleEditing,
@@ -206,8 +198,9 @@ export var QuizInstructions = (_dec = themeable(theme, styles), _dec(_class = (_
206
198
  scrollKey: PropTypes.string,
207
199
  switchOffEditing: PropTypes.func.isRequired,
208
200
  // Injected by makeEditable
209
- switchOnEditing: PropTypes.func.isRequired // Injected by makeEditable
210
-
201
+ switchOnEditing: PropTypes.func.isRequired,
202
+ // Injected by makeEditable,
203
+ styles: PropTypes.object
211
204
  }, _class2.defaultProps = {
212
205
  scrollKey: void 0
213
206
  }, _temp)) || _class);
@@ -0,0 +1,33 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+
3
+ var generateStyle = function generateStyle(componentTheme) {
4
+ var mp = '@media print';
5
+ return {
6
+ topRow: _defineProperty({
7
+ display: 'flex',
8
+ justifyContent: 'space-between'
9
+ }, mp, {
10
+ display: 'none'
11
+ }),
12
+ flexContainer: {
13
+ display: 'flex',
14
+ flexDirection: 'column',
15
+ flexGrow: '1',
16
+ minWidth: '0'
17
+ },
18
+ label: {
19
+ padding: componentTheme.labelPadding,
20
+ paddingLeft: componentTheme.labelLeftPadding,
21
+ paddingBottom: componentTheme.labelBottomPadding,
22
+ fontSize: componentTheme.labelFontSize,
23
+ color: componentTheme.labelColor
24
+ },
25
+ editButtonWrapper: {
26
+ alignSelf: 'flex-end',
27
+ marginRight: componentTheme.editButtonWrapperRightMargin,
28
+ paddingTop: componentTheme.labelPadding
29
+ }
30
+ };
31
+ };
32
+
33
+ export default generateStyle;
@@ -5,28 +5,22 @@ 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
- import { themeable } from '@instructure/ui-themeable';
11
- import { RichContentRenderer } from '@instructure/quiz-rce';
12
- import Overlay from "../../../../../../common/components/shared/overlay/Overlay.js";
11
+ import { withStyle, jsx } from '@instructure/emotion';
12
+ import { RichContentRendererEmotion } from '@instructure/quiz-rce';
13
+ import OverlayEmotion from "../../../../../../common/components/shared/overlayEmotion/index.js";
13
14
  import makeScrollable from "../../../../../../common/components/shared/functionality/makeScrollable.js";
14
- var styles = {
15
- componentId: 'cCwUt',
16
- template: function template(theme) {
17
- return "\n\n.cCwUt_edzr{box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;min-height:4rem;padding:".concat(theme.instructionsShowWrapperPadding || 'inherit', ";position:relative;width:100%}\n\n.cCwUt_espM{font-size:").concat(theme.instructionsShowTextFontSize || 'inherit', ";overflow:hidden;white-space:normal}");
18
- },
19
- 'instructionsShowWrapper': 'cCwUt_edzr',
20
- 'instructionsShowText': 'cCwUt_espM'
21
- };
22
- import theme from "./theme.js";
15
+ import generateStyle from "./styles.js";
16
+ import generateComponentTheme from "./theme.js";
23
17
  import t from '@instructure/quiz-i18n/es/format-message'; // ==========================================
24
18
  // this component shows the quiz instructions
25
19
  // has events that allow for toggling
26
20
  // editing and hover which shows an overlay
27
21
  // ==========================================
28
22
 
29
- export var QuizInstructionsShow = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
23
+ export var QuizInstructionsShow = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
30
24
  _inherits(QuizInstructionsShow, _Component);
31
25
 
32
26
  var _super = _createSuper(QuizInstructionsShow);
@@ -52,17 +46,17 @@ export var QuizInstructionsShow = (_dec = themeable(theme, styles), _dec(_class
52
46
  _createClass(QuizInstructionsShow, [{
53
47
  key: "render",
54
48
  value: function render() {
55
- return /*#__PURE__*/React.createElement("span", {
49
+ return jsx("span", {
56
50
  "data-automation": "sdk-quiz-instructions-show-wrapper"
57
- }, /*#__PURE__*/React.createElement(Overlay, {
58
- wrapperClassName: styles.instructionsShowWrapper,
51
+ }, jsx(OverlayEmotion, {
52
+ wrapperStyles: this.props.styles.instructionsShowWrapper,
59
53
  onClick: this.switchOnEditing,
60
54
  tabIndex: "-1",
61
55
  hideOverlay: this.props.contentLocked
62
- }, /*#__PURE__*/React.createElement("div", {
56
+ }, jsx("div", {
63
57
  "data-automation": "instructions-show-text"
64
- }, /*#__PURE__*/React.createElement(RichContentRenderer, {
65
- customStyles: styles.instructionsShowText,
58
+ }, jsx(RichContentRendererEmotion, {
59
+ customStyles: this.props.styles.instructionsShowText,
66
60
  content: this.props.instructions || t('Add Instructions...')
67
61
  }))));
68
62
  }
@@ -73,7 +67,8 @@ export var QuizInstructionsShow = (_dec = themeable(theme, styles), _dec(_class
73
67
  }(Component), _class2.propTypes = {
74
68
  instructions: PropTypes.string,
75
69
  switchOnEditing: PropTypes.func.isRequired,
76
- contentLocked: PropTypes.bool
70
+ contentLocked: PropTypes.bool,
71
+ styles: PropTypes.object
77
72
  }, _class2.defaultProps = {
78
73
  contentLocked: false,
79
74
  instructions: null
@@ -0,0 +1,22 @@
1
+ var generateStyle = function generateStyle(componentTheme) {
2
+ return {
3
+ instructionsShowWrapper: {
4
+ position: 'relative',
5
+ width: '100%',
6
+ minHeight: '4rem',
7
+ boxSizing: 'border-box',
8
+ padding: componentTheme.instructionsShowWrapperPadding,
9
+ display: 'flex',
10
+ flexDirection: 'column',
11
+ justifyContent: 'center'
12
+ },
13
+ instructionsShowText: {
14
+ label: 'instructionsShowText',
15
+ whiteSpace: 'normal',
16
+ overflow: 'hidden',
17
+ fontSize: componentTheme.instructionsShowTextFontSize
18
+ }
19
+ };
20
+ };
21
+
22
+ export default generateStyle;
@@ -5,28 +5,23 @@ 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
- import { themeable } from '@instructure/ui-themeable';
11
+ import { withStyle, jsx } from '@instructure/emotion';
11
12
  import { TruncateText } from '@instructure/ui-truncate-text';
12
13
  import { Text } from '@instructure/ui-text';
13
- import Overlay from "../../../../../../common/components/shared/overlay/Overlay.js";
14
+ import OverlayEmotion from "../../../../../../common/components/shared/overlayEmotion/index.js";
14
15
  import makeScrollable from "../../../../../../common/components/shared/functionality/makeScrollable.js";
15
- var styles = {
16
- componentId: 'bTfJQ',
17
- template: function template(theme) {
18
- return "\n\n.bTfJQ_VGME{box-sizing:border-box;display:flex;flex-direction:column;height:5rem;justify-content:center;padding-left:".concat(theme.titleShowWrapperLeftPadding || 'inherit', ";position:relative;width:100%}");
19
- },
20
- 'titleShowWrapper': 'bTfJQ_VGME'
21
- };
22
- import theme from "./theme.js"; // ====================================
16
+ import generateStyle from "./styles.js";
17
+ import generateComponentTheme from "./theme.js"; // ====================================
23
18
  // this component shows the quiz title
24
19
  // has events that allow for toggling
25
20
  // editing and hover which shows an
26
21
  // overlay
27
22
  // ====================================
28
23
 
29
- export var QuizTitleShow = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
24
+ export var QuizTitleShow = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
30
25
  _inherits(QuizTitleShow, _Component);
31
26
 
32
27
  var _super = _createSuper(QuizTitleShow);
@@ -52,19 +47,19 @@ export var QuizTitleShow = (_dec = themeable(theme, styles), _dec(_class = (_tem
52
47
  _createClass(QuizTitleShow, [{
53
48
  key: "render",
54
49
  value: function render() {
55
- return /*#__PURE__*/React.createElement("span", {
50
+ return jsx("span", {
56
51
  "data-automation": "sdk-quiz-title-show-wrapper"
57
- }, /*#__PURE__*/React.createElement(Overlay, {
58
- wrapperClassName: styles.titleShowWrapper,
52
+ }, jsx(OverlayEmotion, {
53
+ wrapperStyles: this.props.styles.titleShowWrapper,
59
54
  onClick: this.switchOnEditing,
60
55
  tabIndex: "-1",
61
56
  hideOverlay: this.props.contentLocked
62
- }, /*#__PURE__*/React.createElement(Text, {
57
+ }, jsx(Text, {
63
58
  color: "primary",
64
59
  size: "x-large"
65
- }, /*#__PURE__*/React.createElement("span", {
60
+ }, jsx("span", {
66
61
  "data-automation": "sdk-quiz-title-show-title"
67
- }, /*#__PURE__*/React.createElement(TruncateText, null, this.props.defaultTitle)))));
62
+ }, jsx(TruncateText, null, this.props.defaultTitle)))));
68
63
  }
69
64
  }]);
70
65
 
@@ -73,7 +68,8 @@ export var QuizTitleShow = (_dec = themeable(theme, styles), _dec(_class = (_tem
73
68
  }(Component), _class2.propTypes = {
74
69
  defaultTitle: PropTypes.string.isRequired,
75
70
  switchOnEditing: PropTypes.func.isRequired,
76
- contentLocked: PropTypes.bool
71
+ contentLocked: PropTypes.bool,
72
+ styles: PropTypes.object
77
73
  }, _class2.defaultProps = {
78
74
  contentLocked: false
79
75
  }, _temp)) || _class);
@@ -0,0 +1,16 @@
1
+ var generateStyle = function generateStyle(componentTheme) {
2
+ return {
3
+ titleShowWrapper: {
4
+ position: 'relative',
5
+ width: '100%',
6
+ height: '5rem',
7
+ boxSizing: 'border-box',
8
+ paddingLeft: componentTheme.titleShowWrapperLeftPadding,
9
+ display: 'flex',
10
+ flexDirection: 'column',
11
+ justifyContent: 'center'
12
+ }
13
+ };
14
+ };
15
+
16
+ export default generateStyle;
@@ -1,6 +1,8 @@
1
- export default function generator(_ref) {
1
+ var generateComponentTheme = function generateComponentTheme(_ref) {
2
2
  var spacing = _ref.spacing;
3
3
  return {
4
4
  titleShowWrapperLeftPadding: spacing.large
5
5
  };
6
- }
6
+ };
7
+
8
+ export default generateComponentTheme;
@@ -5,33 +5,24 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
 
6
6
  var _dec, _class, _class2, _temp;
7
7
 
8
- import React, { Component } from 'react';
8
+ /** @jsx jsx */
9
+ import { Component } from 'react';
9
10
  import PropTypes from 'prop-types';
10
11
  import ImmutablePropTypes from 'react-immutable-proptypes';
11
12
  import partial from 'lodash/partial';
12
13
  import { Heading } from '@instructure/ui-heading';
13
- import { themeable } from '@instructure/ui-themeable';
14
+ import { withStyle, jsx } from '@instructure/emotion';
14
15
  import EditButton from "../../editButton/EditButton.js";
15
16
  import QuizTitleEdit from "../Edit/index.js";
16
17
  import QuizTitleShow from "../Show/index.js";
17
- var styles = {
18
- componentId: 'bpmxb',
19
- template: function template(theme) {
20
- return "\n\n.bpmxb_qYhL{border-bottom:".concat(theme.titleShowWrapperBottomBorder || 'inherit', ";display:flex;justify-content:space-between}\n\n.bpmxb_qYhL.bpmxb_cocM{border-bottom:solid;border-color:").concat(theme.titleEditWrapperBorderColor || 'inherit', ";border-width:").concat(theme.titleEditWrapperBorderWidth || 'inherit', "}\n\n.bpmxb_DlrZ{display:flex;flex-direction:column;flex-grow:1;min-width:0}\n\n.bpmxb_blJt{color:").concat(theme.labelColor || 'inherit', ";font-size:").concat(theme.labelFontSize || 'inherit', ";padding:").concat(theme.labelPadding || 'inherit', ";padding-bottom:").concat(theme.labelBottomPadding || 'inherit', ";padding-left:").concat(theme.labelLeftPadding || 'inherit', "}\n\n.bpmxb_UraS{align-self:flex-end;margin-right:").concat(theme.editButtonWrapperRightMargin || 'inherit', ";padding-top:").concat(theme.labelPadding || 'inherit', "}\n\n@media print{.bpmxb_qYhL{display:none}}");
21
- },
22
- 'topRow': 'bpmxb_qYhL',
23
- 'editing': 'bpmxb_cocM',
24
- 'flexContainer': 'bpmxb_DlrZ',
25
- 'label': 'bpmxb_blJt',
26
- 'editButtonWrapper': 'bpmxb_UraS'
27
- };
28
- import theme from "./theme.js";
18
+ import generateStyle from "./styles.js";
19
+ import generateComponentTheme from "./theme.js";
29
20
  import t from '@instructure/quiz-i18n/es/format-message'; // ================================
30
21
  // renders the editable quiz title
31
22
  // input/display component
32
23
  // ================================
33
24
 
34
- export var QuizTitlePresenter = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
25
+ export var QuizTitlePresenter = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
35
26
  _inherits(QuizTitlePresenter, _Component);
36
27
 
37
28
  var _super = _createSuper(QuizTitlePresenter);
@@ -92,10 +83,20 @@ export var QuizTitlePresenter = (_dec = themeable(theme, styles), _dec(_class =
92
83
  }
93
84
 
94
85
  _createClass(QuizTitlePresenter, [{
95
- key: "quizID",
96
- // ===========
86
+ key: "componentDidMount",
87
+ value: function componentDidMount() {
88
+ this.props.makeStyles();
89
+ }
90
+ }, {
91
+ key: "componentDidUpdate",
92
+ value: function componentDidUpdate() {
93
+ this.props.makeStyles();
94
+ } // ===========
97
95
  // helpers
98
96
  // ===========
97
+
98
+ }, {
99
+ key: "quizID",
99
100
  value: function quizID() {
100
101
  return this.props.quiz.id;
101
102
  }
@@ -132,7 +133,7 @@ export var QuizTitlePresenter = (_dec = themeable(theme, styles), _dec(_class =
132
133
  // ===============
133
134
  value: function renderEdit() {
134
135
  var quizTitleEditKey = 'quiz_title_edit';
135
- return /*#__PURE__*/React.createElement(QuizTitleEdit, {
136
+ return jsx(QuizTitleEdit, {
136
137
  isValid: this.isValid(),
137
138
  showError: partial(this.props.showError, quizTitleEditKey),
138
139
  hideError: partial(this.props.hideError, quizTitleEditKey),
@@ -146,7 +147,7 @@ export var QuizTitlePresenter = (_dec = themeable(theme, styles), _dec(_class =
146
147
  }, {
147
148
  key: "renderShow",
148
149
  value: function renderShow() {
149
- return /*#__PURE__*/React.createElement(QuizTitleShow, {
150
+ return jsx(QuizTitleShow, {
150
151
  switchOnEditing: this.props.switchOnEditing,
151
152
  defaultTitle: this.workingTitle(),
152
153
  contentLocked: this.isContentLocked(),
@@ -156,21 +157,20 @@ export var QuizTitlePresenter = (_dec = themeable(theme, styles), _dec(_class =
156
157
  }, {
157
158
  key: "render",
158
159
  value: function render() {
159
- var classnames = "".concat(styles.topRow, " ").concat(this.props.isEditing ? styles.editing : '');
160
160
  var content = this.props.isEditing ? this.renderEdit() : this.renderShow();
161
- return /*#__PURE__*/React.createElement("div", {
161
+ return jsx("div", {
162
162
  tabIndex: "-1",
163
- className: classnames
164
- }, /*#__PURE__*/React.createElement("div", {
165
- className: styles.flexContainer
166
- }, /*#__PURE__*/React.createElement("div", {
167
- className: styles.label
168
- }, /*#__PURE__*/React.createElement(Heading, {
163
+ css: this.props.styles.topRow
164
+ }, jsx("div", {
165
+ css: this.props.styles.flexContainer
166
+ }, jsx("div", {
167
+ css: this.props.styles.label
168
+ }, jsx(Heading, {
169
169
  level: "h4",
170
170
  as: "h2"
171
- }, t('Title'))), /*#__PURE__*/React.createElement("div", null, content)), /*#__PURE__*/React.createElement("div", null, !this.props.isEditing && !this.isContentLocked() && /*#__PURE__*/React.createElement("div", {
172
- className: styles.editButtonWrapper
173
- }, /*#__PURE__*/React.createElement(EditButton, {
171
+ }, t('Title'))), jsx("div", null, content)), jsx("div", null, !this.props.isEditing && !this.isContentLocked() && jsx("div", {
172
+ css: this.props.styles.editButtonWrapper
173
+ }, jsx(EditButton, {
174
174
  ref: this.handleEditButtonRef,
175
175
  screenreaderText: t('Edit Title'),
176
176
  scrollKey: this.props.scrollKey,
@@ -199,7 +199,9 @@ export var QuizTitlePresenter = (_dec = themeable(theme, styles), _dec(_class =
199
199
  // injected by makeEditable
200
200
  switchOnEditing: PropTypes.func.isRequired,
201
201
  // injected by makeEditable
202
- workingQuiz: ImmutablePropTypes.record.isRequired
202
+ workingQuiz: ImmutablePropTypes.record.isRequired,
203
+ makeStyles: PropTypes.func,
204
+ styles: PropTypes.object
203
205
  }, _class2.defaultProps = {
204
206
  scrollKey: void 0
205
207
  }, _temp)) || _class);
@@ -0,0 +1,39 @@
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 mp = '@media print';
6
+ return {
7
+ topRow: _objectSpread(_defineProperty({
8
+ display: 'flex',
9
+ justifyContent: 'space-between',
10
+ borderBottom: componentTheme.titleShowWrapperBottomBorder
11
+ }, mp, {
12
+ display: 'none'
13
+ }), props.isEditing && {
14
+ borderBottom: 'solid',
15
+ borderWidth: componentTheme.titleEditWrapperBorderWidth,
16
+ borderColor: componentTheme.titleEditWrapperBorderColor
17
+ }),
18
+ flexContainer: {
19
+ display: 'flex',
20
+ flexDirection: 'column',
21
+ flexGrow: '1',
22
+ minWidth: '0'
23
+ },
24
+ label: {
25
+ padding: componentTheme.labelPadding,
26
+ paddingLeft: componentTheme.labelLeftPadding,
27
+ paddingBottom: componentTheme.labelBottomPadding,
28
+ fontSize: componentTheme.labelFontSize,
29
+ color: componentTheme.labelColor
30
+ },
31
+ editButtonWrapper: {
32
+ alignSelf: 'flex-end',
33
+ marginRight: componentTheme.editButtonWrapperRightMargin,
34
+ paddingTop: componentTheme.labelPadding
35
+ }
36
+ };
37
+ };
38
+
39
+ export default generateStyle;