react-useanimations 2.0.7 → 2.0.9

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/.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.md +110 -0
  11. package/README_v1.md +46 -0
  12. package/package.json +4 -3
  13. package/{bin → src/bin}/addAnimationFiles.sh +0 -0
  14. package/{bin → src/bin}/generateStories.sh +0 -0
  15. package/src/index.tsx +177 -0
  16. package/{lib → src/lib}/activity/activity.json +0 -0
  17. package/src/lib/activity/index.ts +4 -0
  18. package/{lib → src/lib}/airplay/airplay.json +0 -0
  19. package/src/lib/airplay/index.ts +4 -0
  20. package/{lib → src/lib}/alertCircle/alertCircle.json +0 -0
  21. package/src/lib/alertCircle/index.ts +4 -0
  22. package/{lib → src/lib}/alertOctagon/alertOctagon.json +0 -0
  23. package/src/lib/alertOctagon/index.ts +4 -0
  24. package/{lib → src/lib}/alertTriangle/alertTriangle.json +0 -0
  25. package/src/lib/alertTriangle/index.ts +4 -0
  26. package/{lib → src/lib}/archive/archive.json +0 -0
  27. package/src/lib/archive/index.ts +4 -0
  28. package/{lib → src/lib}/arrowDown/arrowDown.json +0 -0
  29. package/src/lib/arrowDown/index.ts +4 -0
  30. package/{lib → src/lib}/arrowDownCircle/arrowDownCircle.json +0 -0
  31. package/src/lib/arrowDownCircle/index.ts +4 -0
  32. package/{lib → src/lib}/arrowLeftCircle/arrowLeftCircle.json +0 -0
  33. package/src/lib/arrowLeftCircle/index.ts +4 -0
  34. package/{lib → src/lib}/arrowRightCircle/arrowRightCircle.json +0 -0
  35. package/src/lib/arrowRightCircle/index.ts +4 -0
  36. package/{lib → src/lib}/arrowUp/arrowUp.json +0 -0
  37. package/src/lib/arrowUp/index.ts +4 -0
  38. package/{lib → src/lib}/arrowUpCircle/arrowUpCircle.json +0 -0
  39. package/src/lib/arrowUpCircle/index.ts +4 -0
  40. package/{lib → src/lib}/behance/behance.json +0 -0
  41. package/src/lib/behance/index.ts +4 -0
  42. package/{lib → src/lib}/bookmark/bookmark.json +0 -0
  43. package/src/lib/bookmark/index.ts +4 -0
  44. package/{lib → src/lib}/calendar/calendar.json +0 -0
  45. package/src/lib/calendar/index.ts +4 -0
  46. package/{lib → src/lib}/checkBox/checkBox.json +0 -0
  47. package/src/lib/checkBox/index.ts +4 -0
  48. package/{lib → src/lib}/checkmark/checkmark.json +0 -0
  49. package/src/lib/checkmark/index.ts +4 -0
  50. package/{lib → src/lib}/codepen/codepen.json +0 -0
  51. package/src/lib/codepen/index.ts +4 -0
  52. package/{lib → src/lib}/copy/copy.json +0 -0
  53. package/src/lib/copy/index.ts +4 -0
  54. package/{lib → src/lib}/download/download.json +0 -0
  55. package/src/lib/download/index.ts +4 -0
  56. package/{lib → src/lib}/dribbble/dribbble.json +0 -0
  57. package/src/lib/dribbble/index.ts +4 -0
  58. package/{lib → src/lib}/edit/edit.json +0 -0
  59. package/src/lib/edit/index.ts +4 -0
  60. package/{lib → src/lib}/error/error.json +0 -0
  61. package/src/lib/error/index.ts +4 -0
  62. package/{lib → src/lib}/explore/explore.json +0 -0
  63. package/src/lib/explore/index.ts +4 -0
  64. package/{lib → src/lib}/facebook/facebook.json +0 -0
  65. package/src/lib/facebook/index.ts +4 -0
  66. package/{lib → src/lib}/folder/folder.json +0 -0
  67. package/src/lib/folder/index.ts +4 -0
  68. package/{lib → src/lib}/github/github.json +0 -0
  69. package/src/lib/github/index.ts +4 -0
  70. package/{lib → src/lib}/heart/heart.json +0 -0
  71. package/src/lib/heart/index.ts +4 -0
  72. package/{lib → src/lib}/help/help.json +0 -0
  73. package/src/lib/help/index.ts +4 -0
  74. package/{lib → src/lib}/home/home.json +0 -0
  75. package/src/lib/home/index.ts +4 -0
  76. package/src/lib/infinity/index.ts +4 -0
  77. package/{lib → src/lib}/infinity/infinity.json +0 -0
  78. package/src/lib/info/index.ts +4 -0
  79. package/{lib → src/lib}/info/info.json +0 -0
  80. package/src/lib/instagram/index.ts +4 -0
  81. package/{lib → src/lib}/instagram/instagram.json +0 -0
  82. package/src/lib/linkedin/index.ts +4 -0
  83. package/{lib → src/lib}/linkedin/linkedin.json +0 -0
  84. package/src/lib/loading/index.ts +4 -0
  85. package/{lib → src/lib}/loading/loading.json +0 -0
  86. package/src/lib/loading2/index.ts +4 -0
  87. package/{lib → src/lib}/loading2/loading2.json +0 -0
  88. package/src/lib/loading3/index.ts +4 -0
  89. package/{lib → src/lib}/loading3/loading3.json +0 -0
  90. package/src/lib/lock/index.ts +4 -0
  91. package/{lib → src/lib}/lock/lock.json +0 -0
  92. package/src/lib/mail/index.ts +4 -0
  93. package/{lib → src/lib}/mail/mail.json +0 -0
  94. package/src/lib/maximizeMinimize/index.ts +4 -0
  95. package/{lib → src/lib}/maximizeMinimize/maximizeMinimize.json +0 -0
  96. package/src/lib/maximizeMinimize2/index.ts +4 -0
  97. package/{lib → src/lib}/maximizeMinimize2/maximizeMinimize2.json +0 -0
  98. package/src/lib/menu/index.ts +4 -0
  99. package/{lib → src/lib}/menu/menu.json +0 -0
  100. package/src/lib/menu2/index.ts +4 -0
  101. package/{lib → src/lib}/menu2/menu2.json +0 -0
  102. package/src/lib/menu3/index.ts +4 -0
  103. package/{lib → src/lib}/menu3/menu3.json +0 -0
  104. package/src/lib/menu4/index.ts +4 -0
  105. package/{lib → src/lib}/menu4/menu4.json +0 -0
  106. package/src/lib/microphone/index.ts +4 -0
  107. package/{lib → src/lib}/microphone/microphone.json +0 -0
  108. package/src/lib/microphone2/index.ts +4 -0
  109. package/{lib → src/lib}/microphone2/microphone2.json +0 -0
  110. package/src/lib/notification/index.ts +4 -0
  111. package/{lib → src/lib}/notification/notification.json +0 -0
  112. package/src/lib/notification2/index.ts +4 -0
  113. package/{lib → src/lib}/notification2/notification2.json +0 -0
  114. package/src/lib/playPause/index.ts +4 -0
  115. package/{lib → src/lib}/playPause/playPause.json +0 -0
  116. package/src/lib/playPauseCircle/index.ts +4 -0
  117. package/{lib → src/lib}/playPauseCircle/playPauseCircle.json +0 -0
  118. package/src/lib/plusToX/index.ts +4 -0
  119. package/{lib → src/lib}/plusToX/plusToX.json +0 -0
  120. package/src/lib/pocket/index.ts +4 -0
  121. package/{lib → src/lib}/pocket/pocket.json +0 -0
  122. package/src/lib/radioButton/index.ts +4 -0
  123. package/{lib → src/lib}/radioButton/radioButton.json +0 -0
  124. package/src/lib/scrollDown/index.ts +4 -0
  125. package/{lib → src/lib}/scrollDown/scrollDown.json +0 -0
  126. package/src/lib/searchToX/index.ts +4 -0
  127. package/{lib → src/lib}/searchToX/searchToX.json +0 -0
  128. package/src/lib/settings/index.ts +4 -0
  129. package/{lib → src/lib}/settings/settings.json +0 -0
  130. package/src/lib/settings2/index.ts +4 -0
  131. package/{lib → src/lib}/settings2/settings2.json +0 -0
  132. package/src/lib/share/index.ts +4 -0
  133. package/{lib → src/lib}/share/share.json +0 -0
  134. package/src/lib/skipBack/index.ts +4 -0
  135. package/{lib → src/lib}/skipBack/skipBack.json +0 -0
  136. package/src/lib/skipForward/index.ts +4 -0
  137. package/{lib → src/lib}/skipForward/skipForward.json +0 -0
  138. package/src/lib/star/index.ts +4 -0
  139. package/{lib → src/lib}/star/star.json +0 -0
  140. package/src/lib/thumbUp/index.ts +4 -0
  141. package/{lib → src/lib}/thumbUp/thumbUp.json +0 -0
  142. package/src/lib/toggle/index.ts +4 -0
  143. package/{lib → src/lib}/toggle/toggle.json +0 -0
  144. package/src/lib/trash/index.ts +4 -0
  145. package/{lib → src/lib}/trash/trash.json +0 -0
  146. package/src/lib/trash2/index.ts +4 -0
  147. package/{lib → src/lib}/trash2/trash2.json +0 -0
  148. package/src/lib/twitter/index.ts +4 -0
  149. package/{lib → src/lib}/twitter/twitter.json +0 -0
  150. package/src/lib/userMinus/index.ts +4 -0
  151. package/{lib → src/lib}/userMinus/userMinus.json +0 -0
  152. package/src/lib/userPlus/index.ts +4 -0
  153. package/{lib → src/lib}/userPlus/userPlus.json +0 -0
  154. package/src/lib/userX/index.ts +4 -0
  155. package/{lib → src/lib}/userX/userX.json +0 -0
  156. package/src/lib/video/index.ts +4 -0
  157. package/{lib → src/lib}/video/video.json +0 -0
  158. package/src/lib/video2/index.ts +4 -0
  159. package/{lib → src/lib}/video2/video2.json +0 -0
  160. package/src/lib/visibility/index.ts +4 -0
  161. package/{lib → src/lib}/visibility/visibility.json +0 -0
  162. package/src/lib/visibility2/index.ts +4 -0
  163. package/{lib → src/lib}/visibility2/visibility2.json +0 -0
  164. package/src/lib/volume/index.ts +4 -0
  165. package/{lib → src/lib}/volume/volume.json +0 -0
  166. package/src/lib/youtube/index.ts +4 -0
  167. package/{lib → src/lib}/youtube/youtube.json +0 -0
  168. package/src/lib/youtube2/index.ts +4 -0
  169. package/{lib → src/lib}/youtube2/youtube2.json +0 -0
  170. package/src/lib/zoomIn/index.ts +4 -0
  171. package/{lib → src/lib}/zoomIn/zoomIn.json +0 -0
  172. package/src/lib/zoomOut/index.ts +4 -0
  173. package/{lib → src/lib}/zoomOut/zoomOut.json +0 -0
  174. package/src/stories/controlled.stories.tsx +257 -0
  175. package/src/stories/generated.stories.tsx +406 -0
  176. package/src/stories/variants.stories.tsx +237 -0
  177. package/{typings.d.ts → src/typings.d.ts} +0 -0
  178. package/src/utils/constants.ts +93 -0
  179. package/{utils/getEffect.js → src/utils/getEffect.ts} +9 -12
  180. package/src/utils/getEvents.ts +81 -0
  181. package/{utils/index.d.ts → src/utils/index.ts} +0 -0
  182. package/tsconfig.json +67 -0
  183. package/useanimations-preview.gif +0 -0
  184. package/index.d.ts +0 -19
  185. package/index.js +0 -197
  186. package/lib/activity/index.d.ts +0 -3
  187. package/lib/activity/index.js +0 -16
  188. package/lib/airplay/index.d.ts +0 -3
  189. package/lib/airplay/index.js +0 -16
  190. package/lib/alertCircle/index.d.ts +0 -3
  191. package/lib/alertCircle/index.js +0 -16
  192. package/lib/alertOctagon/index.d.ts +0 -3
  193. package/lib/alertOctagon/index.js +0 -16
  194. package/lib/alertTriangle/index.d.ts +0 -3
  195. package/lib/alertTriangle/index.js +0 -16
  196. package/lib/archive/index.d.ts +0 -3
  197. package/lib/archive/index.js +0 -16
  198. package/lib/arrowDown/index.d.ts +0 -3
  199. package/lib/arrowDown/index.js +0 -16
  200. package/lib/arrowDownCircle/index.d.ts +0 -3
  201. package/lib/arrowDownCircle/index.js +0 -16
  202. package/lib/arrowLeftCircle/index.d.ts +0 -3
  203. package/lib/arrowLeftCircle/index.js +0 -16
  204. package/lib/arrowRightCircle/index.d.ts +0 -3
  205. package/lib/arrowRightCircle/index.js +0 -16
  206. package/lib/arrowUp/index.d.ts +0 -3
  207. package/lib/arrowUp/index.js +0 -16
  208. package/lib/arrowUpCircle/index.d.ts +0 -3
  209. package/lib/arrowUpCircle/index.js +0 -16
  210. package/lib/behance/index.d.ts +0 -3
  211. package/lib/behance/index.js +0 -16
  212. package/lib/bookmark/index.d.ts +0 -3
  213. package/lib/bookmark/index.js +0 -16
  214. package/lib/calendar/index.d.ts +0 -3
  215. package/lib/calendar/index.js +0 -16
  216. package/lib/checkBox/index.d.ts +0 -3
  217. package/lib/checkBox/index.js +0 -16
  218. package/lib/checkmark/index.d.ts +0 -3
  219. package/lib/checkmark/index.js +0 -16
  220. package/lib/codepen/index.d.ts +0 -3
  221. package/lib/codepen/index.js +0 -16
  222. package/lib/copy/index.d.ts +0 -3
  223. package/lib/copy/index.js +0 -16
  224. package/lib/download/index.d.ts +0 -3
  225. package/lib/download/index.js +0 -16
  226. package/lib/dribbble/index.d.ts +0 -3
  227. package/lib/dribbble/index.js +0 -16
  228. package/lib/edit/index.d.ts +0 -3
  229. package/lib/edit/index.js +0 -16
  230. package/lib/error/index.d.ts +0 -3
  231. package/lib/error/index.js +0 -16
  232. package/lib/explore/index.d.ts +0 -3
  233. package/lib/explore/index.js +0 -16
  234. package/lib/facebook/index.d.ts +0 -3
  235. package/lib/facebook/index.js +0 -16
  236. package/lib/folder/index.d.ts +0 -3
  237. package/lib/folder/index.js +0 -16
  238. package/lib/github/index.d.ts +0 -3
  239. package/lib/github/index.js +0 -16
  240. package/lib/heart/index.d.ts +0 -3
  241. package/lib/heart/index.js +0 -16
  242. package/lib/help/index.d.ts +0 -3
  243. package/lib/help/index.js +0 -16
  244. package/lib/home/index.d.ts +0 -3
  245. package/lib/home/index.js +0 -16
  246. package/lib/infinity/index.d.ts +0 -3
  247. package/lib/infinity/index.js +0 -16
  248. package/lib/info/index.d.ts +0 -3
  249. package/lib/info/index.js +0 -16
  250. package/lib/instagram/index.d.ts +0 -3
  251. package/lib/instagram/index.js +0 -16
  252. package/lib/linkedin/index.d.ts +0 -3
  253. package/lib/linkedin/index.js +0 -16
  254. package/lib/loading/index.d.ts +0 -3
  255. package/lib/loading/index.js +0 -16
  256. package/lib/loading2/index.d.ts +0 -3
  257. package/lib/loading2/index.js +0 -16
  258. package/lib/loading3/index.d.ts +0 -3
  259. package/lib/loading3/index.js +0 -16
  260. package/lib/lock/index.d.ts +0 -3
  261. package/lib/lock/index.js +0 -16
  262. package/lib/mail/index.d.ts +0 -3
  263. package/lib/mail/index.js +0 -16
  264. package/lib/maximizeMinimize/index.d.ts +0 -3
  265. package/lib/maximizeMinimize/index.js +0 -16
  266. package/lib/maximizeMinimize2/index.d.ts +0 -3
  267. package/lib/maximizeMinimize2/index.js +0 -16
  268. package/lib/menu/index.d.ts +0 -3
  269. package/lib/menu/index.js +0 -16
  270. package/lib/menu2/index.d.ts +0 -3
  271. package/lib/menu2/index.js +0 -16
  272. package/lib/menu3/index.d.ts +0 -3
  273. package/lib/menu3/index.js +0 -16
  274. package/lib/menu4/index.d.ts +0 -3
  275. package/lib/menu4/index.js +0 -16
  276. package/lib/microphone/index.d.ts +0 -3
  277. package/lib/microphone/index.js +0 -16
  278. package/lib/microphone2/index.d.ts +0 -3
  279. package/lib/microphone2/index.js +0 -16
  280. package/lib/notification/index.d.ts +0 -3
  281. package/lib/notification/index.js +0 -16
  282. package/lib/notification2/index.d.ts +0 -3
  283. package/lib/notification2/index.js +0 -16
  284. package/lib/playPause/index.d.ts +0 -3
  285. package/lib/playPause/index.js +0 -16
  286. package/lib/playPauseCircle/index.d.ts +0 -3
  287. package/lib/playPauseCircle/index.js +0 -16
  288. package/lib/plusToX/index.d.ts +0 -3
  289. package/lib/plusToX/index.js +0 -16
  290. package/lib/pocket/index.d.ts +0 -3
  291. package/lib/pocket/index.js +0 -16
  292. package/lib/radioButton/index.d.ts +0 -3
  293. package/lib/radioButton/index.js +0 -16
  294. package/lib/scrollDown/index.d.ts +0 -3
  295. package/lib/scrollDown/index.js +0 -16
  296. package/lib/searchToX/index.d.ts +0 -3
  297. package/lib/searchToX/index.js +0 -16
  298. package/lib/settings/index.d.ts +0 -3
  299. package/lib/settings/index.js +0 -16
  300. package/lib/settings2/index.d.ts +0 -3
  301. package/lib/settings2/index.js +0 -16
  302. package/lib/share/index.d.ts +0 -3
  303. package/lib/share/index.js +0 -16
  304. package/lib/skipBack/index.d.ts +0 -3
  305. package/lib/skipBack/index.js +0 -16
  306. package/lib/skipForward/index.d.ts +0 -3
  307. package/lib/skipForward/index.js +0 -16
  308. package/lib/star/index.d.ts +0 -3
  309. package/lib/star/index.js +0 -16
  310. package/lib/thumbUp/index.d.ts +0 -3
  311. package/lib/thumbUp/index.js +0 -16
  312. package/lib/toggle/index.d.ts +0 -3
  313. package/lib/toggle/index.js +0 -16
  314. package/lib/trash/index.d.ts +0 -3
  315. package/lib/trash/index.js +0 -16
  316. package/lib/trash2/index.d.ts +0 -3
  317. package/lib/trash2/index.js +0 -16
  318. package/lib/twitter/index.d.ts +0 -3
  319. package/lib/twitter/index.js +0 -16
  320. package/lib/userMinus/index.d.ts +0 -3
  321. package/lib/userMinus/index.js +0 -16
  322. package/lib/userPlus/index.d.ts +0 -3
  323. package/lib/userPlus/index.js +0 -16
  324. package/lib/userX/index.d.ts +0 -3
  325. package/lib/userX/index.js +0 -16
  326. package/lib/video/index.d.ts +0 -3
  327. package/lib/video/index.js +0 -16
  328. package/lib/video2/index.d.ts +0 -3
  329. package/lib/video2/index.js +0 -16
  330. package/lib/visibility/index.d.ts +0 -3
  331. package/lib/visibility/index.js +0 -16
  332. package/lib/visibility2/index.d.ts +0 -3
  333. package/lib/visibility2/index.js +0 -16
  334. package/lib/volume/index.d.ts +0 -3
  335. package/lib/volume/index.js +0 -16
  336. package/lib/youtube/index.d.ts +0 -3
  337. package/lib/youtube/index.js +0 -16
  338. package/lib/youtube2/index.d.ts +0 -3
  339. package/lib/youtube2/index.js +0 -16
  340. package/lib/zoomIn/index.d.ts +0 -3
  341. package/lib/zoomIn/index.js +0 -16
  342. package/lib/zoomOut/index.d.ts +0 -3
  343. package/lib/zoomOut/index.js +0 -16
  344. package/stories/controlled.stories.d.ts +0 -60
  345. package/stories/controlled.stories.js +0 -231
  346. package/stories/generated.stories.d.ts +0 -20
  347. package/stories/generated.stories.js +0 -977
  348. package/stories/variants.stories.d.ts +0 -70
  349. package/stories/variants.stories.js +0 -196
  350. package/utils/constants.d.ts +0 -6
  351. package/utils/constants.js +0 -1
  352. package/utils/getEffect.d.ts +0 -3
  353. package/utils/getEvents.d.ts +0 -12
  354. package/utils/getEvents.js +0 -96
  355. 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.md ADDED
