@instructure/ui-motion 8.8.1-snapshot.8 → 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.
Files changed (33) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/es/Transition/{BaseTransition.js → BaseTransition/index.js} +7 -120
  3. package/{src/Transition/types.ts → es/Transition/BaseTransition/props.js} +26 -26
  4. package/es/Transition/index.js +15 -83
  5. package/es/Transition/props.js +95 -0
  6. package/lib/Transition/{BaseTransition.js → BaseTransition/index.js} +8 -121
  7. package/lib/Transition/BaseTransition/props.js +60 -0
  8. package/lib/Transition/index.js +16 -84
  9. package/lib/Transition/props.js +106 -0
  10. package/package.json +12 -13
  11. package/src/Transition/{BaseTransition.ts → BaseTransition/index.ts} +12 -136
  12. package/src/Transition/BaseTransition/props.ts +187 -0
  13. package/src/Transition/index.tsx +15 -77
  14. package/src/Transition/props.ts +144 -0
  15. package/src/Transition/styles.ts +1 -1
  16. package/src/index.ts +1 -1
  17. package/types/Transition/BaseTransition/index.d.ts +101 -0
  18. package/types/Transition/BaseTransition/index.d.ts.map +1 -0
  19. package/types/Transition/BaseTransition/props.d.ts +102 -0
  20. package/types/Transition/BaseTransition/props.d.ts.map +1 -0
  21. package/types/Transition/index.d.ts +35 -62
  22. package/types/Transition/index.d.ts.map +1 -1
  23. package/types/Transition/props.d.ts +28 -0
  24. package/types/Transition/props.d.ts.map +1 -0
  25. package/types/Transition/styles.d.ts +1 -1
  26. package/types/index.d.ts +1 -1
  27. package/LICENSE.md +0 -27
  28. package/es/Transition/types.js +0 -1
  29. package/lib/Transition/types.js +0 -1
  30. package/types/Transition/BaseTransition.d.ts +0 -152
  31. package/types/Transition/BaseTransition.d.ts.map +0 -1
  32. package/types/Transition/types.d.ts +0 -19
  33. package/types/Transition/types.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [8.9.0](https://github.com/instructure/instructure-ui/compare/v8.8.0...v8.9.0) (2021-09-15)
7
+
8
+ ### Bug Fixes
9
+
10
+ - fix shared-types TS errors ([7b83164](https://github.com/instructure/instructure-ui/commit/7b83164f4c5872f3a217e010563f59bf584ae4fc))
11
+
6
12
  # [8.8.0](https://github.com/instructure/instructure-ui/compare/v8.7.0...v8.8.0) (2021-08-27)
7
13
 
8
14
  **Note:** Version bump only for package @instructure/ui-motion
@@ -22,9 +22,9 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
  import React from 'react';
25
- import PropTypes from 'prop-types';
26
25
  import { getClassList } from '@instructure/ui-dom-utils';
27
26
  import { ensureSingleChild, safeCloneElement } from '@instructure/ui-react-utils';
27
+ import { allowedProps, propTypes } from './props';
28
28
  const STATES = {
29
29
  EXITED: -2,
30
30
  EXITING: -1,
@@ -67,9 +67,9 @@ class BaseTransition extends React.Component {
67
67
  const baseTransitionClassName = this.props.transitionClassName;
68
68
 
69
69
  if (fromState && transitionDuration && this.transitionEnabled(toState)) {
70
- classList.add(baseTransitionClassName);
70
+ baseTransitionClassName && classList.add(baseTransitionClassName);
71
71
  } else {
72
- classList.remove(baseTransitionClassName);
72
+ baseTransitionClassName && classList.remove(baseTransitionClassName);
73
73
  }
74
74
 
75
75
  if (prevTransitionClassName) {
@@ -274,115 +274,8 @@ class BaseTransition extends React.Component {
274
274
  }
275
275
 
276
276
  BaseTransition.displayName = "BaseTransition";
277
- BaseTransition.propTypes = {
278
- /**
279
- * Show the component? Triggers the enter or exit animation.
280
- */
281
- in: PropTypes.bool,
282
-
283
- /**
284
- * Unmount the component (remove it from the DOM) when it is not shown.
285
- */
286
- unmountOnExit: PropTypes.bool,
287
-
288
- /**
289
- * Run the enter animation when the component mounts, if it is initially
290
- * shown
291
- */
292
- transitionOnMount: PropTypes.bool,
293
-
294
- /**
295
- * Run the enter animation
296
- */
297
- transitionEnter: PropTypes.bool,
298
-
299
- /**
300
- * Run the exit animation
301
- */
302
- transitionExit: PropTypes.bool,
303
-
304
- /**
305
- * A Timeout for the animation, in milliseconds, to ensure that a node doesn't
306
- * transition indefinately if the browser transitionEnd events are
307
- * canceled or interrupted.
308
- *
309
- * By default this is set to a high number (5 seconds) as a failsafe. You should consider
310
- * setting this to the duration of your animation (or a bit above it).
311
- */
312
- enterDelay: PropTypes.number,
313
-
314
- /**
315
- * A Timeout for the animation, in milliseconds, to ensure that a node doesn't
316
- * transition indefinately if the browser transitionEnd events are
317
- * canceled or interrupted.
318
- *
319
- * By default this is set to a high number (5 seconds) as a failsafe. You should consider
320
- * setting this to the duration of your animation (or a bit above it).
321
- */
322
- exitDelay: PropTypes.number,
323
-
324
- /**
325
- * the base CSS class for the transition (transitions go here)
326
- */
327
- transitionClassName: PropTypes.string,
328
-
329
- /**
330
- * CSS class or classes applied when the component is exited
331
- */
332
- exitedClassName: PropTypes.string,
333
-
334
- /**
335
- * CSS class or classes applied while the component is exiting
336
- */
337
- exitingClassName: PropTypes.string,
338
-
339
- /**
340
- * CSS class or classes applied when the component is entered
341
- */
342
- enteredClassName: PropTypes.string,
343
-
344
- /**
345
- * CSS class or classes applied while the component is entering
346
- */
347
- enteringClassName: PropTypes.string,
348
-
349
- /**
350
- * Callback fired when transitioning to the next state
351
- */
352
- onTransition: PropTypes.func,
353
-
354
- /**
355
- * Callback fired before the "entering" classes are applied
356
- */
357
- onEnter: PropTypes.func,
358
-
359
- /**
360
- * Callback fired after the "entering" classes are applied
361
- */
362
- onEntering: PropTypes.func,
363
-
364
- /**
365
- * Callback fired after the "enter" classes are applied
366
- */
367
- onEntered: PropTypes.func,
368
-
369
- /**
370
- * Callback fired before the "exiting" classes are applied
371
- */
372
- onExit: PropTypes.func,
373
-
374
- /**
375
- * Callback fired after the "exiting" classes are applied
376
- */
377
- onExiting: PropTypes.func,
378
-
379
- /**
380
- * Callback fired after the "exited" classes are applied
381
- */
382
- onExited: PropTypes.func,
383
- children: PropTypes.node,
384
- className: PropTypes.string
385
- };
277
+ BaseTransition.propTypes = propTypes;
278
+ BaseTransition.allowedProps = allowedProps;
386
279
  BaseTransition.defaultProps = {
387
280
  in: false,
388
281
  component: 'div',
@@ -398,14 +291,8 @@ BaseTransition.defaultProps = {
398
291
  onExit: function () {},
399
292
  onExiting: function () {},
400
293
  onExited: function () {},
401
- onTransition: function (toState, fromState) {},
402
- className: void 0,
403
- children: null,
404
- transitionClassName: void 0,
405
- exitedClassName: void 0,
406
- exitingClassName: void 0,
407
- enteredClassName: void 0,
408
- enteringClassName: void 0
294
+ onTransition: function () {},
295
+ children: null
409
296
  };
410
297
  BaseTransition.states = STATES;
411
298
  export default BaseTransition;
@@ -21,29 +21,29 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
-
25
- export type TransitionType =
26
- | 'fade'
27
- | 'scale'
28
- | 'slide-down'
29
- | 'slide-up'
30
- | 'slide-left'
31
- | 'slide-right'
32
-
33
- export type TransitionProps = {
34
- makeStyles?: (...args: any[]) => any
35
- styles?: any
36
- type?: TransitionType
37
- in?: boolean
38
- unmountOnExit?: boolean
39
- transitionOnMount?: boolean
40
- transitionEnter?: boolean
41
- transitionExit?: boolean
42
- onTransition?: (...args: any[]) => any
43
- onEnter?: (...args: any[]) => any
44
- onEntering?: (...args: any[]) => any
45
- onEntered?: (...args: any[]) => any
46
- onExit?: (...args: any[]) => any
47
- onExiting?: (...args: any[]) => any
48
- onExited?: (...args: any[]) => any
49
- }
24
+ import PropTypes from 'prop-types';
25
+ const propTypes = {
26
+ in: PropTypes.bool,
27
+ unmountOnExit: PropTypes.bool,
28
+ transitionOnMount: PropTypes.bool,
29
+ transitionEnter: PropTypes.bool,
30
+ transitionExit: PropTypes.bool,
31
+ enterDelay: PropTypes.number,
32
+ exitDelay: PropTypes.number,
33
+ transitionClassName: PropTypes.string,
34
+ exitedClassName: PropTypes.string,
35
+ exitingClassName: PropTypes.string,
36
+ enteredClassName: PropTypes.string,
37
+ enteringClassName: PropTypes.string,
38
+ onTransition: PropTypes.func,
39
+ onEnter: PropTypes.func,
40
+ onEntering: PropTypes.func,
41
+ onEntered: PropTypes.func,
42
+ onExit: PropTypes.func,
43
+ onExiting: PropTypes.func,
44
+ onExited: PropTypes.func,
45
+ children: PropTypes.node,
46
+ className: PropTypes.string
47
+ };
48
+ const allowedProps = ['in', 'unmountOnExit', 'transitionOnMount', 'transitionEnter', 'transitionExit', 'enterDelay', 'exitDelay', 'transitionClassName', 'exitedClassName', 'exitingClassName', 'enteredClassName', 'enteringClassName', 'onTransition', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited', 'children', 'className'];
49
+ export { propTypes, allowedProps };
@@ -33,13 +33,13 @@ var _dec, _dec2, _class, _class2, _temp;
33
33
  // test is breaking without importing React here
34
34
  // eslint-disable-next-line no-unused-vars
35
35
  import React, { Component } from 'react';
36
- import PropTypes from 'prop-types';
37
36
  import { ms } from '@instructure/ui-utils';
38
37
  import { testable } from '@instructure/ui-testable';
39
38
  import { withStyle, jsx, Global } from '@instructure/emotion';
40
39
  import generateStyle from './styles';
41
40
  import generateComponentTheme from './theme';
42
41
  import { BaseTransition } from './BaseTransition';
42
+ import { allowedProps, propTypes } from './props';
43
43
 
44
44
  /**
45
45
  ---
@@ -66,27 +66,31 @@ let Transition = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
66
66
  this.renderTransitionHelper = () => {
67
67
  const styles = this.props.styles;
68
68
  return jsx(Global, {
69
- styles: styles.globalStyles
69
+ styles: styles === null || styles === void 0 ? void 0 : styles.globalStyles
70
70
  });
71
71
  };
72
72
  }
73
73
 
74
74
  componentDidMount() {
75
- this.props.makeStyles();
75
+ var _this$props$makeStyle, _this$props;
76
+
77
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
76
78
  }
77
79
 
78
- componentDidUpdate(prevProps, prevState, snapshot) {
79
- this.props.makeStyles();
80
+ componentDidUpdate() {
81
+ var _this$props$makeStyle2, _this$props2;
82
+
83
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
80
84
  }
81
85
 
82
86
  render() {
83
87
  var _styles$classNames, _styles$classNames2, _styles$classNames3, _styles$classNames4, _styles$classNames5;
84
88
 
85
- const _this$props = this.props,
86
- type = _this$props.type,
87
- children = _this$props.children,
88
- styles = _this$props.styles,
89
- props = _objectWithoutProperties(_this$props, _excluded);
89
+ const _this$props3 = this.props,
90
+ type = _this$props3.type,
91
+ children = _this$props3.children,
92
+ styles = _this$props3.styles,
93
+ props = _objectWithoutProperties(_this$props3, _excluded);
90
94
 
91
95
  const duration = ms(styles === null || styles === void 0 ? void 0 : styles.duration);
92
96
  return jsx(React.Fragment, null, this.renderTransitionHelper(), jsx(BaseTransition, Object.assign({}, props, {
@@ -102,79 +106,7 @@ let Transition = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2
102
106
  }), children));
103
107
  }
104
108
 
105
- }, _class2.displayName = "Transition", _class2.componentId = 'Transition', _class2.propTypes = {
106
- // eslint-disable-next-line react/require-default-props
107
- makeStyles: PropTypes.func,
108
- // eslint-disable-next-line react/require-default-props
109
- styles: PropTypes.object,
110
- type: PropTypes.oneOf(['fade', 'scale', 'slide-down', 'slide-up', 'slide-left', 'slide-right']),
111
-
112
- /**
113
- * A single element to animate in and out
114
- */
115
- children: PropTypes.element,
116
-
117
- /**
118
- * Show the component; triggers the enter or exit animation
119
- */
120
- in: PropTypes.bool,
121
-
122
- /**
123
- * Unmount the component (remove it from the DOM) when it is not shown
124
- */
125
- unmountOnExit: PropTypes.bool,
126
-
127
- /**
128
- * Run the enter animation when the component mounts, if it is initially
129
- * shown
130
- */
131
- transitionOnMount: PropTypes.bool,
132
-
133
- /**
134
- * Run the enter animation
135
- */
136
- transitionEnter: PropTypes.bool,
137
-
138
- /**
139
- * Run the exit animation
140
- */
141
- transitionExit: PropTypes.bool,
142
-
143
- /**
144
- * Callback fired when transitioning to the next state
145
- */
146
- onTransition: PropTypes.func,
147
-
148
- /**
149
- * Callback fired before the "entering" classes are applied
150
- */
151
- onEnter: PropTypes.func,
152
-
153
- /**
154
- * Callback fired after the "entering" classes are applied
155
- */
156
- onEntering: PropTypes.func,
157
-
158
- /**
159
- * Callback fired after the "enter" classes are applied
160
- */
161
- onEntered: PropTypes.func,
162
-
163
- /**
164
- * Callback fired before the "exiting" classes are applied
165
- */
166
- onExit: PropTypes.func,
167
-
168
- /**
169
- * Callback fired after the "exiting" classes are applied
170
- */
171
- onExiting: PropTypes.func,
172
-
173
- /**
174
- * Callback fired after the "exited" classes are applied
175
- */
176
- onExited: PropTypes.func
177
- }, _class2.defaultProps = {
109
+ }, _class2.displayName = "Transition", _class2.componentId = 'Transition', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
178
110
  type: 'fade',
179
111
  in: false,
180
112
  unmountOnExit: false,
@@ -0,0 +1,95 @@
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 PropTypes from 'prop-types';
25
+ const propTypes = {
26
+ type: PropTypes.oneOf(['fade', 'scale', 'slide-down', 'slide-up', 'slide-left', 'slide-right']),
27
+
28
+ /**
29
+ * A single element to animate in and out
30
+ */
31
+ children: PropTypes.element,
32
+
33
+ /**
34
+ * Show the component; triggers the enter or exit animation
35
+ */
36
+ in: PropTypes.bool,
37
+
38
+ /**
39
+ * Unmount the component (remove it from the DOM) when it is not shown
40
+ */
41
+ unmountOnExit: PropTypes.bool,
42
+
43
+ /**
44
+ * Run the enter animation when the component mounts, if it is initially
45
+ * shown
46
+ */
47
+ transitionOnMount: PropTypes.bool,
48
+
49
+ /**
50
+ * Run the enter animation
51
+ */
52
+ transitionEnter: PropTypes.bool,
53
+
54
+ /**
55
+ * Run the exit animation
56
+ */
57
+ transitionExit: PropTypes.bool,
58
+
59
+ /**
60
+ * Callback fired when transitioning to the next state
61
+ */
62
+ onTransition: PropTypes.func,
63
+
64
+ /**
65
+ * Callback fired before the "entering" classes are applied
66
+ */
67
+ onEnter: PropTypes.func,
68
+
69
+ /**
70
+ * Callback fired after the "entering" classes are applied
71
+ */
72
+ onEntering: PropTypes.func,
73
+
74
+ /**
75
+ * Callback fired after the "enter" classes are applied
76
+ */
77
+ onEntered: PropTypes.func,
78
+
79
+ /**
80
+ * Callback fired before the "exiting" classes are applied
81
+ */
82
+ onExit: PropTypes.func,
83
+
84
+ /**
85
+ * Callback fired after the "exiting" classes are applied
86
+ */
87
+ onExiting: PropTypes.func,
88
+
89
+ /**
90
+ * Callback fired after the "exited" classes are applied
91
+ */
92
+ onExited: PropTypes.func
93
+ };
94
+ const allowedProps = ['type', 'children', 'in', 'unmountOnExit', 'transitionOnMount', 'transitionEnter', 'transitionExit', 'onTransition', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited'];
95
+ export { propTypes, allowedProps };