react-useanimations 2.0.9-RC → 2.0.9-RC1

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.
Files changed (355) hide show
  1. package/{src/bin → bin}/addAnimationFiles.sh +0 -0
  2. package/{src/bin → bin}/generateStories.sh +0 -0
  3. package/index.d.ts +19 -0
  4. package/index.js +197 -0
  5. package/{src/lib → lib}/activity/activity.json +0 -0
  6. package/lib/activity/index.d.ts +3 -0
  7. package/lib/activity/index.js +16 -0
  8. package/{src/lib → lib}/airplay/airplay.json +0 -0
  9. package/lib/airplay/index.d.ts +3 -0
  10. package/lib/airplay/index.js +16 -0
  11. package/{src/lib → lib}/alertCircle/alertCircle.json +0 -0
  12. package/lib/alertCircle/index.d.ts +3 -0
  13. package/lib/alertCircle/index.js +16 -0
  14. package/{src/lib → lib}/alertOctagon/alertOctagon.json +0 -0
  15. package/lib/alertOctagon/index.d.ts +3 -0
  16. package/lib/alertOctagon/index.js +16 -0
  17. package/{src/lib → lib}/alertTriangle/alertTriangle.json +0 -0
  18. package/lib/alertTriangle/index.d.ts +3 -0
  19. package/lib/alertTriangle/index.js +16 -0
  20. package/{src/lib → lib}/archive/archive.json +0 -0
  21. package/lib/archive/index.d.ts +3 -0
  22. package/lib/archive/index.js +16 -0
  23. package/{src/lib → lib}/arrowDown/arrowDown.json +0 -0
  24. package/lib/arrowDown/index.d.ts +3 -0
  25. package/lib/arrowDown/index.js +16 -0
  26. package/{src/lib → lib}/arrowDownCircle/arrowDownCircle.json +0 -0
  27. package/lib/arrowDownCircle/index.d.ts +3 -0
  28. package/lib/arrowDownCircle/index.js +16 -0
  29. package/{src/lib → lib}/arrowLeftCircle/arrowLeftCircle.json +0 -0
  30. package/lib/arrowLeftCircle/index.d.ts +3 -0
  31. package/lib/arrowLeftCircle/index.js +16 -0
  32. package/{src/lib → lib}/arrowRightCircle/arrowRightCircle.json +0 -0
  33. package/lib/arrowRightCircle/index.d.ts +3 -0
  34. package/lib/arrowRightCircle/index.js +16 -0
  35. package/{src/lib → lib}/arrowUp/arrowUp.json +0 -0
  36. package/lib/arrowUp/index.d.ts +3 -0
  37. package/lib/arrowUp/index.js +16 -0
  38. package/{src/lib → lib}/arrowUpCircle/arrowUpCircle.json +0 -0
  39. package/lib/arrowUpCircle/index.d.ts +3 -0
  40. package/lib/arrowUpCircle/index.js +16 -0
  41. package/{src/lib → lib}/behance/behance.json +0 -0
  42. package/lib/behance/index.d.ts +3 -0
  43. package/lib/behance/index.js +16 -0
  44. package/{src/lib → lib}/bookmark/bookmark.json +0 -0
  45. package/lib/bookmark/index.d.ts +3 -0
  46. package/lib/bookmark/index.js +16 -0
  47. package/{src/lib → lib}/calendar/calendar.json +0 -0
  48. package/lib/calendar/index.d.ts +3 -0
  49. package/lib/calendar/index.js +16 -0
  50. package/{src/lib → lib}/checkBox/checkBox.json +0 -0
  51. package/lib/checkBox/index.d.ts +3 -0
  52. package/lib/checkBox/index.js +16 -0
  53. package/{src/lib → lib}/checkmark/checkmark.json +0 -0
  54. package/lib/checkmark/index.d.ts +3 -0
  55. package/lib/checkmark/index.js +16 -0
  56. package/{src/lib → lib}/codepen/codepen.json +0 -0
  57. package/lib/codepen/index.d.ts +3 -0
  58. package/lib/codepen/index.js +16 -0
  59. package/{src/lib → lib}/copy/copy.json +0 -0
  60. package/lib/copy/index.d.ts +3 -0
  61. package/lib/copy/index.js +16 -0
  62. package/{src/lib → lib}/download/download.json +0 -0
  63. package/lib/download/index.d.ts +3 -0
  64. package/lib/download/index.js +16 -0
  65. package/{src/lib → lib}/dribbble/dribbble.json +0 -0
  66. package/lib/dribbble/index.d.ts +3 -0
  67. package/lib/dribbble/index.js +16 -0
  68. package/{src/lib → lib}/edit/edit.json +0 -0
  69. package/lib/edit/index.d.ts +3 -0
  70. package/lib/edit/index.js +16 -0
  71. package/{src/lib → lib}/error/error.json +0 -0
  72. package/lib/error/index.d.ts +3 -0
  73. package/lib/error/index.js +16 -0
  74. package/{src/lib → lib}/explore/explore.json +0 -0
  75. package/lib/explore/index.d.ts +3 -0
  76. package/lib/explore/index.js +16 -0
  77. package/{src/lib → lib}/facebook/facebook.json +0 -0
  78. package/lib/facebook/index.d.ts +3 -0
  79. package/lib/facebook/index.js +16 -0
  80. package/{src/lib → lib}/folder/folder.json +0 -0
  81. package/lib/folder/index.d.ts +3 -0
  82. package/lib/folder/index.js +16 -0
  83. package/{src/lib → lib}/github/github.json +0 -0
  84. package/lib/github/index.d.ts +3 -0
  85. package/lib/github/index.js +16 -0
  86. package/{src/lib → lib}/heart/heart.json +0 -0
  87. package/lib/heart/index.d.ts +3 -0
  88. package/lib/heart/index.js +16 -0
  89. package/{src/lib → lib}/help/help.json +0 -0
  90. package/lib/help/index.d.ts +3 -0
  91. package/lib/help/index.js +16 -0
  92. package/{src/lib → lib}/home/home.json +0 -0
  93. package/lib/home/index.d.ts +3 -0
  94. package/lib/home/index.js +16 -0
  95. package/lib/infinity/index.d.ts +3 -0
  96. package/lib/infinity/index.js +16 -0
  97. package/{src/lib → lib}/infinity/infinity.json +0 -0
  98. package/lib/info/index.d.ts +3 -0
  99. package/lib/info/index.js +16 -0
  100. package/{src/lib → lib}/info/info.json +0 -0
  101. package/lib/instagram/index.d.ts +3 -0
  102. package/lib/instagram/index.js +16 -0
  103. package/{src/lib → lib}/instagram/instagram.json +0 -0
  104. package/lib/linkedin/index.d.ts +3 -0
  105. package/lib/linkedin/index.js +16 -0
  106. package/{src/lib → lib}/linkedin/linkedin.json +0 -0
  107. package/lib/loading/index.d.ts +3 -0
  108. package/lib/loading/index.js +16 -0
  109. package/{src/lib → lib}/loading/loading.json +0 -0
  110. package/lib/loading2/index.d.ts +3 -0
  111. package/lib/loading2/index.js +16 -0
  112. package/{src/lib → lib}/loading2/loading2.json +0 -0
  113. package/lib/loading3/index.d.ts +3 -0
  114. package/lib/loading3/index.js +16 -0
  115. package/{src/lib → lib}/loading3/loading3.json +0 -0
  116. package/lib/lock/index.d.ts +3 -0
  117. package/lib/lock/index.js +16 -0
  118. package/{src/lib → lib}/lock/lock.json +0 -0
  119. package/lib/mail/index.d.ts +3 -0
  120. package/lib/mail/index.js +16 -0
  121. package/{src/lib → lib}/mail/mail.json +0 -0
  122. package/lib/maximizeMinimize/index.d.ts +3 -0
  123. package/lib/maximizeMinimize/index.js +16 -0
  124. package/{src/lib → lib}/maximizeMinimize/maximizeMinimize.json +0 -0
  125. package/lib/maximizeMinimize2/index.d.ts +3 -0
  126. package/lib/maximizeMinimize2/index.js +16 -0
  127. package/{src/lib → lib}/maximizeMinimize2/maximizeMinimize2.json +0 -0
  128. package/lib/menu/index.d.ts +3 -0
  129. package/lib/menu/index.js +16 -0
  130. package/{src/lib → lib}/menu/menu.json +0 -0
  131. package/lib/menu2/index.d.ts +3 -0
  132. package/lib/menu2/index.js +16 -0
  133. package/{src/lib → lib}/menu2/menu2.json +0 -0
  134. package/lib/menu3/index.d.ts +3 -0
  135. package/lib/menu3/index.js +16 -0
  136. package/{src/lib → lib}/menu3/menu3.json +0 -0
  137. package/lib/menu4/index.d.ts +3 -0
  138. package/lib/menu4/index.js +16 -0
  139. package/{src/lib → lib}/menu4/menu4.json +0 -0
  140. package/lib/microphone/index.d.ts +3 -0
  141. package/lib/microphone/index.js +16 -0
  142. package/{src/lib → lib}/microphone/microphone.json +0 -0
  143. package/lib/microphone2/index.d.ts +3 -0
  144. package/lib/microphone2/index.js +16 -0
  145. package/{src/lib → lib}/microphone2/microphone2.json +0 -0
  146. package/lib/notification/index.d.ts +3 -0
  147. package/lib/notification/index.js +16 -0
  148. package/{src/lib → lib}/notification/notification.json +0 -0
  149. package/lib/notification2/index.d.ts +3 -0
  150. package/lib/notification2/index.js +16 -0
  151. package/{src/lib → lib}/notification2/notification2.json +0 -0
  152. package/lib/playPause/index.d.ts +3 -0
  153. package/lib/playPause/index.js +16 -0
  154. package/{src/lib → lib}/playPause/playPause.json +0 -0
  155. package/lib/playPauseCircle/index.d.ts +3 -0
  156. package/lib/playPauseCircle/index.js +16 -0
  157. package/{src/lib → lib}/playPauseCircle/playPauseCircle.json +0 -0
  158. package/lib/plusToX/index.d.ts +3 -0
  159. package/lib/plusToX/index.js +16 -0
  160. package/{src/lib → lib}/plusToX/plusToX.json +0 -0
  161. package/lib/pocket/index.d.ts +3 -0
  162. package/lib/pocket/index.js +16 -0
  163. package/{src/lib → lib}/pocket/pocket.json +0 -0
  164. package/lib/radioButton/index.d.ts +3 -0
  165. package/lib/radioButton/index.js +16 -0
  166. package/{src/lib → lib}/radioButton/radioButton.json +0 -0
  167. package/lib/scrollDown/index.d.ts +3 -0
  168. package/lib/scrollDown/index.js +16 -0
  169. package/{src/lib → lib}/scrollDown/scrollDown.json +0 -0
  170. package/lib/searchToX/index.d.ts +3 -0
  171. package/lib/searchToX/index.js +16 -0
  172. package/{src/lib → lib}/searchToX/searchToX.json +0 -0
  173. package/lib/settings/index.d.ts +3 -0
  174. package/lib/settings/index.js +16 -0
  175. package/{src/lib → lib}/settings/settings.json +0 -0
  176. package/lib/settings2/index.d.ts +3 -0
  177. package/lib/settings2/index.js +16 -0
  178. package/{src/lib → lib}/settings2/settings2.json +0 -0
  179. package/lib/share/index.d.ts +3 -0
  180. package/lib/share/index.js +16 -0
  181. package/{src/lib → lib}/share/share.json +0 -0
  182. package/lib/skipBack/index.d.ts +3 -0
  183. package/lib/skipBack/index.js +16 -0
  184. package/{src/lib → lib}/skipBack/skipBack.json +0 -0
  185. package/lib/skipForward/index.d.ts +3 -0
  186. package/lib/skipForward/index.js +16 -0
  187. package/{src/lib → lib}/skipForward/skipForward.json +0 -0
  188. package/lib/star/index.d.ts +3 -0
  189. package/lib/star/index.js +16 -0
  190. package/{src/lib → lib}/star/star.json +0 -0
  191. package/lib/thumbUp/index.d.ts +3 -0
  192. package/lib/thumbUp/index.js +16 -0
  193. package/{src/lib → lib}/thumbUp/thumbUp.json +0 -0
  194. package/lib/toggle/index.d.ts +3 -0
  195. package/lib/toggle/index.js +16 -0
  196. package/{src/lib → lib}/toggle/toggle.json +0 -0
  197. package/lib/trash/index.d.ts +3 -0
  198. package/lib/trash/index.js +16 -0
  199. package/{src/lib → lib}/trash/trash.json +0 -0
  200. package/lib/trash2/index.d.ts +3 -0
  201. package/lib/trash2/index.js +16 -0
  202. package/{src/lib → lib}/trash2/trash2.json +0 -0
  203. package/lib/twitter/index.d.ts +3 -0
  204. package/lib/twitter/index.js +16 -0
  205. package/{src/lib → lib}/twitter/twitter.json +0 -0
  206. package/lib/userMinus/index.d.ts +3 -0
  207. package/lib/userMinus/index.js +16 -0
  208. package/{src/lib → lib}/userMinus/userMinus.json +0 -0
  209. package/lib/userPlus/index.d.ts +3 -0
  210. package/lib/userPlus/index.js +16 -0
  211. package/{src/lib → lib}/userPlus/userPlus.json +0 -0
  212. package/lib/userX/index.d.ts +3 -0
  213. package/lib/userX/index.js +16 -0
  214. package/{src/lib → lib}/userX/userX.json +0 -0
  215. package/lib/video/index.d.ts +3 -0
  216. package/lib/video/index.js +16 -0
  217. package/{src/lib → lib}/video/video.json +0 -0
  218. package/lib/video2/index.d.ts +3 -0
  219. package/lib/video2/index.js +16 -0
  220. package/{src/lib → lib}/video2/video2.json +0 -0
  221. package/lib/visibility/index.d.ts +3 -0
  222. package/lib/visibility/index.js +16 -0
  223. package/{src/lib → lib}/visibility/visibility.json +0 -0
  224. package/lib/visibility2/index.d.ts +3 -0
  225. package/lib/visibility2/index.js +16 -0
  226. package/{src/lib → lib}/visibility2/visibility2.json +0 -0
  227. package/lib/volume/index.d.ts +3 -0
  228. package/lib/volume/index.js +16 -0
  229. package/{src/lib → lib}/volume/volume.json +0 -0
  230. package/lib/youtube/index.d.ts +3 -0
  231. package/lib/youtube/index.js +16 -0
  232. package/{src/lib → lib}/youtube/youtube.json +0 -0
  233. package/lib/youtube2/index.d.ts +3 -0
  234. package/lib/youtube2/index.js +16 -0
  235. package/{src/lib → lib}/youtube2/youtube2.json +0 -0
  236. package/lib/zoomIn/index.d.ts +3 -0
  237. package/lib/zoomIn/index.js +16 -0
  238. package/{src/lib → lib}/zoomIn/zoomIn.json +0 -0
  239. package/lib/zoomOut/index.d.ts +3 -0
  240. package/lib/zoomOut/index.js +16 -0
  241. package/{src/lib → lib}/zoomOut/zoomOut.json +0 -0
  242. package/package.json +5 -2
  243. package/stories/controlled.stories.d.ts +60 -0
  244. package/stories/controlled.stories.js +231 -0
  245. package/stories/generated.stories.d.ts +20 -0
  246. package/stories/generated.stories.js +977 -0
  247. package/stories/variants.stories.d.ts +70 -0
  248. package/stories/variants.stories.js +196 -0
  249. package/{src/typings.d.ts → typings.d.ts} +0 -0
  250. package/utils/constants.d.ts +6 -0
  251. package/utils/constants.js +1 -0
  252. package/utils/getEffect.d.ts +3 -0
  253. package/{src/utils/getEffect.ts → utils/getEffect.js} +12 -9
  254. package/utils/getEvents.d.ts +12 -0
  255. package/utils/getEvents.js +96 -0
  256. package/{src/utils/index.ts → utils/index.d.ts} +0 -0
  257. package/utils/index.js +23 -0
  258. package/.babelrc +0 -4
  259. package/.editorconfig +0 -15
  260. package/.eslintignore +0 -2
  261. package/.eslintrc.json +0 -31
  262. package/.gitattributes +0 -1
  263. package/.prettierrc +0 -10
  264. package/.storybook/main.js +0 -15
  265. package/.vscode/settings.json +0 -5
  266. package/LICENSE +0 -30
  267. package/README.md +0 -110
  268. package/README_v1.md +0 -46
  269. package/src/index.tsx +0 -177
  270. package/src/lib/activity/index.ts +0 -4
  271. package/src/lib/airplay/index.ts +0 -4
  272. package/src/lib/alertCircle/index.ts +0 -4
  273. package/src/lib/alertOctagon/index.ts +0 -4
  274. package/src/lib/alertTriangle/index.ts +0 -4
  275. package/src/lib/archive/index.ts +0 -4
  276. package/src/lib/arrowDown/index.ts +0 -4
  277. package/src/lib/arrowDownCircle/index.ts +0 -4
  278. package/src/lib/arrowLeftCircle/index.ts +0 -4
  279. package/src/lib/arrowRightCircle/index.ts +0 -4
  280. package/src/lib/arrowUp/index.ts +0 -4
  281. package/src/lib/arrowUpCircle/index.ts +0 -4
  282. package/src/lib/behance/index.ts +0 -4
  283. package/src/lib/bookmark/index.ts +0 -4
  284. package/src/lib/calendar/index.ts +0 -4
  285. package/src/lib/checkBox/index.ts +0 -4
  286. package/src/lib/checkmark/index.ts +0 -4
  287. package/src/lib/codepen/index.ts +0 -4
  288. package/src/lib/copy/index.ts +0 -4
  289. package/src/lib/download/index.ts +0 -4
  290. package/src/lib/dribbble/index.ts +0 -4
  291. package/src/lib/edit/index.ts +0 -4
  292. package/src/lib/error/index.ts +0 -4
  293. package/src/lib/explore/index.ts +0 -4
  294. package/src/lib/facebook/index.ts +0 -4
  295. package/src/lib/folder/index.ts +0 -4
  296. package/src/lib/github/index.ts +0 -4
  297. package/src/lib/heart/index.ts +0 -4
  298. package/src/lib/help/index.ts +0 -4
  299. package/src/lib/home/index.ts +0 -4
  300. package/src/lib/infinity/index.ts +0 -4
  301. package/src/lib/info/index.ts +0 -4
  302. package/src/lib/instagram/index.ts +0 -4
  303. package/src/lib/linkedin/index.ts +0 -4
  304. package/src/lib/loading/index.ts +0 -4
  305. package/src/lib/loading2/index.ts +0 -4
  306. package/src/lib/loading3/index.ts +0 -4
  307. package/src/lib/lock/index.ts +0 -4
  308. package/src/lib/mail/index.ts +0 -4
  309. package/src/lib/maximizeMinimize/index.ts +0 -4
  310. package/src/lib/maximizeMinimize2/index.ts +0 -4
  311. package/src/lib/menu/index.ts +0 -4
  312. package/src/lib/menu2/index.ts +0 -4
  313. package/src/lib/menu3/index.ts +0 -4
  314. package/src/lib/menu4/index.ts +0 -4
  315. package/src/lib/microphone/index.ts +0 -4
  316. package/src/lib/microphone2/index.ts +0 -4
  317. package/src/lib/notification/index.ts +0 -4
  318. package/src/lib/notification2/index.ts +0 -4
  319. package/src/lib/playPause/index.ts +0 -4
  320. package/src/lib/playPauseCircle/index.ts +0 -4
  321. package/src/lib/plusToX/index.ts +0 -4
  322. package/src/lib/pocket/index.ts +0 -4
  323. package/src/lib/radioButton/index.ts +0 -4
  324. package/src/lib/scrollDown/index.ts +0 -4
  325. package/src/lib/searchToX/index.ts +0 -4
  326. package/src/lib/settings/index.ts +0 -4
  327. package/src/lib/settings2/index.ts +0 -4
  328. package/src/lib/share/index.ts +0 -4
  329. package/src/lib/skipBack/index.ts +0 -4
  330. package/src/lib/skipForward/index.ts +0 -4
  331. package/src/lib/star/index.ts +0 -4
  332. package/src/lib/thumbUp/index.ts +0 -4
  333. package/src/lib/toggle/index.ts +0 -4
  334. package/src/lib/trash/index.ts +0 -4
  335. package/src/lib/trash2/index.ts +0 -4
  336. package/src/lib/twitter/index.ts +0 -4
  337. package/src/lib/userMinus/index.ts +0 -4
  338. package/src/lib/userPlus/index.ts +0 -4
  339. package/src/lib/userX/index.ts +0 -4
  340. package/src/lib/video/index.ts +0 -4
  341. package/src/lib/video2/index.ts +0 -4
  342. package/src/lib/visibility/index.ts +0 -4
  343. package/src/lib/visibility2/index.ts +0 -4
  344. package/src/lib/volume/index.ts +0 -4
  345. package/src/lib/youtube/index.ts +0 -4
  346. package/src/lib/youtube2/index.ts +0 -4
  347. package/src/lib/zoomIn/index.ts +0 -4
  348. package/src/lib/zoomOut/index.ts +0 -4
  349. package/src/stories/controlled.stories.tsx +0 -257
  350. package/src/stories/generated.stories.tsx +0 -406
  351. package/src/stories/variants.stories.tsx +0 -237
  352. package/src/utils/constants.ts +0 -93
  353. package/src/utils/getEvents.ts +0 -81
  354. package/tsconfig.json +0 -67
  355. package/useanimations-preview.gif +0 -0
