@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
|
@@ -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
|
|
|
@@ -27,7 +25,7 @@ var _partial = _interopRequireDefault(require("lodash/partial"));
|
|
|
27
25
|
|
|
28
26
|
var _uiHeading = require("@instructure/ui-heading");
|
|
29
27
|
|
|
30
|
-
var
|
|
28
|
+
var _emotion = require("@instructure/emotion");
|
|
31
29
|
|
|
32
30
|
var _EditButton = _interopRequireDefault(require("../../editButton/EditButton.js"));
|
|
33
31
|
|
|
@@ -35,28 +33,19 @@ var _index = _interopRequireDefault(require("../Edit/index.js"));
|
|
|
35
33
|
|
|
36
34
|
var _index2 = _interopRequireDefault(require("../Show/index.js"));
|
|
37
35
|
|
|
36
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
37
|
+
|
|
38
38
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
39
39
|
|
|
40
40
|
var _formatMessage = _interopRequireDefault(require("@instructure/quiz-i18n/es/format-message"));
|
|
41
41
|
|
|
42
42
|
var _dec, _class, _class2, _temp;
|
|
43
43
|
|
|
44
|
-
var styles = {
|
|
45
|
-
componentId: 'bpmxb',
|
|
46
|
-
template: function template(theme) {
|
|
47
|
-
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}}");
|
|
48
|
-
},
|
|
49
|
-
'topRow': 'bpmxb_qYhL',
|
|
50
|
-
'editing': 'bpmxb_cocM',
|
|
51
|
-
'flexContainer': 'bpmxb_DlrZ',
|
|
52
|
-
'label': 'bpmxb_blJt',
|
|
53
|
-
'editButtonWrapper': 'bpmxb_UraS'
|
|
54
|
-
};
|
|
55
44
|
// ================================
|
|
56
45
|
// renders the editable quiz title
|
|
57
46
|
// input/display component
|
|
58
47
|
// ================================
|
|
59
|
-
var QuizTitlePresenter = (_dec = (0,
|
|
48
|
+
var QuizTitlePresenter = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
60
49
|
(0, _inherits2.default)(QuizTitlePresenter, _Component);
|
|
61
50
|
|
|
62
51
|
var _super = (0, _createSuper2.default)(QuizTitlePresenter);
|
|
@@ -117,10 +106,20 @@ var QuizTitlePresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default, sty
|
|
|
117
106
|
}
|
|
118
107
|
|
|
119
108
|
(0, _createClass2.default)(QuizTitlePresenter, [{
|
|
120
|
-
key: "
|
|
121
|
-
|
|
109
|
+
key: "componentDidMount",
|
|
110
|
+
value: function componentDidMount() {
|
|
111
|
+
this.props.makeStyles();
|
|
112
|
+
}
|
|
113
|
+
}, {
|
|
114
|
+
key: "componentDidUpdate",
|
|
115
|
+
value: function componentDidUpdate() {
|
|
116
|
+
this.props.makeStyles();
|
|
117
|
+
} // ===========
|
|
122
118
|
// helpers
|
|
123
119
|
// ===========
|
|
120
|
+
|
|
121
|
+
}, {
|
|
122
|
+
key: "quizID",
|
|
124
123
|
value: function quizID() {
|
|
125
124
|
return this.props.quiz.id;
|
|
126
125
|
}
|
|
@@ -157,7 +156,7 @@ var QuizTitlePresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default, sty
|
|
|
157
156
|
// ===============
|
|
158
157
|
value: function renderEdit() {
|
|
159
158
|
var quizTitleEditKey = 'quiz_title_edit';
|
|
160
|
-
return
|
|
159
|
+
return (0, _emotion.jsx)(_index.default, {
|
|
161
160
|
isValid: this.isValid(),
|
|
162
161
|
showError: (0, _partial.default)(this.props.showError, quizTitleEditKey),
|
|
163
162
|
hideError: (0, _partial.default)(this.props.hideError, quizTitleEditKey),
|
|
@@ -171,7 +170,7 @@ var QuizTitlePresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default, sty
|
|
|
171
170
|
}, {
|
|
172
171
|
key: "renderShow",
|
|
173
172
|
value: function renderShow() {
|
|
174
|
-
return
|
|
173
|
+
return (0, _emotion.jsx)(_index2.default, {
|
|
175
174
|
switchOnEditing: this.props.switchOnEditing,
|
|
176
175
|
defaultTitle: this.workingTitle(),
|
|
177
176
|
contentLocked: this.isContentLocked(),
|
|
@@ -181,21 +180,20 @@ var QuizTitlePresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default, sty
|
|
|
181
180
|
}, {
|
|
182
181
|
key: "render",
|
|
183
182
|
value: function render() {
|
|
184
|
-
var classnames = "".concat(styles.topRow, " ").concat(this.props.isEditing ? styles.editing : '');
|
|
185
183
|
var content = this.props.isEditing ? this.renderEdit() : this.renderShow();
|
|
186
|
-
return
|
|
184
|
+
return (0, _emotion.jsx)("div", {
|
|
187
185
|
tabIndex: "-1",
|
|
188
|
-
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
},
|
|
192
|
-
|
|
193
|
-
},
|
|
186
|
+
css: this.props.styles.topRow
|
|
187
|
+
}, (0, _emotion.jsx)("div", {
|
|
188
|
+
css: this.props.styles.flexContainer
|
|
189
|
+
}, (0, _emotion.jsx)("div", {
|
|
190
|
+
css: this.props.styles.label
|
|
191
|
+
}, (0, _emotion.jsx)(_uiHeading.Heading, {
|
|
194
192
|
level: "h4",
|
|
195
193
|
as: "h2"
|
|
196
|
-
}, (0, _formatMessage.default)('Title'))),
|
|
197
|
-
|
|
198
|
-
},
|
|
194
|
+
}, (0, _formatMessage.default)('Title'))), (0, _emotion.jsx)("div", null, content)), (0, _emotion.jsx)("div", null, !this.props.isEditing && !this.isContentLocked() && (0, _emotion.jsx)("div", {
|
|
195
|
+
css: this.props.styles.editButtonWrapper
|
|
196
|
+
}, (0, _emotion.jsx)(_EditButton.default, {
|
|
199
197
|
ref: this.handleEditButtonRef,
|
|
200
198
|
screenreaderText: (0, _formatMessage.default)('Edit Title'),
|
|
201
199
|
scrollKey: this.props.scrollKey,
|
|
@@ -223,7 +221,9 @@ var QuizTitlePresenter = (_dec = (0, _uiThemeable.themeable)(_theme.default, sty
|
|
|
223
221
|
// injected by makeEditable
|
|
224
222
|
switchOnEditing: _propTypes.default.func.isRequired,
|
|
225
223
|
// injected by makeEditable
|
|
226
|
-
workingQuiz: _reactImmutableProptypes.default.record.isRequired
|
|
224
|
+
workingQuiz: _reactImmutableProptypes.default.record.isRequired,
|
|
225
|
+
makeStyles: _propTypes.default.func,
|
|
226
|
+
styles: _propTypes.default.object
|
|
227
227
|
}, _class2.defaultProps = {
|
|
228
228
|
scrollKey: void 0
|
|
229
229
|
}, _temp)) || _class);
|
|
@@ -0,0 +1,50 @@
|
|
|
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 _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
+
|
|
14
|
+
var generateStyle = function generateStyle(componentTheme, props) {
|
|
15
|
+
var mp = '@media print';
|
|
16
|
+
return {
|
|
17
|
+
topRow: (0, _objectSpread3.default)((0, _defineProperty2.default)({
|
|
18
|
+
display: 'flex',
|
|
19
|
+
justifyContent: 'space-between',
|
|
20
|
+
borderBottom: componentTheme.titleShowWrapperBottomBorder
|
|
21
|
+
}, mp, {
|
|
22
|
+
display: 'none'
|
|
23
|
+
}), props.isEditing && {
|
|
24
|
+
borderBottom: 'solid',
|
|
25
|
+
borderWidth: componentTheme.titleEditWrapperBorderWidth,
|
|
26
|
+
borderColor: componentTheme.titleEditWrapperBorderColor
|
|
27
|
+
}),
|
|
28
|
+
flexContainer: {
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexDirection: 'column',
|
|
31
|
+
flexGrow: '1',
|
|
32
|
+
minWidth: '0'
|
|
33
|
+
},
|
|
34
|
+
label: {
|
|
35
|
+
padding: componentTheme.labelPadding,
|
|
36
|
+
paddingLeft: componentTheme.labelLeftPadding,
|
|
37
|
+
paddingBottom: componentTheme.labelBottomPadding,
|
|
38
|
+
fontSize: componentTheme.labelFontSize,
|
|
39
|
+
color: componentTheme.labelColor
|
|
40
|
+
},
|
|
41
|
+
editButtonWrapper: {
|
|
42
|
+
alignSelf: 'flex-end',
|
|
43
|
+
marginRight: componentTheme.editButtonWrapperRightMargin,
|
|
44
|
+
paddingTop: componentTheme.labelPadding
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var _default = generateStyle;
|
|
50
|
+
exports.default = _default;
|
|
@@ -0,0 +1,102 @@
|
|
|
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 _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
+
|
|
12
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
+
|
|
14
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
|
+
|
|
20
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
21
|
+
|
|
22
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
23
|
+
|
|
24
|
+
var _reduxStore = _interopRequireDefault(require("../../../../reduxStore.js"));
|
|
25
|
+
|
|
26
|
+
var _react = _interopRequireDefault(require("react"));
|
|
27
|
+
|
|
28
|
+
// ======================================================
|
|
29
|
+
// this component extends another component and will run
|
|
30
|
+
// the 'clickedOutside' function defined on that component
|
|
31
|
+
// if users click outside of it
|
|
32
|
+
// clickedOutside: called when the user clicks outside node
|
|
33
|
+
// ignoreClickOutsideIf: if returns true then do not run
|
|
34
|
+
// the clickedOutside callback
|
|
35
|
+
// ======================================================
|
|
36
|
+
var wrapWithOutsideClickEmotion = function wrapWithOutsideClickEmotion(ComposedComponent) {
|
|
37
|
+
return /*#__PURE__*/function (_React$Component) {
|
|
38
|
+
(0, _inherits2.default)(wrappedWithOutsideClick, _React$Component);
|
|
39
|
+
|
|
40
|
+
var _super = (0, _createSuper2.default)(wrappedWithOutsideClick);
|
|
41
|
+
|
|
42
|
+
function wrappedWithOutsideClick(props) {
|
|
43
|
+
var _this;
|
|
44
|
+
|
|
45
|
+
(0, _classCallCheck2.default)(this, wrappedWithOutsideClick);
|
|
46
|
+
_this = _super.call(this, props);
|
|
47
|
+
_this.checkForOutsideClick = _this.checkForOutsideClick.bind((0, _assertThisInitialized2.default)(_this));
|
|
48
|
+
return _this;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
(0, _createClass2.default)(wrappedWithOutsideClick, [{
|
|
52
|
+
key: "componentDidMount",
|
|
53
|
+
value: function componentDidMount() {
|
|
54
|
+
this.mouseDownEventCb = (0, _debounce.default)(this.checkForOutsideClick, 300, {
|
|
55
|
+
leading: true,
|
|
56
|
+
trailing: false
|
|
57
|
+
});
|
|
58
|
+
document.addEventListener('click', this.mouseDownEventCb, true);
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "componentWillUnmount",
|
|
62
|
+
value: function componentWillUnmount() {
|
|
63
|
+
document.removeEventListener('click', this.mouseDownEventCb, true);
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "checkcomponentRef",
|
|
67
|
+
value: function checkcomponentRef() {
|
|
68
|
+
return this.composedComponentRef && this.composedComponentRef.current;
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "checkForOutsideClick",
|
|
72
|
+
value: function checkForOutsideClick(e) {
|
|
73
|
+
var isModalOpen = _reduxStore.default.getAppState().getIn(['modal', 'isOpen']);
|
|
74
|
+
|
|
75
|
+
if (this.checkcomponentRef() && this.composedComponentRef.current.ignoreClickOutsideIf && this.composedComponentRef.current.ignoreClickOutsideIf(e) || isModalOpen) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (this.checkcomponentRef() && this.composedComponentRef.current.clickedOutside) {
|
|
80
|
+
var domNode = _reactDom.default.findDOMNode(this);
|
|
81
|
+
|
|
82
|
+
if (!(domNode && domNode.contains(e.target))) {
|
|
83
|
+
this.composedComponentRef.current.clickedOutside(e);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "render",
|
|
89
|
+
value: function render() {
|
|
90
|
+
this.composedComponentRef = /*#__PURE__*/_react.default.createRef();
|
|
91
|
+
return /*#__PURE__*/_react.default.createElement(ComposedComponent, Object.assign({
|
|
92
|
+
ref: this.composedComponentRef
|
|
93
|
+
}, this.props));
|
|
94
|
+
}
|
|
95
|
+
}]);
|
|
96
|
+
wrappedWithOutsideClick.displayName = "wrappedWithOutsideClick";
|
|
97
|
+
return wrappedWithOutsideClick;
|
|
98
|
+
}(_react.default.Component);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
var _default = wrapWithOutsideClickEmotion;
|
|
102
|
+
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/quiz-core",
|
|
3
|
-
"version": "20.10.1-rc.
|
|
3
|
+
"version": "20.10.1-rc.2+d7cf7930e",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The Quiz React SDK by Instructure Inc.",
|
|
6
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@instructure/emotion": "^8.51.0",
|
|
45
45
|
"@instructure/grading-utils": "^1.0.0",
|
|
46
46
|
"@instructure/outcomes-ui": "^3.1.0",
|
|
47
|
-
"@instructure/quiz-common": "20.10.1-rc.
|
|
48
|
-
"@instructure/quiz-i18n": "20.10.1-rc.
|
|
49
|
-
"@instructure/quiz-interactions": "20.10.1-rc.
|
|
50
|
-
"@instructure/quiz-number-input": "20.10.1-rc.
|
|
51
|
-
"@instructure/quiz-rce": "20.10.1-rc.
|
|
47
|
+
"@instructure/quiz-common": "20.10.1-rc.2+d7cf7930e",
|
|
48
|
+
"@instructure/quiz-i18n": "20.10.1-rc.2+d7cf7930e",
|
|
49
|
+
"@instructure/quiz-interactions": "20.10.1-rc.2+d7cf7930e",
|
|
50
|
+
"@instructure/quiz-number-input": "20.10.1-rc.2+d7cf7930e",
|
|
51
|
+
"@instructure/quiz-rce": "20.10.1-rc.2+d7cf7930e",
|
|
52
52
|
"@instructure/ui-a11y-content": "^8.51.0",
|
|
53
53
|
"@instructure/ui-alerts": "^8.51.0",
|
|
54
54
|
"@instructure/ui-avatar": "^8.51.0",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"file-saver": "~2.0.5",
|
|
113
113
|
"humps": "^2.0.0",
|
|
114
114
|
"immutable": "^3.8.1",
|
|
115
|
-
"instructure-validations": "20.10.1-rc.
|
|
115
|
+
"instructure-validations": "20.10.1-rc.2+d7cf7930e",
|
|
116
116
|
"ipaddr.js": "^1.5.4",
|
|
117
117
|
"isomorphic-fetch": "^2.2.0",
|
|
118
118
|
"isuuid": "^0.1.0",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"intl": "^1.2.4",
|
|
164
164
|
"jquery": "^2.2.3",
|
|
165
165
|
"most-subject": "^5.3.0",
|
|
166
|
-
"quiz-presets": "20.10.1-rc.
|
|
166
|
+
"quiz-presets": "20.10.1-rc.2+d7cf7930e",
|
|
167
167
|
"react": "^16.8.6",
|
|
168
168
|
"react-addons-test-utils": "^15.6.2",
|
|
169
169
|
"react-dom": "^16.8.6",
|
|
@@ -179,5 +179,5 @@
|
|
|
179
179
|
"publishConfig": {
|
|
180
180
|
"access": "public"
|
|
181
181
|
},
|
|
182
|
-
"gitHead": "
|
|
182
|
+
"gitHead": "d7cf7930e666e5646438cd6e3e124841d779de2d"
|
|
183
183
|
}
|