@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.
- package/es/building/components/resources/quiz/instructions/Edit/presenter.js +17 -24
- package/es/building/components/resources/quiz/instructions/Edit/styles.js +21 -0
- package/es/building/components/resources/quiz/instructions/Instructions/presenter.js +21 -28
- package/es/building/components/resources/quiz/instructions/Instructions/styles.js +33 -0
- package/es/building/components/resources/quiz/instructions/Show/index.js +16 -21
- package/es/building/components/resources/quiz/instructions/Show/styles.js +22 -0
- package/es/building/components/resources/quiz/title/Show/index.js +15 -19
- package/es/building/components/resources/quiz/title/Show/styles.js +16 -0
- package/es/building/components/resources/quiz/title/Show/theme.js +4 -2
- package/es/building/components/resources/quiz/title/Title/presenter.js +33 -31
- package/es/building/components/resources/quiz/title/Title/styles.js +39 -0
- package/es/common/components/shared/functionality/componentWithOutsideClickEmotion.js +85 -0
- package/es/common/components/shared/overlayEmotion/index.js +1 -0
- package/lib/building/components/resources/quiz/instructions/Edit/presenter.js +17 -26
- package/lib/building/components/resources/quiz/instructions/Edit/styles.js +29 -0
- package/lib/building/components/resources/quiz/instructions/Instructions/presenter.js +20 -29
- package/lib/building/components/resources/quiz/instructions/Instructions/styles.js +43 -0
- package/lib/building/components/resources/quiz/instructions/Show/index.js +14 -21
- package/lib/building/components/resources/quiz/instructions/Show/styles.js +30 -0
- package/lib/building/components/resources/quiz/title/Show/index.js +14 -20
- package/lib/building/components/resources/quiz/title/Show/styles.js +24 -0
- package/lib/building/components/resources/quiz/title/Show/theme.js +6 -3
- package/lib/building/components/resources/quiz/title/Title/presenter.js +32 -32
- package/lib/building/components/resources/quiz/title/Title/styles.js +50 -0
- package/lib/common/components/shared/functionality/componentWithOutsideClickEmotion.js +102 -0
- package/lib/common/components/shared/overlayEmotion/index.js +1 -0
- package/package.json +9 -9
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
|
+
import ReactDOM from 'react-dom';
|
|
7
|
+
import debounce from 'lodash/debounce';
|
|
8
|
+
import reduxStore from "../../../../reduxStore.js";
|
|
9
|
+
import React from 'react'; // ======================================================
|
|
10
|
+
// this component extends another component and will run
|
|
11
|
+
// the 'clickedOutside' function defined on that component
|
|
12
|
+
// if users click outside of it
|
|
13
|
+
// clickedOutside: called when the user clicks outside node
|
|
14
|
+
// ignoreClickOutsideIf: if returns true then do not run
|
|
15
|
+
// the clickedOutside callback
|
|
16
|
+
// ======================================================
|
|
17
|
+
|
|
18
|
+
var wrapWithOutsideClickEmotion = function wrapWithOutsideClickEmotion(ComposedComponent) {
|
|
19
|
+
return /*#__PURE__*/function (_React$Component) {
|
|
20
|
+
_inherits(wrappedWithOutsideClick, _React$Component);
|
|
21
|
+
|
|
22
|
+
var _super = _createSuper(wrappedWithOutsideClick);
|
|
23
|
+
|
|
24
|
+
function wrappedWithOutsideClick(props) {
|
|
25
|
+
var _this;
|
|
26
|
+
|
|
27
|
+
_classCallCheck(this, wrappedWithOutsideClick);
|
|
28
|
+
|
|
29
|
+
_this = _super.call(this, props);
|
|
30
|
+
_this.checkForOutsideClick = _this.checkForOutsideClick.bind(_assertThisInitialized(_this));
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_createClass(wrappedWithOutsideClick, [{
|
|
35
|
+
key: "componentDidMount",
|
|
36
|
+
value: function componentDidMount() {
|
|
37
|
+
this.mouseDownEventCb = debounce(this.checkForOutsideClick, 300, {
|
|
38
|
+
leading: true,
|
|
39
|
+
trailing: false
|
|
40
|
+
});
|
|
41
|
+
document.addEventListener('click', this.mouseDownEventCb, true);
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "componentWillUnmount",
|
|
45
|
+
value: function componentWillUnmount() {
|
|
46
|
+
document.removeEventListener('click', this.mouseDownEventCb, true);
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
key: "checkcomponentRef",
|
|
50
|
+
value: function checkcomponentRef() {
|
|
51
|
+
return this.composedComponentRef && this.composedComponentRef.current;
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "checkForOutsideClick",
|
|
55
|
+
value: function checkForOutsideClick(e) {
|
|
56
|
+
var isModalOpen = reduxStore.getAppState().getIn(['modal', 'isOpen']);
|
|
57
|
+
|
|
58
|
+
if (this.checkcomponentRef() && this.composedComponentRef.current.ignoreClickOutsideIf && this.composedComponentRef.current.ignoreClickOutsideIf(e) || isModalOpen) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (this.checkcomponentRef() && this.composedComponentRef.current.clickedOutside) {
|
|
63
|
+
var domNode = ReactDOM.findDOMNode(this);
|
|
64
|
+
|
|
65
|
+
if (!(domNode && domNode.contains(e.target))) {
|
|
66
|
+
this.composedComponentRef.current.clickedOutside(e);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "render",
|
|
72
|
+
value: function render() {
|
|
73
|
+
this.composedComponentRef = /*#__PURE__*/React.createRef();
|
|
74
|
+
return /*#__PURE__*/React.createElement(ComposedComponent, Object.assign({
|
|
75
|
+
ref: this.composedComponentRef
|
|
76
|
+
}, this.props));
|
|
77
|
+
}
|
|
78
|
+
}]);
|
|
79
|
+
|
|
80
|
+
wrappedWithOutsideClick.displayName = "wrappedWithOutsideClick";
|
|
81
|
+
return wrappedWithOutsideClick;
|
|
82
|
+
}(React.Component);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default wrapWithOutsideClickEmotion;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -17,18 +15,16 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
17
15
|
|
|
18
16
|
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
17
|
|
|
20
|
-
var _react =
|
|
18
|
+
var _react = require("react");
|
|
21
19
|
|
|
22
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
21
|
|
|
24
22
|
var _uiButtons = require("@instructure/ui-buttons");
|
|
25
23
|
|
|
26
|
-
var
|
|
24
|
+
var _emotion = require("@instructure/emotion");
|
|
27
25
|
|
|
28
26
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
29
27
|
|
|
30
|
-
var _componentWithOutsideClick = _interopRequireDefault(require("../../../../../../common/components/shared/functionality/componentWithOutsideClick.js"));
|
|
31
|
-
|
|
32
28
|
var _CustomPropTypes = _interopRequireDefault(require("../../../../../../common/util/CustomPropTypes.js"));
|
|
33
29
|
|
|
34
30
|
var _ElementsForSelectors = _interopRequireDefault(require("../../../../../../common/util/ElementsForSelectors.js"));
|
|
@@ -37,24 +33,20 @@ var _quizCommon = require("@instructure/quiz-common");
|
|
|
37
33
|
|
|
38
34
|
var _quizRce = require("@instructure/quiz-rce");
|
|
39
35
|
|
|
36
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
37
|
+
|
|
40
38
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
41
39
|
|
|
40
|
+
var _componentWithOutsideClickEmotion = _interopRequireDefault(require("../../../../../../common/components/shared/functionality/componentWithOutsideClickEmotion.js"));
|
|
41
|
+
|
|
42
42
|
var _dec, _class, _class2, _temp;
|
|
43
43
|
|
|
44
|
-
var styles = {
|
|
45
|
-
componentId: 'evnrd',
|
|
46
|
-
template: function template(theme) {
|
|
47
|
-
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', "}");
|
|
48
|
-
},
|
|
49
|
-
'instructionsEditWrapper': 'evnrd_dCmx',
|
|
50
|
-
'footer': 'evnrd_cjWK'
|
|
51
|
-
};
|
|
52
44
|
// ===================================
|
|
53
45
|
// once editing is toggled this div
|
|
54
46
|
// is rendered & has actions that
|
|
55
47
|
// allow for canceling
|
|
56
48
|
// ===================================
|
|
57
|
-
var QuizInstructionsEdit = (_dec = (0,
|
|
49
|
+
var QuizInstructionsEdit = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
58
50
|
(0, _inherits2.default)(QuizInstructionsEdit, _Component);
|
|
59
51
|
|
|
60
52
|
var _super = (0, _createSuper2.default)(QuizInstructionsEdit);
|
|
@@ -82,22 +74,20 @@ var QuizInstructionsEdit = (_dec = (0, _uiThemeable.themeable)(_theme.default, s
|
|
|
82
74
|
}, {
|
|
83
75
|
key: "render",
|
|
84
76
|
value: function render() {
|
|
85
|
-
return
|
|
86
|
-
|
|
87
|
-
},
|
|
77
|
+
return (0, _emotion.jsx)("div", {
|
|
78
|
+
css: this.props.styles.instructionsEditWrapper
|
|
79
|
+
}, (0, _emotion.jsx)(_quizRce.RichContentInput, {
|
|
88
80
|
label: "",
|
|
89
81
|
textareaId: _quizCommon.INSTRUCTIONS_EDIT_ID,
|
|
90
|
-
wrapperClassName: styles.instructionsEdit,
|
|
91
|
-
textareaClassName: styles.instructionsEditInput,
|
|
92
82
|
defaultContent: this.props.inputValue,
|
|
93
83
|
onKeyUp: this.props.onInputChange,
|
|
94
84
|
onChange: this.props.onInputChange
|
|
95
|
-
}),
|
|
96
|
-
|
|
97
|
-
},
|
|
85
|
+
}), (0, _emotion.jsx)("div", {
|
|
86
|
+
css: this.props.styles.footer
|
|
87
|
+
}, (0, _emotion.jsx)(_uiButtons.Button, {
|
|
98
88
|
margin: "0 x-small",
|
|
99
89
|
onClick: this.props.endEditing
|
|
100
|
-
}, (0, _formatMessage.default)('Cancel')),
|
|
90
|
+
}, (0, _formatMessage.default)('Cancel')), (0, _emotion.jsx)(_uiButtons.Button, {
|
|
101
91
|
color: "primary",
|
|
102
92
|
onClick: this.props.saveAndPreview,
|
|
103
93
|
"data-automation": "instructions-done"
|
|
@@ -111,9 +101,10 @@ var QuizInstructionsEdit = (_dec = (0, _uiThemeable.themeable)(_theme.default, s
|
|
|
111
101
|
inputValue: _propTypes.default.string.isRequired,
|
|
112
102
|
onInputChange: _propTypes.default.func.isRequired,
|
|
113
103
|
saveAndPreview: _propTypes.default.func.isRequired,
|
|
114
|
-
appContainer: _CustomPropTypes.default.selectors.isRequired
|
|
104
|
+
appContainer: _CustomPropTypes.default.selectors.isRequired,
|
|
105
|
+
styles: _propTypes.default.object
|
|
115
106
|
}, _temp)) || _class);
|
|
116
107
|
|
|
117
|
-
var _default = (0,
|
|
108
|
+
var _default = (0, _componentWithOutsideClickEmotion.default)(QuizInstructionsEdit);
|
|
118
109
|
|
|
119
110
|
exports.default = _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
9
|
+
return {
|
|
10
|
+
instructionsEditWrapper: {
|
|
11
|
+
position: 'relative',
|
|
12
|
+
width: '100%',
|
|
13
|
+
minHeight: '4rem',
|
|
14
|
+
boxSizing: 'border-box',
|
|
15
|
+
padding: componentTheme.instructionsEditWrapperPadding,
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
justifyContent: 'center'
|
|
19
|
+
},
|
|
20
|
+
footer: {
|
|
21
|
+
marginTop: componentTheme.footerTopMargin,
|
|
22
|
+
display: 'flex',
|
|
23
|
+
justifyContent: 'flex-end'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var _default = generateStyle;
|
|
29
|
+
exports.default = _default;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -17,7 +15,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
17
15
|
|
|
18
16
|
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
17
|
|
|
20
|
-
var _react =
|
|
18
|
+
var _react = require("react");
|
|
21
19
|
|
|
22
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
21
|
|
|
@@ -25,7 +23,7 @@ var _reactImmutableProptypes = _interopRequireDefault(require("react-immutable-p
|
|
|
25
23
|
|
|
26
24
|
var _uiHeading = require("@instructure/ui-heading");
|
|
27
25
|
|
|
28
|
-
var
|
|
26
|
+
var _emotion = require("@instructure/emotion");
|
|
29
27
|
|
|
30
28
|
var _index = _interopRequireDefault(require("../Edit/index.js"));
|
|
31
29
|
|
|
@@ -33,27 +31,19 @@ var _index2 = _interopRequireDefault(require("../Show/index.js"));
|
|
|
33
31
|
|
|
34
32
|
var _EditButton = _interopRequireDefault(require("../../editButton/EditButton.js"));
|
|
35
33
|
|
|
34
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
35
|
+
|
|
36
36
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
37
37
|
|
|
38
38
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
39
39
|
|
|
40
40
|
var _dec, _class, _class2, _temp;
|
|
41
41
|
|
|
42
|
-
var styles = {
|
|
43
|
-
componentId: 'bIKna',
|
|
44
|
-
template: function template(theme) {
|
|
45
|
-
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}}");
|
|
46
|
-
},
|
|
47
|
-
'topRow': 'bIKna_qYhL',
|
|
48
|
-
'flexContainer': 'bIKna_DlrZ',
|
|
49
|
-
'label': 'bIKna_blJt',
|
|
50
|
-
'editButtonWrapper': 'bIKna_UraS'
|
|
51
|
-
};
|
|
52
42
|
// ======================================
|
|
53
43
|
// renders the editable quiz instructions
|
|
54
44
|
// input/display component
|
|
55
45
|
// ======================================
|
|
56
|
-
var QuizInstructions = (_dec = (0,
|
|
46
|
+
var QuizInstructions = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
57
47
|
(0, _inherits2.default)(QuizInstructions, _Component);
|
|
58
48
|
|
|
59
49
|
var _super = (0, _createSuper2.default)(QuizInstructions);
|
|
@@ -168,7 +158,7 @@ var QuizInstructions = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
|
|
|
168
158
|
return;
|
|
169
159
|
}
|
|
170
160
|
|
|
171
|
-
return
|
|
161
|
+
return (0, _emotion.jsx)(_index.default, {
|
|
172
162
|
endEditing: this.endEditing,
|
|
173
163
|
inputValue: this.workingInstructions(),
|
|
174
164
|
onInputChange: this.updateWorkingInstructions,
|
|
@@ -184,7 +174,7 @@ var QuizInstructions = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
|
|
|
184
174
|
}
|
|
185
175
|
|
|
186
176
|
var contentLocked = this.props.quiz.originalQuizLockedByBlueprint;
|
|
187
|
-
return
|
|
177
|
+
return (0, _emotion.jsx)(_index2.default, {
|
|
188
178
|
ref: this.setRef('instructionsPreview'),
|
|
189
179
|
instructions: this.props.quiz.instructions,
|
|
190
180
|
switchOnEditing: this.props.switchOnEditing,
|
|
@@ -195,19 +185,19 @@ var QuizInstructions = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
|
|
|
195
185
|
}, {
|
|
196
186
|
key: "render",
|
|
197
187
|
value: function render() {
|
|
198
|
-
return
|
|
188
|
+
return (0, _emotion.jsx)("div", {
|
|
199
189
|
tabIndex: "-1",
|
|
200
|
-
|
|
201
|
-
},
|
|
202
|
-
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
},
|
|
190
|
+
css: this.props.styles.topRow
|
|
191
|
+
}, (0, _emotion.jsx)("div", {
|
|
192
|
+
css: this.props.styles.flexContainer
|
|
193
|
+
}, (0, _emotion.jsx)("div", {
|
|
194
|
+
css: this.props.styles.label
|
|
195
|
+
}, (0, _emotion.jsx)(_uiHeading.Heading, {
|
|
206
196
|
level: "h4",
|
|
207
197
|
as: "h2"
|
|
208
|
-
}, (0, _formatMessage.default)('Instructions'))),
|
|
209
|
-
|
|
210
|
-
},
|
|
198
|
+
}, (0, _formatMessage.default)('Instructions'))), (0, _emotion.jsx)("div", null, this.editingRender(), this.showRender())), (0, _emotion.jsx)("div", null, !this.props.isEditing && !this.isContentLocked() && (0, _emotion.jsx)("div", {
|
|
199
|
+
css: this.props.styles.editButtonWrapper
|
|
200
|
+
}, (0, _emotion.jsx)(_EditButton.default, {
|
|
211
201
|
screenreaderText: (0, _formatMessage.default)('Edit Instructions'),
|
|
212
202
|
scrollKey: this.props.scrollKey,
|
|
213
203
|
onClick: this.toggleEditing,
|
|
@@ -229,8 +219,9 @@ var QuizInstructions = (_dec = (0, _uiThemeable.themeable)(_theme.default, style
|
|
|
229
219
|
scrollKey: _propTypes.default.string,
|
|
230
220
|
switchOffEditing: _propTypes.default.func.isRequired,
|
|
231
221
|
// Injected by makeEditable
|
|
232
|
-
switchOnEditing: _propTypes.default.func.isRequired
|
|
233
|
-
|
|
222
|
+
switchOnEditing: _propTypes.default.func.isRequired,
|
|
223
|
+
// Injected by makeEditable,
|
|
224
|
+
styles: _propTypes.default.object
|
|
234
225
|
}, _class2.defaultProps = {
|
|
235
226
|
scrollKey: void 0
|
|
236
227
|
}, _temp)) || _class);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
13
|
+
var mp = '@media print';
|
|
14
|
+
return {
|
|
15
|
+
topRow: (0, _defineProperty2.default)({
|
|
16
|
+
display: 'flex',
|
|
17
|
+
justifyContent: 'space-between'
|
|
18
|
+
}, mp, {
|
|
19
|
+
display: 'none'
|
|
20
|
+
}),
|
|
21
|
+
flexContainer: {
|
|
22
|
+
display: 'flex',
|
|
23
|
+
flexDirection: 'column',
|
|
24
|
+
flexGrow: '1',
|
|
25
|
+
minWidth: '0'
|
|
26
|
+
},
|
|
27
|
+
label: {
|
|
28
|
+
padding: componentTheme.labelPadding,
|
|
29
|
+
paddingLeft: componentTheme.labelLeftPadding,
|
|
30
|
+
paddingBottom: componentTheme.labelBottomPadding,
|
|
31
|
+
fontSize: componentTheme.labelFontSize,
|
|
32
|
+
color: componentTheme.labelColor
|
|
33
|
+
},
|
|
34
|
+
editButtonWrapper: {
|
|
35
|
+
alignSelf: 'flex-end',
|
|
36
|
+
marginRight: componentTheme.editButtonWrapperRightMargin,
|
|
37
|
+
paddingTop: componentTheme.labelPadding
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var _default = generateStyle;
|
|
43
|
+
exports.default = _default;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -17,38 +15,32 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
17
15
|
|
|
18
16
|
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
17
|
|
|
20
|
-
var _react =
|
|
18
|
+
var _react = require("react");
|
|
21
19
|
|
|
22
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
21
|
|
|
24
|
-
var
|
|
22
|
+
var _emotion = require("@instructure/emotion");
|
|
25
23
|
|
|
26
24
|
var _quizRce = require("@instructure/quiz-rce");
|
|
27
25
|
|
|
28
|
-
var
|
|
26
|
+
var _index = _interopRequireDefault(require("../../../../../../common/components/shared/overlayEmotion/index.js"));
|
|
29
27
|
|
|
30
28
|
var _makeScrollable = _interopRequireDefault(require("../../../../../../common/components/shared/functionality/makeScrollable.js"));
|
|
31
29
|
|
|
30
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
31
|
+
|
|
32
32
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
33
33
|
|
|
34
34
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
35
35
|
|
|
36
36
|
var _dec, _class, _class2, _temp;
|
|
37
37
|
|
|
38
|
-
var styles = {
|
|
39
|
-
componentId: 'cCwUt',
|
|
40
|
-
template: function template(theme) {
|
|
41
|
-
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}");
|
|
42
|
-
},
|
|
43
|
-
'instructionsShowWrapper': 'cCwUt_edzr',
|
|
44
|
-
'instructionsShowText': 'cCwUt_espM'
|
|
45
|
-
};
|
|
46
38
|
// ==========================================
|
|
47
39
|
// this component shows the quiz instructions
|
|
48
40
|
// has events that allow for toggling
|
|
49
41
|
// editing and hover which shows an overlay
|
|
50
42
|
// ==========================================
|
|
51
|
-
var QuizInstructionsShow = (_dec = (0,
|
|
43
|
+
var QuizInstructionsShow = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
52
44
|
(0, _inherits2.default)(QuizInstructionsShow, _Component);
|
|
53
45
|
|
|
54
46
|
var _super = (0, _createSuper2.default)(QuizInstructionsShow);
|
|
@@ -74,17 +66,17 @@ var QuizInstructionsShow = (_dec = (0, _uiThemeable.themeable)(_theme.default, s
|
|
|
74
66
|
(0, _createClass2.default)(QuizInstructionsShow, [{
|
|
75
67
|
key: "render",
|
|
76
68
|
value: function render() {
|
|
77
|
-
return
|
|
69
|
+
return (0, _emotion.jsx)("span", {
|
|
78
70
|
"data-automation": "sdk-quiz-instructions-show-wrapper"
|
|
79
|
-
},
|
|
80
|
-
|
|
71
|
+
}, (0, _emotion.jsx)(_index.default, {
|
|
72
|
+
wrapperStyles: this.props.styles.instructionsShowWrapper,
|
|
81
73
|
onClick: this.switchOnEditing,
|
|
82
74
|
tabIndex: "-1",
|
|
83
75
|
hideOverlay: this.props.contentLocked
|
|
84
|
-
},
|
|
76
|
+
}, (0, _emotion.jsx)("div", {
|
|
85
77
|
"data-automation": "instructions-show-text"
|
|
86
|
-
},
|
|
87
|
-
customStyles: styles.instructionsShowText,
|
|
78
|
+
}, (0, _emotion.jsx)(_quizRce.RichContentRendererEmotion, {
|
|
79
|
+
customStyles: this.props.styles.instructionsShowText,
|
|
88
80
|
content: this.props.instructions || (0, _formatMessage.default)('Add Instructions...')
|
|
89
81
|
}))));
|
|
90
82
|
}
|
|
@@ -94,7 +86,8 @@ var QuizInstructionsShow = (_dec = (0, _uiThemeable.themeable)(_theme.default, s
|
|
|
94
86
|
}(_react.Component), _class2.propTypes = {
|
|
95
87
|
instructions: _propTypes.default.string,
|
|
96
88
|
switchOnEditing: _propTypes.default.func.isRequired,
|
|
97
|
-
contentLocked: _propTypes.default.bool
|
|
89
|
+
contentLocked: _propTypes.default.bool,
|
|
90
|
+
styles: _propTypes.default.object
|
|
98
91
|
}, _class2.defaultProps = {
|
|
99
92
|
contentLocked: false,
|
|
100
93
|
instructions: null
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
9
|
+
return {
|
|
10
|
+
instructionsShowWrapper: {
|
|
11
|
+
position: 'relative',
|
|
12
|
+
width: '100%',
|
|
13
|
+
minHeight: '4rem',
|
|
14
|
+
boxSizing: 'border-box',
|
|
15
|
+
padding: componentTheme.instructionsShowWrapperPadding,
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
justifyContent: 'center'
|
|
19
|
+
},
|
|
20
|
+
instructionsShowText: {
|
|
21
|
+
label: 'instructionsShowText',
|
|
22
|
+
whiteSpace: 'normal',
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
fontSize: componentTheme.instructionsShowTextFontSize
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var _default = generateStyle;
|
|
30
|
+
exports.default = _default;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -17,38 +15,33 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
17
15
|
|
|
18
16
|
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
17
|
|
|
20
|
-
var _react =
|
|
18
|
+
var _react = require("react");
|
|
21
19
|
|
|
22
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
21
|
|
|
24
|
-
var
|
|
22
|
+
var _emotion = require("@instructure/emotion");
|
|
25
23
|
|
|
26
24
|
var _uiTruncateText = require("@instructure/ui-truncate-text");
|
|
27
25
|
|
|
28
26
|
var _uiText = require("@instructure/ui-text");
|
|
29
27
|
|
|
30
|
-
var
|
|
28
|
+
var _index = _interopRequireDefault(require("../../../../../../common/components/shared/overlayEmotion/index.js"));
|
|
31
29
|
|
|
32
30
|
var _makeScrollable = _interopRequireDefault(require("../../../../../../common/components/shared/functionality/makeScrollable.js"));
|
|
33
31
|
|
|
32
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
33
|
+
|
|
34
34
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
35
35
|
|
|
36
36
|
var _dec, _class, _class2, _temp;
|
|
37
37
|
|
|
38
|
-
var styles = {
|
|
39
|
-
componentId: 'bTfJQ',
|
|
40
|
-
template: function template(theme) {
|
|
41
|
-
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%}");
|
|
42
|
-
},
|
|
43
|
-
'titleShowWrapper': 'bTfJQ_VGME'
|
|
44
|
-
};
|
|
45
38
|
// ====================================
|
|
46
39
|
// this component shows the quiz title
|
|
47
40
|
// has events that allow for toggling
|
|
48
41
|
// editing and hover which shows an
|
|
49
42
|
// overlay
|
|
50
43
|
// ====================================
|
|
51
|
-
var QuizTitleShow = (_dec = (0,
|
|
44
|
+
var QuizTitleShow = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
52
45
|
(0, _inherits2.default)(QuizTitleShow, _Component);
|
|
53
46
|
|
|
54
47
|
var _super = (0, _createSuper2.default)(QuizTitleShow);
|
|
@@ -74,19 +67,19 @@ var QuizTitleShow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
74
67
|
(0, _createClass2.default)(QuizTitleShow, [{
|
|
75
68
|
key: "render",
|
|
76
69
|
value: function render() {
|
|
77
|
-
return
|
|
70
|
+
return (0, _emotion.jsx)("span", {
|
|
78
71
|
"data-automation": "sdk-quiz-title-show-wrapper"
|
|
79
|
-
},
|
|
80
|
-
|
|
72
|
+
}, (0, _emotion.jsx)(_index.default, {
|
|
73
|
+
wrapperStyles: this.props.styles.titleShowWrapper,
|
|
81
74
|
onClick: this.switchOnEditing,
|
|
82
75
|
tabIndex: "-1",
|
|
83
76
|
hideOverlay: this.props.contentLocked
|
|
84
|
-
},
|
|
77
|
+
}, (0, _emotion.jsx)(_uiText.Text, {
|
|
85
78
|
color: "primary",
|
|
86
79
|
size: "x-large"
|
|
87
|
-
},
|
|
80
|
+
}, (0, _emotion.jsx)("span", {
|
|
88
81
|
"data-automation": "sdk-quiz-title-show-title"
|
|
89
|
-
},
|
|
82
|
+
}, (0, _emotion.jsx)(_uiTruncateText.TruncateText, null, this.props.defaultTitle)))));
|
|
90
83
|
}
|
|
91
84
|
}]);
|
|
92
85
|
QuizTitleShow.displayName = "QuizTitleShow";
|
|
@@ -94,7 +87,8 @@ var QuizTitleShow = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles),
|
|
|
94
87
|
}(_react.Component), _class2.propTypes = {
|
|
95
88
|
defaultTitle: _propTypes.default.string.isRequired,
|
|
96
89
|
switchOnEditing: _propTypes.default.func.isRequired,
|
|
97
|
-
contentLocked: _propTypes.default.bool
|
|
90
|
+
contentLocked: _propTypes.default.bool,
|
|
91
|
+
styles: _propTypes.default.object
|
|
98
92
|
}, _class2.defaultProps = {
|
|
99
93
|
contentLocked: false
|
|
100
94
|
}, _temp)) || _class);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
9
|
+
return {
|
|
10
|
+
titleShowWrapper: {
|
|
11
|
+
position: 'relative',
|
|
12
|
+
width: '100%',
|
|
13
|
+
height: '5rem',
|
|
14
|
+
boxSizing: 'border-box',
|
|
15
|
+
paddingLeft: componentTheme.titleShowWrapperLeftPadding,
|
|
16
|
+
display: 'flex',
|
|
17
|
+
flexDirection: 'column',
|
|
18
|
+
justifyContent: 'center'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var _default = generateStyle;
|
|
24
|
+
exports.default = _default;
|
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
9
9
|
var spacing = _ref.spacing;
|
|
10
10
|
return {
|
|
11
11
|
titleShowWrapperLeftPadding: spacing.large
|
|
12
12
|
};
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
var _default = generateComponentTheme;
|
|
16
|
+
exports.default = _default;
|