@instructure/ui-motion 11.7.3-snapshot-25 → 11.7.3-snapshot-27

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 CHANGED
@@ -3,9 +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
- ## [11.7.3-snapshot-25](https://github.com/instructure/instructure-ui/compare/v11.7.2...v11.7.3-snapshot-25) (2026-04-30)
6
+ ## [11.7.3-snapshot-27](https://github.com/instructure/instructure-ui/compare/v11.7.2...v11.7.3-snapshot-27) (2026-05-05)
7
7
 
8
- **Note:** Version bump only for package @instructure/ui-motion
8
+
9
+ ### Bug Fixes
10
+
11
+ * **many:** update dependencies, remove lots of Babel plugins, remove Webpack 4 support ([f916fca](https://github.com/instructure/instructure-ui/commit/f916fcafdddcb2d7de401f93e8ff92cfdfa47bba))
9
12
 
10
13
 
11
14
 
@@ -41,146 +41,33 @@ private: true
41
41
  so that it works with css modules. The internals are pretty different now, but it has roughly the same api.
42
42
  **/
43
43
  class BaseTransition extends Component {
44
- constructor(...args) {
45
- super(...args);
46
- this._timeouts = [];
47
- this._unmounted = false;
48
- this.state = {
49
- transitioning: false
50
- };
51
- this.ref = null;
52
- this.handleRef = el => {
53
- const elementRef = this.props.elementRef;
54
- this.ref = el;
55
- if (typeof elementRef === 'function') {
56
- elementRef(el);
57
- }
58
- };
59
- this.startTransition = (transitionIn, transitionOnStart) => {
60
- const _this$props = this.props,
61
- transitionEnter = _this$props.transitionEnter,
62
- transitionExit = _this$props.transitionExit;
63
- if (transitionIn) {
64
- this.enter(transitionEnter && transitionOnStart ? STATES.EXITED : null);
65
- } else {
66
- this.exit(transitionExit && transitionOnStart ? STATES.ENTERED : null);
67
- }
68
- };
69
- this.transition = (toState, fromState, transitionCallback, transitionDuration = 0) => {
70
- if (this._unmounted) return;
71
- const onTransition = this.props.onTransition;
72
- const classList = getClassList(this.ref);
73
- const transitionClassName = this.getTransitionClassName(toState);
74
- const prevTransitionClassName = this.getTransitionClassName(fromState);
75
- const baseTransitionClassName = this.props.transitionClassName;
76
- if (fromState && transitionDuration && this.transitionEnabled(toState)) {
77
- baseTransitionClassName && classList.add(baseTransitionClassName);
78
- } else {
79
- baseTransitionClassName && classList.remove(baseTransitionClassName);
80
- }
81
- if (prevTransitionClassName) {
82
- classList.remove(prevTransitionClassName);
83
- }
84
- if (transitionClassName) {
85
- classList.add(transitionClassName);
86
- }
87
- if (toState && fromState && typeof onTransition === 'function') {
88
- onTransition(toState, fromState);
89
- }
90
- this._timeouts.push(setTimeout(() => {
91
- if (this._unmounted) return;
92
- if (typeof transitionCallback === 'function') {
93
- transitionCallback();
94
- }
95
- }, transitionDuration));
96
- };
97
- this.enter = initialState => {
98
- if (this.state.transitioning || this._unmounted) return;
99
- const props = this.props;
100
- if (typeof props.onEnter === 'function') {
101
- props.onEnter();
102
- }
103
- if (props.transitionEnter) {
104
- this.setState({
105
- transitioning: true
106
- }, () => {
107
- const enter = () => {
108
- if (typeof props.onEntering === 'function') {
109
- props.onEntering();
110
- }
111
- this.transition(STATES.ENTERED, STATES.ENTERING, () => {
112
- this.setState({
113
- transitioning: false
114
- }, () => {
115
- if (typeof props.onEntered === 'function') {
116
- props.onEntered();
117
- }
118
- });
119
- });
120
- };
121
- if (initialState) {
122
- this.transition(initialState, null, () => {
123
- this.transition(STATES.ENTERING, initialState, enter, props.enterDelay);
124
- });
125
- } else {
126
- enter();
127
- }
128
- });
129
- } else {
130
- this.setState({
131
- transitioning: false
132
- }, () => {
133
- this.transition(STATES.ENTERED, STATES.EXITED);
134
- if (typeof props.onEntered === 'function') {
135
- props.onEntered();
136
- }
137
- });
138
- }
139
- };
140
- this.exit = initialState => {
141
- if (this.state.transitioning) return;
142
- const props = this.props;
143
- if (typeof props.onExit === 'function') {
144
- props.onExit();
145
- }
146
- if (props.transitionExit) {
147
- this.setState({
148
- transitioning: true
149
- }, () => {
150
- const exit = () => {
151
- if (typeof props.onExiting === 'function') {
152
- props.onExiting();
153
- }
154
- this.transition(STATES.EXITED, STATES.EXITING, () => {
155
- this.setState({
156
- transitioning: false
157
- }, () => {
158
- if (typeof props.onExited === 'function') {
159
- props.onExited();
160
- }
161
- });
162
- });
163
- };
164
- if (initialState) {
165
- this.transition(initialState, null, () => {
166
- this.transition(STATES.EXITING, initialState, exit, props.exitDelay);
167
- });
168
- } else {
169
- exit();
170
- }
171
- });
172
- } else {
173
- this.setState({
174
- transitioning: false
175
- }, () => {
176
- this.transition(STATES.EXITED, STATES.ENTERED);
177
- if (typeof props.onExited === 'function') {
178
- props.onExited();
179
- }
180
- });
181
- }
182
- };
183
- }
44
+ static displayName = "BaseTransition";
45
+ static allowedProps = allowedProps;
46
+ static defaultProps = {
47
+ in: false,
48
+ unmountOnExit: false,
49
+ transitionOnMount: false,
50
+ transitionEnter: true,
51
+ transitionExit: true,
52
+ enterDelay: 300,
53
+ exitDelay: 300
54
+ };
55
+ static states = STATES;
56
+ _timeouts = [];
57
+ _unmounted = false;
58
+ state = {
59
+ transitioning: false
60
+ };
61
+ ref = null;
62
+ handleRef = el => {
63
+ const {
64
+ elementRef
65
+ } = this.props;
66
+ this.ref = el;
67
+ if (typeof elementRef === 'function') {
68
+ elementRef(el);
69
+ }
70
+ };
184
71
  componentDidMount() {
185
72
  this.startTransition(this.props.in, this.props.transitionOnMount);
186
73
  this._unmounted = false;
@@ -215,6 +102,47 @@ class BaseTransition extends Component {
215
102
  });
216
103
  this._unmounted = true;
217
104
  }
105
+ startTransition = (transitionIn, transitionOnStart) => {
106
+ const {
107
+ transitionEnter,
108
+ transitionExit
109
+ } = this.props;
110
+ if (transitionIn) {
111
+ this.enter(transitionEnter && transitionOnStart ? STATES.EXITED : null);
112
+ } else {
113
+ this.exit(transitionExit && transitionOnStart ? STATES.ENTERED : null);
114
+ }
115
+ };
116
+ transition = (toState, fromState, transitionCallback, transitionDuration = 0) => {
117
+ if (this._unmounted) return;
118
+ const {
119
+ onTransition
120
+ } = this.props;
121
+ const classList = getClassList(this.ref);
122
+ const transitionClassName = this.getTransitionClassName(toState);
123
+ const prevTransitionClassName = this.getTransitionClassName(fromState);
124
+ const baseTransitionClassName = this.props.transitionClassName;
125
+ if (fromState && transitionDuration && this.transitionEnabled(toState)) {
126
+ baseTransitionClassName && classList.add(baseTransitionClassName);
127
+ } else {
128
+ baseTransitionClassName && classList.remove(baseTransitionClassName);
129
+ }
130
+ if (prevTransitionClassName) {
131
+ classList.remove(prevTransitionClassName);
132
+ }
133
+ if (transitionClassName) {
134
+ classList.add(transitionClassName);
135
+ }
136
+ if (toState && fromState && typeof onTransition === 'function') {
137
+ onTransition(toState, fromState);
138
+ }
139
+ this._timeouts.push(setTimeout(() => {
140
+ if (this._unmounted) return;
141
+ if (typeof transitionCallback === 'function') {
142
+ transitionCallback();
143
+ }
144
+ }, transitionDuration));
145
+ };
218
146
  clearTransition(transitionClassName) {
219
147
  if (this._unmounted) return;
220
148
  this.setState({
@@ -231,8 +159,100 @@ class BaseTransition extends Component {
231
159
  classList.remove(transitionClassName);
232
160
  });
233
161
  }
162
+ enter = initialState => {
163
+ if (this.state.transitioning || this._unmounted) return;
164
+ const {
165
+ props
166
+ } = this;
167
+ if (typeof props.onEnter === 'function') {
168
+ props.onEnter();
169
+ }
170
+ if (props.transitionEnter) {
171
+ this.setState({
172
+ transitioning: true
173
+ }, () => {
174
+ const enter = () => {
175
+ if (typeof props.onEntering === 'function') {
176
+ props.onEntering();
177
+ }
178
+ this.transition(STATES.ENTERED, STATES.ENTERING, () => {
179
+ this.setState({
180
+ transitioning: false
181
+ }, () => {
182
+ if (typeof props.onEntered === 'function') {
183
+ props.onEntered();
184
+ }
185
+ });
186
+ });
187
+ };
188
+ if (initialState) {
189
+ this.transition(initialState, null, () => {
190
+ this.transition(STATES.ENTERING, initialState, enter, props.enterDelay);
191
+ });
192
+ } else {
193
+ enter();
194
+ }
195
+ });
196
+ } else {
197
+ this.setState({
198
+ transitioning: false
199
+ }, () => {
200
+ this.transition(STATES.ENTERED, STATES.EXITED);
201
+ if (typeof props.onEntered === 'function') {
202
+ props.onEntered();
203
+ }
204
+ });
205
+ }
206
+ };
207
+ exit = initialState => {
208
+ if (this.state.transitioning) return;
209
+ const {
210
+ props
211
+ } = this;
212
+ if (typeof props.onExit === 'function') {
213
+ props.onExit();
214
+ }
215
+ if (props.transitionExit) {
216
+ this.setState({
217
+ transitioning: true
218
+ }, () => {
219
+ const exit = () => {
220
+ if (typeof props.onExiting === 'function') {
221
+ props.onExiting();
222
+ }
223
+ this.transition(STATES.EXITED, STATES.EXITING, () => {
224
+ this.setState({
225
+ transitioning: false
226
+ }, () => {
227
+ if (typeof props.onExited === 'function') {
228
+ props.onExited();
229
+ }
230
+ });
231
+ });
232
+ };
233
+ if (initialState) {
234
+ this.transition(initialState, null, () => {
235
+ this.transition(STATES.EXITING, initialState, exit, props.exitDelay);
236
+ });
237
+ } else {
238
+ exit();
239
+ }
240
+ });
241
+ } else {
242
+ this.setState({
243
+ transitioning: false
244
+ }, () => {
245
+ this.transition(STATES.EXITED, STATES.ENTERED);
246
+ if (typeof props.onExited === 'function') {
247
+ props.onExited();
248
+ }
249
+ });
250
+ }
251
+ };
234
252
  transitionEnabled(toState) {
235
- const props = this.props;
253
+ const {
254
+ props
255
+ } = this;
236
256
  switch (toState) {
237
257
  case STATES.EXITED:
238
258
  case STATES.EXITING:
@@ -245,7 +265,9 @@ class BaseTransition extends Component {
245
265
  }
246
266
  }
247
267
  getTransitionClassName(transitionState) {
248
- const props = this.props;
268
+ const {
269
+ props
270
+ } = this;
249
271
  switch (transitionState) {
250
272
  case STATES.EXITED:
251
273
  return props.exitedClassName;
@@ -256,12 +278,12 @@ class BaseTransition extends Component {
256
278
  case STATES.EXITING:
257
279
  return props.exitingClassName;
258
280
  default:
259
- return void 0;
281
+ return undefined;
260
282
  }
261
283
  }
262
284
  renderChildren() {
263
285
  return this.props.children ? safeCloneElement(ensureSingleChild(this.props.children), {
264
- 'aria-hidden': !this.props.in ? true : void 0,
286
+ 'aria-hidden': !this.props.in ? true : undefined,
265
287
  ref: el => {
266
288
  const ref = findDOMNode(el) || null;
267
289
  this.handleRef(ref);
@@ -276,17 +298,5 @@ class BaseTransition extends Component {
276
298
  }
277
299
  }
278
300
  }
279
- BaseTransition.displayName = "BaseTransition";
280
- BaseTransition.allowedProps = allowedProps;
281
- BaseTransition.defaultProps = {
282
- in: false,
283
- unmountOnExit: false,
284
- transitionOnMount: false,
285
- transitionEnter: true,
286
- transitionExit: true,
287
- enterDelay: 300,
288
- exitDelay: 300
289
- };
290
- BaseTransition.states = STATES;
291
301
  export default BaseTransition;
292
302
  export { BaseTransition };
@@ -1,6 +1,4 @@
1
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- const _excluded = ["type", "children", "styles"];
3
- var _dec, _class, _Transition;
1
+ var _dec, _class;
4
2
  /*
5
3
  * The MIT License (MIT)
6
4
  *
@@ -40,53 +38,66 @@ category: components/utilities
40
38
  ---
41
39
  @module Transition
42
40
  **/
43
- let Transition = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_Transition = class Transition extends Component {
44
- constructor(...args) {
45
- super(...args);
46
- this.ref = null;
47
- this.handleRef = el => {
48
- const elementRef = this.props.elementRef;
49
- this.ref = el;
50
- if (typeof elementRef === 'function') {
51
- elementRef(el);
52
- }
53
- };
54
- this.handleExited = () => {
55
- if (typeof this.props.onExited === 'function') {
56
- this.props.onExited(this.props.type);
57
- }
58
- };
59
- this.handleEntered = () => {
60
- if (typeof this.props.onEntered === 'function') {
61
- this.props.onEntered(this.props.type);
62
- }
63
- };
64
- // Transition helper:
65
- // After emotion migration the only way to keep
66
- // the old BaseTransition functionality with adding and removing
67
- // classes was to add the `Global` helper of `emotion`
68
- // Todo: try to refactor or replace Transition/BaseTransition component in v9.0.0. so that it is not class based
69
- this.renderTransitionHelper = () => {
70
- const styles = this.props.styles;
71
- return _jsx(Global, {
72
- styles: styles === null || styles === void 0 ? void 0 : styles.globalStyles
73
- });
74
- };
75
- }
41
+ let Transition = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Transition extends Component {
42
+ static displayName = "Transition";
43
+ static componentId = 'Transition';
44
+ static allowedProps = allowedProps;
45
+ static defaultProps = {
46
+ type: 'fade',
47
+ in: false,
48
+ unmountOnExit: false,
49
+ transitionOnMount: false,
50
+ transitionEnter: true,
51
+ transitionExit: true
52
+ };
53
+ static states = BaseTransition.states;
54
+ ref = null;
55
+ handleRef = el => {
56
+ const {
57
+ elementRef
58
+ } = this.props;
59
+ this.ref = el;
60
+ if (typeof elementRef === 'function') {
61
+ elementRef(el);
62
+ }
63
+ };
76
64
  componentDidMount() {
77
- var _this$props$makeStyle, _this$props;
78
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
65
+ this.props.makeStyles?.();
79
66
  }
80
67
  componentDidUpdate() {
81
- var _this$props$makeStyle2, _this$props2;
82
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
68
+ this.props.makeStyles?.();
83
69
  }
70
+ handleExited = () => {
71
+ if (typeof this.props.onExited === 'function') {
72
+ this.props.onExited(this.props.type);
73
+ }
74
+ };
75
+ handleEntered = () => {
76
+ if (typeof this.props.onEntered === 'function') {
77
+ this.props.onEntered(this.props.type);
78
+ }
79
+ };
80
+
81
+ // Transition helper:
82
+ // After emotion migration the only way to keep
83
+ // the old BaseTransition functionality with adding and removing
84
+ // classes was to add the `Global` helper of `emotion`
85
+ // Todo: try to refactor or replace Transition/BaseTransition component in v9.0.0. so that it is not class based
86
+ renderTransitionHelper = () => {
87
+ const {
88
+ styles
89
+ } = this.props;
90
+ return _jsx(Global, {
91
+ styles: styles?.globalStyles
92
+ });
93
+ };
84
94
  render() {
85
- const _this$props3 = this.props,
86
- type = _this$props3.type,
87
- children = _this$props3.children,
88
- styles = _this$props3.styles,
89
- props = _objectWithoutProperties(_this$props3, _excluded);
95
+ const {
96
+ type,
97
+ children,
98
+ styles,
99
+ ...props
100
+ } = this.props;
90
101
  const duration = ms(styles.duration);
91
102
  return _jsxs(_Fragment, {
92
103
  children: [this.renderTransitionHelper(), _jsx(BaseTransition, {
@@ -105,13 +116,6 @@ let Transition = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(
105
116
  })]
106
117
  });
107
118
  }
108
- }, _Transition.displayName = "Transition", _Transition.componentId = 'Transition', _Transition.allowedProps = allowedProps, _Transition.defaultProps = {
109
- type: 'fade',
110
- in: false,
111
- unmountOnExit: false,
112
- transitionOnMount: false,
113
- transitionEnter: true,
114
- transitionExit: true
115
- }, _Transition.states = BaseTransition.states, _Transition)) || _class);
119
+ }) || _class);
116
120
  export default Transition;
117
121
  export { Transition };
@@ -37,7 +37,9 @@ const getClassNames = type => ({
37
37
  * @return The final style object, which will be used in the component
38
38
  */
39
39
  const generateStyle = (componentTheme, props) => {
40
- const type = props.type;
40
+ const {
41
+ type
42
+ } = props;
41
43
 
42
44
  /**
43
45
  * After emotion migration the only way to keep
@@ -28,10 +28,12 @@
28
28
  * @return {Object} The final theme object with the overrides and component variables
29
29
  */
30
30
  const generateComponentTheme = theme => {
31
- const transitions = theme.transitions;
31
+ const {
32
+ transitions
33
+ } = theme;
32
34
  const componentVariables = {
33
- duration: transitions === null || transitions === void 0 ? void 0 : transitions.duration,
34
- timing: transitions === null || transitions === void 0 ? void 0 : transitions.timing
35
+ duration: transitions?.duration,
36
+ timing: transitions?.timing
35
37
  };
36
38
  return {
37
39
  ...componentVariables