react-lottie 1.2.10 → 2.0.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,39 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [2.0.0](https://github.com/chenqingspring/react-lottie/compare/v1.2.10...v2.0.0) (2026-11-04)
6
+
7
+ This release folds in the changes that were prepared as 1.2.11 (never
8
+ published) and modernizes the development toolchain.
9
+
10
+ ### Breaking Changes
11
+
12
+ * the `react` peer dependency is now `>=16.8.0` (previously `>=15.0.0`);
13
+ React 15 is no longer supported. The component is tested against React 18
14
+ and works with React 19.
15
+ * import animation JSON with a default import
16
+ (`import animationData from './pinjump.json'`). A namespace import
17
+ (`import * as animationData`) yields a frozen ESM module object that
18
+ lottie-web cannot annotate, which fails under Vite and other strict ESM
19
+ bundlers.
20
+
21
+ ### Features
22
+
23
+ * add a `tabIndex` prop so presentational animations can be removed from the tab order ([#130](https://github.com/chenqingspring/react-lottie/issues/130))
24
+ * support the `renderer` option and document it in the README
25
+ * print a highlighted maintenance banner after `npm install` (maintained automatically by Relay; report bugs and feature requests on GitHub; https://get-relay.cc) and document it in the README
26
+
27
+ ### Bug Fixes
28
+
29
+ * leave playback alone on re-renders unless a playback prop changed, so an `autoplay: false` animation no longer starts itself and a paused one is not restarted; a re-created but equal `segments` array no longer replays the animation ([#32](https://github.com/chenqingspring/react-lottie/issues/32), [#43](https://github.com/chenqingspring/react-lottie/issues/43))
30
+ * apply the initial `isStopped`, `isPaused` and `direction` props on mount instead of only on update
31
+ * replay changed segments immediately by passing `force` to `playSegments` ([#82](https://github.com/chenqingspring/react-lottie/issues/82))
32
+ * reload the animation when the remote `path` option changes ([#99](https://github.com/chenqingspring/react-lottie/issues/99))
33
+ * run the data/path reload on modern React instead of the deprecated `componentWillUpdate` ([#77](https://github.com/chenqingspring/react-lottie/issues/77))
34
+ * guard `destroy()` when the animation was never created ([#51](https://github.com/chenqingspring/react-lottie/issues/51))
35
+ * make the imperative `pause()` method actually pause, and stop restarting a paused animation on unrelated prop updates ([#58](https://github.com/chenqingspring/react-lottie/issues/58))
36
+ * drop the runtime dependency on `babel-runtime`, which broke consumers' builds ([#177](https://github.com/chenqingspring/react-lottie/issues/177))
37
+
5
38
  ### [1.2.10](https://github.com/chenqingspring/react-lottie/compare/v1.2.9...v1.2.10) (2024-11-30)
6
39
 
7
40
 
package/README.md CHANGED
@@ -5,9 +5,9 @@
5
5
  ## Demo
6
6
  https://chenqingspring.github.io/react-lottie
7
7
 
8
- ## Wapper of bodymovin.js
8
+ ## Wrapper of lottie-web
9
9
 
10
- [bodymovin](https://github.com/bodymovin/bodymovin) is [Adobe After Effects](http://www.adobe.com/products/aftereffects.html) plugin for exporting animations as JSON, also it provide bodymovin.js for render them as svg/canvas/html.
10
+ [lottie-web](https://github.com/airbnb/lottie-web) (previously Bodymovin) is an [Adobe After Effects](http://www.adobe.com/products/aftereffects.html) plugin for exporting animations as JSON. It also provides the player that renders them as svg/canvas/html.
11
11
 
12
12
  ## Why Lottie?
13
13
 
@@ -31,6 +31,46 @@ Install through npm:
31
31
  npm install --save react-lottie
32
32
  ```
33
33
 
34
+ > **Note:** react-lottie is maintained automatically by Relay. Learn more at
35
+ > [get-relay.cc](https://get-relay.cc).
36
+ >
37
+ > Found a bug or have a feature request? Open an issue on
38
+ > [GitHub](https://github.com/chenqingspring/react-lottie/issues) and Relay
39
+ > will review and fix it.
40
+
41
+ ## Requirements
42
+
43
+ React 16.8 or newer. The test suite runs against React 18; the component uses
44
+ plain class components and works with React 19 as well.
45
+
46
+ ## Local development
47
+
48
+ Run the Storybook stories with `npm start` (port 9010) and the test suite with
49
+ `npm test`.
50
+
51
+ ## TypeScript
52
+
53
+ Type definitions are maintained on DefinitelyTyped and track this package's
54
+ props. Install them alongside the package:
55
+
56
+ ```
57
+ npm install --save-dev @types/react-lottie
58
+ ```
59
+
60
+ TypeScript picks the declarations up automatically, so no import changes are
61
+ needed.
62
+
63
+ ## Testing
64
+
65
+ `lottie-web` probes canvas support when it is imported, so a jsdom-based test
66
+ runner needs a canvas implementation before the component is loaded. With Jest
67
+ (the default for Create React App), add [`jest-canvas-mock`](https://github.com/hustcc/jest-canvas-mock)
68
+ to your setup file:
69
+
70
+ ```javascript
71
+ import 'jest-canvas-mock';
72
+ ```
73
+
34
74
  ## Usage
35
75
 
36
76
  Import pinjump.json as animation data
@@ -38,7 +78,7 @@ Import pinjump.json as animation data
38
78
  ```jsx
39
79
  import React from 'react'
40
80
  import Lottie from 'react-lottie';
41
- import * as animationData from './pinjump.json'
81
+ import animationData from './pinjump.json'
42
82
 
43
83
  export default class LottieControl extends React.Component {
44
84
 
@@ -56,7 +96,7 @@ export default class LottieControl extends React.Component {
56
96
  const defaultOptions = {
57
97
  loop: true,
58
98
  autoplay: true,
59
- animationData: animationData,
99
+ animationData: animationData.default,
60
100
  rendererSettings: {
61
101
  preserveAspectRatio: 'xMidYMid slice'
62
102
  }
@@ -77,8 +117,79 @@ export default class LottieControl extends React.Component {
77
117
 
78
118
  ```
79
119
 
120
+ ### Play on hover
121
+
122
+ `eventListeners` takes lottie-web animation events (`complete`, `loopComplete`,
123
+ `enterFrame`, ...), not DOM events. Registering `onMouseOver` or `onMouseLeave`
124
+ there will never fire. Put the DOM handlers on a wrapper element and drive the
125
+ component with props instead.
126
+
127
+ To play forward on hover and reverse from the current frame on leave, keep the
128
+ animation running and flip `direction`. `isStopped` resets the animation to its
129
+ first frame, so only use it once, to start from a known state.
130
+
131
+ ```jsx
132
+ import React from 'react'
133
+ import Lottie from 'react-lottie';
134
+ import animationData from './pinjump.json'
135
+
136
+ export default class HoverLottie extends React.Component {
137
+
138
+ constructor(props) {
139
+ super(props);
140
+ this.state = {isStopped: true, direction: 1};
141
+ }
142
+
143
+ render() {
144
+ const defaultOptions = {
145
+ loop: false,
146
+ autoplay: false,
147
+ animationData: animationData.default,
148
+ rendererSettings: {
149
+ preserveAspectRatio: 'xMidYMid slice'
150
+ }
151
+ };
152
+
153
+ return <div
154
+ onMouseEnter={() => this.setState({isStopped: false, direction: 1})}
155
+ onMouseLeave={() => this.setState({direction: -1})}>
156
+ <Lottie options={defaultOptions}
157
+ height={100}
158
+ width={100}
159
+ isStopped={this.state.isStopped}
160
+ direction={this.state.direction}
161
+ isClickToPauseDisabled />
162
+ </div>
163
+ }
164
+ }
165
+
166
+ ```
167
+
168
+ ### Play a segment
169
+
170
+ Pass `segments` to play a frame range instead of the whole animation. The
171
+ frames are the ones shown in After Effects / the lottie editor.
172
+
173
+ ```jsx
174
+ <Lottie options={defaultOptions}
175
+ height={400}
176
+ width={400}
177
+ segments={[45, 90]} />
178
+ ```
179
+
180
+ Changing `segments` while the animation is running restarts playback from the
181
+ new `fromFrame`, so a single state value is enough to switch ranges:
182
+
183
+ ```jsx
184
+ <Lottie options={defaultOptions} segments={this.state.segment} />
185
+ ```
186
+
187
+ A segment also has to be reachable with `loop`/`autoplay` as usual: with
188
+ `loop: false` and `autoplay: false` the range only plays once you flip
189
+ `isStopped` or pass a new `segments` value.
190
+
80
191
  ### props
81
- The `<Lottie />` Component supports the following components:
192
+ The `<Lottie />` Component supports the following props:
82
193
 
83
194
  **options** *required*
84
195
 
@@ -88,7 +199,11 @@ the object representing the animation settings that will be instantiated by body
88
199
  >
89
200
  >**autoplay** *options* [default: `false`]
90
201
  >
91
- >**animationData** *required*
202
+ >**animationData** *optional* — the exported animation data. Mutually exclusive with `path`.
203
+ >
204
+ >**path** *optional* — a URL (or path) to a JSON animation file. Mutually exclusive with `animationData`.
205
+ >
206
+ >**renderer** *optional* [default: `svg`]
92
207
  >
93
208
  >**rendererSettings** *required*
94
209
 
@@ -100,9 +215,36 @@ pixel value for containers width.
100
215
 
101
216
  pixel value for containers height.
102
217
 
218
+ **isStopped** *optional* [default: `false`]
219
+
220
+ Stops the animation and resets it to the first frame. Setting it back to `false`
221
+ resumes playback. Unlike `isPaused`, this discards the current position.
222
+
223
+ **isPaused** *optional* [default: `false`]
224
+
225
+ Pauses the animation without losing its current frame. Setting it back to
226
+ `false` resumes from where it stopped.
227
+
228
+ **speed** *optional* [default: `1`]
229
+
230
+ Playback rate. `2` plays twice as fast, `0.5` at half speed, and negative
231
+ values play in reverse at that rate.
232
+
233
+ **direction** *optional* [default: `1`]
234
+
235
+ `1` plays forward, `-1` plays backward. Changing it keeps the current frame,
236
+ which is what you want for hover-in / hover-out effects.
237
+
238
+ **segments** *optional* [default: none]
239
+
240
+ `[fromFrame, toFrame]` to play only part of the animation, e.g. `[45, 90]`.
241
+ The range is applied as soon as the prop is set and re-applied whenever it
242
+ changes, so a new value starts playing that segment immediately even while the
243
+ animation is running. See [Play a segment](#play-a-segment).
244
+
103
245
  **eventListeners** *optional* [default: `[]`]
104
246
 
105
- This is an array of objects containing a `eventName` and `callback` function that will be registered as eventlisteners on the animation object. refer to [bodymovin#events](https://github.com/bodymovin/bodymovin#events) where the mention using addEventListener, for a list of available custom events.
247
+ This is an array of objects containing a `eventName` and `callback` function that will be registered as eventlisteners on the animation object. refer to [bodymovin#events](https://github.com/bodymovin/bodymovin#events) where the mention using addEventListener, for a list of available custom events. These are lottie-web animation events, not DOM events: for `onMouseOver`, `onMouseLeave` and friends put the handler on a wrapping element, as shown in [Play on hover](#play-on-hover).
106
248
 
107
249
  example:
108
250
  ```jsx
@@ -117,9 +259,31 @@ eventListeners=[
117
259
  **isClickToPauseDisabled** *optional* [default: `false`]
118
260
  When this props is left unspecified or is set to `false` animations are paused or resumed when a user clicks or taps them. If you do not want this behaviour set this prop to `true`.
119
261
 
262
+ **ariaRole** *optional* [default: `button`]
263
+
264
+ Role of the rendered container. Pass `img` for a purely decorative animation
265
+ that is described by `ariaLabel`.
266
+
267
+ **ariaLabel** *optional* [default: `animation`]
268
+
269
+ Accessible name of the container.
270
+
271
+ **title** *optional* [default: `''`]
272
+
273
+ `title` attribute (native tooltip) of the container.
274
+
275
+ **style** *optional*
276
+
277
+ Extra inline styles merged onto the container, after the `width`, `height` and
278
+ layout defaults. Use it to override `overflow` or `margin`.
279
+
280
+ **tabIndex** *optional* [default: `0`]
281
+ Tab order of the rendered container. Pass `-1` for a purely presentational
282
+ animation that should not receive keyboard focus.
283
+
120
284
  ## Related Projects
121
285
 
122
- * [Bodymovin](https://github.com/bodymovin/bodymovin) react-lottie is a wrapper of bodymovin
286
+ * [lottie-web](https://github.com/airbnb/lottie-web) react-lottie is a wrapper of lottie-web
123
287
  * [Angular Lottie](https://github.com/chenqingspring/ng-lottie) angular implementation
124
288
  * [Vue Lottie](https://github.com/chenqingspring/vue-lottie) vue implementation
125
289
  * [React Native Lottie](https://github.com/airbnb/lottie-react-native) react native implementation by airbnb
package/dist/index.js CHANGED
@@ -1,62 +1,45 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
- var _extends2 = require('babel-runtime/helpers/extends');
8
-
9
- var _extends3 = _interopRequireDefault(_extends2);
10
-
11
- var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
12
-
13
- var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
14
-
15
- var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
16
-
17
- var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
18
-
19
- var _createClass2 = require('babel-runtime/helpers/createClass');
20
-
21
- var _createClass3 = _interopRequireDefault(_createClass2);
22
-
23
- var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
24
-
25
- var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
26
-
27
- var _inherits2 = require('babel-runtime/helpers/inherits');
28
-
29
- var _inherits3 = _interopRequireDefault(_inherits2);
30
-
31
- var _react = require('react');
32
-
33
- var _react2 = _interopRequireDefault(_react);
34
-
35
- var _propTypes = require('prop-types');
36
-
37
- var _propTypes2 = _interopRequireDefault(_propTypes);
38
-
39
- var _lottieWeb = require('lottie-web');
40
-
41
- var _lottieWeb2 = _interopRequireDefault(_lottieWeb);
42
-
43
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44
-
45
- var Lottie = function (_React$Component) {
46
- (0, _inherits3.default)(Lottie, _React$Component);
47
-
6
+ exports["default"] = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _lottieWeb = _interopRequireDefault(require("lottie-web"));
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
11
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
12
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
15
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
16
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
17
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
18
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
19
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
20
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
21
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
22
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
23
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
24
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
25
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
26
+ function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
27
+ var segmentsAreEqual = function segmentsAreEqual(a, b) {
28
+ if (a === b) return true;
29
+ if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
30
+ return a.every(function (value, index) {
31
+ return value === b[index];
32
+ });
33
+ };
34
+ var Lottie = exports["default"] = /*#__PURE__*/function (_React$Component) {
48
35
  function Lottie() {
49
- var _ref;
50
-
51
- var _temp, _this, _ret;
52
-
53
- (0, _classCallCheck3.default)(this, Lottie);
54
-
55
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
36
+ var _this;
37
+ _classCallCheck(this, Lottie);
38
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
56
39
  args[_key] = arguments[_key];
57
40
  }
58
-
59
- return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Lottie.__proto__ || (0, _getPrototypeOf2.default)(Lottie)).call.apply(_ref, [this].concat(args))), _this), _this.handleClickToPause = function () {
41
+ _this = _callSuper(this, Lottie, [].concat(args));
42
+ _defineProperty(_this, "handleClickToPause", function () {
60
43
  // The pause() method is for handling pausing by passing a prop isPaused
61
44
  // This method is for handling the ability to pause by clicking on the animation
62
45
  if (_this.anim.isPaused) {
@@ -64,66 +47,83 @@ var Lottie = function (_React$Component) {
64
47
  } else {
65
48
  _this.anim.pause();
66
49
  }
67
- }, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
50
+ });
51
+ return _this;
68
52
  }
69
-
70
- (0, _createClass3.default)(Lottie, [{
71
- key: 'componentDidMount',
53
+ _inherits(Lottie, _React$Component);
54
+ return _createClass(Lottie, [{
55
+ key: "componentDidMount",
72
56
  value: function componentDidMount() {
73
- var _props = this.props,
74
- options = _props.options,
75
- eventListeners = _props.eventListeners;
57
+ var _this$props = this.props,
58
+ options = _this$props.options,
59
+ eventListeners = _this$props.eventListeners;
76
60
  var loop = options.loop,
77
- autoplay = options.autoplay,
78
- animationData = options.animationData,
79
- rendererSettings = options.rendererSettings,
80
- segments = options.segments;
81
-
82
-
61
+ autoplay = options.autoplay,
62
+ animationData = options.animationData,
63
+ _options$renderer = options.renderer,
64
+ renderer = _options$renderer === void 0 ? 'svg' : _options$renderer,
65
+ rendererSettings = options.rendererSettings,
66
+ segments = options.segments;
83
67
  this.options = {
84
68
  container: this.el,
85
- renderer: 'svg',
69
+ renderer: renderer,
86
70
  loop: loop !== false,
87
71
  autoplay: autoplay !== false,
88
72
  segments: segments !== false,
89
73
  animationData: animationData,
90
74
  rendererSettings: rendererSettings
91
75
  };
92
-
93
- this.options = (0, _extends3.default)({}, this.options, options);
94
- this.anim = _lottieWeb2.default.loadAnimation(this.options);
76
+ this.options = _objectSpread(_objectSpread({}, this.options), options);
77
+ this.anim = _lottieWeb["default"].loadAnimation(this.options);
95
78
  this.registerEvents(eventListeners);
96
79
  this.setSpeed();
80
+ this.setDirection();
81
+
82
+ /* Apply the initial playback props, which are otherwise only read on update */
83
+ if (this.props.isStopped) {
84
+ this.stop();
85
+ } else if (this.props.isPaused) {
86
+ this.pause();
87
+ }
97
88
  }
98
89
  }, {
99
- key: 'componentWillUpdate',
100
- value: function componentWillUpdate(nextProps /* , nextState */) {
101
- /* Recreate the animation handle if the data is changed */
102
- if (this.options.animationData !== nextProps.options.animationData) {
103
- this.deRegisterEvents(this.props.eventListeners);
90
+ key: "componentDidUpdate",
91
+ value: function componentDidUpdate(prevProps) {
92
+ /* Recreate the animation handle if the data or its remote path changed.
93
+ Done here rather than in componentWillUpdate, which React has deprecated
94
+ and which is unsafe in concurrent rendering (#77, #100, #119). */
95
+ var dataChanged = this.options.animationData !== this.props.options.animationData;
96
+ var pathChanged = this.options.path !== this.props.options.path;
97
+ if (dataChanged || pathChanged) {
98
+ this.deRegisterEvents(prevProps.eventListeners);
104
99
  this.destroy();
105
- this.options = (0, _extends3.default)({}, this.options, nextProps.options);
106
- this.anim = _lottieWeb2.default.loadAnimation(this.options);
107
- this.registerEvents(nextProps.eventListeners);
100
+ this.options = _objectSpread(_objectSpread({}, this.options), this.props.options);
101
+ this.anim = _lottieWeb["default"].loadAnimation(this.options);
102
+ this.registerEvents(this.props.eventListeners);
108
103
  }
109
- }
110
- }, {
111
- key: 'componentDidUpdate',
112
- value: function componentDidUpdate() {
104
+
105
+ /* Only drive playback when a playback prop asks for it. Re-rendering used
106
+ to call play() unconditionally, which started an animation that was
107
+ created with `autoplay: false` and restarted one the caller had paused
108
+ (#32, #43, #58). A newly loaded animation is left to its own `autoplay`
109
+ setting unless one of the playback props overrides it below. */
110
+ var playbackChanged = prevProps.isStopped !== this.props.isStopped || prevProps.isPaused !== this.props.isPaused || !segmentsAreEqual(prevProps.segments, this.props.segments);
113
111
  if (this.props.isStopped) {
114
112
  this.stop();
115
- } else if (this.props.segments) {
116
- this.playSegments();
117
- } else {
118
- this.play();
113
+ } else if (this.props.isPaused) {
114
+ this.pause();
115
+ } else if (playbackChanged) {
116
+ if (this.props.segments) {
117
+ this.playSegments();
118
+ } else {
119
+ this.play();
120
+ }
119
121
  }
120
-
121
- this.pause();
122
122
  this.setSpeed();
123
123
  this.setDirection();
124
124
  }
125
125
  }, {
126
- key: 'componentWillUnmount',
126
+ key: "componentWillUnmount",
127
127
  value: function componentWillUnmount() {
128
128
  this.deRegisterEvents(this.props.eventListeners);
129
129
  this.destroy();
@@ -131,104 +131,98 @@ var Lottie = function (_React$Component) {
131
131
  this.anim = null;
132
132
  }
133
133
  }, {
134
- key: 'setSpeed',
134
+ key: "setSpeed",
135
135
  value: function setSpeed() {
136
136
  this.anim.setSpeed(this.props.speed);
137
137
  }
138
138
  }, {
139
- key: 'setDirection',
139
+ key: "setDirection",
140
140
  value: function setDirection() {
141
141
  this.anim.setDirection(this.props.direction);
142
142
  }
143
143
  }, {
144
- key: 'play',
144
+ key: "play",
145
145
  value: function play() {
146
146
  this.anim.play();
147
147
  }
148
148
  }, {
149
- key: 'playSegments',
149
+ key: "playSegments",
150
150
  value: function playSegments() {
151
- this.anim.playSegments(this.props.segments);
151
+ /* Passing `force` replays the new segments even if the animation is
152
+ already running, so a segments prop change takes effect immediately. */
153
+ this.anim.playSegments(this.props.segments, true);
152
154
  }
153
155
  }, {
154
- key: 'stop',
156
+ key: "stop",
155
157
  value: function stop() {
156
158
  this.anim.stop();
157
159
  }
158
160
  }, {
159
- key: 'pause',
161
+ key: "pause",
160
162
  value: function pause() {
161
- if (this.props.isPaused && !this.anim.isPaused) {
162
- this.anim.pause();
163
- } else if (!this.props.isPaused && this.anim.isPaused) {
164
- this.anim.pause();
165
- }
163
+ this.anim.pause();
166
164
  }
167
165
  }, {
168
- key: 'destroy',
166
+ key: "destroy",
169
167
  value: function destroy() {
168
+ /* The animation may already be gone, e.g. after a fast unmount or a
169
+ failed loadAnimation call (issue #51). */
170
+ if (!this.anim) return;
170
171
  this.anim.destroy();
171
172
  }
172
173
  }, {
173
- key: 'registerEvents',
174
+ key: "registerEvents",
174
175
  value: function registerEvents(eventListeners) {
175
176
  var _this2 = this;
176
-
177
177
  eventListeners.forEach(function (eventListener) {
178
178
  _this2.anim.addEventListener(eventListener.eventName, eventListener.callback);
179
179
  });
180
180
  }
181
181
  }, {
182
- key: 'deRegisterEvents',
182
+ key: "deRegisterEvents",
183
183
  value: function deRegisterEvents(eventListeners) {
184
184
  var _this3 = this;
185
-
186
185
  eventListeners.forEach(function (eventListener) {
187
186
  _this3.anim.removeEventListener(eventListener.eventName, eventListener.callback);
188
187
  });
189
188
  }
190
189
  }, {
191
- key: 'render',
190
+ key: "render",
192
191
  value: function render() {
193
192
  var _this4 = this;
194
-
195
- var _props2 = this.props,
196
- width = _props2.width,
197
- height = _props2.height,
198
- ariaRole = _props2.ariaRole,
199
- ariaLabel = _props2.ariaLabel,
200
- isClickToPauseDisabled = _props2.isClickToPauseDisabled,
201
- title = _props2.title;
202
-
203
-
193
+ var _this$props2 = this.props,
194
+ width = _this$props2.width,
195
+ height = _this$props2.height,
196
+ ariaRole = _this$props2.ariaRole,
197
+ ariaLabel = _this$props2.ariaLabel,
198
+ isClickToPauseDisabled = _this$props2.isClickToPauseDisabled,
199
+ title = _this$props2.title,
200
+ tabIndex = _this$props2.tabIndex;
204
201
  var getSize = function getSize(initial) {
205
- var size = void 0;
206
-
202
+ var size;
207
203
  if (typeof initial === 'number') {
208
- size = initial + 'px';
204
+ size = "".concat(initial, "px");
209
205
  } else {
210
206
  size = initial || '100%';
211
207
  }
212
-
213
208
  return size;
214
209
  };
215
-
216
- var lottieStyles = (0, _extends3.default)({
210
+ var lottieStyles = _objectSpread({
217
211
  width: getSize(width),
218
212
  height: getSize(height),
219
213
  overflow: 'hidden',
220
214
  margin: '0 auto',
221
215
  outline: 'none'
222
216
  }, this.props.style);
223
-
224
217
  var onClickHandler = isClickToPauseDisabled ? function () {
225
218
  return null;
226
219
  } : this.handleClickToPause;
227
-
228
220
  return (
229
- // Bug with eslint rules https://github.com/airbnb/javascript/issues/1374
230
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions
231
- _react2.default.createElement('div', {
221
+ /*#__PURE__*/
222
+ // Click-to-pause is intentional and role="button" is set; keyboard control
223
+ // is not part of the API yet.
224
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events
225
+ _react["default"].createElement("div", {
232
226
  ref: function ref(c) {
233
227
  _this4.el = c;
234
228
  },
@@ -236,35 +230,30 @@ var Lottie = function (_React$Component) {
236
230
  onClick: onClickHandler,
237
231
  title: title,
238
232
  role: ariaRole,
239
- 'aria-label': ariaLabel,
240
- tabIndex: '0'
233
+ "aria-label": ariaLabel,
234
+ tabIndex: tabIndex
241
235
  })
242
236
  );
243
237
  }
244
238
  }]);
245
- return Lottie;
246
- }(_react2.default.Component);
247
-
248
- exports.default = Lottie;
249
-
250
-
239
+ }(_react["default"].Component);
251
240
  Lottie.propTypes = {
252
- eventListeners: _propTypes2.default.arrayOf(_propTypes2.default.object),
253
- options: _propTypes2.default.object.isRequired,
254
- height: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
255
- width: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
256
- isStopped: _propTypes2.default.bool,
257
- isPaused: _propTypes2.default.bool,
258
- speed: _propTypes2.default.number,
259
- segments: _propTypes2.default.arrayOf(_propTypes2.default.number),
260
- direction: _propTypes2.default.number,
261
- ariaRole: _propTypes2.default.string,
262
- ariaLabel: _propTypes2.default.string,
263
- isClickToPauseDisabled: _propTypes2.default.bool,
264
- title: _propTypes2.default.string,
265
- style: _propTypes2.default.object
241
+ eventListeners: _propTypes["default"].arrayOf(_propTypes["default"].object),
242
+ options: _propTypes["default"].object.isRequired,
243
+ height: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
244
+ width: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
245
+ isStopped: _propTypes["default"].bool,
246
+ isPaused: _propTypes["default"].bool,
247
+ speed: _propTypes["default"].number,
248
+ segments: _propTypes["default"].arrayOf(_propTypes["default"].number),
249
+ direction: _propTypes["default"].number,
250
+ ariaRole: _propTypes["default"].string,
251
+ ariaLabel: _propTypes["default"].string,
252
+ isClickToPauseDisabled: _propTypes["default"].bool,
253
+ title: _propTypes["default"].string,
254
+ style: _propTypes["default"].object,
255
+ tabIndex: _propTypes["default"].number
266
256
  };
267
-
268
257
  Lottie.defaultProps = {
269
258
  eventListeners: [],
270
259
  isStopped: false,
@@ -273,5 +262,6 @@ Lottie.defaultProps = {
273
262
  ariaRole: 'button',
274
263
  ariaLabel: 'animation',
275
264
  isClickToPauseDisabled: false,
276
- title: ''
265
+ title: '',
266
+ tabIndex: 0
277
267
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-lottie",
3
- "version": "1.2.10",
3
+ "version": "2.0.0",
4
4
  "funding": "https://opencollective.com/react-lottie",
5
5
  "description": "lottie animation view for React",
6
6
  "repository": {
@@ -10,48 +10,55 @@
10
10
  "license": "MIT",
11
11
  "scripts": {
12
12
  "release": "git add package.json && git commit -m 'chore: bump version number' && standard-version --first-release && git push --follow-tags origin master && npm publish",
13
+ "postinstall": "node scripts/postinstall.js",
13
14
  "prepublish": ". ./.scripts/prepublish.sh",
14
15
  "lint": "eslint src",
15
16
  "lintfix": "eslint src --fix",
16
- "testonly": "mocha --require .scripts/mocha_runner src/**/tests/**/*.js",
17
+ "testonly": "mocha --require .scripts/mocha_runner.js src/**/tests/**/*.js",
17
18
  "test": "npm run lint && npm run testonly",
18
19
  "test-watch": "npm run testonly -- --watch --watch-extensions js",
19
- "start": "start-storybook -p 9010",
20
+ "start": "storybook dev -p 9010",
21
+ "build-storybook": "storybook build -o .out",
20
22
  "publish-storybook": "bash .scripts/publish_storybook.sh",
21
23
  "postpublish": "npm run publish-storybook"
22
24
  },
23
25
  "devDependencies": {
24
- "@kadira/storybook": "^2.35.3",
25
- "babel-cli": "^6.26.0",
26
- "babel-core": "^6.26.3",
27
- "babel-eslint": "^6.1.2",
28
- "babel-loader": "^6.2.5",
29
- "babel-plugin-transform-runtime": "^6.15.0",
30
- "babel-polyfill": "^6.26.0",
31
- "babel-preset-react-app": "^0.2.1",
32
- "chai": "^3.5.0",
33
- "enzyme": "^2.2.0",
34
- "eslint": "^3.6.0",
35
- "eslint-config-airbnb": "^12.0.0",
36
- "eslint-plugin-import": "^1.16.0",
37
- "eslint-plugin-jsx-a11y": "^2.2.2",
38
- "eslint-plugin-react": "^6.3.0",
39
- "git-url-parse": "^6.0.1",
40
- "jsdom": "^9.5.0",
41
- "mocha": "^5.2.0",
42
- "react": "^15.6.2",
43
- "react-addons-test-utils": "^15.6.2",
44
- "react-dom": "^15.6.2",
45
- "sinon": "^1.17.6",
46
- "standard-version": "^9.5.0"
26
+ "@babel/cli": "^7.29.7",
27
+ "@babel/core": "^7.29.7",
28
+ "@babel/preset-env": "^7.29.7",
29
+ "@babel/preset-react": "^7.29.7",
30
+ "@babel/register": "^7.29.7",
31
+ "@cfaester/enzyme-adapter-react-18": "^0.8.0",
32
+ "@eslint/js": "^9.39.5",
33
+ "@storybook/react-vite": "^10.6.5",
34
+ "chai": "^4.5.0",
35
+ "enzyme": "^3.11.0",
36
+ "eslint": "^9.39.5",
37
+ "eslint-plugin-jsx-a11y": "^6.10.2",
38
+ "eslint-plugin-react": "^7.37.5",
39
+ "eslint-plugin-react-hooks": "^7.1.1",
40
+ "globals": "^17.14.0",
41
+ "jsdom": "^29.1.1",
42
+ "mocha": "^12.0.3",
43
+ "react": "^18.3.1",
44
+ "react-dom": "^18.3.1",
45
+ "sinon": "^22.1.0",
46
+ "standard-version": "^9.5.0",
47
+ "storybook": "^10.6.5",
48
+ "vite": "^7.3.7"
47
49
  },
48
50
  "peerDependencies": {
49
- "react": ">=15.0.0"
51
+ "react": ">=16.8.0"
52
+ },
53
+ "overrides": {
54
+ "cheerio": "1.0.0-rc.12"
55
+ },
56
+ "resolutions": {
57
+ "cheerio": "1.0.0-rc.12"
50
58
  },
51
59
  "dependencies": {
52
- "babel-runtime": "^6.26.0",
53
60
  "lottie-web": "^5.12.2",
54
- "prop-types": "^15.6.1"
61
+ "prop-types": "^15.8.1"
55
62
  },
56
63
  "main": "dist/index.js"
57
64
  }
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+
3
+ // Shown after `npm install` so anyone who runs into a problem knows where to
4
+ // report it. This file ships in the published tarball (`.scripts/` does not),
5
+ // so keep it dependency-free and never let it fail an install.
6
+
7
+ const ISSUES_URL = 'https://github.com/chenqingspring/react-lottie/issues';
8
+ const RELAY_URL = 'https://get-relay.cc';
9
+
10
+ const ANSI = {
11
+ reset: '\u001b[0m',
12
+ bold: '\u001b[1m',
13
+ cyan: '\u001b[36m',
14
+ };
15
+
16
+ // Colors make the banner pop in a terminal, but npm usually captures the
17
+ // script output, so the box frame alone has to carry the emphasis.
18
+ const colorEnabled = (() => {
19
+ if (process.env.NO_COLOR) return false;
20
+ if (process.env.FORCE_COLOR === '0') return false;
21
+ if (process.env.TERM === 'dumb') return false;
22
+ return Boolean(process.env.FORCE_COLOR) || Boolean(process.stdout && process.stdout.isTTY);
23
+ })();
24
+
25
+ const style = (text, ...codes) =>
26
+ colorEnabled ? `${codes.join('')}${text}${ANSI.reset}` : text;
27
+
28
+ const accent = (text) => style(text, ANSI.bold, ANSI.cyan);
29
+
30
+ // Modern terminals render the rounded box; Windows consoles may not, so fall
31
+ // back to plain ASCII there.
32
+ const frame = process.platform === 'win32'
33
+ ? { tl: '+', tr: '+', bl: '+', br: '+', h: '-', v: '|' }
34
+ : { tl: '╭', tr: '╮', bl: '╰', br: '╯', h: '─', v: '│' };
35
+
36
+ const rows = [
37
+ { plain: '', styled: '' },
38
+ {
39
+ plain: 'react-lottie is maintained automatically by RELAY',
40
+ styled: `react-lottie is maintained automatically by ${accent('RELAY')}`,
41
+ },
42
+ {
43
+ plain: `Learn more: ${RELAY_URL}`,
44
+ styled: `Learn more: ${accent(RELAY_URL)}`,
45
+ },
46
+ { plain: '', styled: '' },
47
+ {
48
+ plain: 'Found a bug or have a feature request?',
49
+ styled: 'Found a bug or have a feature request?',
50
+ },
51
+ {
52
+ plain: 'Open an issue and RELAY will review and fix it:',
53
+ styled: `Open an issue and ${accent('RELAY')} will review and fix it:`,
54
+ },
55
+ {
56
+ plain: ` ${ISSUES_URL}`,
57
+ styled: ` ${accent(ISSUES_URL)}`,
58
+ },
59
+ ];
60
+
61
+ const width = Math.max(...rows.map((row) => row.plain.length));
62
+ const horizontal = frame.h.repeat(width + 4);
63
+ const border = (text) => style(text, ANSI.cyan);
64
+
65
+ const notice = [
66
+ '',
67
+ border(`${frame.tl}${horizontal}${frame.tr}`),
68
+ ...rows.map(({ plain, styled }) =>
69
+ `${border(frame.v)} ${styled}${' '.repeat(width - plain.length)} ${border(frame.v)}`),
70
+ border(`${frame.bl}${horizontal}${frame.br}`),
71
+ '',
72
+ ].join('\n');
73
+
74
+ try {
75
+ console.log(notice);
76
+ } catch {
77
+ // A missing stdout (or a hostile environment) must not break the install.
78
+ }
package/.eslintrc DELETED
@@ -1,22 +0,0 @@
1
- {
2
- "parser": "babel-eslint",
3
- "extends": "airbnb",
4
- "rules": {
5
- # We use _ to define private variables and methods in clases
6
- "no-underscore-dangle": 0,
7
- # This seems to be buggy we don't want eslint to check this
8
- "import/no-extraneous-dependencies": 0,
9
- # This is a depricated rule. So we turned off it.
10
- "react/require-extension": 0,
11
- # We can write JSX in anyfile we want.
12
- "react/jsx-filename-extension": 0,
13
- # We don't like this rule.
14
- "arrow-body-style": 0,
15
- # We don't like this rule. We write arrow functions only when we needed.
16
- "prefer-arrow-callback": 0,
17
- # We don't need to write function names always.
18
- "func-names": 0,
19
- # propTypes can be object
20
- "react/forbid-prop-types": 0,
21
- },
22
- }
@@ -1,15 +0,0 @@
1
- # These are supported funding model platforms
2
-
3
- github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
- patreon: # Replace with a single Patreon username
5
- open_collective: react-lottie
6
- ko_fi: # Replace with a single Ko-fi username
7
- tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
- community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
- liberapay: # Replace with a single Liberapay username
10
- issuehunt: # Replace with a single IssueHunt username
11
- lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12
- polar: # Replace with a single Polar username
13
- buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14
- thanks_dev: # Replace with a single thanks.dev username
15
- custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="ERROR" enabled_by_default="true" />
5
- </profile>
6
- </component>
package/.idea/misc.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="JavaScriptSettings">
4
- <option name="languageLevel" value="JSX" />
5
- </component>
6
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/react-lottie.iml" filepath="$PROJECT_DIR$/.idea/react-lottie.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
- <excludeFolder url="file://$MODULE_DIR$/temp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
@@ -1,11 +0,0 @@
1
- // IMPORTANT
2
- // ---------
3
- // This is an auto generated file with React CDK.
4
- // Do not modify this file.
5
-
6
- const parse = require('git-url-parse');
7
- var ghUrl = process.argv[2];
8
- const parsedUrl = parse(ghUrl);
9
-
10
- const ghPagesUrl = 'https://' + parsedUrl.owner + '.github.io/' + parsedUrl.name;
11
- console.log(ghPagesUrl);
@@ -1,34 +0,0 @@
1
- // IMPORTANT
2
- // ---------
3
- // This is an auto generated file with React CDK.
4
- // Do not modify this file.
5
- // Use `.scripts/user/pretest.js instead`.
6
-
7
- process.env.NODE_ENV = 'development';
8
- require('babel-core/register');
9
- require('babel-polyfill');
10
-
11
- // Add jsdom support, which is required for enzyme.
12
- var jsdom = require('jsdom').jsdom;
13
-
14
- var exposedProperties = ['window', 'navigator', 'document'];
15
-
16
- global.document = jsdom('');
17
- global.window = document.defaultView;
18
- Object.keys(document.defaultView).forEach((property) => {
19
- if (typeof global[property] === 'undefined') {
20
- exposedProperties.push(property);
21
- global[property] = document.defaultView[property];
22
- }
23
- });
24
-
25
- global.navigator = {
26
- userAgent: 'node.js'
27
- };
28
-
29
- process.on('unhandledRejection', function (error) {
30
- console.error('Unhandled Promise Rejection:');
31
- console.error(error && error.stack || error);
32
- });
33
-
34
- require('./user/pretest.js');
@@ -1,16 +0,0 @@
1
- #!/bin/bash
2
-
3
- # IMPORTANT
4
- # ---------
5
- # This is an auto generated file with React CDK.
6
- # Do not modify this file.
7
- # Use `.scripts/user/prepublish.sh instead`.
8
-
9
- echo "=> Transpiling 'src' into ES5 ..."
10
- echo ""
11
- rm -rf ./dist
12
- NODE_ENV=production ./node_modules/.bin/babel --ignore tests,stories --plugins "transform-runtime" ./src --out-dir ./dist
13
- echo ""
14
- echo "=> Transpiling completed."
15
-
16
- . .scripts/user/prepublish.sh
@@ -1,47 +0,0 @@
1
- #!/bin/bash
2
-
3
- # IMPORTANT
4
- # ---------
5
- # This is an auto generated file with React CDK.
6
- # Do not modify this file.
7
-
8
- set -e # exit with nonzero exit code if anything fails
9
-
10
- # get GIT url
11
-
12
- GIT_URL=`git config --get remote.origin.url`
13
- if [[ $GIT_URL == "" ]]; then
14
- echo "This project is not configured with a remote git repo".
15
- exit 1
16
- fi
17
-
18
- # clear and re-create the out directory
19
- rm -rf .out || exit 0;
20
- mkdir .out;
21
-
22
- # run our compile script, discussed above
23
- build-storybook -o .out
24
-
25
- # go to the out directory and create a *new* Git repo
26
- cd .out
27
- git init
28
-
29
- # inside this git repo we'll pretend to be a new user
30
- git config user.name "GH Pages Bot"
31
- git config user.email "hello@ghbot.com"
32
-
33
- # The first and only commit to this new Git repo contains all the
34
- # files present with the commit message "Deploy to GitHub Pages".
35
- git add .
36
- git commit -m "Deploy Storybook to GitHub Pages"
37
-
38
- # Force push from the current repo's master branch to the remote
39
- # repo's gh-pages branch. (All previous history on the gh-pages branch
40
- # will be lost, since we are overwriting it.) We redirect any output to
41
- # /dev/null to hide any sensitive credential data that might otherwise be exposed.
42
- git push --force --quiet $GIT_URL master:gh-pages > /dev/null 2>&1
43
- cd ..
44
- rm -rf .out
45
-
46
- echo ""
47
- echo "=> Storybook deployed to: `node .scripts/get_gh_pages_url.js $GIT_URL`"
@@ -1 +0,0 @@
1
- # Use this file to your own code to run at NPM `prepublish` event.
@@ -1 +0,0 @@
1
- // Use this file to setup any test utilities.
@@ -1,12 +0,0 @@
1
- // IMPORTANT
2
- // ---------
3
- // This is an auto generated file with React CDK.
4
- // Do not modify this file.
5
-
6
- import { configure } from '@kadira/storybook';
7
-
8
- function loadStories() {
9
- require('../src/stories');
10
- }
11
-
12
- configure(loadStories, module);
@@ -1,44 +0,0 @@
1
- <a href="https://github.com/chenqingspring/react-lottie" class="github-corner" aria-label="View source on Github">
2
- <svg width="80" height="80" viewBox="0 0 250 250"
3
- style="fill:#e91e63;color:#fff;position:absolute;top:0;border:0;right:0" aria-hidden="true">
4
- <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
5
- <path
6
- d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
7
- fill="currentColor" style="transform-origin:130px 106px" class="octo-arm"></path>
8
- <path
9
- d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
10
- fill="currentColor" class="octo-body"></path>
11
- </svg>
12
- </a>
13
- <style type="text/css">
14
- .github-corner {
15
-
16
- }
17
-
18
- .github-corner:hover .octo-arm {
19
- animation: octocat-wave 560ms ease-in-out
20
- }
21
-
22
- @keyframes octocat-wave {
23
- 0%, 100% {
24
- transform: rotate(0)
25
- }
26
- 20%, 60% {
27
- transform: rotate(-25deg)
28
- }
29
- 40%, 80% {
30
- transform: rotate(10deg)
31
- }
32
- }
33
-
34
- @media (max-width: 500px) {
35
- .github-corner:hover .octo-arm {
36
- animation: none
37
- }
38
-
39
- .github-corner .octo-arm {
40
- animation: octocat-wave 560ms ease-in-out
41
- }
42
- }
43
-
44
- </style>