@instructure/quiz-core 20.15.0 → 20.15.1-rc.0

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.
@@ -19,13 +19,39 @@ export var QuizzesSpinner = (_dec = withStyle(generateStyle, null), _dec(_class
19
19
 
20
20
  var _super = _createSuper(QuizzesSpinner);
21
21
 
22
- function QuizzesSpinner() {
22
+ function QuizzesSpinner(props) {
23
+ var _this;
24
+
23
25
  _classCallCheck(this, QuizzesSpinner);
24
26
 
25
- return _super.apply(this, arguments);
27
+ _this = _super.call(this, props);
28
+ _this.state = {
29
+ hidden: _this.props.delay && _this.props.delay > 0
30
+ };
31
+ return _this;
26
32
  }
27
33
 
28
34
  _createClass(QuizzesSpinner, [{
35
+ key: "componentDidMount",
36
+ value: function componentDidMount() {
37
+ var _this2 = this;
38
+
39
+ if (this.props.delay > 0) {
40
+ this.timer = setTimeout(function () {
41
+ _this2.setState({
42
+ hidden: false
43
+ });
44
+ }, this.props.delay);
45
+ }
46
+ }
47
+ }, {
48
+ key: "componentWillUnmount",
49
+ value: function componentWillUnmount() {
50
+ if (this.timer) {
51
+ clearTimeout(this.timer);
52
+ }
53
+ }
54
+ }, {
29
55
  key: "mainText",
30
56
  value: function mainText() {
31
57
  var _this$props = this.props,
@@ -42,9 +68,12 @@ export var QuizzesSpinner = (_dec = withStyle(generateStyle, null), _dec(_class
42
68
  value: function render() {
43
69
  var _this$props2 = this.props,
44
70
  size = _this$props2.size,
45
- minHeight = _this$props2.minHeight;
71
+ minHeight = _this$props2.minHeight,
72
+ styles = _this$props2.styles;
73
+ var hidden = this.state.hidden;
74
+ if (hidden) return null;
46
75
  return jsx("div", {
47
- css: this.props.styles.wrapper,
76
+ css: styles.wrapper,
48
77
  style: {
49
78
  minHeight: minHeight
50
79
  }
@@ -63,7 +92,8 @@ export var QuizzesSpinner = (_dec = withStyle(generateStyle, null), _dec(_class
63
92
  size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large']),
64
93
  color: PropTypes.string,
65
94
  minHeight: PropTypes.string,
66
- styles: PropTypes.object
95
+ styles: PropTypes.object,
96
+ delay: PropTypes.number
67
97
  }, _class2.defaultProps = {
68
98
  mainText: null,
69
99
  size: 'large',
@@ -38,12 +38,38 @@ var QuizzesSpinner = (_dec = (0, _emotion.withStyle)(_styles.default, null), _de
38
38
 
39
39
  var _super = (0, _createSuper2.default)(QuizzesSpinner);
40
40
 
41
- function QuizzesSpinner() {
41
+ function QuizzesSpinner(props) {
42
+ var _this;
43
+
42
44
  (0, _classCallCheck2.default)(this, QuizzesSpinner);
43
- return _super.apply(this, arguments);
45
+ _this = _super.call(this, props);
46
+ _this.state = {
47
+ hidden: _this.props.delay && _this.props.delay > 0
48
+ };
49
+ return _this;
44
50
  }
45
51
 
46
52
  (0, _createClass2.default)(QuizzesSpinner, [{
53
+ key: "componentDidMount",
54
+ value: function componentDidMount() {
55
+ var _this2 = this;
56
+
57
+ if (this.props.delay > 0) {
58
+ this.timer = setTimeout(function () {
59
+ _this2.setState({
60
+ hidden: false
61
+ });
62
+ }, this.props.delay);
63
+ }
64
+ }
65
+ }, {
66
+ key: "componentWillUnmount",
67
+ value: function componentWillUnmount() {
68
+ if (this.timer) {
69
+ clearTimeout(this.timer);
70
+ }
71
+ }
72
+ }, {
47
73
  key: "mainText",
48
74
  value: function mainText() {
49
75
  var _this$props = this.props,
@@ -60,9 +86,12 @@ var QuizzesSpinner = (_dec = (0, _emotion.withStyle)(_styles.default, null), _de
60
86
  value: function render() {
61
87
  var _this$props2 = this.props,
62
88
  size = _this$props2.size,
63
- minHeight = _this$props2.minHeight;
89
+ minHeight = _this$props2.minHeight,
90
+ styles = _this$props2.styles;
91
+ var hidden = this.state.hidden;
92
+ if (hidden) return null;
64
93
  return (0, _emotion.jsx)("div", {
65
- css: this.props.styles.wrapper,
94
+ css: styles.wrapper,
66
95
  style: {
67
96
  minHeight: minHeight
68
97
  }
@@ -80,7 +109,8 @@ var QuizzesSpinner = (_dec = (0, _emotion.withStyle)(_styles.default, null), _de
80
109
  size: _propTypes.default.oneOf(['x-small', 'small', 'medium', 'large']),
81
110
  color: _propTypes.default.string,
82
111
  minHeight: _propTypes.default.string,
83
- styles: _propTypes.default.object
112
+ styles: _propTypes.default.object,
113
+ delay: _propTypes.default.number
84
114
  }, _class2.defaultProps = {
85
115
  mainText: null,
86
116
  size: 'large',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/quiz-core",
3
- "version": "20.15.0",
3
+ "version": "20.15.1-rc.0+10eccaac3",
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.2.2",
47
- "@instructure/quiz-common": "^20.15.0",
48
- "@instructure/quiz-i18n": "^20.15.0",
49
- "@instructure/quiz-interactions": "^20.15.0",
50
- "@instructure/quiz-number-input": "^20.15.0",
51
- "@instructure/quiz-rce": "^20.15.0",
47
+ "@instructure/quiz-common": "20.15.1-rc.0+10eccaac3",
48
+ "@instructure/quiz-i18n": "20.15.1-rc.0+10eccaac3",
49
+ "@instructure/quiz-interactions": "20.15.1-rc.0+10eccaac3",
50
+ "@instructure/quiz-number-input": "20.15.1-rc.0+10eccaac3",
51
+ "@instructure/quiz-rce": "20.15.1-rc.0+10eccaac3",
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",
@@ -111,7 +111,7 @@
111
111
  "file-saver": "~2.0.5",
112
112
  "humps": "^2.0.0",
113
113
  "immutable": "^3.8.1",
114
- "instructure-validations": "^20.15.0",
114
+ "instructure-validations": "20.15.1-rc.0+10eccaac3",
115
115
  "ipaddr.js": "^1.5.4",
116
116
  "isomorphic-fetch": "^2.2.0",
117
117
  "isuuid": "^0.1.0",
@@ -142,7 +142,7 @@
142
142
  "uuid": "^3.2.1"
143
143
  },
144
144
  "devDependencies": {
145
- "@instructure/quiz-scripts": "^20.15.0",
145
+ "@instructure/quiz-scripts": "20.15.0",
146
146
  "@instructure/ui-axe-check": "^8.51.0",
147
147
  "@instructure/ui-babel-preset": "^7.22.1",
148
148
  "@instructure/ui-karma-config": "^7.22.1",
@@ -163,7 +163,7 @@
163
163
  "jquery": "^2.2.3",
164
164
  "karma-junit-reporter": "^2.0.1",
165
165
  "most-subject": "^5.3.0",
166
- "quiz-presets": "^20.15.0",
166
+ "quiz-presets": "20.15.1-rc.0+10eccaac3",
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": "2869f42867a86018c22320b7c43671eb3c1fa8dc"
182
+ "gitHead": "10eccaac38c53983784e217e9b5e92dfc921acf5"
183
183
  }