react-useanimations 2.0.8 → 2.0.9-RC

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 (354) hide show
  1. package/.babelrc +4 -0
  2. package/.editorconfig +15 -0
  3. package/.eslintignore +2 -0
  4. package/.eslintrc.json +31 -0
  5. package/.gitattributes +1 -0
  6. package/.prettierrc +10 -0
  7. package/.storybook/main.js +15 -0
  8. package/.vscode/settings.json +5 -0
  9. package/LICENSE +30 -0
  10. package/README_v1.md +46 -0
  11. package/package.json +4 -3
  12. package/{bin → src/bin}/addAnimationFiles.sh +0 -0
  13. package/{bin → src/bin}/generateStories.sh +0 -0
  14. package/src/index.tsx +177 -0
  15. package/{lib → src/lib}/activity/activity.json +0 -0
  16. package/src/lib/activity/index.ts +4 -0
  17. package/{lib → src/lib}/airplay/airplay.json +0 -0
  18. package/src/lib/airplay/index.ts +4 -0
  19. package/{lib → src/lib}/alertCircle/alertCircle.json +0 -0
  20. package/src/lib/alertCircle/index.ts +4 -0
  21. package/{lib → src/lib}/alertOctagon/alertOctagon.json +0 -0
  22. package/src/lib/alertOctagon/index.ts +4 -0
  23. package/{lib → src/lib}/alertTriangle/alertTriangle.json +0 -0
  24. package/src/lib/alertTriangle/index.ts +4 -0
  25. package/{lib → src/lib}/archive/archive.json +0 -0
  26. package/src/lib/archive/index.ts +4 -0
  27. package/{lib → src/lib}/arrowDown/arrowDown.json +0 -0
  28. package/src/lib/arrowDown/index.ts +4 -0
  29. package/{lib → src/lib}/arrowDownCircle/arrowDownCircle.json +0 -0
  30. package/src/lib/arrowDownCircle/index.ts +4 -0
  31. package/{lib → src/lib}/arrowLeftCircle/arrowLeftCircle.json +0 -0
  32. package/src/lib/arrowLeftCircle/index.ts +4 -0
  33. package/{lib → src/lib}/arrowRightCircle/arrowRightCircle.json +0 -0
  34. package/src/lib/arrowRightCircle/index.ts +4 -0
  35. package/{lib → src/lib}/arrowUp/arrowUp.json +0 -0
  36. package/src/lib/arrowUp/index.ts +4 -0
  37. package/{lib → src/lib}/arrowUpCircle/arrowUpCircle.json +0 -0
  38. package/src/lib/arrowUpCircle/index.ts +4 -0
  39. package/{lib → src/lib}/behance/behance.json +0 -0
  40. package/src/lib/behance/index.ts +4 -0
  41. package/{lib → src/lib}/bookmark/bookmark.json +0 -0
  42. package/src/lib/bookmark/index.ts +4 -0
  43. package/{lib → src/lib}/calendar/calendar.json +0 -0
  44. package/src/lib/calendar/index.ts +4 -0
  45. package/{lib → src/lib}/checkBox/checkBox.json +0 -0
  46. package/src/lib/checkBox/index.ts +4 -0
  47. package/{lib → src/lib}/checkmark/checkmark.json +0 -0
  48. package/src/lib/checkmark/index.ts +4 -0
  49. package/{lib → src/lib}/codepen/codepen.json +0 -0
  50. package/src/lib/codepen/index.ts +4 -0
  51. package/{lib → src/lib}/copy/copy.json +0 -0
  52. package/src/lib/copy/index.ts +4 -0
  53. package/{lib → src/lib}/download/download.json +0 -0
  54. package/src/lib/download/index.ts +4 -0
  55. package/{lib → src/lib}/dribbble/dribbble.json +0 -0
  56. package/src/lib/dribbble/index.ts +4 -0
  57. package/{lib → src/lib}/edit/edit.json +0 -0
  58. package/src/lib/edit/index.ts +4 -0
  59. package/{lib → src/lib}/error/error.json +0 -0
  60. package/src/lib/error/index.ts +4 -0
  61. package/{lib → src/lib}/explore/explore.json +0 -0
  62. package/src/lib/explore/index.ts +4 -0
  63. package/{lib → src/lib}/facebook/facebook.json +0 -0
  64. package/src/lib/facebook/index.ts +4 -0
  65. package/{lib → src/lib}/folder/folder.json +0 -0
  66. package/src/lib/folder/index.ts +4 -0
  67. package/{lib → src/lib}/github/github.json +0 -0
  68. package/src/lib/github/index.ts +4 -0
  69. package/{lib → src/lib}/heart/heart.json +0 -0
  70. package/src/lib/heart/index.ts +4 -0
  71. package/{lib → src/lib}/help/help.json +0 -0
  72. package/src/lib/help/index.ts +4 -0
  73. package/{lib → src/lib}/home/home.json +0 -0
  74. package/src/lib/home/index.ts +4 -0
  75. package/src/lib/infinity/index.ts +4 -0
  76. package/{lib → src/lib}/infinity/infinity.json +0 -0
  77. package/src/lib/info/index.ts +4 -0
  78. package/{lib → src/lib}/info/info.json +0 -0
  79. package/src/lib/instagram/index.ts +4 -0
  80. package/{lib → src/lib}/instagram/instagram.json +0 -0
  81. package/src/lib/linkedin/index.ts +4 -0
  82. package/{lib → src/lib}/linkedin/linkedin.json +0 -0
  83. package/src/lib/loading/index.ts +4 -0
  84. package/{lib → src/lib}/loading/loading.json +0 -0
  85. package/src/lib/loading2/index.ts +4 -0
  86. package/{lib → src/lib}/loading2/loading2.json +0 -0
  87. package/src/lib/loading3/index.ts +4 -0
  88. package/{lib → src/lib}/loading3/loading3.json +0 -0
  89. package/src/lib/lock/index.ts +4 -0
  90. package/{lib → src/lib}/lock/lock.json +0 -0
  91. package/src/lib/mail/index.ts +4 -0
  92. package/{lib → src/lib}/mail/mail.json +0 -0
  93. package/src/lib/maximizeMinimize/index.ts +4 -0
  94. package/{lib → src/lib}/maximizeMinimize/maximizeMinimize.json +0 -0
  95. package/src/lib/maximizeMinimize2/index.ts +4 -0
  96. package/{lib → src/lib}/maximizeMinimize2/maximizeMinimize2.json +0 -0
  97. package/src/lib/menu/index.ts +4 -0
  98. package/{lib → src/lib}/menu/menu.json +0 -0
  99. package/src/lib/menu2/index.ts +4 -0
  100. package/{lib → src/lib}/menu2/menu2.json +0 -0
  101. package/src/lib/menu3/index.ts +4 -0
  102. package/{lib → src/lib}/menu3/menu3.json +0 -0
  103. package/src/lib/menu4/index.ts +4 -0
  104. package/{lib → src/lib}/menu4/menu4.json +0 -0
  105. package/src/lib/microphone/index.ts +4 -0
  106. package/{lib → src/lib}/microphone/microphone.json +0 -0
  107. package/src/lib/microphone2/index.ts +4 -0
  108. package/{lib → src/lib}/microphone2/microphone2.json +0 -0
  109. package/src/lib/notification/index.ts +4 -0
  110. package/{lib → src/lib}/notification/notification.json +0 -0
  111. package/src/lib/notification2/index.ts +4 -0
  112. package/{lib → src/lib}/notification2/notification2.json +0 -0
  113. package/src/lib/playPause/index.ts +4 -0
  114. package/{lib → src/lib}/playPause/playPause.json +0 -0
  115. package/src/lib/playPauseCircle/index.ts +4 -0
  116. package/{lib → src/lib}/playPauseCircle/playPauseCircle.json +0 -0
  117. package/src/lib/plusToX/index.ts +4 -0
  118. package/{lib → src/lib}/plusToX/plusToX.json +0 -0
  119. package/src/lib/pocket/index.ts +4 -0
  120. package/{lib → src/lib}/pocket/pocket.json +0 -0
  121. package/src/lib/radioButton/index.ts +4 -0
  122. package/{lib → src/lib}/radioButton/radioButton.json +0 -0
  123. package/src/lib/scrollDown/index.ts +4 -0
  124. package/{lib → src/lib}/scrollDown/scrollDown.json +0 -0
  125. package/src/lib/searchToX/index.ts +4 -0
  126. package/{lib → src/lib}/searchToX/searchToX.json +0 -0
  127. package/src/lib/settings/index.ts +4 -0
  128. package/{lib → src/lib}/settings/settings.json +0 -0
  129. package/src/lib/settings2/index.ts +4 -0
  130. package/{lib → src/lib}/settings2/settings2.json +0 -0
  131. package/src/lib/share/index.ts +4 -0
  132. package/{lib → src/lib}/share/share.json +0 -0
  133. package/src/lib/skipBack/index.ts +4 -0
  134. package/{lib → src/lib}/skipBack/skipBack.json +0 -0
  135. package/src/lib/skipForward/index.ts +4 -0
  136. package/{lib → src/lib}/skipForward/skipForward.json +0 -0
  137. package/src/lib/star/index.ts +4 -0
  138. package/{lib → src/lib}/star/star.json +0 -0
  139. package/src/lib/thumbUp/index.ts +4 -0
  140. package/{lib → src/lib}/thumbUp/thumbUp.json +0 -0
  141. package/src/lib/toggle/index.ts +4 -0
  142. package/{lib → src/lib}/toggle/toggle.json +0 -0
  143. package/src/lib/trash/index.ts +4 -0
  144. package/{lib → src/lib}/trash/trash.json +0 -0
  145. package/src/lib/trash2/index.ts +4 -0
  146. package/{lib → src/lib}/trash2/trash2.json +0 -0
  147. package/src/lib/twitter/index.ts +4 -0
  148. package/{lib → src/lib}/twitter/twitter.json +0 -0
  149. package/src/lib/userMinus/index.ts +4 -0
  150. package/{lib → src/lib}/userMinus/userMinus.json +0 -0
  151. package/src/lib/userPlus/index.ts +4 -0
  152. package/{lib → src/lib}/userPlus/userPlus.json +0 -0
  153. package/src/lib/userX/index.ts +4 -0
  154. package/{lib → src/lib}/userX/userX.json +0 -0
  155. package/src/lib/video/index.ts +4 -0
  156. package/{lib → src/lib}/video/video.json +0 -0
  157. package/src/lib/video2/index.ts +4 -0
  158. package/{lib → src/lib}/video2/video2.json +0 -0
  159. package/src/lib/visibility/index.ts +4 -0
  160. package/{lib → src/lib}/visibility/visibility.json +0 -0
  161. package/src/lib/visibility2/index.ts +4 -0
  162. package/{lib → src/lib}/visibility2/visibility2.json +0 -0
  163. package/src/lib/volume/index.ts +4 -0
  164. package/{lib → src/lib}/volume/volume.json +0 -0
  165. package/src/lib/youtube/index.ts +4 -0
  166. package/{lib → src/lib}/youtube/youtube.json +0 -0
  167. package/src/lib/youtube2/index.ts +4 -0
  168. package/{lib → src/lib}/youtube2/youtube2.json +0 -0
  169. package/src/lib/zoomIn/index.ts +4 -0
  170. package/{lib → src/lib}/zoomIn/zoomIn.json +0 -0
  171. package/src/lib/zoomOut/index.ts +4 -0
  172. package/{lib → src/lib}/zoomOut/zoomOut.json +0 -0
  173. package/src/stories/controlled.stories.tsx +257 -0
  174. package/src/stories/generated.stories.tsx +406 -0
  175. package/src/stories/variants.stories.tsx +237 -0
  176. package/{typings.d.ts → src/typings.d.ts} +0 -0
  177. package/src/utils/constants.ts +93 -0
  178. package/{utils/getEffect.js → src/utils/getEffect.ts} +9 -12
  179. package/src/utils/getEvents.ts +81 -0
  180. package/{utils/index.d.ts → src/utils/index.ts} +0 -0
  181. package/tsconfig.json +67 -0
  182. package/useanimations-preview.gif +0 -0
  183. package/index.d.ts +0 -19
  184. package/index.js +0 -197
  185. package/lib/activity/index.d.ts +0 -3
  186. package/lib/activity/index.js +0 -16
  187. package/lib/airplay/index.d.ts +0 -3
  188. package/lib/airplay/index.js +0 -16
  189. package/lib/alertCircle/index.d.ts +0 -3
  190. package/lib/alertCircle/index.js +0 -16
  191. package/lib/alertOctagon/index.d.ts +0 -3
  192. package/lib/alertOctagon/index.js +0 -16
  193. package/lib/alertTriangle/index.d.ts +0 -3
  194. package/lib/alertTriangle/index.js +0 -16
  195. package/lib/archive/index.d.ts +0 -3
  196. package/lib/archive/index.js +0 -16
  197. package/lib/arrowDown/index.d.ts +0 -3
  198. package/lib/arrowDown/index.js +0 -16
  199. package/lib/arrowDownCircle/index.d.ts +0 -3
  200. package/lib/arrowDownCircle/index.js +0 -16
  201. package/lib/arrowLeftCircle/index.d.ts +0 -3
  202. package/lib/arrowLeftCircle/index.js +0 -16
  203. package/lib/arrowRightCircle/index.d.ts +0 -3
  204. package/lib/arrowRightCircle/index.js +0 -16
  205. package/lib/arrowUp/index.d.ts +0 -3
  206. package/lib/arrowUp/index.js +0 -16
  207. package/lib/arrowUpCircle/index.d.ts +0 -3
  208. package/lib/arrowUpCircle/index.js +0 -16
  209. package/lib/behance/index.d.ts +0 -3
  210. package/lib/behance/index.js +0 -16
  211. package/lib/bookmark/index.d.ts +0 -3
  212. package/lib/bookmark/index.js +0 -16
  213. package/lib/calendar/index.d.ts +0 -3
  214. package/lib/calendar/index.js +0 -16
  215. package/lib/checkBox/index.d.ts +0 -3
  216. package/lib/checkBox/index.js +0 -16
  217. package/lib/checkmark/index.d.ts +0 -3
  218. package/lib/checkmark/index.js +0 -16
  219. package/lib/codepen/index.d.ts +0 -3
  220. package/lib/codepen/index.js +0 -16
  221. package/lib/copy/index.d.ts +0 -3
  222. package/lib/copy/index.js +0 -16
  223. package/lib/download/index.d.ts +0 -3
  224. package/lib/download/index.js +0 -16
  225. package/lib/dribbble/index.d.ts +0 -3
  226. package/lib/dribbble/index.js +0 -16
  227. package/lib/edit/index.d.ts +0 -3
  228. package/lib/edit/index.js +0 -16
  229. package/lib/error/index.d.ts +0 -3
  230. package/lib/error/index.js +0 -16
  231. package/lib/explore/index.d.ts +0 -3
  232. package/lib/explore/index.js +0 -16
  233. package/lib/facebook/index.d.ts +0 -3
  234. package/lib/facebook/index.js +0 -16
  235. package/lib/folder/index.d.ts +0 -3
  236. package/lib/folder/index.js +0 -16
  237. package/lib/github/index.d.ts +0 -3
  238. package/lib/github/index.js +0 -16
  239. package/lib/heart/index.d.ts +0 -3
  240. package/lib/heart/index.js +0 -16
  241. package/lib/help/index.d.ts +0 -3
  242. package/lib/help/index.js +0 -16
  243. package/lib/home/index.d.ts +0 -3
  244. package/lib/home/index.js +0 -16
  245. package/lib/infinity/index.d.ts +0 -3
  246. package/lib/infinity/index.js +0 -16
  247. package/lib/info/index.d.ts +0 -3
  248. package/lib/info/index.js +0 -16
  249. package/lib/instagram/index.d.ts +0 -3
  250. package/lib/instagram/index.js +0 -16
  251. package/lib/linkedin/index.d.ts +0 -3
  252. package/lib/linkedin/index.js +0 -16
  253. package/lib/loading/index.d.ts +0 -3
  254. package/lib/loading/index.js +0 -16
  255. package/lib/loading2/index.d.ts +0 -3
  256. package/lib/loading2/index.js +0 -16
  257. package/lib/loading3/index.d.ts +0 -3
  258. package/lib/loading3/index.js +0 -16
  259. package/lib/lock/index.d.ts +0 -3
  260. package/lib/lock/index.js +0 -16
  261. package/lib/mail/index.d.ts +0 -3
  262. package/lib/mail/index.js +0 -16
  263. package/lib/maximizeMinimize/index.d.ts +0 -3
  264. package/lib/maximizeMinimize/index.js +0 -16
  265. package/lib/maximizeMinimize2/index.d.ts +0 -3
  266. package/lib/maximizeMinimize2/index.js +0 -16
  267. package/lib/menu/index.d.ts +0 -3
  268. package/lib/menu/index.js +0 -16
  269. package/lib/menu2/index.d.ts +0 -3
  270. package/lib/menu2/index.js +0 -16
  271. package/lib/menu3/index.d.ts +0 -3
  272. package/lib/menu3/index.js +0 -16
  273. package/lib/menu4/index.d.ts +0 -3
  274. package/lib/menu4/index.js +0 -16
  275. package/lib/microphone/index.d.ts +0 -3
  276. package/lib/microphone/index.js +0 -16
  277. package/lib/microphone2/index.d.ts +0 -3
  278. package/lib/microphone2/index.js +0 -16
  279. package/lib/notification/index.d.ts +0 -3
  280. package/lib/notification/index.js +0 -16
  281. package/lib/notification2/index.d.ts +0 -3
  282. package/lib/notification2/index.js +0 -16
  283. package/lib/playPause/index.d.ts +0 -3
  284. package/lib/playPause/index.js +0 -16
  285. package/lib/playPauseCircle/index.d.ts +0 -3
  286. package/lib/playPauseCircle/index.js +0 -16
  287. package/lib/plusToX/index.d.ts +0 -3
  288. package/lib/plusToX/index.js +0 -16
  289. package/lib/pocket/index.d.ts +0 -3
  290. package/lib/pocket/index.js +0 -16
  291. package/lib/radioButton/index.d.ts +0 -3
  292. package/lib/radioButton/index.js +0 -16
  293. package/lib/scrollDown/index.d.ts +0 -3
  294. package/lib/scrollDown/index.js +0 -16
  295. package/lib/searchToX/index.d.ts +0 -3
  296. package/lib/searchToX/index.js +0 -16
  297. package/lib/settings/index.d.ts +0 -3
  298. package/lib/settings/index.js +0 -16
  299. package/lib/settings2/index.d.ts +0 -3
  300. package/lib/settings2/index.js +0 -16
  301. package/lib/share/index.d.ts +0 -3
  302. package/lib/share/index.js +0 -16
  303. package/lib/skipBack/index.d.ts +0 -3
  304. package/lib/skipBack/index.js +0 -16
  305. package/lib/skipForward/index.d.ts +0 -3
  306. package/lib/skipForward/index.js +0 -16
  307. package/lib/star/index.d.ts +0 -3
  308. package/lib/star/index.js +0 -16
  309. package/lib/thumbUp/index.d.ts +0 -3
  310. package/lib/thumbUp/index.js +0 -16
  311. package/lib/toggle/index.d.ts +0 -3
  312. package/lib/toggle/index.js +0 -16
  313. package/lib/trash/index.d.ts +0 -3
  314. package/lib/trash/index.js +0 -16
  315. package/lib/trash2/index.d.ts +0 -3
  316. package/lib/trash2/index.js +0 -16
  317. package/lib/twitter/index.d.ts +0 -3
  318. package/lib/twitter/index.js +0 -16
  319. package/lib/userMinus/index.d.ts +0 -3
  320. package/lib/userMinus/index.js +0 -16
  321. package/lib/userPlus/index.d.ts +0 -3
  322. package/lib/userPlus/index.js +0 -16
  323. package/lib/userX/index.d.ts +0 -3
  324. package/lib/userX/index.js +0 -16
  325. package/lib/video/index.d.ts +0 -3
  326. package/lib/video/index.js +0 -16
  327. package/lib/video2/index.d.ts +0 -3
  328. package/lib/video2/index.js +0 -16
  329. package/lib/visibility/index.d.ts +0 -3
  330. package/lib/visibility/index.js +0 -16
  331. package/lib/visibility2/index.d.ts +0 -3
  332. package/lib/visibility2/index.js +0 -16
  333. package/lib/volume/index.d.ts +0 -3
  334. package/lib/volume/index.js +0 -16
  335. package/lib/youtube/index.d.ts +0 -3
  336. package/lib/youtube/index.js +0 -16
  337. package/lib/youtube2/index.d.ts +0 -3
  338. package/lib/youtube2/index.js +0 -16
  339. package/lib/zoomIn/index.d.ts +0 -3
  340. package/lib/zoomIn/index.js +0 -16
  341. package/lib/zoomOut/index.d.ts +0 -3
  342. package/lib/zoomOut/index.js +0 -16
  343. package/stories/controlled.stories.d.ts +0 -60
  344. package/stories/controlled.stories.js +0 -231
  345. package/stories/generated.stories.d.ts +0 -20
  346. package/stories/generated.stories.js +0 -977
  347. package/stories/variants.stories.d.ts +0 -70
  348. package/stories/variants.stories.js +0 -196
  349. package/utils/constants.d.ts +0 -6
  350. package/utils/constants.js +0 -1
  351. package/utils/getEffect.d.ts +0 -3
  352. package/utils/getEvents.d.ts +0 -12
  353. package/utils/getEvents.js +0 -96
  354. package/utils/index.js +0 -23
