@instructure/ui-motion 8.33.1 → 8.33.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/CHANGELOG.md +4 -0
- package/es/Transition/BaseTransition/index.js +4 -54
- package/es/Transition/BaseTransition/props.js +3 -1
- package/es/Transition/TransitionLocator.js +2 -1
- package/es/Transition/index.js +4 -20
- package/es/Transition/props.js +1 -0
- package/es/Transition/styles.js +8 -7
- package/es/Transition/theme.js +2 -2
- package/lib/Transition/BaseTransition/index.js +4 -62
- package/lib/Transition/BaseTransition/props.js +3 -4
- package/lib/Transition/TransitionLocator.js +1 -3
- package/lib/Transition/index.js +4 -29
- package/lib/Transition/locator.js +0 -2
- package/lib/Transition/props.js +1 -6
- package/lib/Transition/styles.js +8 -9
- package/lib/Transition/theme.js +2 -3
- package/lib/index.js +0 -2
- package/package.json +11 -11
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = exports.BaseTransition = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _getClassList = require("@instructure/ui-dom-utils/lib/getClassList.js");
|
|
13
|
-
|
|
14
10
|
var _findDOMNode = require("@instructure/ui-dom-utils/lib/findDOMNode.js");
|
|
15
|
-
|
|
16
11
|
var _ensureSingleChild = require("@instructure/ui-react-utils/lib/ensureSingleChild.js");
|
|
17
|
-
|
|
18
12
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
19
|
-
|
|
20
13
|
var _props = require("./props");
|
|
21
|
-
|
|
22
14
|
/*
|
|
23
15
|
* The MIT License (MIT)
|
|
24
16
|
*
|
|
@@ -42,12 +34,14 @@ var _props = require("./props");
|
|
|
42
34
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
35
|
* SOFTWARE.
|
|
44
36
|
*/
|
|
37
|
+
|
|
45
38
|
const STATES = {
|
|
46
39
|
EXITED: -2,
|
|
47
40
|
EXITING: -1,
|
|
48
41
|
ENTERING: 1,
|
|
49
42
|
ENTERED: 2
|
|
50
43
|
};
|
|
44
|
+
|
|
51
45
|
/**
|
|
52
46
|
---
|
|
53
47
|
private: true
|
|
@@ -55,11 +49,9 @@ private: true
|
|
|
55
49
|
Note: this is forked from https://github.com/react-bootstrap/react-overlays/blob/master/src/Transition.js
|
|
56
50
|
so that it works with css modules. The internals are pretty different now, but it has roughly the same api.
|
|
57
51
|
**/
|
|
58
|
-
|
|
59
52
|
class BaseTransition extends _react.default.Component {
|
|
60
53
|
constructor() {
|
|
61
54
|
var _this;
|
|
62
|
-
|
|
63
55
|
super(...arguments);
|
|
64
56
|
_this = this;
|
|
65
57
|
this._timeouts = [];
|
|
@@ -68,75 +60,58 @@ class BaseTransition extends _react.default.Component {
|
|
|
68
60
|
transitioning: false
|
|
69
61
|
};
|
|
70
62
|
this.ref = null;
|
|
71
|
-
|
|
72
63
|
this.handleRef = el => {
|
|
73
64
|
const elementRef = this.props.elementRef;
|
|
74
65
|
this.ref = el;
|
|
75
|
-
|
|
76
66
|
if (typeof elementRef === 'function') {
|
|
77
67
|
elementRef(el);
|
|
78
68
|
}
|
|
79
69
|
};
|
|
80
|
-
|
|
81
70
|
this.startTransition = (transitionIn, transitionOnStart) => {
|
|
82
71
|
const _this$props = this.props,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
72
|
+
transitionEnter = _this$props.transitionEnter,
|
|
73
|
+
transitionExit = _this$props.transitionExit;
|
|
86
74
|
if (transitionIn) {
|
|
87
75
|
this.enter(transitionEnter && transitionOnStart ? STATES.EXITED : null);
|
|
88
76
|
} else {
|
|
89
77
|
this.exit(transitionExit && transitionOnStart ? STATES.ENTERED : null);
|
|
90
78
|
}
|
|
91
79
|
};
|
|
92
|
-
|
|
93
80
|
this.transition = function (toState, fromState, transitionCallback) {
|
|
94
81
|
let transitionDuration = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
|
|
95
82
|
if (_this._unmounted) return;
|
|
96
83
|
const onTransition = _this.props.onTransition;
|
|
97
84
|
const classList = (0, _getClassList.getClassList)(_this.ref);
|
|
98
|
-
|
|
99
85
|
const transitionClassName = _this.getTransitionClassName(toState);
|
|
100
|
-
|
|
101
86
|
const prevTransitionClassName = _this.getTransitionClassName(fromState);
|
|
102
|
-
|
|
103
87
|
const baseTransitionClassName = _this.props.transitionClassName;
|
|
104
|
-
|
|
105
88
|
if (fromState && transitionDuration && _this.transitionEnabled(toState)) {
|
|
106
89
|
baseTransitionClassName && classList.add(baseTransitionClassName);
|
|
107
90
|
} else {
|
|
108
91
|
baseTransitionClassName && classList.remove(baseTransitionClassName);
|
|
109
92
|
}
|
|
110
|
-
|
|
111
93
|
if (prevTransitionClassName) {
|
|
112
94
|
classList.remove(prevTransitionClassName);
|
|
113
95
|
}
|
|
114
|
-
|
|
115
96
|
if (transitionClassName) {
|
|
116
97
|
classList.add(transitionClassName);
|
|
117
98
|
}
|
|
118
|
-
|
|
119
99
|
if (toState && fromState && typeof onTransition === 'function') {
|
|
120
100
|
onTransition(toState, fromState);
|
|
121
101
|
}
|
|
122
|
-
|
|
123
102
|
_this._timeouts.push(setTimeout(() => {
|
|
124
103
|
if (_this._unmounted) return;
|
|
125
|
-
|
|
126
104
|
if (typeof transitionCallback === 'function') {
|
|
127
105
|
transitionCallback();
|
|
128
106
|
}
|
|
129
107
|
}, transitionDuration));
|
|
130
108
|
};
|
|
131
|
-
|
|
132
109
|
this.enter = initialState => {
|
|
133
110
|
if (this.state.transitioning || this._unmounted) return;
|
|
134
111
|
const props = this.props;
|
|
135
|
-
|
|
136
112
|
if (typeof props.onEnter === 'function') {
|
|
137
113
|
props.onEnter();
|
|
138
114
|
}
|
|
139
|
-
|
|
140
115
|
if (props.transitionEnter) {
|
|
141
116
|
this.setState({
|
|
142
117
|
transitioning: true
|
|
@@ -145,7 +120,6 @@ class BaseTransition extends _react.default.Component {
|
|
|
145
120
|
if (typeof props.onEntering === 'function') {
|
|
146
121
|
props.onEntering();
|
|
147
122
|
}
|
|
148
|
-
|
|
149
123
|
this.transition(STATES.ENTERED, STATES.ENTERING, () => {
|
|
150
124
|
this.setState({
|
|
151
125
|
transitioning: false
|
|
@@ -156,7 +130,6 @@ class BaseTransition extends _react.default.Component {
|
|
|
156
130
|
});
|
|
157
131
|
});
|
|
158
132
|
};
|
|
159
|
-
|
|
160
133
|
if (initialState) {
|
|
161
134
|
this.transition(initialState, null, () => {
|
|
162
135
|
this.transition(STATES.ENTERING, initialState, enter, props.enterDelay);
|
|
@@ -170,22 +143,18 @@ class BaseTransition extends _react.default.Component {
|
|
|
170
143
|
transitioning: false
|
|
171
144
|
}, () => {
|
|
172
145
|
this.transition(STATES.ENTERED, STATES.EXITED);
|
|
173
|
-
|
|
174
146
|
if (typeof props.onEntered === 'function') {
|
|
175
147
|
props.onEntered();
|
|
176
148
|
}
|
|
177
149
|
});
|
|
178
150
|
}
|
|
179
151
|
};
|
|
180
|
-
|
|
181
152
|
this.exit = initialState => {
|
|
182
153
|
if (this.state.transitioning) return;
|
|
183
154
|
const props = this.props;
|
|
184
|
-
|
|
185
155
|
if (typeof props.onExit === 'function') {
|
|
186
156
|
props.onExit();
|
|
187
157
|
}
|
|
188
|
-
|
|
189
158
|
if (props.transitionExit) {
|
|
190
159
|
this.setState({
|
|
191
160
|
transitioning: true
|
|
@@ -194,7 +163,6 @@ class BaseTransition extends _react.default.Component {
|
|
|
194
163
|
if (typeof props.onExiting === 'function') {
|
|
195
164
|
props.onExiting();
|
|
196
165
|
}
|
|
197
|
-
|
|
198
166
|
this.transition(STATES.EXITED, STATES.EXITING, () => {
|
|
199
167
|
this.setState({
|
|
200
168
|
transitioning: false
|
|
@@ -205,7 +173,6 @@ class BaseTransition extends _react.default.Component {
|
|
|
205
173
|
});
|
|
206
174
|
});
|
|
207
175
|
};
|
|
208
|
-
|
|
209
176
|
if (initialState) {
|
|
210
177
|
this.transition(initialState, null, () => {
|
|
211
178
|
this.transition(STATES.EXITING, initialState, exit, props.exitDelay);
|
|
@@ -219,7 +186,6 @@ class BaseTransition extends _react.default.Component {
|
|
|
219
186
|
transitioning: false
|
|
220
187
|
}, () => {
|
|
221
188
|
this.transition(STATES.EXITED, STATES.ENTERED);
|
|
222
|
-
|
|
223
189
|
if (typeof props.onExited === 'function') {
|
|
224
190
|
props.onExited();
|
|
225
191
|
}
|
|
@@ -227,43 +193,34 @@ class BaseTransition extends _react.default.Component {
|
|
|
227
193
|
}
|
|
228
194
|
};
|
|
229
195
|
}
|
|
230
|
-
|
|
231
196
|
componentDidMount() {
|
|
232
197
|
this.startTransition(this.props.in, this.props.transitionOnMount);
|
|
233
198
|
this._unmounted = false;
|
|
234
199
|
}
|
|
235
|
-
|
|
236
200
|
getSnapshotBeforeUpdate(prevProps, prevState) {
|
|
237
201
|
if (this.props.in !== prevProps.in && prevState.transitioning) {
|
|
238
202
|
// direction changed before previous transition finished
|
|
239
203
|
return true;
|
|
240
204
|
}
|
|
241
|
-
|
|
242
205
|
return null;
|
|
243
206
|
}
|
|
244
|
-
|
|
245
207
|
componentDidUpdate(prevProps, _prevState, cancelPrematurely) {
|
|
246
208
|
if (cancelPrematurely) {
|
|
247
209
|
this.clearTransition(prevProps.transitionClassName);
|
|
248
210
|
}
|
|
249
|
-
|
|
250
211
|
if (this.props.transitionClassName !== prevProps.transitionClassName) {
|
|
251
212
|
this.clearTransition(prevProps.transitionClassName);
|
|
252
213
|
}
|
|
253
|
-
|
|
254
214
|
if (prevProps.in !== this.props.in) {
|
|
255
215
|
this.startTransition(this.props.in, true);
|
|
256
216
|
}
|
|
257
217
|
}
|
|
258
|
-
|
|
259
218
|
componentWillUnmount() {
|
|
260
219
|
this._timeouts.forEach(timeout => {
|
|
261
220
|
clearTimeout(timeout);
|
|
262
221
|
});
|
|
263
|
-
|
|
264
222
|
this._unmounted = true;
|
|
265
223
|
}
|
|
266
|
-
|
|
267
224
|
clearTransition(transitionClassName) {
|
|
268
225
|
if (this._unmounted) return;
|
|
269
226
|
this.setState({
|
|
@@ -273,7 +230,6 @@ class BaseTransition extends _react.default.Component {
|
|
|
273
230
|
const classList = (0, _getClassList.getClassList)(this.ref);
|
|
274
231
|
Object.values(STATES).forEach(state => {
|
|
275
232
|
const className = this.getTransitionClassName(state);
|
|
276
|
-
|
|
277
233
|
if (className) {
|
|
278
234
|
classList.remove(className);
|
|
279
235
|
}
|
|
@@ -281,45 +237,34 @@ class BaseTransition extends _react.default.Component {
|
|
|
281
237
|
classList.remove(transitionClassName);
|
|
282
238
|
});
|
|
283
239
|
}
|
|
284
|
-
|
|
285
240
|
transitionEnabled(toState) {
|
|
286
241
|
const props = this.props;
|
|
287
|
-
|
|
288
242
|
switch (toState) {
|
|
289
243
|
case STATES.EXITED:
|
|
290
244
|
case STATES.EXITING:
|
|
291
245
|
return props.transitionExit;
|
|
292
|
-
|
|
293
246
|
case STATES.ENTERED:
|
|
294
247
|
case STATES.ENTERING:
|
|
295
248
|
return props.transitionEnter;
|
|
296
|
-
|
|
297
249
|
default:
|
|
298
250
|
return false;
|
|
299
251
|
}
|
|
300
252
|
}
|
|
301
|
-
|
|
302
253
|
getTransitionClassName(transitionState) {
|
|
303
254
|
const props = this.props;
|
|
304
|
-
|
|
305
255
|
switch (transitionState) {
|
|
306
256
|
case STATES.EXITED:
|
|
307
257
|
return props.exitedClassName;
|
|
308
|
-
|
|
309
258
|
case STATES.ENTERING:
|
|
310
259
|
return props.enteringClassName;
|
|
311
|
-
|
|
312
260
|
case STATES.ENTERED:
|
|
313
261
|
return props.enteredClassName;
|
|
314
|
-
|
|
315
262
|
case STATES.EXITING:
|
|
316
263
|
return props.exitingClassName;
|
|
317
|
-
|
|
318
264
|
default:
|
|
319
265
|
return void 0;
|
|
320
266
|
}
|
|
321
267
|
}
|
|
322
|
-
|
|
323
268
|
renderChildren() {
|
|
324
269
|
return this.props.children ? (0, _safeCloneElement.safeCloneElement)((0, _ensureSingleChild.ensureSingleChild)(this.props.children), {
|
|
325
270
|
'aria-hidden': !this.props.in ? true : void 0,
|
|
@@ -329,7 +274,6 @@ class BaseTransition extends _react.default.Component {
|
|
|
329
274
|
}
|
|
330
275
|
}) : null;
|
|
331
276
|
}
|
|
332
|
-
|
|
333
277
|
render() {
|
|
334
278
|
if (!this.props.in && this.props.unmountOnExit && !this.state.transitioning) {
|
|
335
279
|
return null;
|
|
@@ -337,9 +281,7 @@ class BaseTransition extends _react.default.Component {
|
|
|
337
281
|
return this.renderChildren();
|
|
338
282
|
}
|
|
339
283
|
}
|
|
340
|
-
|
|
341
284
|
}
|
|
342
|
-
|
|
343
285
|
exports.BaseTransition = BaseTransition;
|
|
344
286
|
BaseTransition.displayName = "BaseTransition";
|
|
345
287
|
BaseTransition.propTypes = _props.propTypes;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.transitionCommonPropTypes = exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,6 +29,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
const transitionCommonPropTypes = {
|
|
36
34
|
in: _propTypes.default.bool,
|
|
37
35
|
unmountOnExit: _propTypes.default.bool,
|
|
@@ -49,7 +47,8 @@ const transitionCommonPropTypes = {
|
|
|
49
47
|
elementRef: _propTypes.default.func
|
|
50
48
|
};
|
|
51
49
|
exports.transitionCommonPropTypes = transitionCommonPropTypes;
|
|
52
|
-
const propTypes = {
|
|
50
|
+
const propTypes = {
|
|
51
|
+
...transitionCommonPropTypes,
|
|
53
52
|
enterDelay: _propTypes.default.number,
|
|
54
53
|
exitDelay: _propTypes.default.number,
|
|
55
54
|
transitionClassName: _propTypes.default.string.isRequired,
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TransitionLocator = void 0;
|
|
7
|
-
|
|
8
7
|
var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
|
|
9
|
-
|
|
10
8
|
var _index = require("./index");
|
|
11
|
-
|
|
12
9
|
/*
|
|
13
10
|
* The MIT License (MIT)
|
|
14
11
|
*
|
|
@@ -32,6 +29,7 @@ var _index = require("./index");
|
|
|
32
29
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
30
|
* SOFTWARE.
|
|
34
31
|
*/
|
|
32
|
+
|
|
35
33
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
36
34
|
const TransitionLocator = (0, _locator.locator)(_index.Transition.selector);
|
|
37
35
|
exports.TransitionLocator = TransitionLocator;
|
package/lib/Transition/index.js
CHANGED
|
@@ -1,36 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = exports.Transition = void 0;
|
|
11
|
-
|
|
12
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
-
|
|
16
11
|
var _ms = require("@instructure/ui-utils/lib/ms.js");
|
|
17
|
-
|
|
18
12
|
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
19
|
-
|
|
20
13
|
var _emotion = require("@instructure/emotion");
|
|
21
|
-
|
|
22
14
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
23
|
-
|
|
24
15
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
25
|
-
|
|
26
16
|
var _BaseTransition = require("./BaseTransition");
|
|
27
|
-
|
|
28
17
|
var _props = require("./props");
|
|
29
|
-
|
|
30
18
|
const _excluded = ["type", "children", "styles"];
|
|
31
|
-
|
|
32
19
|
var _dec, _dec2, _class, _class2;
|
|
33
|
-
|
|
34
20
|
/**
|
|
35
21
|
---
|
|
36
22
|
category: components/utilities
|
|
@@ -42,28 +28,23 @@ let Transition = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
42
28
|
constructor() {
|
|
43
29
|
super(...arguments);
|
|
44
30
|
this.ref = null;
|
|
45
|
-
|
|
46
31
|
this.handleRef = el => {
|
|
47
32
|
const elementRef = this.props.elementRef;
|
|
48
33
|
this.ref = el;
|
|
49
|
-
|
|
50
34
|
if (typeof elementRef === 'function') {
|
|
51
35
|
elementRef(el);
|
|
52
36
|
}
|
|
53
37
|
};
|
|
54
|
-
|
|
55
38
|
this.handleExited = () => {
|
|
56
39
|
if (typeof this.props.onExited === 'function') {
|
|
57
40
|
this.props.onExited(this.props.type);
|
|
58
41
|
}
|
|
59
42
|
};
|
|
60
|
-
|
|
61
43
|
this.handleEntered = () => {
|
|
62
44
|
if (typeof this.props.onEntered === 'function') {
|
|
63
45
|
this.props.onEntered(this.props.type);
|
|
64
46
|
}
|
|
65
47
|
};
|
|
66
|
-
|
|
67
48
|
this.renderTransitionHelper = () => {
|
|
68
49
|
const styles = this.props.styles;
|
|
69
50
|
return (0, _emotion.jsx)(_emotion.Global, {
|
|
@@ -71,25 +52,20 @@ let Transition = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
71
52
|
});
|
|
72
53
|
};
|
|
73
54
|
}
|
|
74
|
-
|
|
75
55
|
componentDidMount() {
|
|
76
56
|
var _this$props$makeStyle, _this$props;
|
|
77
|
-
|
|
78
57
|
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
79
58
|
}
|
|
80
|
-
|
|
81
59
|
componentDidUpdate() {
|
|
82
60
|
var _this$props$makeStyle2, _this$props2;
|
|
83
|
-
|
|
84
61
|
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
85
62
|
}
|
|
86
|
-
|
|
87
63
|
render() {
|
|
88
64
|
const _this$props3 = this.props,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
65
|
+
type = _this$props3.type,
|
|
66
|
+
children = _this$props3.children,
|
|
67
|
+
styles = _this$props3.styles,
|
|
68
|
+
props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
93
69
|
const duration = (0, _ms.ms)(styles.duration);
|
|
94
70
|
return (0, _emotion.jsx)(_react.default.Fragment, null, this.renderTransitionHelper(), (0, _emotion.jsx)(_BaseTransition.BaseTransition, Object.assign({}, props, {
|
|
95
71
|
enterDelay: duration,
|
|
@@ -104,7 +80,6 @@ let Transition = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
|
|
|
104
80
|
elementRef: this.handleRef
|
|
105
81
|
}), children));
|
|
106
82
|
}
|
|
107
|
-
|
|
108
83
|
}, _class2.displayName = "Transition", _class2.componentId = 'Transition', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
109
84
|
type: 'fade',
|
|
110
85
|
in: false,
|
package/lib/Transition/props.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.transitionTypePropType = exports.propTypes = exports.allowedProps = void 0;
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _props = require("./BaseTransition/props");
|
|
13
|
-
|
|
14
10
|
/*
|
|
15
11
|
* The MIT License (MIT)
|
|
16
12
|
*
|
|
@@ -34,10 +30,9 @@ var _props = require("./BaseTransition/props");
|
|
|
34
30
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
35
31
|
* SOFTWARE.
|
|
36
32
|
*/
|
|
37
|
-
const transitionTypes = ['fade', 'scale', 'slide-down', 'slide-up', 'slide-left', 'slide-right'];
|
|
38
33
|
|
|
34
|
+
const transitionTypes = ['fade', 'scale', 'slide-down', 'slide-up', 'slide-left', 'slide-right'];
|
|
39
35
|
const transitionTypePropType = _propTypes.default.oneOf(transitionTypes);
|
|
40
|
-
|
|
41
36
|
exports.transitionTypePropType = transitionTypePropType;
|
|
42
37
|
const propTypes = {
|
|
43
38
|
type: transitionTypePropType,
|
package/lib/Transition/styles.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getClassNames = exports.generateStyle = exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -28,6 +27,7 @@ exports.getClassNames = exports.generateStyle = exports.default = void 0;
|
|
|
28
27
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
28
|
* SOFTWARE.
|
|
30
29
|
*/
|
|
30
|
+
|
|
31
31
|
const getClassNames = type => ({
|
|
32
32
|
transitioning: `transition--${type}-transitioning`,
|
|
33
33
|
exited: `transition--${type}-exited`,
|
|
@@ -35,6 +35,7 @@ const getClassNames = type => ({
|
|
|
35
35
|
entered: `transition--${type}-entered`,
|
|
36
36
|
entering: `transition--${type}-entering`
|
|
37
37
|
});
|
|
38
|
+
|
|
38
39
|
/**
|
|
39
40
|
* ---
|
|
40
41
|
* private: true
|
|
@@ -45,12 +46,10 @@ const getClassNames = type => ({
|
|
|
45
46
|
* @param {Object} state the state of the component, the style is applied to
|
|
46
47
|
* @return {Object} The final style object, which will be used in the component
|
|
47
48
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
49
|
exports.getClassNames = getClassNames;
|
|
51
|
-
|
|
52
50
|
const generateStyle = (componentTheme, props) => {
|
|
53
51
|
const type = props.type;
|
|
52
|
+
|
|
54
53
|
/**
|
|
55
54
|
* After emotion migration the only way to keep
|
|
56
55
|
* the old BaseTransition functionality with adding and removing
|
|
@@ -60,8 +59,8 @@ const generateStyle = (componentTheme, props) => {
|
|
|
60
59
|
*/
|
|
61
60
|
|
|
62
61
|
const baseTransition = `opacity ${componentTheme.duration} ${componentTheme.timing}, transform ${componentTheme.duration} ${componentTheme.timing}`;
|
|
63
|
-
/* Animation type: fade */
|
|
64
62
|
|
|
63
|
+
/* Animation type: fade */
|
|
65
64
|
const fadeAnimation = {
|
|
66
65
|
[`.transition--fade-transitioning`]: {
|
|
67
66
|
transition: baseTransition
|
|
@@ -75,8 +74,8 @@ const generateStyle = (componentTheme, props) => {
|
|
|
75
74
|
opacity: 1
|
|
76
75
|
}
|
|
77
76
|
};
|
|
78
|
-
/* Animation type: scale */
|
|
79
77
|
|
|
78
|
+
/* Animation type: scale */
|
|
80
79
|
const scaleAnimation = {
|
|
81
80
|
[`.transition--scale-transitioning`]: {
|
|
82
81
|
transition: baseTransition
|
|
@@ -92,6 +91,7 @@ const generateStyle = (componentTheme, props) => {
|
|
|
92
91
|
opacity: 1
|
|
93
92
|
}
|
|
94
93
|
};
|
|
94
|
+
|
|
95
95
|
/* Animation type: slide */
|
|
96
96
|
|
|
97
97
|
/*
|
|
@@ -103,7 +103,6 @@ const generateStyle = (componentTheme, props) => {
|
|
|
103
103
|
The base transition class enables/disables transitions
|
|
104
104
|
from one state to another, so transitions should be set there.
|
|
105
105
|
*/
|
|
106
|
-
|
|
107
106
|
const slideAnimation = {
|
|
108
107
|
[`.transition--slide-right-transitioning,
|
|
109
108
|
.transition--slide-left-transitioning,
|
|
@@ -148,13 +147,13 @@ const generateStyle = (componentTheme, props) => {
|
|
|
148
147
|
return {
|
|
149
148
|
duration: componentTheme.duration,
|
|
150
149
|
classNames: getClassNames(type),
|
|
151
|
-
globalStyles: {
|
|
150
|
+
globalStyles: {
|
|
151
|
+
...fadeAnimation,
|
|
152
152
|
...scaleAnimation,
|
|
153
153
|
...slideAnimation
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
156
|
};
|
|
157
|
-
|
|
158
157
|
exports.generateStyle = generateStyle;
|
|
159
158
|
var _default = generateStyle;
|
|
160
159
|
exports.default = _default;
|
package/lib/Transition/theme.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
/*
|
|
9
8
|
* The MIT License (MIT)
|
|
10
9
|
*
|
|
@@ -40,9 +39,9 @@ const generateComponentTheme = theme => {
|
|
|
40
39
|
duration: transitions === null || transitions === void 0 ? void 0 : transitions.duration,
|
|
41
40
|
timing: transitions === null || transitions === void 0 ? void 0 : transitions.timing
|
|
42
41
|
};
|
|
43
|
-
return {
|
|
42
|
+
return {
|
|
43
|
+
...componentVariables
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
-
|
|
47
46
|
var _default = generateComponentTheme;
|
|
48
47
|
exports.default = _default;
|
package/lib/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-motion",
|
|
3
|
-
"version": "8.33.
|
|
3
|
+
"version": "8.33.2",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,19 +23,19 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.33.
|
|
27
|
-
"@instructure/ui-test-locator": "8.33.
|
|
28
|
-
"@instructure/ui-test-utils": "8.33.
|
|
29
|
-
"@instructure/ui-themes": "8.33.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.33.2",
|
|
27
|
+
"@instructure/ui-test-locator": "8.33.2",
|
|
28
|
+
"@instructure/ui-test-utils": "8.33.2",
|
|
29
|
+
"@instructure/ui-themes": "8.33.2"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/runtime": "^7.13.10",
|
|
33
|
-
"@instructure/emotion": "8.33.
|
|
34
|
-
"@instructure/shared-types": "8.33.
|
|
35
|
-
"@instructure/ui-dom-utils": "8.33.
|
|
36
|
-
"@instructure/ui-react-utils": "8.33.
|
|
37
|
-
"@instructure/ui-testable": "8.33.
|
|
38
|
-
"@instructure/ui-utils": "8.33.
|
|
33
|
+
"@instructure/emotion": "8.33.2",
|
|
34
|
+
"@instructure/shared-types": "8.33.2",
|
|
35
|
+
"@instructure/ui-dom-utils": "8.33.2",
|
|
36
|
+
"@instructure/ui-react-utils": "8.33.2",
|
|
37
|
+
"@instructure/ui-testable": "8.33.2",
|
|
38
|
+
"@instructure/ui-utils": "8.33.2",
|
|
39
39
|
"prop-types": "^15"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|