@momentum-design/components 0.73.3 → 0.73.5
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.
@@ -11,7 +11,7 @@ import { html } from 'lit';
|
|
11
11
|
import { property } from 'lit/decorators.js';
|
12
12
|
import { createRef, ref } from 'lit/directives/ref.js';
|
13
13
|
import lottie from 'lottie-web/build/player/lottie_light';
|
14
|
-
import
|
14
|
+
import animationManifest from '@momentum-design/animations/dist/manifest';
|
15
15
|
import styles from './animation.styles';
|
16
16
|
import { Component } from '../../models';
|
17
17
|
import { DEFAULTS } from './animation.constants';
|
@@ -123,13 +123,15 @@ class Animation extends Component {
|
|
123
123
|
* Import animation data dynamically
|
124
124
|
*/
|
125
125
|
getAnimationData() {
|
126
|
-
if (
|
127
|
-
|
126
|
+
if (this.name && animationManifest[this.name]) {
|
127
|
+
const path = animationManifest[this.name].replace(/^\./, '');
|
128
|
+
import(`@momentum-design/animations/dist${path}`)
|
129
|
+
.then((result) => this.onLoadSuccessHandler(result.default))
|
130
|
+
.catch((error) => this.onLoadFailHandler(error));
|
131
|
+
}
|
132
|
+
else {
|
133
|
+
this.onLoadFailHandler(new Error(`Invalid animation name: ${this.name}`));
|
128
134
|
}
|
129
|
-
const path = animationManifest[this.name].replace(/^\./, '');
|
130
|
-
return import(`@momentum-design/animations/dist${path}`)
|
131
|
-
.then((result) => this.onLoadSuccessHandler(result.default))
|
132
|
-
.catch((error) => this.onLoadFailHandler(error));
|
133
135
|
}
|
134
136
|
updated(changedProperties) {
|
135
137
|
super.updated(changedProperties);
|
@@ -137,7 +139,7 @@ class Animation extends Component {
|
|
137
139
|
// note: we re-create the animation for parameter changes as well, because lottie
|
138
140
|
// does not API for changing them on the fly
|
139
141
|
if (changedProperties.has('name') || changedProperties.has('loop') || changedProperties.has('autoplay')) {
|
140
|
-
this.getAnimationData()
|
142
|
+
this.getAnimationData();
|
141
143
|
}
|
142
144
|
if (changedProperties.has('ariaLabel') || changedProperties.has('ariaLabelledBy')) {
|
143
145
|
this.role = this.ariaLabel || this.ariaLabelledBy ? 'img' : null;
|
package/package.json
CHANGED