package/.babelrc ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
3
+ "plugins": ["@babel/plugin-proposal-class-properties"]
4
+ }
package/.editorconfig ADDED
@@ -0,0 +1,15 @@
1
+
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ end_of_line = lf
7
+ indent_style = space
8
+ insert_final_newline = true
9
+ indent_size = 2
10
+
11
+ [*.{js,ts,jsx,tsx}]
12
+ indent_size = 2
13
+
14
+ [*.json]
15
+ indent_size = 2
package/.eslintignore ADDED
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ dist
package/.eslintrc.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "root": true,
3
+ "parser": "@typescript-eslint/parser",
4
+ "plugins": [
5
+ "@typescript-eslint"
6
+ ],
7
+ "extends": [
8
+ "airbnb-typescript",
9
+ "prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
10
+ "plugin:prettier/recommended" // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
11
+ ],
12
+ "parserOptions": {
13
+ "project": "./tsconfig.json"
14
+ },
15
+ "rules": {
16
+ "arrow-parens": "off",
17
+ "react/jsx-props-no-spreading": "off",
18
+ "react/prop-types": "off",
19
+ "rest-spread-spacing": "off",
20
+ "object-curly-newline": "off",
21
+ "import/no-extraneous-dependencies": [
22
+ "error",
23
+ {
24
+ "devDependencies": [
25
+ ".storybook/**",
26
+ "./src/**/*.stories.tsx"
27
+ ]
28
+ }
29
+ ]
30
+ }
31
+ }
package/.gitattributes ADDED
@@ -0,0 +1 @@
1
+ docs/** linguist-generated=true
package/.prettierrc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "printWidth": 100,
3
+ "tabWidth": 2,
4
+ "singleQuote": true,
5
+ "trailingComma": "es5",
6
+ "bracketSpacing": true,
7
+ "jsxBracketSameLine": false,
8
+ "semi": true
9
+ }
10
+
@@ -0,0 +1,15 @@
1
+ module.exports = {
2
+ stories: ['../src/**/*.stories.tsx'],
3
+ webpackFinal: async (config) => {
4
+ config.module.rules.push({
5
+ test: /\.(ts|tsx)$/,
6
+ loader: require.resolve('babel-loader'),
7
+ options: {
8
+ presets: [['react-app', { flow: false, typescript: true }]],
9
+ },
10
+ });
11
+ config.resolve.extensions.push('.ts', '.tsx');
12
+ return config;
13
+ },
14
+ addons: ['@storybook/addon-actions', '@storybook/addon-links'],
15
+ };
@@ -0,0 +1,5 @@
1
+ {
2
+ "editor.codeActionsOnSave": {
3
+ "source.fixAll.eslint": true
4
+ },
5
+ }
package/LICENSE ADDED
@@ -0,0 +1,30 @@
1
+ RIGHTS
2
+
3
+ All the free files available in useAnimations are distributed
4
+ under Creative Commons (CC) Attribution (BY) unless stated otherwise.
5
+ Our resources (animations) can be used for personal and commercial usage
6
+ within Web and Mobile Applications.
7
+
8
+ You may modify the resources according to your requirements and use them
9
+ in any or all of your personal or commercial projects. For example,
10
+ you may include this resource on a website or mobile application
11
+ you will be designing for a client.
12
+
13
+ You are required to attribute or link to useanimations.com in any of projects.
14
+ useAnimations (useanimations.com) will not be responsible for any outcome
15
+ that may occur during the use of our resources.
16
+
17
+ Files from useAnimations can be shared as long as the useAnimations
18
+ are credited appropriately.
19
+
20
+
21
+ PROHIBITIONS
22
+
23
+ You do not have the rights to redistribute, resell, lease, license,
24
+ sub-license or offer the file downloaded to any third party.
25
+ For any resalable web applications, software programs, web templates,
26
+ app templates, merchandise etc. you should not include our graphics resources.
27
+ This will be considered as a redistribution of our resources
28
+ which is forbidden by us.
29
+
30
+ More about Creative Commons (CC) Attribution (BY) - https://creativecommons.org/licenses/by/4.0/
package/README_v1.md ADDED
@@ -0,0 +1,46 @@
1
+ ## React UseAnimations Icons
2
+
3
+ [![npm version](https://img.shields.io/npm/v/react-useanimations.svg?style=flat-square)](https://www.npmjs.com/package/react-useanimations) [![npm downloads](https://img.shields.io/npm/dm/react-useanimations.svg?style=flat-square)](https://www.npmjs.com/package/react-useanimations)
4
+
5
+ #### What is react-useanimations?
6
+
7
+ React-useanimations is a collection of free animated open source icons for React.js.
8
+
9
+ #### Collection
10
+
11
+ [https://react.useanimations.com](https://react.useanimations.com/) and play with examples.
12
+
13
+ ![](useanimations-preview.gif)
14
+
15
+ ### Installation
16
+
17
+ Using Yarn:
18
+
19
+ ```
20
+ yarn add react-useanimations
21
+ ```
22
+
23
+ or using NPM:
24
+
25
+ ```
26
+ npm install react-useanimations
27
+ ```
28
+
29
+ ### Usage
30
+ This is README for v1, consider upgrading to v2, it will improve your performance - [react-useanimations@v1](https://github.com/useAnimations/react-useanimations/blob/master/README.md)
31
+
32
+ Basic Usage
33
+ ```javascript
34
+ import React from 'react';
35
+ import UseAnimations from 'react-useanimations';
36
+
37
+ const App = () => <UseAnimations animationKey="github" />;
38
+
39
+ export default App;
40
+ ```
41
+
42
+ Icons can be configured with inline props:
43
+
44
+ ```javascript
45
+ <UseAnimations animationKey="alert" size={56} style={{ padding: 100 }} />
46
+ ```
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "react-useanimations",
3
- "version": "2.0.8",
3
+ "version": "2.0.9-RC",
4
4
  "description": "Official React component for useanimations icons",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/useAnimations/react-useanimations.git"
8
8
  },
9
- "author": "Tuan Phung",
9
+ "author": "Tuan Phung, Marek Feikus",
10
10
  "license": "MIT",
11
11
  "bugs": {
12
12
  "url": "https://github.com/useAnimations/react-useanimations/issues"
@@ -72,6 +72,7 @@
72
72
  "typescript": "^3.8.3"
73
73
  },
74
74
  "peerDependencies": {
75
- "react": "^16.9.0"
75
+ "react": ">=16",
76
+ "react-dom": ">=16"
76
77
  }
77
78
  }
File without changes
File without changes
package/src/index.tsx ADDED
@@ -0,0 +1,177 @@
1
+ /* eslint-disable react/require-default-props */
2
+ import React, { useState, useEffect, useRef, ReactElement } from 'react';
3
+ // UNFORTUNATELY WHEN LIGHT VERSION IS USED, SOME ANIMATIONS ARE NOT WORKING AS EXPECTED
4
+ // import lottie from 'lottie-web/build/player/lottie_light';
5
+ import lottie from 'lottie-web';
6
+ import type { AnimationItem, AnimationConfigWithData, AnimationConfig } from 'lottie-web';
7
+
8
+ import { getEffect, getEvents } from './utils';
9
+ import type { Animation, AnimationEffect } from './utils';
10
+
11
+ const getRandomId = (key: Animation['animationKey']) =>
12
+ `${key}_i${Math.floor(Math.random() * 10000 + 1)}`;
13
+
14
+ type Props = {
15
+ animation: Animation;
16
+ reverse?: boolean;
17
+ strokeColor?: string;
18
+ fillColor?: string;
19
+ pathCss?: string;
20
+ options?: Partial<AnimationConfig>;
21
+ size?: number;
22
+ loop?: AnimationConfig['loop'];
23
+ autoplay?: AnimationConfig['autoplay'];
24
+ speed?: number;
25
+ wrapperStyle?: React.CSSProperties;
26
+ render?: (eventProps: any, animationProps: any) => ReactElement;
27
+ } & React.HTMLProps<HTMLDivElement>;
28
+
29
+ const UseAnimations: React.FC<Props> = ({
30
+ animation: { animationData, animationKey },
31
+ reverse = false,
32
+ size = 24,
33
+ speed = 1,
34
+ strokeColor,
35
+ fillColor,
36
+ pathCss,
37
+ loop,
38
+ autoplay,
39
+ wrapperStyle,
40
+ options,
41
+ onClick,
42
+ render,
43
+ ...other
44
+ }) => {
45
+ const [animation, setAnimation] = useState<AnimationItem>();
46
+ const [animationId] = useState<string>(getRandomId(animationKey));
47
+ const [events, setEvents] = useState<any>({});
48
+ const ref = useRef<HTMLDivElement>(null);
49
+
50
+ const defaultStyles = {
51
+ overflow: 'hidden',
52
+ outline: 'none',
53
+ width: `${size}px`,
54
+ height: `${size}px`,
55
+ ...wrapperStyle,
56
+ };
57
+
58
+ // INVOKE THE LOTTIE ANIMATION
59
+ useEffect(() => {
60
+ const animEffect: AnimationEffect = getEffect(animationKey);
61
+
62
+ const defaultOptions: AnimationConfigWithData = {
63
+ container: ref.current as Element,
64
+ renderer: 'svg',
65
+ animationData,
66
+ loop: loop || animEffect === 'LOOP_PLAY',
67
+ autoplay: autoplay || animEffect === 'LOOP_PLAY',
68
+ rendererSettings: {
69
+ // LOADS DOM ELEMENTS WHEN NEEDED. MIGHT SPEED UP INITIALIZATION FOR LARGE NUMBER OF ELEMENTS.
70
+ progressiveLoad: true,
71
+ // lottie-web missing id type
72
+ // @ts-ignore-next-line
73
+ id: animationId,
74
+ },
75
+ ...options,
76
+ };
77
+
78
+ setAnimation(lottie.loadAnimation(defaultOptions));
79
+
80
+ return () => {
81
+ animation?.destroy();
82
+ setAnimation(undefined);
83
+ };
84
+ }, []);
85
+
86
+ // HANDLE STYLING FOR ANIMATION
87
+ useEffect(() => {
88
+ if (strokeColor || fillColor || pathCss) {
89
+ try {
90
+ const css = `#${animationId} path { ${strokeColor ? `stroke: ${strokeColor};` : ''} ${
91
+ fillColor ? `fill: ${fillColor};` : ''
92
+ } ${pathCss || ''}}`;
93
+ let sheetEl: any = document.getElementById('useAnimationsSheet');
94
+
95
+ // STYLESHEET HASN'T BEEN CREATED YET
96
+ if (!sheetEl) {
97
+ sheetEl = document.createElement('style');
98
+ sheetEl.setAttribute('id', 'useAnimationsSheet');
99
+ sheetEl.appendChild(document.createTextNode(''));
100
+ document.head.appendChild(sheetEl);
101
+ }
102
+
103
+ const sheet = sheetEl ? sheetEl.sheet || sheetEl.styleSheet : null;
104
+ sheet.insertRule(css);
105
+ } catch (err) {
106
+ // eslint-disable-next-line
107
+ console.warn(
108
+ `There's been a problem with deleting a CSSRule, please report that issue in https://github.com/useAnimations/react-useanimations`,
109
+ err
110
+ );
111
+ }
112
+ }
113
+
114
+ return () => {
115
+ // DELETE CSS RULE
116
+ try {
117
+ const sheetEl: any = document.getElementById('useAnimationsSheet');
118
+ const sheet = sheetEl ? sheetEl.sheet || sheetEl.styleSheet : null;
119
+
120
+ if (sheet) {
121
+ const animationRuleIndex = Array.from(sheet.cssRules).findIndex(
122
+ (rule: any) => rule.selectorText === `#${animationId} path`
123
+ );
124
+
125
+ if (animationRuleIndex !== -1) {
126
+ sheet.deleteRule(animationRuleIndex);
127
+ }
128
+ }
129
+ } catch (err) {
130
+ // eslint-disable-next-line
131
+ console.warn(
132
+ `There's been a problem with deleting a CSSRule, please report that issue in https://github.com/useAnimations/react-useanimations`,
133
+ err
134
+ );
135
+ }
136
+ };
137
+ }, [strokeColor, fillColor, pathCss]);
138
+
139
+ // SET NAVIGATION EVENTS
140
+ useEffect(() => {
141
+ // eslint-disable-next-line
142
+ const events = animation
143
+ ? getEvents({
144
+ animation,
145
+ reverse,
146
+ animEffect: getEffect(animationKey),
147
+ })
148
+ : undefined;
149
+
150
+ if (events) setEvents(events);
151
+ }, [animation, reverse]);
152
+
153
+ // SET ANIMATION SPEED
154
+ useEffect(() => {
155
+ if (animation) {
156
+ animation.setSpeed(speed);
157
+ }
158
+ }, [animation, speed]);
159
+
160
+ const eventProps = {
161
+ ...events,
162
+ onClick: (e: React.MouseEvent<HTMLDivElement>) => {
163
+ if (onClick) onClick(e);
164
+ if (events && 'onClick' in events) events.onClick();
165
+ },
166
+ };
167
+
168
+ const animationProps = {
169
+ ref,
170
+ ...other,
171
+ style: defaultStyles,
172
+ };
173
+
174
+ return render ? render(eventProps, animationProps) : <div {...eventProps} {...animationProps} />;
175
+ };
176
+
177
+ export default UseAnimations;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import activity from './activity.json';
3
+
4
+ export default { animationData: activity, animationKey: 'activity' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import airplay from './airplay.json';
3
+
4
+ export default { animationData: airplay, animationKey: 'airplay' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import alertCircle from './alertCircle.json';
3
+
4
+ export default { animationData: alertCircle, animationKey: 'alertCircle' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import alertOctagon from './alertOctagon.json';
3
+
4
+ export default { animationData: alertOctagon, animationKey: 'alertOctagon' } as Animation;
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import alertTriangle from './alertTriangle.json';
3
+
4
+ export default { animationData: alertTriangle, animationKey: 'alertTriangle' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import archive from './archive.json';
3
+
4
+ export default { animationData: archive, animationKey: 'archive' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import arrowDown from './arrowDown.json';
3
+
4
+ export default { animationData: arrowDown, animationKey: 'arrowDown' } as Animation;
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import arrowDownCircle from './arrowDownCircle.json';
3
+
4
+ export default { animationData: arrowDownCircle, animationKey: 'arrowDownCircle' } as Animation;
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import arrowLeftCircle from './arrowLeftCircle.json';
3
+
4
+ export default { animationData: arrowLeftCircle, animationKey: 'arrowLeftCircle' } as Animation;
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import arrowRightCircle from './arrowRightCircle.json';
3
+
4
+ export default { animationData: arrowRightCircle, animationKey: 'arrowRightCircle' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import arrowUp from './arrowUp.json';
3
+
4
+ export default { animationData: arrowUp, animationKey: 'arrowUp' } as Animation;
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import arrowUpCircle from './arrowUpCircle.json';
3
+
4
+ export default { animationData: arrowUpCircle, animationKey: 'arrowUpCircle' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import behance from './behance.json';
3
+
4
+ export default { animationData: behance, animationKey: 'behance' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import bookmark from './bookmark.json';
3
+
4
+ export default { animationData: bookmark, animationKey: 'bookmark' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import calendar from './calendar.json';
3
+
4
+ export default { animationData: calendar, animationKey: 'calendar' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import checkBox from './checkBox.json';
3
+
4
+ export default { animationData: checkBox, animationKey: 'checkBox' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import checkmark from './checkmark.json';
3
+
4
+ export default { animationData: checkmark, animationKey: 'checkmark' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import codepen from './codepen.json';
3
+
4
+ export default { animationData: codepen, animationKey: 'codepen' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import copy from './copy.json';
3
+
4
+ export default { animationData: copy, animationKey: 'copy' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import download from './download.json';
3
+
4
+ export default { animationData: download, animationKey: 'download' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import dribbble from './dribbble.json';
3
+
4
+ export default { animationData: dribbble, animationKey: 'dribbble' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import edit from './edit.json';
3
+
4
+ export default { animationData: edit, animationKey: 'edit' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import error from './error.json';
3
+
4
+ export default { animationData: error, animationKey: 'error' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import explore from './explore.json';
3
+
4
+ export default { animationData: explore, animationKey: 'explore' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import facebook from './facebook.json';
3
+
4
+ export default { animationData: facebook, animationKey: 'facebook' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import folder from './folder.json';
3
+
4
+ export default { animationData: folder, animationKey: 'folder' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import github from './github.json';
3
+
4
+ export default { animationData: github, animationKey: 'github' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import heart from './heart.json';
3
+
4
+ export default { animationData: heart, animationKey: 'heart' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import help from './help.json';
3
+
4
+ export default { animationData: help, animationKey: 'help' } as Animation;
File without changes
@@ -0,0 +1,4 @@
1
+ import type { Animation } from '../../utils/constants';
2
+ import home from './home.json';
3
+
4
+ export default { animationData: home, animationKey: 'home' } as Animation;