@@ -0,0 +1,110 @@
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 or visit our [Storybook](https://useanimations.github.io/react-useanimations/)
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 -S react-useanimations
27
+ ```
28
+
29
+ ### Usage
30
+ If you still need to use v1, please refer to this README instead - [react-useanimations@v1](https://github.com/useAnimations/react-useanimations/blob/master/README_v1.md)
31
+
32
+ Basic usage
33
+ ```javascript
34
+ import React from 'react';
35
+ import UseAnimations from 'react-useanimations';
36
+ // EVERY ANIMATION NEEDS TO BE IMPORTED FIRST -> YOUR BUNDLE WILL INCLUDE ONLY WHAT IT NEEDS
37
+ import github from 'react-useanimations/lib/github'
38
+
39
+ const App = () => <UseAnimations animation={github} />;
40
+
41
+ export default App;
42
+ ```
43
+
44
+ Icons can be configured with inline props:
45
+
46
+ ```javascript
47
+ <UseAnimations animation={github} size={56} wrapperStyle={{ padding: 100 }} />
48
+ ```
49
+
50
+ These props are available:
51
+ | Prop | Default | Definition |
52
+ | :------------- | :----------: | -----------: |
53
+ | animation | / | animation file |
54
+ | size | `24` | animation size |
55
+ | strokeColor | `'inherit'` | animation stroke color |
56
+ | fillColor | `''` | animation fill color
57
+ | wrapperStyle | `{}` | wrapper div styles |
58
+ | pathCss | `''` | css string for the animation path element |
59
+ | reverse | `false` | assing to `true` when eg. checkbox should be checked initally |
60
+ | autoplay | `false`* | false except in animations like loading etc. |
61
+ | loop | `false`* | false except in animations like loading etc. |
62
+ | options | `{}` | provide any other custom options which will override the default ones |
63
+ | speed | `1` | a number to determine the speed of lottie(1 is normal speed) |
64
+
65
+ <br />
66
+ Controlled checkbox example
67
+
68
+ ```javascript
69
+ export const RadioButton = () => {
70
+ // JUST EXAMPLE - THIS PART OF THE STATE WILL PROBABLY COME FROM A PARENT FORM COMPONENT
71
+ const [checked, setChecked] = useState(true);
72
+
73
+ return (
74
+ <div style={{ padding: '20px' }}>
75
+ <span>radioButton</span>
76
+ <UseAnimation
77
+ reverse={checked}
78
+ onClick={() => {
79
+ setChecked(!checked);
80
+ }}
81
+ size={40}
82
+ wrapperStyle={{ marginTop: '5px' }}
83
+ animation={radioButton}
84
+ />
85
+ </div>
86
+ );
87
+ };
88
+ ```
89
+
90
+ Animation wrapped in element (use render prop).
91
+ ```javascript
92
+ export const WrapperElement = () => {
93
+ return (
94
+ <UseAnimation
95
+ animation={heart}
96
+ size={60}
97
+ onClick={() => {
98
+ // eslint-disable-next-line
99
+ console.log('additional onClick cb is working');
100
+ }}
101
+ render={(eventProps, animationProps) => (
102
+ <button style={{ padding: '20px' }} type="button" {...eventProps}>
103
+ <div {...animationProps} />
104
+ </button>
105
+ )}
106
+ />
107
+ );
108
+ };
109
+ ```
110
+ Note that `eventProps` consists of `onClick`, `mouseOver` and other DOM events which you probably want to assign to your wrapping element (e.g. Button) and `animationProps` consist of an actual animation which you should spread inside a simple `<div>`
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.7",
3
+ "version": "2.0.9",
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