@instructure/ui-motion 8.11.2-snapshot.3 → 8.11.2-snapshot.45
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/Transition/BaseTransition/index.js +46 -27
- package/es/Transition/BaseTransition/props.js +12 -10
- package/es/Transition/index.js +8 -17
- package/es/Transition/props.js +4 -67
- package/es/Transition/styles.js +11 -8
- package/lib/Transition/BaseTransition/index.js +46 -27
- package/lib/Transition/BaseTransition/props.js +13 -10
- package/lib/Transition/index.js +8 -17
- package/lib/Transition/props.js +6 -67
- package/lib/Transition/styles.js +14 -9
- package/package.json +12 -12
- package/src/Transition/BaseTransition/index.ts +88 -79
- package/src/Transition/BaseTransition/props.ts +93 -51
- package/src/Transition/index.tsx +15 -32
- package/src/Transition/props.ts +32 -88
- package/src/Transition/styles.ts +10 -9
- package/types/Transition/BaseTransition/index.d.ts +27 -66
- package/types/Transition/BaseTransition/index.d.ts.map +1 -1
- package/types/Transition/BaseTransition/props.d.ts +52 -38
- package/types/Transition/BaseTransition/props.d.ts.map +1 -1
- package/types/Transition/index.d.ts +5 -55
- package/types/Transition/index.d.ts.map +1 -1
- package/types/Transition/props.d.ts +14 -18
- package/types/Transition/props.d.ts.map +1 -1
- package/types/Transition/styles.d.ts +8 -0
- package/types/Transition/styles.d.ts.map +1 -1
|
@@ -27,7 +27,16 @@ import PropTypes from 'prop-types'
|
|
|
27
27
|
|
|
28
28
|
import type { PropValidators } from '@instructure/shared-types'
|
|
29
29
|
|
|
30
|
-
type
|
|
30
|
+
type TransitionType =
|
|
31
|
+
| 'fade'
|
|
32
|
+
| 'scale'
|
|
33
|
+
| 'slide-down'
|
|
34
|
+
| 'slide-up'
|
|
35
|
+
| 'slide-left'
|
|
36
|
+
| 'slide-right'
|
|
37
|
+
|
|
38
|
+
// These props get passed from Transition
|
|
39
|
+
type TransitionCommonProps = {
|
|
31
40
|
/**
|
|
32
41
|
* Show the component? Triggers the enter or exit animation.
|
|
33
42
|
*/
|
|
@@ -52,6 +61,46 @@ type BaseTransitionOwnProps = {
|
|
|
52
61
|
*/
|
|
53
62
|
transitionExit?: boolean
|
|
54
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Callback fired when transitioning to the next state
|
|
66
|
+
*/
|
|
67
|
+
onTransition?: (
|
|
68
|
+
toState: BaseTransitionStatesType,
|
|
69
|
+
fromState: BaseTransitionStatesType
|
|
70
|
+
) => void
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Callback fired before the "entering" classes are applied
|
|
74
|
+
*/
|
|
75
|
+
onEnter?: () => void
|
|
76
|
+
/**
|
|
77
|
+
* Callback fired after the "entering" classes are applied
|
|
78
|
+
*/
|
|
79
|
+
onEntering?: () => void
|
|
80
|
+
/**
|
|
81
|
+
* Callback fired after the "enter" classes are applied
|
|
82
|
+
*/
|
|
83
|
+
onEntered?: (type?: TransitionType) => void
|
|
84
|
+
/**
|
|
85
|
+
* Callback fired before the "exiting" classes are applied
|
|
86
|
+
*/
|
|
87
|
+
onExit?: () => void
|
|
88
|
+
/**
|
|
89
|
+
* Callback fired after the "exiting" classes are applied
|
|
90
|
+
*/
|
|
91
|
+
onExiting?: () => void
|
|
92
|
+
/**
|
|
93
|
+
* Callback fired after the "exited" classes are applied
|
|
94
|
+
*/
|
|
95
|
+
onExited?: (type?: TransitionType) => void
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* A single element to animate in and out
|
|
99
|
+
*/
|
|
100
|
+
children?: React.ReactNode
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
type OwnProps = {
|
|
55
104
|
/**
|
|
56
105
|
* A Timeout for the animation, in milliseconds, to ensure that a node doesn't
|
|
57
106
|
* transition indefinately if the browser transitionEnd events are
|
|
@@ -75,79 +124,46 @@ type BaseTransitionOwnProps = {
|
|
|
75
124
|
/**
|
|
76
125
|
* the base CSS class for the transition (transitions go here)
|
|
77
126
|
*/
|
|
78
|
-
transitionClassName
|
|
127
|
+
transitionClassName: string
|
|
79
128
|
|
|
80
129
|
/**
|
|
81
130
|
* CSS class or classes applied when the component is exited
|
|
82
131
|
*/
|
|
83
|
-
exitedClassName
|
|
132
|
+
exitedClassName: string
|
|
84
133
|
/**
|
|
85
134
|
* CSS class or classes applied while the component is exiting
|
|
86
135
|
*/
|
|
87
|
-
exitingClassName
|
|
136
|
+
exitingClassName: string
|
|
88
137
|
/**
|
|
89
138
|
* CSS class or classes applied when the component is entered
|
|
90
139
|
*/
|
|
91
|
-
enteredClassName
|
|
140
|
+
enteredClassName: string
|
|
92
141
|
/**
|
|
93
142
|
* CSS class or classes applied while the component is entering
|
|
94
143
|
*/
|
|
95
|
-
enteringClassName
|
|
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
|
|
144
|
+
enteringClassName: string
|
|
128
145
|
|
|
129
146
|
className?: string
|
|
130
147
|
}
|
|
131
148
|
|
|
149
|
+
// This intersection is needed for calculating allowedProps
|
|
150
|
+
type BaseTransitionOwnProps = TransitionCommonProps & OwnProps
|
|
151
|
+
|
|
152
|
+
// this is getting exported, might be extended later,
|
|
153
|
+
// that's why it is separated from BaseTransitionOwnProps
|
|
154
|
+
type BaseTransitionProps = BaseTransitionOwnProps
|
|
155
|
+
|
|
156
|
+
type CommonPropKeys = keyof TransitionCommonProps
|
|
132
157
|
type PropKeys = keyof BaseTransitionOwnProps
|
|
133
158
|
|
|
134
159
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
135
160
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
161
|
+
const transitionCommonPropTypes: PropValidators<CommonPropKeys> = {
|
|
139
162
|
in: PropTypes.bool,
|
|
140
163
|
unmountOnExit: PropTypes.bool,
|
|
141
164
|
transitionOnMount: PropTypes.bool,
|
|
142
165
|
transitionEnter: PropTypes.bool,
|
|
143
166
|
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
167
|
onTransition: PropTypes.func,
|
|
152
168
|
onEnter: PropTypes.func,
|
|
153
169
|
onEntering: PropTypes.func,
|
|
@@ -155,7 +171,19 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
155
171
|
onExit: PropTypes.func,
|
|
156
172
|
onExiting: PropTypes.func,
|
|
157
173
|
onExited: PropTypes.func,
|
|
158
|
-
children: PropTypes.node
|
|
174
|
+
children: PropTypes.node
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
178
|
+
...transitionCommonPropTypes,
|
|
179
|
+
|
|
180
|
+
enterDelay: PropTypes.number,
|
|
181
|
+
exitDelay: PropTypes.number,
|
|
182
|
+
transitionClassName: PropTypes.string.isRequired,
|
|
183
|
+
exitedClassName: PropTypes.string.isRequired,
|
|
184
|
+
exitingClassName: PropTypes.string.isRequired,
|
|
185
|
+
enteredClassName: PropTypes.string.isRequired,
|
|
186
|
+
enteringClassName: PropTypes.string.isRequired,
|
|
159
187
|
className: PropTypes.string
|
|
160
188
|
}
|
|
161
189
|
|
|
@@ -183,5 +211,19 @@ const allowedProps: AllowedPropKeys = [
|
|
|
183
211
|
'className'
|
|
184
212
|
]
|
|
185
213
|
|
|
186
|
-
|
|
187
|
-
|
|
214
|
+
type BaseTransitionState = {
|
|
215
|
+
transitioning: boolean
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
type BaseTransitionStateValue = 'EXITED' | 'EXITING' | 'ENTERING' | 'ENTERED'
|
|
219
|
+
type BaseTransitionStatesType = -2 | -1 | 1 | 2
|
|
220
|
+
|
|
221
|
+
export type {
|
|
222
|
+
BaseTransitionProps,
|
|
223
|
+
TransitionCommonProps,
|
|
224
|
+
TransitionType,
|
|
225
|
+
BaseTransitionState,
|
|
226
|
+
BaseTransitionStateValue,
|
|
227
|
+
BaseTransitionStatesType
|
|
228
|
+
}
|
|
229
|
+
export { propTypes, allowedProps, transitionCommonPropTypes }
|
package/src/Transition/index.tsx
CHANGED
|
@@ -46,6 +46,7 @@ import type { TransitionProps } from './props'
|
|
|
46
46
|
category: components/utilities
|
|
47
47
|
---
|
|
48
48
|
@module Transition
|
|
49
|
+
@tsProps
|
|
49
50
|
**/
|
|
50
51
|
@withStyle(generateStyle, generateComponentTheme)
|
|
51
52
|
@testable()
|
|
@@ -61,17 +62,7 @@ class Transition extends Component<TransitionProps> {
|
|
|
61
62
|
unmountOnExit: false,
|
|
62
63
|
transitionOnMount: false,
|
|
63
64
|
transitionEnter: true,
|
|
64
|
-
transitionExit: true
|
|
65
|
-
|
|
66
|
-
onEnter: function () {},
|
|
67
|
-
onEntering: function () {},
|
|
68
|
-
onEntered: function () {},
|
|
69
|
-
onExit: function () {},
|
|
70
|
-
onExiting: function () {},
|
|
71
|
-
onExited: function () {},
|
|
72
|
-
// @ts-expect-error ts-migrate(6133) FIXME: 'toState' is declared but its value is never read.
|
|
73
|
-
onTransition: function (toState, fromState) {},
|
|
74
|
-
children: null
|
|
65
|
+
transitionExit: true
|
|
75
66
|
}
|
|
76
67
|
|
|
77
68
|
static states = BaseTransition.states
|
|
@@ -86,24 +77,21 @@ class Transition extends Component<TransitionProps> {
|
|
|
86
77
|
|
|
87
78
|
handleExited = () => {
|
|
88
79
|
if (typeof this.props.onExited === 'function') {
|
|
89
|
-
this.props.onExited(this.props.type)
|
|
80
|
+
this.props.onExited(this.props.type!)
|
|
90
81
|
}
|
|
91
82
|
}
|
|
92
83
|
|
|
93
84
|
handleEntered = () => {
|
|
94
85
|
if (typeof this.props.onEntered === 'function') {
|
|
95
|
-
this.props.onEntered(this.props.type)
|
|
86
|
+
this.props.onEntered(this.props.type!)
|
|
96
87
|
}
|
|
97
88
|
}
|
|
98
89
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
*
|
|
105
|
-
* Todo: try to refactor or replace Transition/BaseTransition component in v9.0.0. so that it is not class based
|
|
106
|
-
*/
|
|
90
|
+
// Transition helper:
|
|
91
|
+
// After emotion migration the only way to keep
|
|
92
|
+
// the old BaseTransition functionality with adding and removing
|
|
93
|
+
// classes was to add the `Global` helper of `emotion`
|
|
94
|
+
// Todo: try to refactor or replace Transition/BaseTransition component in v9.0.0. so that it is not class based
|
|
107
95
|
renderTransitionHelper = () => {
|
|
108
96
|
const { styles } = this.props
|
|
109
97
|
|
|
@@ -113,7 +101,7 @@ class Transition extends Component<TransitionProps> {
|
|
|
113
101
|
render() {
|
|
114
102
|
const { type, children, styles, ...props } = this.props
|
|
115
103
|
|
|
116
|
-
const duration = ms(styles
|
|
104
|
+
const duration = ms(styles!.duration)
|
|
117
105
|
|
|
118
106
|
return (
|
|
119
107
|
<>
|
|
@@ -122,16 +110,11 @@ class Transition extends Component<TransitionProps> {
|
|
|
122
110
|
{...props}
|
|
123
111
|
enterDelay={duration}
|
|
124
112
|
exitDelay={duration}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
exitingClassName={styles?.classNames?.exiting}
|
|
131
|
-
//@ts-expect-error TODO:
|
|
132
|
-
enteredClassName={styles?.classNames?.entered}
|
|
133
|
-
//@ts-expect-error TODO:
|
|
134
|
-
enteringClassName={styles?.classNames?.entering}
|
|
113
|
+
transitionClassName={styles!.classNames.transitioning}
|
|
114
|
+
exitedClassName={styles!.classNames.exited}
|
|
115
|
+
exitingClassName={styles!.classNames.exiting}
|
|
116
|
+
enteredClassName={styles!.classNames.entered}
|
|
117
|
+
enteringClassName={styles!.classNames.entering}
|
|
135
118
|
onEntered={this.handleEntered}
|
|
136
119
|
onExited={this.handleExited}
|
|
137
120
|
>
|
package/src/Transition/props.ts
CHANGED
|
@@ -21,38 +21,36 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
import PropTypes from 'prop-types'
|
|
26
26
|
|
|
27
27
|
import type { PropValidators, TransitionTheme } from '@instructure/shared-types'
|
|
28
28
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
import { transitionCommonPropTypes } from './BaseTransition/props'
|
|
31
|
+
import type {
|
|
32
|
+
TransitionCommonProps,
|
|
33
|
+
TransitionType
|
|
34
|
+
} from './BaseTransition/props'
|
|
35
|
+
|
|
36
|
+
const transitionTypes: Readonly<Array<TransitionType>> = [
|
|
37
|
+
'fade',
|
|
38
|
+
'scale',
|
|
39
|
+
'slide-down',
|
|
40
|
+
'slide-up',
|
|
41
|
+
'slide-left',
|
|
42
|
+
'slide-right'
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
const transitionTypePropType = PropTypes.oneOf(transitionTypes)
|
|
37
46
|
|
|
38
|
-
|
|
39
|
-
type TransitionOwnProps = {
|
|
47
|
+
type OwnProps = {
|
|
40
48
|
type?: TransitionType
|
|
41
|
-
in?: boolean
|
|
42
|
-
unmountOnExit?: boolean
|
|
43
|
-
transitionOnMount?: boolean
|
|
44
|
-
transitionEnter?: boolean
|
|
45
|
-
transitionExit?: boolean
|
|
46
|
-
onTransition?: (...args: any[]) => any
|
|
47
|
-
onEnter?: (...args: any[]) => any
|
|
48
|
-
onEntering?: (...args: any[]) => any
|
|
49
|
-
onEntered?: (...args: any[]) => any
|
|
50
|
-
onExit?: (...args: any[]) => any
|
|
51
|
-
onExiting?: (...args: any[]) => any
|
|
52
|
-
onExited?: (...args: any[]) => any
|
|
53
|
-
children?: React.ReactNode
|
|
54
49
|
}
|
|
55
50
|
|
|
51
|
+
// TransitionCommonProps get passed to BaseTransition
|
|
52
|
+
type TransitionOwnProps = OwnProps & TransitionCommonProps
|
|
53
|
+
|
|
56
54
|
type PropKeys = keyof TransitionOwnProps
|
|
57
55
|
|
|
58
56
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
@@ -60,74 +58,20 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
|
60
58
|
type TransitionProps = TransitionOwnProps &
|
|
61
59
|
WithStyleProps<TransitionTheme, TransitionStyle>
|
|
62
60
|
|
|
63
|
-
type TransitionStyle = ComponentStyle<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
'slide-right'
|
|
74
|
-
])
|
|
61
|
+
type TransitionStyle = ComponentStyle<'globalStyles'> & {
|
|
62
|
+
duration: TransitionTheme['duration']
|
|
63
|
+
classNames: {
|
|
64
|
+
transitioning: string
|
|
65
|
+
exited: string
|
|
66
|
+
exiting: string
|
|
67
|
+
entered: string
|
|
68
|
+
entering: string
|
|
69
|
+
}
|
|
70
|
+
}
|
|
75
71
|
|
|
76
72
|
const propTypes: PropValidators<PropKeys> = {
|
|
77
73
|
type: transitionTypePropType,
|
|
78
|
-
|
|
79
|
-
* A single element to animate in and out
|
|
80
|
-
*/
|
|
81
|
-
children: PropTypes.element,
|
|
82
|
-
/**
|
|
83
|
-
* Show the component; triggers the enter or exit animation
|
|
84
|
-
*/
|
|
85
|
-
in: PropTypes.bool,
|
|
86
|
-
/**
|
|
87
|
-
* Unmount the component (remove it from the DOM) when it is not shown
|
|
88
|
-
*/
|
|
89
|
-
unmountOnExit: PropTypes.bool,
|
|
90
|
-
/**
|
|
91
|
-
* Run the enter animation when the component mounts, if it is initially
|
|
92
|
-
* shown
|
|
93
|
-
*/
|
|
94
|
-
transitionOnMount: PropTypes.bool,
|
|
95
|
-
/**
|
|
96
|
-
* Run the enter animation
|
|
97
|
-
*/
|
|
98
|
-
transitionEnter: PropTypes.bool,
|
|
99
|
-
/**
|
|
100
|
-
* Run the exit animation
|
|
101
|
-
*/
|
|
102
|
-
transitionExit: PropTypes.bool,
|
|
103
|
-
/**
|
|
104
|
-
* Callback fired when transitioning to the next state
|
|
105
|
-
*/
|
|
106
|
-
onTransition: PropTypes.func,
|
|
107
|
-
/**
|
|
108
|
-
* Callback fired before the "entering" classes are applied
|
|
109
|
-
*/
|
|
110
|
-
onEnter: PropTypes.func,
|
|
111
|
-
/**
|
|
112
|
-
* Callback fired after the "entering" classes are applied
|
|
113
|
-
*/
|
|
114
|
-
onEntering: PropTypes.func,
|
|
115
|
-
/**
|
|
116
|
-
* Callback fired after the "enter" classes are applied
|
|
117
|
-
*/
|
|
118
|
-
onEntered: PropTypes.func,
|
|
119
|
-
/**
|
|
120
|
-
* Callback fired before the "exiting" classes are applied
|
|
121
|
-
*/
|
|
122
|
-
onExit: PropTypes.func,
|
|
123
|
-
/**
|
|
124
|
-
* Callback fired after the "exiting" classes are applied
|
|
125
|
-
*/
|
|
126
|
-
onExiting: PropTypes.func,
|
|
127
|
-
/**
|
|
128
|
-
* Callback fired after the "exited" classes are applied
|
|
129
|
-
*/
|
|
130
|
-
onExited: PropTypes.func
|
|
74
|
+
...transitionCommonPropTypes
|
|
131
75
|
}
|
|
132
76
|
|
|
133
77
|
const allowedProps: AllowedPropKeys = [
|
package/src/Transition/styles.ts
CHANGED
|
@@ -25,6 +25,14 @@
|
|
|
25
25
|
import type { TransitionTheme } from '@instructure/shared-types'
|
|
26
26
|
import type { TransitionProps, TransitionStyle } from './props'
|
|
27
27
|
|
|
28
|
+
const getClassNames = (type: TransitionProps['type']) => ({
|
|
29
|
+
transitioning: `transition--${type}-transitioning`,
|
|
30
|
+
exited: `transition--${type}-exited`,
|
|
31
|
+
exiting: `transition--${type}-exiting`,
|
|
32
|
+
entered: `transition--${type}-entered`,
|
|
33
|
+
entering: `transition--${type}-entering`
|
|
34
|
+
})
|
|
35
|
+
|
|
28
36
|
/**
|
|
29
37
|
* ---
|
|
30
38
|
* private: true
|
|
@@ -140,15 +148,7 @@ const generateStyle = (
|
|
|
140
148
|
|
|
141
149
|
return {
|
|
142
150
|
duration: componentTheme.duration,
|
|
143
|
-
classNames: type
|
|
144
|
-
? {
|
|
145
|
-
transitioning: `transition--${type}-transitioning`,
|
|
146
|
-
exited: `transition--${type}-exited`,
|
|
147
|
-
exiting: `transition--${type}-exiting`,
|
|
148
|
-
entered: `transition--${type}-entered`,
|
|
149
|
-
entering: `transition--${type}-entering`
|
|
150
|
-
}
|
|
151
|
-
: {},
|
|
151
|
+
classNames: getClassNames(type),
|
|
152
152
|
globalStyles: {
|
|
153
153
|
...fadeAnimation,
|
|
154
154
|
...scaleAnimation,
|
|
@@ -157,4 +157,5 @@ const generateStyle = (
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
export { generateStyle, getClassNames }
|
|
160
161
|
export default generateStyle
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { BaseTransitionProps } from './props';
|
|
2
|
+
import type { BaseTransitionProps, BaseTransitionState, BaseTransitionStateValue, BaseTransitionStatesType } from './props';
|
|
3
3
|
/**
|
|
4
4
|
---
|
|
5
5
|
private: true
|
|
@@ -7,94 +7,55 @@ private: true
|
|
|
7
7
|
Note: this is forked from https://github.com/react-bootstrap/react-overlays/blob/master/src/Transition.js
|
|
8
8
|
so that it works with css modules. The internals are pretty different now, but it has roughly the same api.
|
|
9
9
|
**/
|
|
10
|
-
declare class BaseTransition extends React.Component<BaseTransitionProps> {
|
|
11
|
-
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
12
|
-
in?: boolean | undefined;
|
|
13
|
-
unmountOnExit?: boolean | undefined;
|
|
14
|
-
transitionOnMount?: boolean | undefined;
|
|
15
|
-
transitionEnter?: boolean | undefined;
|
|
16
|
-
transitionExit?: boolean | undefined;
|
|
10
|
+
declare class BaseTransition extends React.Component<BaseTransitionProps, BaseTransitionState> {
|
|
11
|
+
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof import("./props").TransitionCommonProps | keyof {
|
|
17
12
|
enterDelay?: number | undefined;
|
|
18
13
|
exitDelay?: number | undefined;
|
|
19
|
-
transitionClassName
|
|
20
|
-
exitedClassName
|
|
21
|
-
exitingClassName
|
|
22
|
-
enteredClassName
|
|
23
|
-
enteringClassName
|
|
24
|
-
onTransition?: ((toState: number, fromState: number) => void) | undefined;
|
|
25
|
-
onEnter?: (() => void) | undefined;
|
|
26
|
-
onEntering?: (() => void) | undefined;
|
|
27
|
-
onEntered?: (() => void) | undefined;
|
|
28
|
-
onExit?: (() => void) | undefined;
|
|
29
|
-
onExiting?: (() => void) | undefined;
|
|
30
|
-
onExited?: (() => void) | undefined;
|
|
31
|
-
children?: React.ReactNode;
|
|
14
|
+
transitionClassName: string;
|
|
15
|
+
exitedClassName: string;
|
|
16
|
+
exitingClassName: string;
|
|
17
|
+
enteredClassName: string;
|
|
18
|
+
enteringClassName: string;
|
|
32
19
|
className?: string | undefined;
|
|
33
20
|
}>;
|
|
34
|
-
static allowedProps: readonly (keyof {
|
|
35
|
-
in?: boolean | undefined;
|
|
36
|
-
unmountOnExit?: boolean | undefined;
|
|
37
|
-
transitionOnMount?: boolean | undefined;
|
|
38
|
-
transitionEnter?: boolean | undefined;
|
|
39
|
-
transitionExit?: boolean | undefined;
|
|
21
|
+
static allowedProps: readonly (keyof import("./props").TransitionCommonProps | keyof {
|
|
40
22
|
enterDelay?: number | undefined;
|
|
41
23
|
exitDelay?: number | undefined;
|
|
42
|
-
transitionClassName
|
|
43
|
-
exitedClassName
|
|
44
|
-
exitingClassName
|
|
45
|
-
enteredClassName
|
|
46
|
-
enteringClassName
|
|
47
|
-
onTransition?: ((toState: number, fromState: number) => void) | undefined;
|
|
48
|
-
onEnter?: (() => void) | undefined;
|
|
49
|
-
onEntering?: (() => void) | undefined;
|
|
50
|
-
onEntered?: (() => void) | undefined;
|
|
51
|
-
onExit?: (() => void) | undefined;
|
|
52
|
-
onExiting?: (() => void) | undefined;
|
|
53
|
-
onExited?: (() => void) | undefined;
|
|
54
|
-
children?: React.ReactNode;
|
|
24
|
+
transitionClassName: string;
|
|
25
|
+
exitedClassName: string;
|
|
26
|
+
exitingClassName: string;
|
|
27
|
+
enteredClassName: string;
|
|
28
|
+
enteringClassName: string;
|
|
55
29
|
className?: string | undefined;
|
|
56
30
|
})[];
|
|
57
31
|
static defaultProps: {
|
|
58
32
|
in: boolean;
|
|
59
|
-
component: string;
|
|
60
33
|
unmountOnExit: boolean;
|
|
61
34
|
transitionOnMount: boolean;
|
|
62
35
|
transitionEnter: boolean;
|
|
63
36
|
transitionExit: boolean;
|
|
64
37
|
enterDelay: number;
|
|
65
38
|
exitDelay: number;
|
|
66
|
-
onEnter: () => void;
|
|
67
|
-
onEntering: () => void;
|
|
68
|
-
onEntered: () => void;
|
|
69
|
-
onExit: () => void;
|
|
70
|
-
onExiting: () => void;
|
|
71
|
-
onExited: () => void;
|
|
72
|
-
onTransition: () => void;
|
|
73
|
-
children: null;
|
|
74
39
|
};
|
|
75
|
-
static states:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
ENTERING: number;
|
|
79
|
-
ENTERED: number;
|
|
80
|
-
};
|
|
81
|
-
_timeouts: never[];
|
|
40
|
+
static states: Record<BaseTransitionStateValue, BaseTransitionStatesType>;
|
|
41
|
+
_timeouts: ReturnType<typeof setTimeout>[];
|
|
42
|
+
_unmounted: boolean;
|
|
82
43
|
state: {
|
|
83
44
|
transitioning: boolean;
|
|
84
45
|
};
|
|
85
46
|
componentDidMount(): void;
|
|
86
|
-
getSnapshotBeforeUpdate(prevProps:
|
|
87
|
-
componentDidUpdate(prevProps:
|
|
47
|
+
getSnapshotBeforeUpdate(prevProps: BaseTransitionProps, prevState: BaseTransitionState): true | null;
|
|
48
|
+
componentDidUpdate(prevProps: BaseTransitionProps, _prevState: BaseTransitionState, cancelPrematurely: boolean): void;
|
|
88
49
|
componentWillUnmount(): void;
|
|
89
|
-
startTransition: (transitionIn:
|
|
90
|
-
transition: (toState:
|
|
91
|
-
clearTransition(transitionClassName:
|
|
92
|
-
enter: (initialState:
|
|
93
|
-
exit: (initialState:
|
|
94
|
-
transitionEnabled(toState:
|
|
95
|
-
getTransitionClassName(transitionState:
|
|
50
|
+
startTransition: (transitionIn: BaseTransitionProps['in'], transitionOnStart: BaseTransitionProps['transitionOnMount']) => void;
|
|
51
|
+
transition: (toState: BaseTransitionStatesType | null, fromState: BaseTransitionStatesType | null, transitionCallback?: (() => void) | undefined, transitionDuration?: number) => void;
|
|
52
|
+
clearTransition(transitionClassName: string): void;
|
|
53
|
+
enter: (initialState: BaseTransitionStatesType | null) => void;
|
|
54
|
+
exit: (initialState: BaseTransitionStatesType | null) => void;
|
|
55
|
+
transitionEnabled(toState: BaseTransitionStatesType | null): boolean | undefined;
|
|
56
|
+
getTransitionClassName(transitionState: BaseTransitionStatesType | null): string | undefined;
|
|
96
57
|
ref: React.RefObject<unknown>;
|
|
97
|
-
renderChildren(): React.ReactElement<any, string | React.JSXElementConstructor<any
|
|
58
|
+
renderChildren(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
98
59
|
render(): React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
99
60
|
}
|
|
100
61
|
export default BaseTransition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Transition/BaseTransition/index.ts"],"names":[],"mappings":"AAwBA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Transition/BaseTransition/index.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAkC,MAAM,OAAO,CAAA;AAStD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,SAAS,CAAA;AAShB;;;;;;GAMG;AACH,cAAM,cAAe,SAAQ,KAAK,CAAC,SAAS,CAC1C,mBAAmB,EACnB,mBAAmB,CACpB;IACC,MAAM,CAAC,SAAS;;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;;;;;;;MAQlB;IAED,MAAM,CAAC,MAAM,6DAAS;IAEtB,SAAS,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,EAAE,CAAK;IAC/C,UAAU,UAAQ;IAElB,KAAK;;MAEJ;IAED,iBAAiB;IAIjB,uBAAuB,CACrB,SAAS,EAAE,mBAAmB,EAC9B,SAAS,EAAE,mBAAmB;IAShC,kBAAkB,CAChB,SAAS,EAAE,mBAAmB,EAC9B,UAAU,EAAE,mBAAmB,EAC/B,iBAAiB,EAAE,OAAO;IAe5B,oBAAoB;IAOpB,eAAe,iBACC,mBAAmB,CAAC,IAAI,CAAC,qBACpB,mBAAmB,CAAC,mBAAmB,CAAC,UAQ5D;IAED,UAAU,YACC,wBAAwB,GAAG,IAAI,aAC7B,wBAAwB,GAAG,IAAI,8BACf,IAAI,oDAwChC;IAED,eAAe,CAAC,mBAAmB,EAAE,MAAM;IAqB3C,KAAK,iBAAkB,wBAAwB,GAAG,IAAI,UA4CrD;IAED,IAAI,iBAAkB,wBAAwB,GAAG,IAAI,UAuCpD;IAED,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,IAAI;IAe1D,sBAAsB,CAAC,eAAe,EAAE,wBAAwB,GAAG,IAAI;IAiBvE,GAAG,2BAAc;IAEjB,cAAc;IAYd,MAAM;CAWP;AAED,eAAe,cAAc,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,CAAA"}
|