@instructure/ui-motion 8.8.1-snapshot.3 → 8.9.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.
- package/CHANGELOG.md +6 -0
- package/es/Transition/{BaseTransition.js → BaseTransition/index.js} +7 -120
- package/{src/Transition/types.ts → es/Transition/BaseTransition/props.js} +26 -26
- package/es/Transition/index.js +15 -83
- package/es/Transition/props.js +95 -0
- package/lib/Transition/{BaseTransition.js → BaseTransition/index.js} +8 -121
- package/lib/Transition/BaseTransition/props.js +60 -0
- package/lib/Transition/index.js +16 -84
- package/lib/Transition/props.js +106 -0
- package/package.json +12 -13
- package/src/Transition/{BaseTransition.ts → BaseTransition/index.ts} +12 -136
- package/src/Transition/BaseTransition/props.ts +187 -0
- package/src/Transition/index.tsx +15 -77
- package/src/Transition/props.ts +144 -0
- package/src/Transition/styles.ts +1 -1
- package/src/index.ts +1 -1
- package/types/Transition/BaseTransition/index.d.ts +101 -0
- package/types/Transition/BaseTransition/index.d.ts.map +1 -0
- package/types/Transition/BaseTransition/props.d.ts +102 -0
- package/types/Transition/BaseTransition/props.d.ts.map +1 -0
- package/types/Transition/index.d.ts +35 -62
- package/types/Transition/index.d.ts.map +1 -1
- package/types/Transition/props.d.ts +28 -0
- package/types/Transition/props.d.ts.map +1 -0
- package/types/Transition/styles.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/LICENSE.md +0 -27
- package/es/Transition/types.js +0 -1
- package/lib/Transition/types.js +0 -1
- package/types/Transition/BaseTransition.d.ts +0 -152
- package/types/Transition/BaseTransition.d.ts.map +0 -1
- package/types/Transition/types.d.ts +0 -19
- package/types/Transition/types.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-motion",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.9.0",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -24,19 +24,19 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@instructure/
|
|
28
|
-
"@instructure/ui-
|
|
29
|
-
"@instructure/ui-test-
|
|
30
|
-
"@instructure/ui-
|
|
31
|
-
"@instructure/ui-themes": "8.8.1-snapshot.3+d5d6d4cd8"
|
|
27
|
+
"@instructure/ui-babel-preset": "8.9.0",
|
|
28
|
+
"@instructure/ui-test-locator": "8.9.0",
|
|
29
|
+
"@instructure/ui-test-utils": "8.9.0",
|
|
30
|
+
"@instructure/ui-themes": "8.9.0"
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
34
33
|
"@babel/runtime": "^7.13.10",
|
|
35
|
-
"@instructure/emotion": "8.
|
|
36
|
-
"@instructure/
|
|
37
|
-
"@instructure/ui-
|
|
38
|
-
"@instructure/ui-
|
|
39
|
-
"@instructure/ui-
|
|
34
|
+
"@instructure/emotion": "8.9.0",
|
|
35
|
+
"@instructure/shared-types": "8.9.0",
|
|
36
|
+
"@instructure/ui-dom-utils": "8.9.0",
|
|
37
|
+
"@instructure/ui-react-utils": "8.9.0",
|
|
38
|
+
"@instructure/ui-testable": "8.9.0",
|
|
39
|
+
"@instructure/ui-utils": "8.9.0",
|
|
40
40
|
"prop-types": "^15"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
@@ -45,6 +45,5 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
|
-
"sideEffects": false
|
|
49
|
-
"gitHead": "d5d6d4cd8f300e8635c69248f5d794c002269e08"
|
|
48
|
+
"sideEffects": false
|
|
50
49
|
}
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
26
|
|
|
28
27
|
import { getClassList } from '@instructure/ui-dom-utils'
|
|
29
28
|
import {
|
|
@@ -31,6 +30,9 @@ import {
|
|
|
31
30
|
safeCloneElement
|
|
32
31
|
} from '@instructure/ui-react-utils'
|
|
33
32
|
|
|
33
|
+
import { allowedProps, propTypes } from './props'
|
|
34
|
+
import type { BaseTransitionProps } from './props'
|
|
35
|
+
|
|
34
36
|
const STATES = {
|
|
35
37
|
EXITED: -2,
|
|
36
38
|
EXITING: -1,
|
|
@@ -45,109 +47,9 @@ private: true
|
|
|
45
47
|
Note: this is forked from https://github.com/react-bootstrap/react-overlays/blob/master/src/Transition.js
|
|
46
48
|
so that it works with css modules. The internals are pretty different now, but it has roughly the same api.
|
|
47
49
|
**/
|
|
48
|
-
class BaseTransition extends React.Component {
|
|
49
|
-
static propTypes =
|
|
50
|
-
|
|
51
|
-
* Show the component? Triggers the enter or exit animation.
|
|
52
|
-
*/
|
|
53
|
-
in: PropTypes.bool,
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Unmount the component (remove it from the DOM) when it is not shown.
|
|
57
|
-
*/
|
|
58
|
-
unmountOnExit: PropTypes.bool,
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Run the enter animation when the component mounts, if it is initially
|
|
62
|
-
* shown
|
|
63
|
-
*/
|
|
64
|
-
transitionOnMount: PropTypes.bool,
|
|
65
|
-
/**
|
|
66
|
-
* Run the enter animation
|
|
67
|
-
*/
|
|
68
|
-
transitionEnter: PropTypes.bool,
|
|
69
|
-
/**
|
|
70
|
-
* Run the exit animation
|
|
71
|
-
*/
|
|
72
|
-
transitionExit: PropTypes.bool,
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* A Timeout for the animation, in milliseconds, to ensure that a node doesn't
|
|
76
|
-
* transition indefinately if the browser transitionEnd events are
|
|
77
|
-
* canceled or interrupted.
|
|
78
|
-
*
|
|
79
|
-
* By default this is set to a high number (5 seconds) as a failsafe. You should consider
|
|
80
|
-
* setting this to the duration of your animation (or a bit above it).
|
|
81
|
-
*/
|
|
82
|
-
enterDelay: PropTypes.number,
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* A Timeout for the animation, in milliseconds, to ensure that a node doesn't
|
|
86
|
-
* transition indefinately if the browser transitionEnd events are
|
|
87
|
-
* canceled or interrupted.
|
|
88
|
-
*
|
|
89
|
-
* By default this is set to a high number (5 seconds) as a failsafe. You should consider
|
|
90
|
-
* setting this to the duration of your animation (or a bit above it).
|
|
91
|
-
*/
|
|
92
|
-
exitDelay: PropTypes.number,
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* the base CSS class for the transition (transitions go here)
|
|
96
|
-
*/
|
|
97
|
-
transitionClassName: PropTypes.string,
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* CSS class or classes applied when the component is exited
|
|
101
|
-
*/
|
|
102
|
-
exitedClassName: PropTypes.string,
|
|
103
|
-
/**
|
|
104
|
-
* CSS class or classes applied while the component is exiting
|
|
105
|
-
*/
|
|
106
|
-
exitingClassName: PropTypes.string,
|
|
107
|
-
/**
|
|
108
|
-
* CSS class or classes applied when the component is entered
|
|
109
|
-
*/
|
|
110
|
-
enteredClassName: PropTypes.string,
|
|
111
|
-
/**
|
|
112
|
-
* CSS class or classes applied while the component is entering
|
|
113
|
-
*/
|
|
114
|
-
enteringClassName: PropTypes.string,
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Callback fired when transitioning to the next state
|
|
118
|
-
*/
|
|
119
|
-
onTransition: PropTypes.func,
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Callback fired before the "entering" classes are applied
|
|
123
|
-
*/
|
|
124
|
-
onEnter: PropTypes.func,
|
|
125
|
-
/**
|
|
126
|
-
* Callback fired after the "entering" classes are applied
|
|
127
|
-
*/
|
|
128
|
-
onEntering: PropTypes.func,
|
|
129
|
-
/**
|
|
130
|
-
* Callback fired after the "enter" classes are applied
|
|
131
|
-
*/
|
|
132
|
-
onEntered: PropTypes.func,
|
|
133
|
-
/**
|
|
134
|
-
* Callback fired before the "exiting" classes are applied
|
|
135
|
-
*/
|
|
136
|
-
onExit: PropTypes.func,
|
|
137
|
-
/**
|
|
138
|
-
* Callback fired after the "exiting" classes are applied
|
|
139
|
-
*/
|
|
140
|
-
onExiting: PropTypes.func,
|
|
141
|
-
/**
|
|
142
|
-
* Callback fired after the "exited" classes are applied
|
|
143
|
-
*/
|
|
144
|
-
onExited: PropTypes.func,
|
|
145
|
-
|
|
146
|
-
children: PropTypes.node,
|
|
147
|
-
|
|
148
|
-
className: PropTypes.string
|
|
149
|
-
}
|
|
150
|
-
|
|
50
|
+
class BaseTransition extends React.Component<BaseTransitionProps> {
|
|
51
|
+
static propTypes = propTypes
|
|
52
|
+
static allowedProps = allowedProps
|
|
151
53
|
static defaultProps = {
|
|
152
54
|
in: false,
|
|
153
55
|
component: 'div',
|
|
@@ -166,16 +68,9 @@ class BaseTransition extends React.Component {
|
|
|
166
68
|
onExit: function () {},
|
|
167
69
|
onExiting: function () {},
|
|
168
70
|
onExited: function () {},
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
className: undefined,
|
|
173
|
-
children: null,
|
|
174
|
-
transitionClassName: undefined,
|
|
175
|
-
exitedClassName: undefined,
|
|
176
|
-
exitingClassName: undefined,
|
|
177
|
-
enteredClassName: undefined,
|
|
178
|
-
enteringClassName: undefined
|
|
71
|
+
onTransition: function () {},
|
|
72
|
+
|
|
73
|
+
children: null
|
|
179
74
|
}
|
|
180
75
|
|
|
181
76
|
static states = STATES
|
|
@@ -187,13 +82,11 @@ class BaseTransition extends React.Component {
|
|
|
187
82
|
}
|
|
188
83
|
|
|
189
84
|
componentDidMount() {
|
|
190
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'in' does not exist on type 'Readonly<{}>... Remove this comment to see the full error message
|
|
191
85
|
this.startTransition(this.props.in, this.props.transitionOnMount)
|
|
192
86
|
}
|
|
193
87
|
|
|
194
88
|
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'prevProps' implicitly has an 'any' type... Remove this comment to see the full error message
|
|
195
89
|
getSnapshotBeforeUpdate(prevProps, prevState) {
|
|
196
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'in' does not exist on type 'Readonly<{}>... Remove this comment to see the full error message
|
|
197
90
|
if (this.props.in !== prevProps.in && prevState.transitioning) {
|
|
198
91
|
// direction changed before previous transition finished
|
|
199
92
|
return true
|
|
@@ -207,14 +100,11 @@ class BaseTransition extends React.Component {
|
|
|
207
100
|
this.clearTransition(prevProps.transitionClassName)
|
|
208
101
|
}
|
|
209
102
|
|
|
210
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'transitionClassName' does not exist on t... Remove this comment to see the full error message
|
|
211
103
|
if (this.props.transitionClassName !== prevProps.transitionClassName) {
|
|
212
104
|
this.clearTransition(prevProps.transitionClassName)
|
|
213
105
|
}
|
|
214
106
|
|
|
215
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'in' does not exist on type 'Readonly<{}>... Remove this comment to see the full error message
|
|
216
107
|
if (prevProps.in !== this.props.in) {
|
|
217
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'in' does not exist on type 'Readonly<{}>... Remove this comment to see the full error message
|
|
218
108
|
this.startTransition(this.props.in, true)
|
|
219
109
|
}
|
|
220
110
|
}
|
|
@@ -229,7 +119,6 @@ class BaseTransition extends React.Component {
|
|
|
229
119
|
|
|
230
120
|
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'transitionIn' implicitly has an 'any' t... Remove this comment to see the full error message
|
|
231
121
|
startTransition = (transitionIn, transitionOnStart) => {
|
|
232
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'transitionEnter' does not exist on type ... Remove this comment to see the full error message
|
|
233
122
|
const { transitionEnter, transitionExit } = this.props
|
|
234
123
|
if (transitionIn) {
|
|
235
124
|
this.enter(transitionEnter && transitionOnStart ? STATES.EXITED : null)
|
|
@@ -254,13 +143,12 @@ class BaseTransition extends React.Component {
|
|
|
254
143
|
|
|
255
144
|
const transitionClassName = this.getTransitionClassName(toState)
|
|
256
145
|
const prevTransitionClassName = this.getTransitionClassName(fromState)
|
|
257
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'transitionClassName' does not exist on t... Remove this comment to see the full error message
|
|
258
146
|
const baseTransitionClassName = this.props.transitionClassName
|
|
259
147
|
|
|
260
148
|
if (fromState && transitionDuration && this.transitionEnabled(toState)) {
|
|
261
|
-
classList.add(baseTransitionClassName)
|
|
149
|
+
baseTransitionClassName && classList.add(baseTransitionClassName)
|
|
262
150
|
} else {
|
|
263
|
-
classList.remove(baseTransitionClassName)
|
|
151
|
+
baseTransitionClassName && classList.remove(baseTransitionClassName)
|
|
264
152
|
}
|
|
265
153
|
|
|
266
154
|
if (prevTransitionClassName) {
|
|
@@ -301,6 +189,7 @@ class BaseTransition extends React.Component {
|
|
|
301
189
|
const classList = getClassList(this)
|
|
302
190
|
|
|
303
191
|
Object.keys(STATES).forEach((state) => {
|
|
192
|
+
// @ts-expect-error FIXME: type
|
|
304
193
|
classList.remove(this.getTransitionClassName(state))
|
|
305
194
|
})
|
|
306
195
|
|
|
@@ -317,7 +206,6 @@ class BaseTransition extends React.Component {
|
|
|
317
206
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'onEnter' does not exist on type 'Readonl... Remove this comment to see the full error message
|
|
318
207
|
props.onEnter()
|
|
319
208
|
|
|
320
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'transitionEnter' does not exist on type ... Remove this comment to see the full error message
|
|
321
209
|
if (props.transitionEnter) {
|
|
322
210
|
this.setState({ transitioning: true }, () => {
|
|
323
211
|
const enter = () => {
|
|
@@ -336,7 +224,6 @@ class BaseTransition extends React.Component {
|
|
|
336
224
|
STATES.ENTERING,
|
|
337
225
|
initialState,
|
|
338
226
|
enter,
|
|
339
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'enterDelay' does not exist on type 'Read... Remove this comment to see the full error message
|
|
340
227
|
props.enterDelay
|
|
341
228
|
)
|
|
342
229
|
})
|
|
@@ -362,7 +249,6 @@ class BaseTransition extends React.Component {
|
|
|
362
249
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'onExit' does not exist on type 'Readonly... Remove this comment to see the full error message
|
|
363
250
|
props.onExit()
|
|
364
251
|
|
|
365
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'transitionExit' does not exist on type '... Remove this comment to see the full error message
|
|
366
252
|
if (props.transitionExit) {
|
|
367
253
|
this.setState({ transitioning: true }, () => {
|
|
368
254
|
const exit = () => {
|
|
@@ -377,7 +263,6 @@ class BaseTransition extends React.Component {
|
|
|
377
263
|
}
|
|
378
264
|
if (initialState) {
|
|
379
265
|
this.transition(initialState, null, () => {
|
|
380
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'exitDelay' does not exist on type 'Reado... Remove this comment to see the full error message
|
|
381
266
|
this.transition(STATES.EXITING, initialState, exit, props.exitDelay)
|
|
382
267
|
})
|
|
383
268
|
} else {
|
|
@@ -401,11 +286,9 @@ class BaseTransition extends React.Component {
|
|
|
401
286
|
switch (toState) {
|
|
402
287
|
case STATES.EXITED:
|
|
403
288
|
case STATES.EXITING:
|
|
404
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'transitionExit' does not exist on type '... Remove this comment to see the full error message
|
|
405
289
|
return props.transitionExit
|
|
406
290
|
case STATES.ENTERED:
|
|
407
291
|
case STATES.ENTERING:
|
|
408
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'transitionEnter' does not exist on type ... Remove this comment to see the full error message
|
|
409
292
|
return props.transitionEnter
|
|
410
293
|
default:
|
|
411
294
|
return false
|
|
@@ -417,16 +300,12 @@ class BaseTransition extends React.Component {
|
|
|
417
300
|
const { props } = this
|
|
418
301
|
switch (transitionState) {
|
|
419
302
|
case STATES.EXITED:
|
|
420
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'exitedClassName' does not exist on type ... Remove this comment to see the full error message
|
|
421
303
|
return props.exitedClassName
|
|
422
304
|
case STATES.ENTERING:
|
|
423
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'enteringClassName' does not exist on typ... Remove this comment to see the full error message
|
|
424
305
|
return props.enteringClassName
|
|
425
306
|
case STATES.ENTERED:
|
|
426
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'enteredClassName' does not exist on type... Remove this comment to see the full error message
|
|
427
307
|
return props.enteredClassName
|
|
428
308
|
case STATES.EXITING:
|
|
429
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'exitingClassName' does not exist on type... Remove this comment to see the full error message
|
|
430
309
|
return props.exitingClassName
|
|
431
310
|
default:
|
|
432
311
|
return null
|
|
@@ -435,16 +314,13 @@ class BaseTransition extends React.Component {
|
|
|
435
314
|
|
|
436
315
|
renderChildren() {
|
|
437
316
|
return safeCloneElement(ensureSingleChild(this.props.children)!, {
|
|
438
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'in' does not exist on type 'Readonly<{}>... Remove this comment to see the full error message
|
|
439
317
|
'aria-hidden': !this.props.in ? true : null
|
|
440
318
|
})
|
|
441
319
|
}
|
|
442
320
|
|
|
443
321
|
render() {
|
|
444
322
|
if (
|
|
445
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'in' does not exist on type 'Readonly<{}>... Remove this comment to see the full error message
|
|
446
323
|
!this.props.in &&
|
|
447
|
-
// @ts-expect-error ts-migrate(2339) FIXME: Property 'unmountOnExit' does not exist on type 'R... Remove this comment to see the full error message
|
|
448
324
|
this.props.unmountOnExit &&
|
|
449
325
|
!this.state.transitioning
|
|
450
326
|
) {
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import React from 'react'
|
|
25
|
+
import PropTypes from 'prop-types'
|
|
26
|
+
|
|
27
|
+
import type { PropValidators } from '@instructure/shared-types'
|
|
28
|
+
import type { WithStyleProps } from '@instructure/emotion'
|
|
29
|
+
|
|
30
|
+
type BaseTransitionOwnProps = {
|
|
31
|
+
/**
|
|
32
|
+
* Show the component? Triggers the enter or exit animation.
|
|
33
|
+
*/
|
|
34
|
+
in?: boolean
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Unmount the component (remove it from the DOM) when it is not shown.
|
|
38
|
+
*/
|
|
39
|
+
unmountOnExit?: boolean
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Run the enter animation when the component mounts, if it is initially
|
|
43
|
+
* shown
|
|
44
|
+
*/
|
|
45
|
+
transitionOnMount?: boolean
|
|
46
|
+
/**
|
|
47
|
+
* Run the enter animation
|
|
48
|
+
*/
|
|
49
|
+
transitionEnter?: boolean
|
|
50
|
+
/**
|
|
51
|
+
* Run the exit animation
|
|
52
|
+
*/
|
|
53
|
+
transitionExit?: boolean
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A Timeout for the animation, in milliseconds, to ensure that a node doesn't
|
|
57
|
+
* transition indefinately if the browser transitionEnd events are
|
|
58
|
+
* canceled or interrupted.
|
|
59
|
+
*
|
|
60
|
+
* By default this is set to a high number (5 seconds) as a failsafe. You should consider
|
|
61
|
+
* setting this to the duration of your animation (or a bit above it).
|
|
62
|
+
*/
|
|
63
|
+
enterDelay?: number
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A Timeout for the animation, in milliseconds, to ensure that a node doesn't
|
|
67
|
+
* transition indefinately if the browser transitionEnd events are
|
|
68
|
+
* canceled or interrupted.
|
|
69
|
+
*
|
|
70
|
+
* By default this is set to a high number (5 seconds) as a failsafe. You should consider
|
|
71
|
+
* setting this to the duration of your animation (or a bit above it).
|
|
72
|
+
*/
|
|
73
|
+
exitDelay?: number
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* the base CSS class for the transition (transitions go here)
|
|
77
|
+
*/
|
|
78
|
+
transitionClassName?: string
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* CSS class or classes applied when the component is exited
|
|
82
|
+
*/
|
|
83
|
+
exitedClassName?: string
|
|
84
|
+
/**
|
|
85
|
+
* CSS class or classes applied while the component is exiting
|
|
86
|
+
*/
|
|
87
|
+
exitingClassName?: string
|
|
88
|
+
/**
|
|
89
|
+
* CSS class or classes applied when the component is entered
|
|
90
|
+
*/
|
|
91
|
+
enteredClassName?: string
|
|
92
|
+
/**
|
|
93
|
+
* CSS class or classes applied while the component is entering
|
|
94
|
+
*/
|
|
95
|
+
enteringClassName?: string
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Callback fired when transitioning to the next state
|
|
99
|
+
*/
|
|
100
|
+
onTransition?: (toState: number, fromState: number) => void
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Callback fired before the "entering" classes are applied
|
|
104
|
+
*/
|
|
105
|
+
onEnter?: () => void
|
|
106
|
+
/**
|
|
107
|
+
* Callback fired after the "entering" classes are applied
|
|
108
|
+
*/
|
|
109
|
+
onEntering?: () => void
|
|
110
|
+
/**
|
|
111
|
+
* Callback fired after the "enter" classes are applied
|
|
112
|
+
*/
|
|
113
|
+
onEntered?: () => void
|
|
114
|
+
/**
|
|
115
|
+
* Callback fired before the "exiting" classes are applied
|
|
116
|
+
*/
|
|
117
|
+
onExit?: () => void
|
|
118
|
+
/**
|
|
119
|
+
* Callback fired after the "exiting" classes are applied
|
|
120
|
+
*/
|
|
121
|
+
onExiting?: () => void
|
|
122
|
+
/**
|
|
123
|
+
* Callback fired after the "exited" classes are applied
|
|
124
|
+
*/
|
|
125
|
+
onExited?: () => void
|
|
126
|
+
|
|
127
|
+
children?: React.ReactNode
|
|
128
|
+
|
|
129
|
+
className?: string
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
type PropKeys = keyof BaseTransitionOwnProps
|
|
133
|
+
|
|
134
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
135
|
+
|
|
136
|
+
type BaseTransitionProps = BaseTransitionOwnProps & WithStyleProps
|
|
137
|
+
|
|
138
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
139
|
+
in: PropTypes.bool,
|
|
140
|
+
unmountOnExit: PropTypes.bool,
|
|
141
|
+
transitionOnMount: PropTypes.bool,
|
|
142
|
+
transitionEnter: PropTypes.bool,
|
|
143
|
+
transitionExit: PropTypes.bool,
|
|
144
|
+
enterDelay: PropTypes.number,
|
|
145
|
+
exitDelay: PropTypes.number,
|
|
146
|
+
transitionClassName: PropTypes.string,
|
|
147
|
+
exitedClassName: PropTypes.string,
|
|
148
|
+
exitingClassName: PropTypes.string,
|
|
149
|
+
enteredClassName: PropTypes.string,
|
|
150
|
+
enteringClassName: PropTypes.string,
|
|
151
|
+
onTransition: PropTypes.func,
|
|
152
|
+
onEnter: PropTypes.func,
|
|
153
|
+
onEntering: PropTypes.func,
|
|
154
|
+
onEntered: PropTypes.func,
|
|
155
|
+
onExit: PropTypes.func,
|
|
156
|
+
onExiting: PropTypes.func,
|
|
157
|
+
onExited: PropTypes.func,
|
|
158
|
+
children: PropTypes.node,
|
|
159
|
+
className: PropTypes.string
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const allowedProps: AllowedPropKeys = [
|
|
163
|
+
'in',
|
|
164
|
+
'unmountOnExit',
|
|
165
|
+
'transitionOnMount',
|
|
166
|
+
'transitionEnter',
|
|
167
|
+
'transitionExit',
|
|
168
|
+
'enterDelay',
|
|
169
|
+
'exitDelay',
|
|
170
|
+
'transitionClassName',
|
|
171
|
+
'exitedClassName',
|
|
172
|
+
'exitingClassName',
|
|
173
|
+
'enteredClassName',
|
|
174
|
+
'enteringClassName',
|
|
175
|
+
'onTransition',
|
|
176
|
+
'onEnter',
|
|
177
|
+
'onEntering',
|
|
178
|
+
'onEntered',
|
|
179
|
+
'onExit',
|
|
180
|
+
'onExiting',
|
|
181
|
+
'onExited',
|
|
182
|
+
'children',
|
|
183
|
+
'className'
|
|
184
|
+
]
|
|
185
|
+
|
|
186
|
+
export type { BaseTransitionProps }
|
|
187
|
+
export { propTypes, allowedProps }
|