@instructure/ui-motion 11.6.0 → 11.6.1-pr-snapshot-1779894247159

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,6 +3,14 @@
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.6.1-pr-snapshot-1779894247159](https://github.com/instructure/instructure-ui/compare/v11.6.0...v11.6.1-pr-snapshot-1779894247159) (2026-05-27)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-motion
9
+
10
+
11
+
12
+
13
+
6
14
  # [11.6.0](https://github.com/instructure/instructure-ui/compare/v11.5.0...v11.6.0) (2026-02-18)
7
15
 
8
16
  **Note:** Version bump only for package @instructure/ui-motion
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.allowedProps = void 0;
7
1
  /*
8
2
  * The MIT License (MIT)
9
3
  *
@@ -28,6 +22,16 @@ exports.allowedProps = void 0;
28
22
  * SOFTWARE.
29
23
  */
30
24
 
31
- // TransitionCommonProps get passed to BaseTransition
32
-
33
- const allowedProps = exports.allowedProps = ['type', 'children', 'in', 'unmountOnExit', 'transitionOnMount', 'transitionEnter', 'transitionExit', 'onTransition', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited', 'elementRef'];
25
+ module.exports = {
26
+ presets: [
27
+ [
28
+ require('@instructure/ui-babel-preset'),
29
+ {
30
+ coverage: Boolean(process.env.COVERAGE),
31
+ esModules: Boolean(process.env.ES_MODULES),
32
+ removeConsole: process.env.NODE_ENV === 'production',
33
+ transformImports: Boolean(process.env.TRANSFORM_IMPORTS)
34
+ }
35
+ ]
36
+ ]
37
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@instructure/ui-motion",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-pr-snapshot-1779894247159",
4
+ "type": "module",
4
5
  "description": "A UI component library made by Instructure Inc.",
5
6
  "author": "Instructure, Inc. Engineering and Product Design",
6
7
  "module": "./es/index.js",
7
- "main": "./lib/index.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "repository": {
10
10
  "type": "git",
@@ -15,18 +15,18 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
- "@instructure/emotion": "11.6.0",
19
- "@instructure/ui-react-utils": "11.6.0",
20
- "@instructure/ui-dom-utils": "11.6.0",
21
- "@instructure/shared-types": "11.6.0",
22
- "@instructure/ui-utils": "11.6.0"
18
+ "@instructure/emotion": "11.6.1-pr-snapshot-1779894247159",
19
+ "@instructure/ui-dom-utils": "11.6.1-pr-snapshot-1779894247159",
20
+ "@instructure/ui-react-utils": "11.6.1-pr-snapshot-1779894247159",
21
+ "@instructure/shared-types": "11.6.1-pr-snapshot-1779894247159",
22
+ "@instructure/ui-utils": "11.6.1-pr-snapshot-1779894247159"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@testing-library/jest-dom": "^6.6.3",
26
26
  "@testing-library/react": "15.0.7",
27
27
  "vitest": "^3.2.2",
28
- "@instructure/ui-babel-preset": "11.6.0",
29
- "@instructure/ui-themes": "11.6.0"
28
+ "@instructure/ui-babel-preset": "11.6.1-pr-snapshot-1779894247159",
29
+ "@instructure/ui-themes": "11.6.1-pr-snapshot-1779894247159"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">=18 <=19"
@@ -39,10 +39,8 @@
39
39
  ".": {
40
40
  "types": "./types/index.d.ts",
41
41
  "import": "./es/index.js",
42
- "require": "./lib/index.js",
43
42
  "default": "./es/index.js"
44
43
  },
45
- "./lib/*": "./lib/*",
46
44
  "./es/*": "./es/*",
47
45
  "./types/*": "./types/*",
48
46
  "./package.json": "./package.json",
@@ -52,7 +50,7 @@
52
50
  "lint": "ui-scripts lint",
53
51
  "lint:fix": "ui-scripts lint --fix",
54
52
  "clean": "ui-scripts clean",
55
- "build": "ui-scripts build --modules es,cjs",
53
+ "build": "ui-scripts build",
56
54
  "build:watch": "pnpm run ts:check -- --watch & ui-scripts build --watch",
57
55
  "build:types": "tsc -p tsconfig.build.json",
58
56
  "ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
@@ -1,300 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.BaseTransition = void 0;
7
- var _react = require("react");
8
- var _getClassList = require("@instructure/ui-dom-utils/lib/getClassList.js");
9
- var _findDOMNode = require("@instructure/ui-dom-utils/lib/findDOMNode.js");
10
- var _ensureSingleChild = require("@instructure/ui-react-utils/lib/ensureSingleChild.js");
11
- var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
12
- var _props = require("./props");
13
- /*
14
- * The MIT License (MIT)
15
- *
16
- * Copyright (c) 2015 - present Instructure, Inc.
17
- *
18
- * Permission is hereby granted, free of charge, to any person obtaining a copy
19
- * of this software and associated documentation files (the "Software"), to deal
20
- * in the Software without restriction, including without limitation the rights
21
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22
- * copies of the Software, and to permit persons to whom the Software is
23
- * furnished to do so, subject to the following conditions:
24
- *
25
- * The above copyright notice and this permission notice shall be included in all
26
- * copies or substantial portions of the Software.
27
- *
28
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34
- * SOFTWARE.
35
- */
36
-
37
- const STATES = {
38
- EXITED: -2,
39
- EXITING: -1,
40
- ENTERING: 1,
41
- ENTERED: 2
42
- };
43
-
44
- /**
45
- ---
46
- private: true
47
- ---
48
- Note: this is forked from https://github.com/react-bootstrap/react-overlays/blob/master/src/Transition.js
49
- so that it works with css modules. The internals are pretty different now, but it has roughly the same api.
50
- **/
51
- class BaseTransition extends _react.Component {
52
- constructor(...args) {
53
- super(...args);
54
- this._timeouts = [];
55
- this._unmounted = false;
56
- this.state = {
57
- transitioning: false
58
- };
59
- this.ref = null;
60
- this.handleRef = el => {
61
- const elementRef = this.props.elementRef;
62
- this.ref = el;
63
- if (typeof elementRef === 'function') {
64
- elementRef(el);
65
- }
66
- };
67
- this.startTransition = (transitionIn, transitionOnStart) => {
68
- const _this$props = this.props,
69
- transitionEnter = _this$props.transitionEnter,
70
- transitionExit = _this$props.transitionExit;
71
- if (transitionIn) {
72
- this.enter(transitionEnter && transitionOnStart ? STATES.EXITED : null);
73
- } else {
74
- this.exit(transitionExit && transitionOnStart ? STATES.ENTERED : null);
75
- }
76
- };
77
- this.transition = (toState, fromState, transitionCallback, transitionDuration = 0) => {
78
- if (this._unmounted) return;
79
- const onTransition = this.props.onTransition;
80
- const classList = (0, _getClassList.getClassList)(this.ref);
81
- const transitionClassName = this.getTransitionClassName(toState);
82
- const prevTransitionClassName = this.getTransitionClassName(fromState);
83
- const baseTransitionClassName = this.props.transitionClassName;
84
- if (fromState && transitionDuration && this.transitionEnabled(toState)) {
85
- baseTransitionClassName && classList.add(baseTransitionClassName);
86
- } else {
87
- baseTransitionClassName && classList.remove(baseTransitionClassName);
88
- }
89
- if (prevTransitionClassName) {
90
- classList.remove(prevTransitionClassName);
91
- }
92
- if (transitionClassName) {
93
- classList.add(transitionClassName);
94
- }
95
- if (toState && fromState && typeof onTransition === 'function') {
96
- onTransition(toState, fromState);
97
- }
98
- this._timeouts.push(setTimeout(() => {
99
- if (this._unmounted) return;
100
- if (typeof transitionCallback === 'function') {
101
- transitionCallback();
102
- }
103
- }, transitionDuration));
104
- };
105
- this.enter = initialState => {
106
- if (this.state.transitioning || this._unmounted) return;
107
- const props = this.props;
108
- if (typeof props.onEnter === 'function') {
109
- props.onEnter();
110
- }
111
- if (props.transitionEnter) {
112
- this.setState({
113
- transitioning: true
114
- }, () => {
115
- const enter = () => {
116
- if (typeof props.onEntering === 'function') {
117
- props.onEntering();
118
- }
119
- this.transition(STATES.ENTERED, STATES.ENTERING, () => {
120
- this.setState({
121
- transitioning: false
122
- }, () => {
123
- if (typeof props.onEntered === 'function') {
124
- props.onEntered();
125
- }
126
- });
127
- });
128
- };
129
- if (initialState) {
130
- this.transition(initialState, null, () => {
131
- this.transition(STATES.ENTERING, initialState, enter, props.enterDelay);
132
- });
133
- } else {
134
- enter();
135
- }
136
- });
137
- } else {
138
- this.setState({
139
- transitioning: false
140
- }, () => {
141
- this.transition(STATES.ENTERED, STATES.EXITED);
142
- if (typeof props.onEntered === 'function') {
143
- props.onEntered();
144
- }
145
- });
146
- }
147
- };
148
- this.exit = initialState => {
149
- if (this.state.transitioning) return;
150
- const props = this.props;
151
- if (typeof props.onExit === 'function') {
152
- props.onExit();
153
- }
154
- if (props.transitionExit) {
155
- this.setState({
156
- transitioning: true
157
- }, () => {
158
- const exit = () => {
159
- if (typeof props.onExiting === 'function') {
160
- props.onExiting();
161
- }
162
- this.transition(STATES.EXITED, STATES.EXITING, () => {
163
- this.setState({
164
- transitioning: false
165
- }, () => {
166
- if (typeof props.onExited === 'function') {
167
- props.onExited();
168
- }
169
- });
170
- });
171
- };
172
- if (initialState) {
173
- this.transition(initialState, null, () => {
174
- this.transition(STATES.EXITING, initialState, exit, props.exitDelay);
175
- });
176
- } else {
177
- exit();
178
- }
179
- });
180
- } else {
181
- this.setState({
182
- transitioning: false
183
- }, () => {
184
- this.transition(STATES.EXITED, STATES.ENTERED);
185
- if (typeof props.onExited === 'function') {
186
- props.onExited();
187
- }
188
- });
189
- }
190
- };
191
- }
192
- componentDidMount() {
193
- this.startTransition(this.props.in, this.props.transitionOnMount);
194
- this._unmounted = false;
195
- }
196
- getSnapshotBeforeUpdate(prevProps, prevState) {
197
- if (this.props.in !== prevProps.in && prevState.transitioning) {
198
- // direction changed before previous transition finished
199
- return true;
200
- }
201
- return null;
202
- }
203
- componentDidUpdate(prevProps, _prevState, cancelPrematurely) {
204
- if (cancelPrematurely) {
205
- this.clearTransition(prevProps.transitionClassName);
206
- }
207
- if (this.props.transitionClassName !== prevProps.transitionClassName) {
208
- this.clearTransition(prevProps.transitionClassName);
209
- }
210
- if (prevProps.in !== this.props.in) {
211
- if (_prevState.transitioning) {
212
- this.clearTransition(prevProps.transitionClassName);
213
- clearTimeout(this._timeouts.pop());
214
- this.setState({
215
- transitioning: false
216
- }, () => this.startTransition(this.props.in, true));
217
- } else this.startTransition(this.props.in, true);
218
- }
219
- }
220
- componentWillUnmount() {
221
- this._timeouts.forEach(timeout => {
222
- clearTimeout(timeout);
223
- });
224
- this._unmounted = true;
225
- }
226
- clearTransition(transitionClassName) {
227
- if (this._unmounted) return;
228
- this.setState({
229
- transitioning: false
230
- }, () => {
231
- if (this._unmounted) return;
232
- const classList = (0, _getClassList.getClassList)(this.ref);
233
- Object.values(STATES).forEach(state => {
234
- const className = this.getTransitionClassName(state);
235
- if (className) {
236
- classList.remove(className);
237
- }
238
- });
239
- classList.remove(transitionClassName);
240
- });
241
- }
242
- transitionEnabled(toState) {
243
- const props = this.props;
244
- switch (toState) {
245
- case STATES.EXITED:
246
- case STATES.EXITING:
247
- return props.transitionExit;
248
- case STATES.ENTERED:
249
- case STATES.ENTERING:
250
- return props.transitionEnter;
251
- default:
252
- return false;
253
- }
254
- }
255
- getTransitionClassName(transitionState) {
256
- const props = this.props;
257
- switch (transitionState) {
258
- case STATES.EXITED:
259
- return props.exitedClassName;
260
- case STATES.ENTERING:
261
- return props.enteringClassName;
262
- case STATES.ENTERED:
263
- return props.enteredClassName;
264
- case STATES.EXITING:
265
- return props.exitingClassName;
266
- default:
267
- return void 0;
268
- }
269
- }
270
- renderChildren() {
271
- return this.props.children ? (0, _safeCloneElement.safeCloneElement)((0, _ensureSingleChild.ensureSingleChild)(this.props.children), {
272
- 'aria-hidden': !this.props.in ? true : void 0,
273
- ref: el => {
274
- const ref = (0, _findDOMNode.findDOMNode)(el) || null;
275
- this.handleRef(ref);
276
- }
277
- }) : null;
278
- }
279
- render() {
280
- if (!this.props.in && this.props.unmountOnExit && !this.state.transitioning) {
281
- return null;
282
- } else {
283
- return this.renderChildren();
284
- }
285
- }
286
- }
287
- exports.BaseTransition = BaseTransition;
288
- BaseTransition.displayName = "BaseTransition";
289
- BaseTransition.allowedProps = _props.allowedProps;
290
- BaseTransition.defaultProps = {
291
- in: false,
292
- unmountOnExit: false,
293
- transitionOnMount: false,
294
- transitionEnter: true,
295
- transitionExit: true,
296
- enterDelay: 300,
297
- exitDelay: 300
298
- };
299
- BaseTransition.states = STATES;
300
- var _default = exports.default = BaseTransition;
@@ -1,38 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.allowedProps = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- // These props get passed from Transition
32
-
33
- // This intersection is needed for calculating allowedProps
34
-
35
- // this is getting exported, might be extended later,
36
- // that's why it is separated from BaseTransitionOwnProps
37
-
38
- const allowedProps = exports.allowedProps = ['in', 'unmountOnExit', 'transitionOnMount', 'transitionEnter', 'transitionExit', 'enterDelay', 'exitDelay', 'transitionClassName', 'exitedClassName', 'exitingClassName', 'enteredClassName', 'enteringClassName', 'onTransition', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited', 'children', 'className', 'elementRef'];
@@ -1,122 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.Transition = void 0;
8
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
- var _react = require("react");
10
- var _ms = require("@instructure/ui-utils/lib/ms.js");
11
- var _emotion = require("@instructure/emotion");
12
- var _styles = _interopRequireDefault(require("./styles"));
13
- var _theme = _interopRequireDefault(require("./theme"));
14
- var _BaseTransition = require("./BaseTransition");
15
- var _props = require("./props");
16
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
- const _excluded = ["type", "children", "styles"];
18
- var _dec, _class, _Transition;
19
- /*
20
- * The MIT License (MIT)
21
- *
22
- * Copyright (c) 2015 - present Instructure, Inc.
23
- *
24
- * Permission is hereby granted, free of charge, to any person obtaining a copy
25
- * of this software and associated documentation files (the "Software"), to deal
26
- * in the Software without restriction, including without limitation the rights
27
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28
- * copies of the Software, and to permit persons to whom the Software is
29
- * furnished to do so, subject to the following conditions:
30
- *
31
- * The above copyright notice and this permission notice shall be included in all
32
- * copies or substantial portions of the Software.
33
- *
34
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40
- * SOFTWARE.
41
- */
42
- // test is breaking without importing React here
43
- /**
44
- ---
45
- category: components/utilities
46
- ---
47
- @module Transition
48
- **/
49
- let Transition = exports.Transition = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_Transition = class Transition extends _react.Component {
50
- constructor(...args) {
51
- super(...args);
52
- this.ref = null;
53
- this.handleRef = el => {
54
- const elementRef = this.props.elementRef;
55
- this.ref = el;
56
- if (typeof elementRef === 'function') {
57
- elementRef(el);
58
- }
59
- };
60
- this.handleExited = () => {
61
- if (typeof this.props.onExited === 'function') {
62
- this.props.onExited(this.props.type);
63
- }
64
- };
65
- this.handleEntered = () => {
66
- if (typeof this.props.onEntered === 'function') {
67
- this.props.onEntered(this.props.type);
68
- }
69
- };
70
- // Transition helper:
71
- // After emotion migration the only way to keep
72
- // the old BaseTransition functionality with adding and removing
73
- // classes was to add the `Global` helper of `emotion`
74
- // Todo: try to refactor or replace Transition/BaseTransition component in v9.0.0. so that it is not class based
75
- this.renderTransitionHelper = () => {
76
- const styles = this.props.styles;
77
- return (0, _jsxRuntime.jsx)(_emotion.Global, {
78
- styles: styles === null || styles === void 0 ? void 0 : styles.globalStyles
79
- });
80
- };
81
- }
82
- componentDidMount() {
83
- var _this$props$makeStyle, _this$props;
84
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
85
- }
86
- componentDidUpdate() {
87
- var _this$props$makeStyle2, _this$props2;
88
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
89
- }
90
- render() {
91
- const _this$props3 = this.props,
92
- type = _this$props3.type,
93
- children = _this$props3.children,
94
- styles = _this$props3.styles,
95
- props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
96
- const duration = (0, _ms.ms)(styles.duration);
97
- return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
98
- children: [this.renderTransitionHelper(), (0, _jsxRuntime.jsx)(_BaseTransition.BaseTransition, {
99
- ...props,
100
- enterDelay: duration,
101
- exitDelay: duration,
102
- transitionClassName: styles.classNames.transitioning,
103
- exitedClassName: styles.classNames.exited,
104
- exitingClassName: styles.classNames.exiting,
105
- enteredClassName: styles.classNames.entered,
106
- enteringClassName: styles.classNames.entering,
107
- onEntered: this.handleEntered,
108
- onExited: this.handleExited,
109
- elementRef: this.handleRef,
110
- children: children
111
- })]
112
- });
113
- }
114
- }, _Transition.displayName = "Transition", _Transition.componentId = 'Transition', _Transition.allowedProps = _props.allowedProps, _Transition.defaultProps = {
115
- type: 'fade',
116
- in: false,
117
- unmountOnExit: false,
118
- transitionOnMount: false,
119
- transitionEnter: true,
120
- transitionExit: true
121
- }, _Transition.states = _BaseTransition.BaseTransition.states, _Transition)) || _class);
122
- var _default = exports.default = Transition;
@@ -1,156 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getClassNames = exports.generateStyle = exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- const getClassNames = type => ({
32
- transitioning: `transition--${type}-transitioning`,
33
- exited: `transition--${type}-exited`,
34
- exiting: `transition--${type}-exiting`,
35
- entered: `transition--${type}-entered`,
36
- entering: `transition--${type}-entering`
37
- });
38
-
39
- /**
40
- * Generates the style object from the theme and provided additional information
41
- * @param componentTheme The theme variable object.
42
- * @param props the props of the component, the style is applied to
43
- * @return The final style object, which will be used in the component
44
- */
45
- exports.getClassNames = getClassNames;
46
- const generateStyle = (componentTheme, props) => {
47
- const type = props.type;
48
-
49
- /**
50
- * After emotion migration the only way to keep
51
- * the old BaseTransition functionality with adding and removing
52
- * classes was to add the `Global` helper of `emotion`
53
- *
54
- * `!important` is added, so it overrides any other animation
55
- * (this class is only on the DOM node while the animation is running)
56
- *
57
- * Todo: refactor or replace Transition/BaseTransition component in v9.0.0. so that it is not class based
58
- */
59
- const baseTransition = `opacity ${componentTheme.duration} ${componentTheme.timing}, transform ${componentTheme.duration} ${componentTheme.timing} !important`;
60
-
61
- /* Animation type: fade */
62
- const fadeAnimation = {
63
- [`.transition--fade-transitioning`]: {
64
- transition: baseTransition
65
- },
66
- [`.transition--fade-exiting,
67
- .transition--fade-exited`]: {
68
- opacity: 0.01
69
- },
70
- [`.transition--fade-entering,
71
- .transition--fade-entered`]: {
72
- opacity: 1
73
- }
74
- };
75
-
76
- /* Animation type: scale */
77
- const scaleAnimation = {
78
- [`.transition--scale-transitioning`]: {
79
- transition: baseTransition
80
- },
81
- [`.transition--scale-exiting,
82
- .transition--scale-exited`]: {
83
- transform: 'scale(0.01) translate3d(0, 0, 0)',
84
- opacity: 0.01
85
- },
86
- [`.transition--scale-entering,
87
- .transition--scale-entered`]: {
88
- transform: 'scale(1) translate3d(0, 0, 0)',
89
- opacity: 1
90
- }
91
- };
92
-
93
- /* Animation type: slide */
94
-
95
- /*
96
- Note: the transitions for slide are:
97
- from EXITED to ENTERING and from ENTERED to EXITING.
98
- ENTERED and EXITED will be set directly
99
- when enter or exit transitions are disabled and they reset
100
- the 'stage' for the next transition.
101
- The base transition class enables/disables transitions
102
- from one state to another, so transitions should be set there.
103
- */
104
- const slideAnimation = {
105
- [`.transition--slide-right-transitioning,
106
- .transition--slide-left-transitioning,
107
- .transition--slide-up-transitioning,
108
- .transition--slide-down-transitioning`]: {
109
- transition: baseTransition
110
- },
111
- [`.transition--slide-right-exited,
112
- .transition--slide-left-exited,
113
- .transition--slide-up-exited,
114
- .transition--slide-down-exited`]: {
115
- opacity: 0.01
116
- },
117
- [`.transition--slide-right-exiting,
118
- .transition--slide-right-exited`]: {
119
- transform: 'translate3d(100%, 0, 0)'
120
- },
121
- [`.transition--slide-left-exiting,
122
- .transition--slide-left-exited`]: {
123
- transform: 'translate3d(-100%, 0, 0)'
124
- },
125
- [`.transition--slide-up-exiting,
126
- .transition--slide-up-exited`]: {
127
- transform: 'translate3d(0, -100%, 0)'
128
- },
129
- [`.transition--slide-down-exiting,
130
- .transition--slide-down-exited`]: {
131
- transform: 'translate3d(0, 100%, 0)'
132
- },
133
- [`.transition--slide-left-entering,
134
- .transition--slide-right-entering,
135
- .transition--slide-up-entering,
136
- .transition--slide-down-entering,
137
- .transition--slide-left-entered,
138
- .transition--slide-right-entered,
139
- .transition--slide-up-entered,
140
- .transition--slide-down-entered`]: {
141
- transform: 'translate3d(0, 0, 0)',
142
- opacity: 1
143
- }
144
- };
145
- return {
146
- duration: componentTheme.duration,
147
- classNames: getClassNames(type),
148
- globalStyles: {
149
- ...fadeAnimation,
150
- ...scaleAnimation,
151
- ...slideAnimation
152
- }
153
- };
154
- };
155
- exports.generateStyle = generateStyle;
156
- var _default = exports.default = generateStyle;
@@ -1,46 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * Generates the theme object for the component from the theme and provided additional information
33
- * @param {Object} theme The actual theme object.
34
- * @return {Object} The final theme object with the overrides and component variables
35
- */
36
- const generateComponentTheme = theme => {
37
- const transitions = theme.transitions;
38
- const componentVariables = {
39
- duration: transitions === null || transitions === void 0 ? void 0 : transitions.duration,
40
- timing: transitions === null || transitions === void 0 ? void 0 : transitions.timing
41
- };
42
- return {
43
- ...componentVariables
44
- };
45
- };
46
- var _default = exports.default = generateComponentTheme;
package/lib/index.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "BaseTransition", {
7
- enumerable: true,
8
- get: function () {
9
- return _BaseTransition.BaseTransition;
10
- }
11
- });
12
- Object.defineProperty(exports, "Transition", {
13
- enumerable: true,
14
- get: function () {
15
- return _Transition.Transition;
16
- }
17
- });
18
- var _Transition = require("./Transition");
19
- var _BaseTransition = require("./Transition/BaseTransition");
package/lib/package.json DELETED
@@ -1 +0,0 @@
1
- {"type":"commonjs"}