@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 * as animationManifest from '@momentum-design/animations/dist/manifest.json';
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 (!(this.name && animationManifest[this.name])) {
127
- return Promise.reject(new Error(`Invalid animation name: ${this.name}`));
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().catch((err) => { var _a; return (_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, err.message); });
142
+ this.getAnimationData();
141
143
  }
142
144
  if (changedProperties.has('ariaLabel') || changedProperties.has('ariaLabelledBy')) {
143
145
  this.role = this.ariaLabel || this.ariaLabelledBy ? 'img' : null;
@@ -1,3 +1,8 @@
1
+ import { css } from 'lit';
1
2
  import { hostFitContentStyles } from '../../utils/styles';
2
- const styles = [hostFitContentStyles];
3
+ const styles = [hostFitContentStyles, css `
4
+ :host svg{
5
+ display: block;
6
+ }
7
+ `];
3
8
  export default styles;
package/package.json CHANGED
@@ -41,5 +41,5 @@
41
41
  "lottie-web": "^5.12.2",
42
42
  "uuid": "^11.0.5"
43
43
  },
44
- "version": "0.73.3"
44
+ "version": "0.73.5"
45
45
  }