diginet-core-ui 1.3.24

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 (360) hide show
  1. package/assets/avatar/default.svg +3 -0
  2. package/assets/images/menu/dhr/Default.svg +13 -0
  3. package/assets/images/menu/dhr/MHRM00N0001.svg +14 -0
  4. package/assets/images/menu/dhr/MHRM09N0001.svg +1 -0
  5. package/assets/images/menu/dhr/MHRM09N0002.svg +3 -0
  6. package/assets/images/menu/dhr/MHRM09N0003.svg +25 -0
  7. package/assets/images/menu/dhr/MHRM25N0001.svg +26 -0
  8. package/assets/images/menu/dhr/MHRM29N0001.svg +30 -0
  9. package/assets/images/menu/dhr/MHRM29N0015.svg +63 -0
  10. package/assets/images/menu/dhr/MHRM39N0012.svg +43 -0
  11. package/assets/images/menu/dhr/MHRM39N0013.svg +24 -0
  12. package/assets/images/menu/dhr/MHRM39N0014.svg +14 -0
  13. package/assets/images/menu/dhr/MHRM39N0015.svg +36 -0
  14. package/assets/images/menu/dhr/MHRM39N0016.svg +23 -0
  15. package/assets/images/menu/dhr/MHRM77N0001.svg +28 -0
  16. package/assets/images/menu/dhr/MHRM84N0001.svg +27 -0
  17. package/assets/images/menu/dhr/MHRM84N0002.svg +24 -0
  18. package/assets/images/menu/dhr/MHRM89N0001.svg +16 -0
  19. package/assets/images/menu/dhr/MHRP00N0001.svg +10 -0
  20. package/assets/images/menu/dhr/MHRP09N0001.svg +22 -0
  21. package/assets/images/menu/dhr/MHRP09N0002.svg +19 -0
  22. package/assets/images/menu/dhr/MHRP09N0003.svg +12 -0
  23. package/assets/images/menu/dhr/MHRP09N0004.svg +6 -0
  24. package/assets/images/menu/dhr/MHRP09N0005.svg +10 -0
  25. package/assets/images/menu/dhr/MHRP09N0006.svg +17 -0
  26. package/assets/images/menu/dhr/MHRP09N0007.svg +15 -0
  27. package/assets/images/menu/dhr/MHRP09N0008.svg +8 -0
  28. package/assets/images/menu/dhr/MHRP09N0009.svg +10 -0
  29. package/assets/images/menu/dhr/MHRP09N0010.svg +12 -0
  30. package/assets/images/menu/dhr/MHRP09N0011.svg +16 -0
  31. package/assets/images/menu/dhr/MHRP09N0012.svg +6 -0
  32. package/assets/images/menu/dhr/MHRP09N0013.svg +8 -0
  33. package/assets/images/menu/dhr/MHRP09N0014.svg +11 -0
  34. package/assets/images/menu/dhr/MHRP09N0015.svg +12 -0
  35. package/assets/images/menu/dhr/MHRP09N0016.svg +18 -0
  36. package/assets/images/menu/dhr/MHRP09N0017.svg +18 -0
  37. package/assets/images/menu/dhr/MHRP09N0018.svg +12 -0
  38. package/assets/images/menu/dhr/MHRP09N0019.svg +13 -0
  39. package/assets/images/menu/dhr/MHRP09N0020.svg +17 -0
  40. package/assets/images/menu/dhr/MHRP09N0021.svg +10 -0
  41. package/assets/images/menu/dhr/MHRP09N0022.svg +16 -0
  42. package/assets/images/menu/dhr/MHRP09N0023.svg +8 -0
  43. package/assets/images/menu/dhr/MHRP09N0024.svg +15 -0
  44. package/assets/images/menu/dhr/MHRP09N0025.svg +16 -0
  45. package/assets/images/menu/dhr/MHRP09N0026.svg +13 -0
  46. package/assets/images/menu/dhr/MHRP09N0027.svg +10 -0
  47. package/assets/images/menu/dhr/MHRP13N0001.svg +9 -0
  48. package/assets/images/menu/dhr/MHRP21N0001.svg +12 -0
  49. package/assets/images/menu/dhr/MHRP21N0002.svg +13 -0
  50. package/assets/images/menu/dhr/MHRP25N0001.svg +13 -0
  51. package/assets/images/menu/dhr/MHRP25N0002.svg +16 -0
  52. package/assets/images/menu/dhr/MHRP25N0003.svg +38 -0
  53. package/assets/images/menu/dhr/MHRP25N0004.svg +17 -0
  54. package/assets/images/menu/dhr/MHRP25N0005.svg +20 -0
  55. package/assets/images/menu/dhr/MHRP29N0001.svg +18 -0
  56. package/assets/images/menu/dhr/MHRP29N0002.svg +15 -0
  57. package/assets/images/menu/dhr/MHRP29N0003.svg +20 -0
  58. package/assets/images/menu/dhr/MHRP29N0004.svg +21 -0
  59. package/assets/images/menu/dhr/MHRP29N0005.svg +21 -0
  60. package/assets/images/menu/dhr/MHRP29N0006.svg +14 -0
  61. package/assets/images/menu/dhr/MHRP29N0007.svg +19 -0
  62. package/assets/images/menu/dhr/MHRP29N0008.svg +20 -0
  63. package/assets/images/menu/dhr/MHRP29N0009.svg +11 -0
  64. package/assets/images/menu/dhr/MHRP29N0010.svg +11 -0
  65. package/assets/images/menu/dhr/MHRP29N0011.svg +12 -0
  66. package/assets/images/menu/dhr/MHRP29N0013.svg +27 -0
  67. package/assets/images/menu/dhr/MHRP29N0014.svg +32 -0
  68. package/assets/images/menu/dhr/MHRP29N0016.svg +54 -0
  69. package/assets/images/menu/dhr/MHRP29N0017.svg +24 -0
  70. package/assets/images/menu/dhr/MHRP29N0018.svg +44 -0
  71. package/assets/images/menu/dhr/MHRP29N0019.svg +17 -0
  72. package/assets/images/menu/dhr/MHRP29N0020.svg +11 -0
  73. package/assets/images/menu/dhr/MHRP38N0001.svg +13 -0
  74. package/assets/images/menu/dhr/MHRP38N0002.svg +14 -0
  75. package/assets/images/menu/dhr/MHRP39N0001.svg +15 -0
  76. package/assets/images/menu/dhr/MHRP39N0002.svg +13 -0
  77. package/assets/images/menu/dhr/MHRP39N0003.svg +16 -0
  78. package/assets/images/menu/dhr/MHRP39N0004.svg +22 -0
  79. package/assets/images/menu/dhr/MHRP39N0005.svg +16 -0
  80. package/assets/images/menu/dhr/MHRP39N0006.svg +17 -0
  81. package/assets/images/menu/dhr/MHRP39N0007.svg +13 -0
  82. package/assets/images/menu/dhr/MHRP39N0008.svg +3 -0
  83. package/assets/images/menu/dhr/MHRP39N0009.svg +3 -0
  84. package/assets/images/menu/dhr/MHRP39N0010.svg +7 -0
  85. package/assets/images/menu/dhr/MHRP39N0011.svg +14 -0
  86. package/assets/images/menu/dhr/MHRP39N0013.svg +10 -0
  87. package/assets/images/menu/dhr/MHRP39N0014.svg +11 -0
  88. package/assets/images/menu/dhr/MHRP39N1222.svg +12 -0
  89. package/assets/images/menu/dhr/MHRP51N0001.svg +9 -0
  90. package/assets/images/menu/dhr/MHRP51N0002.svg +13 -0
  91. package/assets/images/menu/dhr/MHRP52N0001.svg +21 -0
  92. package/assets/images/menu/dhr/MHRP52N0002.svg +21 -0
  93. package/assets/images/menu/dhr/MHRP52N0003.svg +16 -0
  94. package/assets/images/menu/dhr/MHRP75N0001.svg +19 -0
  95. package/assets/images/menu/dhr/MHRP75N0002.svg +25 -0
  96. package/assets/images/menu/dhr/MHRP75N0003.svg +3 -0
  97. package/assets/images/menu/dhr/MHRP75N0006.svg +14 -0
  98. package/assets/images/menu/dhr/MHRP75N0007.svg +19 -0
  99. package/assets/images/menu/dhr/MHRP75N0008.svg +19 -0
  100. package/assets/images/menu/dhr/MHRP77N0007.svg +28 -0
  101. package/assets/images/menu/dhr/MHRP77N0008.svg +17 -0
  102. package/assets/images/menu/dhr/MHRP77N0009.svg +19 -0
  103. package/assets/images/menu/dhr/MHRP77N0010.svg +20 -0
  104. package/assets/images/menu/dhr/MHRP89N1000.svg +6 -0
  105. package/assets/images/menu/dhr/MHRP89N1001.svg +6 -0
  106. package/assets/images/menu/dhr/W00F0001.svg +3 -0
  107. package/assets/images/menu/dhr/W00F0002.svg +3 -0
  108. package/assets/images/menu/dhr/W00F0003.svg +3 -0
  109. package/assets/images/menu/dhr/W00F0004.svg +3 -0
  110. package/assets/images/menu/dhr/W00F0005.svg +1 -0
  111. package/assets/images/menu/dhr/W09F2000-WEB5.svg +17 -0
  112. package/assets/images/menu/dhr/W09F2000.svg +6 -0
  113. package/assets/images/menu/dhr/W09F2002-WEB5.svg +21 -0
  114. package/assets/images/menu/dhr/W09F2005-WEB5.svg +13 -0
  115. package/assets/images/menu/dhr/W09F2020-WEB5.svg +16 -0
  116. package/assets/images/menu/dhr/W09F2022-WEB5.svg +20 -0
  117. package/assets/images/menu/dhr/W09F2150-WEB5.svg +16 -0
  118. package/assets/images/menu/dhr/W09F2152-WEB5.svg +20 -0
  119. package/assets/images/menu/dhr/W09F2160-WEB5.svg +14 -0
  120. package/assets/images/menu/dhr/W09F2162-WEB5.svg +18 -0
  121. package/assets/images/menu/dhr/W29F4006-WEB5.svg +19 -0
  122. package/assets/images/menu/dhr/W75F2260-WEB5.svg +15 -0
  123. package/assets/images/menu/dhr/W75F2261-WEB5.svg +19 -0
  124. package/assets/images/menu/dhr/W75F3005-WEB5.svg +13 -0
  125. package/assets/images/menu/dhr/W75F4070-WEB5.svg +21 -0
  126. package/assets/images/menu/dhr/W75F4071-WEB5.svg +17 -0
  127. package/assets/images/menu/dhr/W75F4100-WEB5.svg +14 -0
  128. package/assets/images/menu/dhr/W77F1011.svg +19 -0
  129. package/assets/images/menu/dhr/W77F1013.svg +22 -0
  130. package/assets/images/menu/erp/W00F0001.svg +3 -0
  131. package/assets/images/menu/erp/W00F0002.svg +3 -0
  132. package/assets/images/menu/erp/W00F0003.svg +3 -0
  133. package/assets/images/menu/erp/W00F0004.svg +3 -0
  134. package/assets/images/menu/erp/W05F0001.svg +16 -0
  135. package/assets/images/menu/erp/W05F0001N0000.svg +16 -0
  136. package/assets/images/menu/erp/W05F0004N0000.svg +6 -0
  137. package/assets/images/menu/erp/W05F0006.svg +30 -0
  138. package/assets/images/menu/erp/W05F0007N0000.svg +6 -0
  139. package/assets/images/menu/erp/W05F0008.svg +14 -0
  140. package/assets/images/menu/erp/W05F4000.svg +9 -0
  141. package/assets/images/menu/erp/W06F0001.svg +17 -0
  142. package/assets/images/menu/erp/W06F0001N0000.svg +17 -0
  143. package/assets/images/menu/erp/W06F0004N0000.svg +22 -0
  144. package/assets/images/menu/erp/W06F0005.svg +22 -0
  145. package/assets/images/menu/erp/W06F0006.svg +55 -0
  146. package/assets/images/menu/erp/W06F0008.svg +17 -0
  147. package/assets/images/menu/erp/WA3F1025.svg +5 -0
  148. package/assets/images/menu/erp/WA3F2100.svg +10 -0
  149. package/components/accordion/context.js +6 -0
  150. package/components/accordion/css.js +159 -0
  151. package/components/accordion/details.js +60 -0
  152. package/components/accordion/group.js +122 -0
  153. package/components/accordion/index.js +117 -0
  154. package/components/accordion/summary.js +175 -0
  155. package/components/alert/index.js +264 -0
  156. package/components/alert/notify.js +192 -0
  157. package/components/avatar/index.js +556 -0
  158. package/components/badge/index.js +223 -0
  159. package/components/button/icon.js +493 -0
  160. package/components/button/index.js +653 -0
  161. package/components/button/more.js +135 -0
  162. package/components/button/ripple-effect.js +85 -0
  163. package/components/card/body-card.js +67 -0
  164. package/components/card/card.js +127 -0
  165. package/components/card/context.js +6 -0
  166. package/components/card/index.js +50 -0
  167. package/components/chart/Pie/Circle.js +50 -0
  168. package/components/chart/Pie/Sector.js +142 -0
  169. package/components/chart/Pie/Sectors.js +91 -0
  170. package/components/chart/Pie/index.js +311 -0
  171. package/components/chart/Pie-v2/Circle.js +50 -0
  172. package/components/chart/Pie-v2/Sector.js +128 -0
  173. package/components/chart/Pie-v2/Sectors.js +224 -0
  174. package/components/chart/Pie-v2/index.js +397 -0
  175. package/components/chart/bar/Axis.js +79 -0
  176. package/components/chart/bar/Bar.js +365 -0
  177. package/components/chart/bar/Grid.js +115 -0
  178. package/components/chart/bar/Labels.js +175 -0
  179. package/components/chart/bar/Points.js +111 -0
  180. package/components/chart/bar/index.js +172 -0
  181. package/components/chart/bar-v2/Axis.js +79 -0
  182. package/components/chart/bar-v2/Bar.js +374 -0
  183. package/components/chart/bar-v2/Grid.js +115 -0
  184. package/components/chart/bar-v2/Labels.js +175 -0
  185. package/components/chart/bar-v2/Points.js +111 -0
  186. package/components/chart/bar-v2/index.js +172 -0
  187. package/components/chart/line/Axis.js +79 -0
  188. package/components/chart/line/Grid.js +115 -0
  189. package/components/chart/line/Labels.js +172 -0
  190. package/components/chart/line/Path.js +163 -0
  191. package/components/chart/line/Point.js +348 -0
  192. package/components/chart/line/Title.js +56 -0
  193. package/components/chart/line/index.js +174 -0
  194. package/components/chart/line-v2/Axis.js +79 -0
  195. package/components/chart/line-v2/Grid.js +115 -0
  196. package/components/chart/line-v2/Labels.js +172 -0
  197. package/components/chart/line-v2/Path.js +163 -0
  198. package/components/chart/line-v2/Point.js +354 -0
  199. package/components/chart/line-v2/Title.js +56 -0
  200. package/components/chart/line-v2/index.js +174 -0
  201. package/components/check-text/index.js +157 -0
  202. package/components/check-text/interview-confirmation.js +172 -0
  203. package/components/check-text/interview-status.js +138 -0
  204. package/components/chip/attach.js +180 -0
  205. package/components/chip/index.js +340 -0
  206. package/components/collapse/index.js +67 -0
  207. package/components/dialogs/colors.js +11 -0
  208. package/components/divider/index.js +71 -0
  209. package/components/divider/style.js +12 -0
  210. package/components/form-control/attachment/index.js +1890 -0
  211. package/components/form-control/calendar/function.js +673 -0
  212. package/components/form-control/calendar/index.js +248 -0
  213. package/components/form-control/calendar/range.js +293 -0
  214. package/components/form-control/checkbox/index.js +306 -0
  215. package/components/form-control/control/index.js +92 -0
  216. package/components/form-control/date-picker/index-old.js +953 -0
  217. package/components/form-control/date-picker/index.js +676 -0
  218. package/components/form-control/date-range-picker/index.js +1305 -0
  219. package/components/form-control/dropdown/index.js +1865 -0
  220. package/components/form-control/dropdown-box/index.js +292 -0
  221. package/components/form-control/form/context.js +5 -0
  222. package/components/form-control/form/index.js +41 -0
  223. package/components/form-control/form-group/index.js +118 -0
  224. package/components/form-control/helper-text/index.js +71 -0
  225. package/components/form-control/input-base/index.js +733 -0
  226. package/components/form-control/label/index.js +73 -0
  227. package/components/form-control/money-input/index.js +491 -0
  228. package/components/form-control/number-input/index.js +633 -0
  229. package/components/form-control/phone-input/index.js +433 -0
  230. package/components/form-control/radio/index.js +263 -0
  231. package/components/form-control/text-input/index.js +523 -0
  232. package/components/form-control/time-picker/index.js +829 -0
  233. package/components/form-control/time-picker/swiper.js +590 -0
  234. package/components/form-control/toggle/index.js +250 -0
  235. package/components/form-view/helper-text.js +33 -0
  236. package/components/form-view/index.js +107 -0
  237. package/components/form-view/input.js +129 -0
  238. package/components/form-view/label.js +38 -0
  239. package/components/index.js +100 -0
  240. package/components/list/list-item-action.js +82 -0
  241. package/components/list/list-item-icon.js +76 -0
  242. package/components/list/list-item-text.js +57 -0
  243. package/components/list/list-item.js +114 -0
  244. package/components/list/list.js +155 -0
  245. package/components/list/sub-header.js +61 -0
  246. package/components/modal/body.js +71 -0
  247. package/components/modal/context.js +6 -0
  248. package/components/modal/footer.js +63 -0
  249. package/components/modal/header.js +108 -0
  250. package/components/modal/index.js +69 -0
  251. package/components/modal/modal.js +339 -0
  252. package/components/others/extra/index.js +124 -0
  253. package/components/others/scrollbar/index.js +95 -0
  254. package/components/paging/page-info.js +298 -0
  255. package/components/paging/page-selector.js +281 -0
  256. package/components/paper/index.js +119 -0
  257. package/components/popover/index.js +417 -0
  258. package/components/popup/danger_popup.js +215 -0
  259. package/components/popup/index.js +469 -0
  260. package/components/popup/proposals_popup.js +364 -0
  261. package/components/popup/v2/danger-popup.js +17 -0
  262. package/components/popup/v2/index.js +460 -0
  263. package/components/popup/v2/info-popup.js +17 -0
  264. package/components/popup/v2/success-popup.js +17 -0
  265. package/components/popup/v2/warning-popup.js +17 -0
  266. package/components/popup/v2/yes-no-popup.js +20 -0
  267. package/components/progress/circular.js +414 -0
  268. package/components/progress/linear.js +327 -0
  269. package/components/rating/index.js +392 -0
  270. package/components/slider/slider-container.js +356 -0
  271. package/components/slider/slider-item.js +183 -0
  272. package/components/status/index.js +123 -0
  273. package/components/tab/context.js +3 -0
  274. package/components/tab/tab-container.js +83 -0
  275. package/components/tab/tab-header.js +133 -0
  276. package/components/tab/tab-panel.js +51 -0
  277. package/components/tab/tab.js +206 -0
  278. package/components/tooltip/index.js +602 -0
  279. package/components/tooltip/portal.js +13 -0
  280. package/components/transfer/index.js +489 -0
  281. package/components/tree-view/css.js +94 -0
  282. package/components/tree-view/index.js +1009 -0
  283. package/components/typography/index.js +218 -0
  284. package/css/styles.css +1 -0
  285. package/css/styles.css.map +1 -0
  286. package/global/index.js +175 -0
  287. package/icons/basic.js +6326 -0
  288. package/icons/effect.js +171 -0
  289. package/icons/general/clock/clock.js +21 -0
  290. package/icons/general/color-handler/background.js +41 -0
  291. package/icons/general/color-handler/text.js +41 -0
  292. package/icons/general/emoji/emoji.js +35 -0
  293. package/icons/general/font-properties/bold.js +21 -0
  294. package/icons/general/font-properties/font-family.js +35 -0
  295. package/icons/general/font-properties/font-size.js +27 -0
  296. package/icons/general/font-properties/italic.js +21 -0
  297. package/icons/general/font-properties/underline.js +31 -0
  298. package/icons/general/hyperlink/hyperlink.js +38 -0
  299. package/icons/general/indent/decrease.js +55 -0
  300. package/icons/general/indent/increase.js +55 -0
  301. package/icons/general/index.js +21 -0
  302. package/icons/general/list/bullets.js +77 -0
  303. package/icons/general/list/numbering.js +71 -0
  304. package/icons/general/picture/picture.js +21 -0
  305. package/icons/general/steps/redo.js +21 -0
  306. package/icons/general/steps/undo.js +21 -0
  307. package/icons/general/text-align/center.js +21 -0
  308. package/icons/general/text-align/justify.js +21 -0
  309. package/icons/general/text-align/left.js +21 -0
  310. package/icons/general/text-align/right.js +21 -0
  311. package/icons/index.js +3 -0
  312. package/icons/menu/dhr.js +2440 -0
  313. package/icons/menu/erp.js +490 -0
  314. package/icons/menu/index.js +5 -0
  315. package/icons/menu/v2/index.js +52 -0
  316. package/locale/index.js +11 -0
  317. package/package.json +45 -0
  318. package/readme.md +517 -0
  319. package/styles/animation.js +890 -0
  320. package/styles/color-helper.js +504 -0
  321. package/styles/colors.js +306 -0
  322. package/styles/general.js +48 -0
  323. package/styles/media-queries.js +10 -0
  324. package/styles/typography.js +122 -0
  325. package/styles/utils.js +10 -0
  326. package/theme/index.js +5 -0
  327. package/theme/make-styles.js +95 -0
  328. package/theme/set-theme.js +39 -0
  329. package/theme/settings.js +230 -0
  330. package/theme/theme-provider.js +68 -0
  331. package/theme/theme.js +56 -0
  332. package/theme/with-styles.js +17 -0
  333. package/theme/with-theme.js +11 -0
  334. package/utils/array/array.js +186 -0
  335. package/utils/console.js +34 -0
  336. package/utils/date.js +471 -0
  337. package/utils/error/error.js +62 -0
  338. package/utils/error/errors.js +247 -0
  339. package/utils/getFileType.js +32 -0
  340. package/utils/index.js +23 -0
  341. package/utils/iterator.js +45 -0
  342. package/utils/map-parent.js +53 -0
  343. package/utils/number.js +64 -0
  344. package/utils/object/extend.js +57 -0
  345. package/utils/object/object.js +68 -0
  346. package/utils/parseHTML.js +8 -0
  347. package/utils/promisify.js +38 -0
  348. package/utils/randomString.js +33 -0
  349. package/utils/remove-unicode.js +6 -0
  350. package/utils/render-portal.js +90 -0
  351. package/utils/renderHTML.js +21 -0
  352. package/utils/renderIcon.js +57 -0
  353. package/utils/string/capitalize.js +3 -0
  354. package/utils/string/capitalizeSentenceCase.js +10 -0
  355. package/utils/string/string.js +81 -0
  356. package/utils/type.js +90 -0
  357. package/utils/updatePosition.js +36 -0
  358. package/utils/useOnClickOutside.js +23 -0
  359. package/utils/usePortal.js +56 -0
  360. package/utils/validate.js +149 -0