File without changes
File without changes
package/index.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import React, { ReactElement } from 'react';
2
+ import type { AnimationConfig } from 'lottie-web';
3
+ import type { Animation } from './utils';
4
+ declare type Props = {
5
+ animation: Animation;
6
+ reverse?: boolean;
7
+ strokeColor?: string;
8
+ fillColor?: string;
9
+ pathCss?: string;
10
+ options?: Partial<AnimationConfig>;
11
+ size?: number;
12
+ loop?: AnimationConfig['loop'];
13
+ autoplay?: AnimationConfig['autoplay'];
14
+ speed?: number;
15
+ wrapperStyle?: React.CSSProperties;
16
+ render?: (eventProps: any, animationProps: any) => ReactElement;
17
+ } & React.HTMLProps<HTMLDivElement>;
18
+ declare const UseAnimations: React.FC<Props>;
19
+ export default UseAnimations;
package/index.js ADDED
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _lottieWeb = _interopRequireDefault(require("lottie-web"));
13
+
14
+ var _utils = require("./utils");
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
+
18
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
19
+
20
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+
22
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
+
24
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
25
+
26
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
27
+
28
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
29
+
30
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
31
+
32
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
33
+
34
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
35
+
36
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
37
+
38
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
39
+
40
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
41
+
42
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
43
+
44
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
45
+
46
+ var getRandomId = function getRandomId(key) {
47
+ return "".concat(key, "_i").concat(Math.floor(Math.random() * 10000 + 1));
48
+ };
49
+
50
+ var UseAnimations = function UseAnimations(_ref) {
51
+ var _ref$animation = _ref.animation,
52
+ animationData = _ref$animation.animationData,
53
+ animationKey = _ref$animation.animationKey,
54
+ _ref$reverse = _ref.reverse,
55
+ reverse = _ref$reverse === void 0 ? false : _ref$reverse,
56
+ _ref$size = _ref.size,
57
+ size = _ref$size === void 0 ? 24 : _ref$size,
58
+ _ref$speed = _ref.speed,
59
+ speed = _ref$speed === void 0 ? 1 : _ref$speed,
60
+ strokeColor = _ref.strokeColor,
61
+ fillColor = _ref.fillColor,
62
+ pathCss = _ref.pathCss,
63
+ loop = _ref.loop,
64
+ autoplay = _ref.autoplay,
65
+ wrapperStyle = _ref.wrapperStyle,
66
+ options = _ref.options,
67
+ _onClick = _ref.onClick,
68
+ render = _ref.render,
69
+ other = _objectWithoutProperties(_ref, ["animation", "reverse", "size", "speed", "strokeColor", "fillColor", "pathCss", "loop", "autoplay", "wrapperStyle", "options", "onClick", "render"]);
70
+
71
+ var _useState = (0, _react.useState)(),
72
+ _useState2 = _slicedToArray(_useState, 2),
73
+ animation = _useState2[0],
74
+ setAnimation = _useState2[1];
75
+
76
+ var _useState3 = (0, _react.useState)(getRandomId(animationKey)),
77
+ _useState4 = _slicedToArray(_useState3, 1),
78
+ animationId = _useState4[0];
79
+
80
+ var _useState5 = (0, _react.useState)({}),
81
+ _useState6 = _slicedToArray(_useState5, 2),
82
+ events = _useState6[0],
83
+ setEvents = _useState6[1];
84
+
85
+ var ref = (0, _react.useRef)(null);
86
+
87
+ var defaultStyles = _objectSpread({
88
+ overflow: 'hidden',
89
+ outline: 'none',
90
+ width: "".concat(size, "px"),
91
+ height: "".concat(size, "px")
92
+ }, wrapperStyle); // INVOKE THE LOTTIE ANIMATION
93
+
94
+
95
+ (0, _react.useEffect)(function () {
96
+ var animEffect = (0, _utils.getEffect)(animationKey);
97
+
98
+ var defaultOptions = _objectSpread({
99
+ container: ref.current,
100
+ renderer: 'svg',
101
+ animationData: animationData,
102
+ loop: loop || animEffect === 'LOOP_PLAY',
103
+ autoplay: autoplay || animEffect === 'LOOP_PLAY',
104
+ rendererSettings: {
105
+ // LOADS DOM ELEMENTS WHEN NEEDED. MIGHT SPEED UP INITIALIZATION FOR LARGE NUMBER OF ELEMENTS.
106
+ progressiveLoad: true,
107
+ // lottie-web missing id type
108
+ // @ts-ignore-next-line
109
+ id: animationId
110
+ }
111
+ }, options);
112
+
113
+ setAnimation(_lottieWeb["default"].loadAnimation(defaultOptions));
114
+ return function () {
115
+ animation === null || animation === void 0 ? void 0 : animation.destroy();
116
+ setAnimation(undefined);
117
+ };
118
+ }, []); // HANDLE STYLING FOR ANIMATION
119
+
120
+ (0, _react.useEffect)(function () {
121
+ if (strokeColor || fillColor || pathCss) {
122
+ try {
123
+ var css = "#".concat(animationId, " path { ").concat(strokeColor ? "stroke: ".concat(strokeColor, ";") : '', " ").concat(fillColor ? "fill: ".concat(fillColor, ";") : '', " ").concat(pathCss || '', "}");
124
+ var sheetEl = document.getElementById('useAnimationsSheet'); // STYLESHEET HASN'T BEEN CREATED YET
125
+
126
+ if (!sheetEl) {
127
+ sheetEl = document.createElement('style');
128
+ sheetEl.setAttribute('id', 'useAnimationsSheet');
129
+ sheetEl.appendChild(document.createTextNode(''));
130
+ document.head.appendChild(sheetEl);
131
+ }
132
+
133
+ var sheet = sheetEl ? sheetEl.sheet || sheetEl.styleSheet : null;
134
+ sheet.insertRule(css);
135
+ } catch (err) {
136
+ // eslint-disable-next-line
137
+ console.warn("There's been a problem with deleting a CSSRule, please report that issue in https://github.com/useAnimations/react-useanimations", err);
138
+ }
139
+ }
140
+
141
+ return function () {
142
+ // DELETE CSS RULE
143
+ try {
144
+ var _sheetEl = document.getElementById('useAnimationsSheet');
145
+
146
+ var _sheet = _sheetEl ? _sheetEl.sheet || _sheetEl.styleSheet : null;
147
+
148
+ if (_sheet) {
149
+ var animationRuleIndex = Array.from(_sheet.cssRules).findIndex(function (rule) {
150
+ return rule.selectorText === "#".concat(animationId, " path");
151
+ });
152
+
153
+ if (animationRuleIndex !== -1) {
154
+ _sheet.deleteRule(animationRuleIndex);
155
+ }
156
+ }
157
+ } catch (err) {
158
+ // eslint-disable-next-line
159
+ console.warn("There's been a problem with deleting a CSSRule, please report that issue in https://github.com/useAnimations/react-useanimations", err);
160
+ }
161
+ };
162
+ }, [strokeColor, fillColor, pathCss]); // SET NAVIGATION EVENTS
163
+
164
+ (0, _react.useEffect)(function () {
165
+ // eslint-disable-next-line
166
+ var events = animation ? (0, _utils.getEvents)({
167
+ animation: animation,
168
+ reverse: reverse,
169
+ animEffect: (0, _utils.getEffect)(animationKey)
170
+ }) : undefined;
171
+ if (events) setEvents(events);
172
+ }, [animation, reverse]); // SET ANIMATION SPEED
173
+
174
+ (0, _react.useEffect)(function () {
175
+ if (animation) {
176
+ animation.setSpeed(speed);
177
+ }
178
+ }, [animation, speed]);
179
+
180
+ var eventProps = _objectSpread(_objectSpread({}, events), {}, {
181
+ onClick: function onClick(e) {
182
+ if (_onClick) _onClick(e);
183
+ if (events && 'onClick' in events) events.onClick();
184
+ }
185
+ });
186
+
187
+ var animationProps = _objectSpread(_objectSpread({
188
+ ref: ref
189
+ }, other), {}, {
190
+ style: defaultStyles
191
+ });
192
+
193
+ return render ? render(eventProps, animationProps) : /*#__PURE__*/_react["default"].createElement("div", _extends({}, eventProps, animationProps));
194
+ };
195
+
196
+ var _default = UseAnimations;
197
+ exports["default"] = _default;
File without changes
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _activity = _interopRequireDefault(require("./activity.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _activity["default"],
14
+ animationKey: 'activity'
15
+ };
16
+ exports["default"] = _default;
File without changes
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _airplay = _interopRequireDefault(require("./airplay.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _airplay["default"],
14
+ animationKey: 'airplay'
15
+ };
16
+ exports["default"] = _default;
File without changes
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _alertCircle = _interopRequireDefault(require("./alertCircle.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _alertCircle["default"],
14
+ animationKey: 'alertCircle'
15
+ };
16
+ exports["default"] = _default;
File without changes
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _alertOctagon = _interopRequireDefault(require("./alertOctagon.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _alertOctagon["default"],
14
+ animationKey: 'alertOctagon'
15
+ };
16
+ exports["default"] = _default;
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _alertTriangle = _interopRequireDefault(require("./alertTriangle.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _alertTriangle["default"],
14
+ animationKey: 'alertTriangle'
15
+ };
16
+ exports["default"] = _default;
File without changes
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _archive = _interopRequireDefault(require("./archive.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _archive["default"],
14
+ animationKey: 'archive'
15
+ };
16
+ exports["default"] = _default;
File without changes
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _arrowDown = _interopRequireDefault(require("./arrowDown.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _arrowDown["default"],
14
+ animationKey: 'arrowDown'
15
+ };
16
+ exports["default"] = _default;
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _arrowDownCircle = _interopRequireDefault(require("./arrowDownCircle.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _arrowDownCircle["default"],
14
+ animationKey: 'arrowDownCircle'
15
+ };
16
+ exports["default"] = _default;
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _arrowLeftCircle = _interopRequireDefault(require("./arrowLeftCircle.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _arrowLeftCircle["default"],
14
+ animationKey: 'arrowLeftCircle'
15
+ };
16
+ exports["default"] = _default;
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _arrowRightCircle = _interopRequireDefault(require("./arrowRightCircle.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _arrowRightCircle["default"],
14
+ animationKey: 'arrowRightCircle'
15
+ };
16
+ exports["default"] = _default;
File without changes
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _arrowUp = _interopRequireDefault(require("./arrowUp.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _arrowUp["default"],
14
+ animationKey: 'arrowUp'
15
+ };
16
+ exports["default"] = _default;
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _arrowUpCircle = _interopRequireDefault(require("./arrowUpCircle.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _arrowUpCircle["default"],
14
+ animationKey: 'arrowUpCircle'
15
+ };
16
+ exports["default"] = _default;
File without changes
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _behance = _interopRequireDefault(require("./behance.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _behance["default"],
14
+ animationKey: 'behance'
15
+ };
16
+ exports["default"] = _default;
File without changes
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _bookmark = _interopRequireDefault(require("./bookmark.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _bookmark["default"],
14
+ animationKey: 'bookmark'
15
+ };
16
+ exports["default"] = _default;
File without changes
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _calendar = _interopRequireDefault(require("./calendar.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _calendar["default"],
14
+ animationKey: 'calendar'
15
+ };
16
+ exports["default"] = _default;
File without changes
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _checkBox = _interopRequireDefault(require("./checkBox.json"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ var _default = {
13
+ animationData: _checkBox["default"],
14
+ animationKey: 'checkBox'
15
+ };
16
+ exports["default"] = _default;
File without changes
@@ -0,0 +1,3 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ declare const _default: Animation;
3
+ export default _default;