@@ -0,0 +1,890 @@
1
+ import { keyframes } from '@emotion/core';
2
+ import { promisify } from '../utils';
3
+
4
+ const loadStyles = css => {
5
+ const head = document.head || document.getElementsByTagName('head')[0]; // no <head> node? create one...
6
+
7
+ if (!head) {
8
+ head = document.createElement('head');
9
+ const body = document.body || document.getElementsByTagName('body')[0];
10
+
11
+ if (body) {
12
+ body.parentNode.insertBefore(head, body);
13
+ } else {
14
+ document.documentElement.appendChild(head);
15
+ }
16
+ }
17
+
18
+ const style = document.createElement('style');
19
+
20
+ if (style.styleSheet) {
21
+ // IE
22
+ style.styleSheet.cssText = css;
23
+ } else {
24
+ // the world
25
+ style.appendChild(document.createTextNode(css));
26
+ }
27
+
28
+ head.appendChild(style);
29
+ return style;
30
+ };
31
+
32
+ const pfx = ['webkit', 'moz', 'MS', 'o', ''];
33
+
34
+ const addStyleEvent = (el, type, callback = () => {}) => {
35
+ for (let p in pfx) {
36
+ if (!pfx[p]) {
37
+ type = type.toLowerCase();
38
+ }
39
+
40
+ el.addEventListener(pfx[p] + type, callback, false);
41
+ }
42
+ };
43
+
44
+ const removeStyleEvent = (el, type, callback = () => {}) => {
45
+ for (let p in pfx) {
46
+ if (!pfx[p]) {
47
+ type = type.toLowerCase();
48
+ }
49
+
50
+ el.removeEventListener(pfx[p] + type, callback, false);
51
+ }
52
+ };
53
+
54
+ const getTransformProperty = () => {
55
+ const styles = ['webkitTransform', 'MozTransform', 'msTransform', 'OTransform', 'transform'];
56
+ const el = document.createElement('p');
57
+ let style;
58
+
59
+ for (let i in styles) {
60
+ style = styles[i];
61
+
62
+ if (el.style[style] !== null) {
63
+ return style;
64
+ }
65
+ }
66
+ };
67
+
68
+ const getAnimationProperty = () => {
69
+ const styles = ['webkitAnimation', 'MozAnimation', 'msAnimation', 'OAnimation', 'animation'];
70
+ const el = document.createElement('div');
71
+ let style;
72
+
73
+ for (let i in styles) {
74
+ style = styles[i];
75
+
76
+ if (el.style[style] !== null) {
77
+ return style;
78
+ }
79
+ }
80
+ };
81
+
82
+ const registeredAnimations = {};
83
+ const mainDefaults = {
84
+ duration: 1000,
85
+ fillMode: 'both',
86
+ easing: 'ease',
87
+ iterations: 1,
88
+ delay: 0,
89
+ direction: 'normal',
90
+ resetWhenDone: false,
91
+ clearTransformsBeforeStart: false
92
+ };
93
+ export const hasAnimation = name => {
94
+ return registeredAnimations.hasOwnProperty(name);
95
+ };
96
+
97
+ const clearTransformProp = el => {
98
+ el.style.transform = '';
99
+ el.style[getTransformProperty()] = '';
100
+ };
101
+
102
+ const clearAnimationProp = el => {
103
+ el.style[getAnimationProperty()] = '';
104
+ el.style.animation = '';
105
+ };
106
+
107
+ const setAnimationProp = (els, val, opts) => {
108
+ const clearTransforms = opts && opts.clearTransforms === true; // we got a collection, potentially
109
+
110
+ for (let i in els) {
111
+ // we do both because... chrome does both
112
+ if (clearTransforms) {
113
+ clearTransformProp(els[i]);
114
+ }
115
+
116
+ if (els[i].style) {
117
+ els[i].style[getAnimationProperty()] = val;
118
+ }
119
+ }
120
+ };
121
+
122
+ const addUnit = (item, unit) => {
123
+ if (typeof item === 'string') {
124
+ return item;
125
+ }
126
+
127
+ return item + unit;
128
+ };
129
+
130
+ const getValueForProperty = (val, prop) => {
131
+ if (val.hasOwnProperty(prop)) {
132
+ return val[prop];
133
+ }
134
+
135
+ return 0;
136
+ };
137
+
138
+ const createCssTranslateString = val => {
139
+ var res = []; // array of values is assumed to be [x,y,(z)]
140
+
141
+ if (Array.isArray(val)) {
142
+ if (val.length === 2) {
143
+ res = res.concat(val, 0);
144
+ } else {
145
+ res = val;
146
+ }
147
+ } else {
148
+ res.push(getValueForProperty(val, 'x'));
149
+ res.push(getValueForProperty(val, 'y'));
150
+ res.push(getValueForProperty(val, 'z'));
151
+ }
152
+
153
+ res = res.map(function (val) {
154
+ return addUnit(val, 'px');
155
+ });
156
+ return 'translate3d(' + res.join(',') + ')';
157
+ };
158
+
159
+ const lookups = {
160
+ scale: val => {
161
+ return 'scale(' + val + ')';
162
+ },
163
+ rotate: val => {
164
+ return 'rotate(' + addUnit(val, 'deg') + ')';
165
+ },
166
+ translate: val => {
167
+ return createCssTranslateString(val);
168
+ },
169
+ transform: val => {
170
+ return val;
171
+ }
172
+ };
173
+
174
+ const prefix = () => {
175
+ if (typeof document !== 'undefined') {
176
+ const el = document.documentElement || document.createElement('div');
177
+ return el.style.animation !== null ? '' : '-webkit-';
178
+ }
179
+ };
180
+
181
+ const getStyles = obj => {
182
+ // array of values is assumed to be [x,y,(z)]
183
+ if (Array.isArray(obj)) {
184
+ return prefix() + 'transform:' + createCssTranslateString(obj);
185
+ }
186
+
187
+ let transformBuff = [],
188
+ otherStyles = []; // object assumes
189
+
190
+ if (typeof obj === 'object') {
191
+ for (let key in obj) {
192
+ if (lookups[key]) {
193
+ transformBuff.push(lookups[key](obj[key]));
194
+ } else {
195
+ otherStyles.push(key + ':' + obj[key]);
196
+ }
197
+ }
198
+ }
199
+
200
+ otherStyles.push(prefix() + 'transform:' + transformBuff.join(''));
201
+ return otherStyles.join(';');
202
+ };
203
+
204
+ const getLine = (percentage, styles) => {
205
+ if (typeof percentage === 'number') {
206
+ percentage += '%';
207
+ } else if (typeof percentage === 'string' && percentage.indexOf('%') === -1) {
208
+ percentage += '%';
209
+ }
210
+
211
+ return percentage + '{' + getStyles(styles) + '}';
212
+ };
213
+
214
+ const createKeyframeAnimation = (name, positions) => {
215
+ let buf = '@' + prefix() + 'keyframes ' + name + '{'; // we got an array of arrays
216
+
217
+ if (Array.isArray(positions)) {
218
+ buf += positions.map(function (pos, index) {
219
+ let percentage;
220
+
221
+ if (index) {
222
+ percentage = index / (positions.length - 1) * 100;
223
+ } else {
224
+ percentage = 0;
225
+ }
226
+
227
+ return getLine(percentage, pos);
228
+ }).join('');
229
+ } else {
230
+ for (let key in positions) {
231
+ buf += getLine(key, positions[key]);
232
+ }
233
+ }
234
+
235
+ buf += '}';
236
+ return buf;
237
+ };
238
+
239
+ const setAnimationAsTransform = (els, opts) => {
240
+ const clearAnimations = opts && opts.clearAnimations === true; // we got a collection, potentially
241
+
242
+ for (let i in els) {
243
+ els[i].style[getTransformProperty()] = getComputedStyle(els[i])[getTransformProperty()];
244
+ if (clearAnimations) clearAnimationProp(els[i]);
245
+ }
246
+ };
247
+
248
+ export const runAnimation = promisify((els, opts, cb = () => {}) => {
249
+ if (typeof opts === 'string') {
250
+ opts = {
251
+ name: opts
252
+ };
253
+ }
254
+
255
+ if (!els.length) {
256
+ els = [els];
257
+ }
258
+
259
+ if (!opts.name) {
260
+ return cb(Error('must supply animation name'));
261
+ }
262
+
263
+ const found = registeredAnimations[opts.name];
264
+
265
+ if (!found) {
266
+ return cb(Error(`no animation named ${opts.name} exists`));
267
+ }
268
+
269
+ opts = { ...opts,
270
+ ...found.presets,
271
+ ...mainDefaults
272
+ };
273
+
274
+ const animationEnd = () => {
275
+ removeStyleEvent(els[0], 'AnimationEnd', animationEnd);
276
+
277
+ if (opts.resetWhenDone) {
278
+ setAnimationAsTransform(els, {
279
+ clearAnimations: true
280
+ });
281
+ }
282
+
283
+ return cb(null, els);
284
+ };
285
+
286
+ addStyleEvent(els[0], 'AnimationEnd', animationEnd);
287
+ const styles = [opts.name, addUnit(opts.duration, 'ms'), opts.easing, opts.iterations, addUnit(opts.delay, 'ms'), opts.direction, opts.fillMode];
288
+ setAnimationProp(els, styles.join(' '), {
289
+ clearTransforms: opts.clearTransformsBeforeStart
290
+ });
291
+ });
292
+ export const registerAnimation = opts => {
293
+ unregisterAnimation(opts.name);
294
+ const el = loadStyles(createKeyframeAnimation(opts.name, opts.animation));
295
+ el.setAttribute('data-name', opts.name);
296
+ registeredAnimations[opts.name] = {
297
+ el: el,
298
+ presets: opts.presets || {}
299
+ };
300
+ };
301
+ export const unregisterAnimation = name => {
302
+ if (hasAnimation(name)) {
303
+ const styleEl = registeredAnimations[name].el;
304
+ styleEl.parentNode.removeChild(styleEl);
305
+ delete registeredAnimations[name];
306
+ }
307
+ };
308
+ const backInDown = keyframes`
309
+ 0% {
310
+ transform: translateY(-1200px) scale(0.7);
311
+ opacity: 0.7;
312
+ }
313
+
314
+ 80% {
315
+ transform: translateY(0px) scale(0.7);
316
+ opacity: 0.7;
317
+ }
318
+
319
+ 100% {
320
+ transform: scale(1);
321
+ opacity: 1;
322
+ }
323
+ `;
324
+ const backInLeft = keyframes`
325
+ 0% {
326
+ transform: translateX(-2000px) scale(0.7);
327
+ opacity: 0.7;
328
+ }
329
+
330
+ 80% {
331
+ transform: translateX(0px) scale(0.7);
332
+ opacity: 0.7;
333
+ }
334
+
335
+ 100% {
336
+ transform: scale(1);
337
+ opacity: 1;
338
+ }
339
+ `;
340
+ const backInRight = keyframes`
341
+ 0% {
342
+ transform: translateX(2000px) scale(0.7);
343
+ opacity: 0.7;
344
+ }
345
+
346
+ 80% {
347
+ transform: translateX(0px) scale(0.7);
348
+ opacity: 0.7;
349
+ }
350
+
351
+ 100% {
352
+ transform: scale(1);
353
+ opacity: 1;
354
+ }
355
+ `;
356
+ const backInUp = keyframes`
357
+ 0% {
358
+ transform: translateY(1200px) scale(0.7);
359
+ opacity: 0.7;
360
+ }
361
+
362
+ 80% {
363
+ transform: translateY(0px) scale(0.7);
364
+ opacity: 0.7;
365
+ }
366
+
367
+ 100% {
368
+ transform: scale(1);
369
+ opacity: 1;
370
+ }
371
+ `;
372
+ const backOutDown = keyframes`
373
+ 0% {
374
+ transform: scale(1);
375
+ opacity: 1;
376
+ }
377
+
378
+ 20% {
379
+ transform: translateY(0px) scale(0.7);
380
+ opacity: 0.7;
381
+ }
382
+
383
+ 100% {
384
+ transform: translateY(700px) scale(0.7);
385
+ opacity: 0.7;
386
+ }
387
+ `;
388
+ const backOutLeft = keyframes`
389
+ 0% {
390
+ transform: scale(1);
391
+ opacity: 1;
392
+ }
393
+
394
+ 20% {
395
+ transform: translateX(0px) scale(0.7);
396
+ opacity: 0.7;
397
+ }
398
+
399
+ 100% {
400
+ transform: translateX(-2000px) scale(0.7);
401
+ opacity: 0.7;
402
+ }
403
+ `;
404
+ const backOutRight = keyframes`
405
+ 0% {
406
+ transform: scale(1);
407
+ opacity: 1;
408
+ }
409
+
410
+ 20% {
411
+ transform: translateX(0px) scale(0.7);
412
+ opacity: 0.7;
413
+ }
414
+
415
+ 100% {
416
+ transform: translateX(2000px) scale(0.7);
417
+ opacity: 0.7;
418
+ }
419
+ `;
420
+ const backOutUp = keyframes`
421
+ 0% {
422
+ transform: scale(1);
423
+ opacity: 1;
424
+ }
425
+
426
+ 20% {
427
+ transform: translateY(0px) scale(0.7);
428
+ opacity: 0.7;
429
+ }
430
+
431
+ 100% {
432
+ transform: translateY(-700px) scale(0.7);
433
+ opacity: 0.7;
434
+ }
435
+ `;
436
+ const bounceIn = keyframes`
437
+ from,
438
+ 20%,
439
+ 40%,
440
+ 60%,
441
+ 80%,
442
+ to {
443
+ animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
444
+ }
445
+
446
+ 0% {
447
+ opacity: 0;
448
+ transform: scale3d(0.3, 0.3, 0.3);
449
+ }
450
+
451
+ 20% {
452
+ transform: scale3d(1.1, 1.1, 1.1);
453
+ }
454
+
455
+ 40% {
456
+ transform: scale3d(0.9, 0.9, 0.9);
457
+ }
458
+
459
+ 60% {
460
+ opacity: 1;
461
+ transform: scale3d(1.03, 1.03, 1.03);
462
+ }
463
+
464
+ 80% {
465
+ transform: scale3d(0.97, 0.97, 0.97);
466
+ }
467
+
468
+ to {
469
+ opacity: 1;
470
+ transform: scale3d(1, 1, 1);
471
+ }
472
+ `;
473
+ const bounceInDown = keyframes`
474
+ from,
475
+ 60%,
476
+ 75%,
477
+ 90%,
478
+ to {
479
+ animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
480
+ }
481
+
482
+ 0% {
483
+ opacity: 0;
484
+ transform: translate3d(0, -3000px, 0) scaleY(3);
485
+ }
486
+
487
+ 60% {
488
+ opacity: 1;
489
+ transform: translate3d(0, 25px, 0) scaleY(0.9);
490
+ }
491
+
492
+ 75% {
493
+ transform: translate3d(0, -10px, 0) scaleY(0.95);
494
+ }
495
+
496
+ 90% {
497
+ transform: translate3d(0, 5px, 0) scaleY(0.985);
498
+ }
499
+
500
+ to {
501
+ transform: translate3d(0, 0, 0);
502
+ }
503
+ `;
504
+ const bounceInLeft = keyframes`
505
+ from,
506
+ 60%,
507
+ 75%,
508
+ 90%,
509
+ to {
510
+ animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
511
+ }
512
+
513
+ 0% {
514
+ opacity: 0;
515
+ transform: translate3d(-3000px, 0, 0) scaleX(3);
516
+ }
517
+
518
+ 60% {
519
+ opacity: 1;
520
+ transform: translate3d(25px, 0, 0) scaleX(1);
521
+ }
522
+
523
+ 75% {
524
+ transform: translate3d(-10px, 0, 0) scaleX(0.98);
525
+ }
526
+
527
+ 90% {
528
+ transform: translate3d(5px, 0, 0) scaleX(0.995);
529
+ }
530
+
531
+ to {
532
+ transform: translate3d(0, 0, 0);
533
+ }
534
+ `;
535
+ const bounceInRight = keyframes`
536
+ from,
537
+ 60%,
538
+ 75%,
539
+ 90%,
540
+ to {
541
+ animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
542
+ }
543
+
544
+ from {
545
+ opacity: 0;
546
+ transform: translate3d(3000px, 0, 0) scaleX(3);
547
+ }
548
+
549
+ 60% {
550
+ opacity: 1;
551
+ transform: translate3d(-25px, 0, 0) scaleX(1);
552
+ }
553
+
554
+ 75% {
555
+ transform: translate3d(10px, 0, 0) scaleX(0.98);
556
+ }
557
+
558
+ 90% {
559
+ transform: translate3d(-5px, 0, 0) scaleX(0.995);
560
+ }
561
+
562
+ to {
563
+ transform: translate3d(0, 0, 0);
564
+ }
565
+ `;
566
+ const bounceInUp = keyframes`
567
+ from,
568
+ 60%,
569
+ 75%,
570
+ 90%,
571
+ to {
572
+ animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
573
+ }
574
+
575
+ from {
576
+ opacity: 0;
577
+ transform: translate3d(0, 3000px, 0) scaleY(5);
578
+ }
579
+
580
+ 60% {
581
+ opacity: 1;
582
+ transform: translate3d(0, -20px, 0) scaleY(0.9);
583
+ }
584
+
585
+ 75% {
586
+ transform: translate3d(0, 10px, 0) scaleY(0.95);
587
+ }
588
+
589
+ 90% {
590
+ transform: translate3d(0, -5px, 0) scaleY(0.985);
591
+ }
592
+
593
+ to {
594
+ transform: translate3d(0, 0, 0);
595
+ }
596
+ `;
597
+ const bounceOut = keyframes`
598
+ 20% {
599
+ transform: scale3d(0.9, 0.9, 0.9);
600
+ }
601
+
602
+ 50%,
603
+ 55% {
604
+ opacity: 1;
605
+ transform: scale3d(1.1, 1.1, 1.1);
606
+ }
607
+
608
+ to {
609
+ opacity: 0;
610
+ transform: scale3d(0.3, 0.3, 0.3);
611
+ }
612
+ `;
613
+ const bounceOutDown = keyframes`
614
+ 20% {
615
+ transform: translate3d(0, 10px, 0) scaleY(0.985);
616
+ }
617
+
618
+ 40%,
619
+ 45% {
620
+ opacity: 1;
621
+ transform: translate3d(0, -20px, 0) scaleY(0.9);
622
+ }
623
+
624
+ to {
625
+ opacity: 0;
626
+ transform: translate3d(0, 2000px, 0) scaleY(3);
627
+ }
628
+ `;
629
+ const bounceOutLeft = keyframes`
630
+ 20% {
631
+ opacity: 1;
632
+ transform: translate3d(20px, 0, 0) scaleX(0.9);
633
+ }
634
+
635
+ to {
636
+ opacity: 0;
637
+ transform: translate3d(-2000px, 0, 0) scaleX(2);
638
+ }
639
+ `;
640
+ const bounceOutRight = keyframes`
641
+ 20% {
642
+ opacity: 1;
643
+ transform: translate3d(-20px, 0, 0) scaleX(0.9);
644
+ }
645
+
646
+ to {
647
+ opacity: 0;
648
+ transform: translate3d(2000px, 0, 0) scaleX(2);
649
+ }
650
+ `;
651
+ const bounceOutUp = keyframes`
652
+ 20% {
653
+ transform: translate3d(0, -10px, 0) scaleY(0.985);
654
+ }
655
+
656
+ 40%,
657
+ 45% {
658
+ opacity: 1;
659
+ transform: translate3d(0, 20px, 0) scaleY(0.9);
660
+ }
661
+
662
+ to {
663
+ opacity: 0;
664
+ transform: translate3d(0, -2000px, 0) scaleY(3);
665
+ }
666
+ `;
667
+ const fadeIn = keyframes`
668
+ from {
669
+ opacity: 0;
670
+ }
671
+
672
+ to {
673
+ opacity: 1;
674
+ }
675
+ `;
676
+ const fadeInDown = keyframes`
677
+ from {
678
+ opacity: 0;
679
+ transform: translate3d(0, -100%, 0);
680
+ }
681
+
682
+ to {
683
+ opacity: 1;
684
+ transform: translate3d(0, 0, 0);
685
+ }
686
+ `;
687
+ const fadeInDownFar = keyframes`
688
+ from {
689
+ opacity: 0;
690
+ transform: translate3d(0, -100%, 0);
691
+ }
692
+
693
+ to {
694
+ opacity: 1;
695
+ transform: translate3d(0, 0, 0);
696
+ }
697
+ `;
698
+ const fadeInLeft = keyframes`
699
+ from {
700
+ opacity: 0;
701
+ transform: translate3d(-100%, 0, 0);
702
+ }
703
+
704
+ to {
705
+ opacity: 1;
706
+ transform: translate3d(0, 0, 0);
707
+ }
708
+ `;
709
+ const fadeInLeftFar = keyframes`
710
+ from {
711
+ opacity: 0;
712
+ transform: translate3d(-2000px, 0, 0);
713
+ }
714
+
715
+ to {
716
+ opacity: 1;
717
+ transform: translate3d(0, 0, 0);
718
+ }
719
+ `;
720
+ const fadeInRight = keyframes`
721
+ from {
722
+ opacity: 0;
723
+ transform: translate3d(100%, 0, 0);
724
+ }
725
+
726
+ to {
727
+ opacity: 1;
728
+ transform: translate3d(0, 0, 0);
729
+ }
730
+ `;
731
+ const fadeInRightFar = keyframes`
732
+ from {
733
+ opacity: 0;
734
+ transform: translate3d(2000px, 0, 0);
735
+ }
736
+
737
+ to {
738
+ opacity: 1;
739
+ transform: translate3d(0, 0, 0);
740
+ }
741
+ `;
742
+ const fadeInUp = keyframes`
743
+ from {
744
+ opacity: 0;
745
+ transform: translate3d(0, 100%, 0);
746
+ }
747
+
748
+ to {
749
+ opacity: 1;
750
+ transform: translate3d(0, 0, 0);
751
+ }
752
+ `;
753
+ const fadeInUpFar = keyframes`
754
+ from {
755
+ opacity: 0;
756
+ transform: translate3d(0, 2000px, 0);
757
+ }
758
+
759
+ to {
760
+ opacity: 1;
761
+ transform: translate3d(0, 0, 0);
762
+ }
763
+ `;
764
+ const fadeOut = keyframes`
765
+ from {
766
+ opacity: 1;
767
+ }
768
+
769
+ to {
770
+ opacity: 0;
771
+ }
772
+ `;
773
+ const fadeOutDown = keyframes`
774
+ from {
775
+ opacity: 1;
776
+ }
777
+
778
+ to {
779
+ opacity: 0;
780
+ transform: translate3d(0, 100%, 0);
781
+ }
782
+ `;
783
+ const fadeOutDownFar = keyframes`
784
+ from {
785
+ opacity: 1;
786
+ }
787
+
788
+ to {
789
+ opacity: 0;
790
+ transform: translate3d(0, 2000px, 0);
791
+ }
792
+ `;
793
+ const fadeOutLeft = keyframes`
794
+ from {
795
+ opacity: 1;
796
+ }
797
+
798
+ to {
799
+ opacity: 0;
800
+ transform: translate3d(-100%, 0, 0);
801
+ }
802
+ `;
803
+ const fadeOutLeftFar = keyframes`
804
+ from {
805
+ opacity: 1;
806
+ }
807
+
808
+ to {
809
+ opacity: 0;
810
+ transform: translate3d(-2000px, 0, 0);
811
+ }
812
+ `;
813
+ const fadeOutRight = keyframes`
814
+ from {
815
+ opacity: 1;
816
+ }
817
+
818
+ to {
819
+ opacity: 0;
820
+ transform: translate3d(100%, 0, 0);
821
+ }
822
+ `;
823
+ const fadeOutRightFar = keyframes`
824
+ from {
825
+ opacity: 1;
826
+ }
827
+
828
+ to {
829
+ opacity: 0;
830
+ transform: translate3d(2000px, 0, 0);
831
+ }
832
+ `;
833
+ const fadeOutUp = keyframes`
834
+ from {
835
+ opacity: 1;
836
+ }
837
+
838
+ to {
839
+ opacity: 0;
840
+ transform: translate3d(0, -100%, 0);
841
+ }
842
+ `;
843
+ const fadeOutUpFar = keyframes`
844
+ from {
845
+ opacity: 1;
846
+ }
847
+
848
+ to {
849
+ opacity: 0;
850
+ transform: translate3d(0, -2000px, 0);
851
+ }
852
+ `;
853
+ export const animations = {
854
+ backInDown,
855
+ backInLeft,
856
+ backInRight,
857
+ backInUp,
858
+ backOutDown,
859
+ backOutLeft,
860
+ backOutRight,
861
+ backOutUp,
862
+ bounceIn,
863
+ bounceInDown,
864
+ bounceInLeft,
865
+ bounceInRight,
866
+ bounceInUp,
867
+ bounceOut,
868
+ bounceOutDown,
869
+ bounceOutLeft,
870
+ bounceOutRight,
871
+ bounceOutUp,
872
+ fadeIn,
873
+ fadeInDown,
874
+ fadeInDownFar,
875
+ fadeInLeft,
876
+ fadeInLeftFar,
877
+ fadeInRight,
878
+ fadeInRightFar,
879
+ fadeInUp,
880
+ fadeInUpFar,
881
+ fadeOut,
882
+ fadeOutDown,
883
+ fadeOutDownFar,
884
+ fadeOutLeft,
885
+ fadeOutLeftFar,
886
+ fadeOutRight,
887
+ fadeOutRightFar,
888
+ fadeOutUp,
889
+ fadeOutUpFar
890
+ };