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,115 @@
1
+ /** @jsxRuntime classic */
2
+
3
+ /** @jsx jsx */
4
+ import PropTypes from "prop-types";
5
+ import { jsx } from '@emotion/core';
6
+
7
+ const Grid = ({
8
+ getX,
9
+ getY,
10
+ gridColor,
11
+ GridLines,
12
+ gridWidth,
13
+ labelsCountY,
14
+ maxX,
15
+ maxY,
16
+ minX,
17
+ minY,
18
+ unitWidth
19
+ }) => {
20
+ let gridX = [];
21
+ let gridY = [];
22
+
23
+ for (let i = minX; i <= maxX + unitWidth; i++) {
24
+ gridX.push(jsx("line", {
25
+ key: i,
26
+ x1: getX(i),
27
+ y1: getY(minY),
28
+ x2: getX(i),
29
+ y2: getY(maxY + 5)
30
+ }));
31
+ }
32
+
33
+ const yStep = labelsCountY > 0 ? labelsCountY : unitWidth;
34
+
35
+ for (let i = minY; i <= maxY; i += Math.floor(maxY / yStep)) {
36
+ gridY.push(jsx("line", {
37
+ key: i,
38
+ x1: getX(minX),
39
+ y1: getY(i),
40
+ x2: getX(maxX + unitWidth + 0.5),
41
+ y2: getY(i)
42
+ }));
43
+ }
44
+
45
+ if (GridLines === 'full') {
46
+ return jsx("g", {
47
+ className: 'DGN-Grid-BarChart',
48
+ stroke: gridColor,
49
+ strokeWidth: gridWidth
50
+ }, gridX, gridY);
51
+ }
52
+
53
+ if (GridLines === 'horizontal') {
54
+ return jsx("g", {
55
+ className: 'DGN-Grid-BarChart',
56
+ stroke: gridColor,
57
+ strokeWidth: gridWidth
58
+ }, gridY);
59
+ }
60
+
61
+ if (GridLines === 'none') {
62
+ return null;
63
+ } else {
64
+ return jsx("g", {
65
+ className: 'DGN-Grid-BarChart',
66
+ stroke: gridColor,
67
+ strokeWidth: gridWidth
68
+ }, gridY);
69
+ }
70
+ };
71
+
72
+ Grid.propTypes = {
73
+ /** the getX position x on Ox*/
74
+ getX: PropTypes.func,
75
+
76
+ /** the getY position y on Oy */
77
+ getY: PropTypes.func,
78
+
79
+ /** change color of grid Columb*/
80
+ gridColor: PropTypes.string,
81
+
82
+ /** change Columb grid display style ['full' , 'horizontal', 'none']*/
83
+ GridLines: PropTypes.string,
84
+
85
+ /** hiden or show grid columb*/
86
+ gridVisible: PropTypes.bool,
87
+ gridWidth: PropTypes.number,
88
+ labelsCountY: PropTypes.number,
89
+
90
+ /** the maxX is maximum of Ox quantity returned by data*/
91
+ maxX: PropTypes.number,
92
+
93
+ /** the maxY is maximum of Oy quantity returned by data*/
94
+ maxY: PropTypes.number,
95
+
96
+ /** the minX is minimum of OX quantity returned by data*/
97
+ minX: PropTypes.number,
98
+
99
+ /** the minY is minimum of Oy quantity returned by data*/
100
+ minY: PropTypes.number,
101
+
102
+ /** the unitWidth */
103
+ unitWidth: PropTypes.number
104
+ };
105
+ Grid.defaultProps = {
106
+ getX: x => x,
107
+ getY: y => y,
108
+ gridColor: 'rgba(127, 130, 142, 0.15)',
109
+ GridLines: 'full',
110
+ gridVisible: false,
111
+ gridWidth: 0.5,
112
+ labelsCountY: 5,
113
+ unitWidth: 1
114
+ };
115
+ export default Grid;
@@ -0,0 +1,175 @@
1
+ /** @jsxRuntime classic */
2
+
3
+ /** @jsx jsx */
4
+ import PropTypes from "prop-types";
5
+ import { jsx, css } from '@emotion/core';
6
+ import theme from '../../../theme/settings';
7
+
8
+ const Labels = ({
9
+ getX,
10
+ getY,
11
+ data,
12
+ labelsColor,
13
+ labelsCountY,
14
+ labelsFormatX,
15
+ viewBoxWidth,
16
+ labelsFormatY,
17
+ labelsHeightX,
18
+ labelsOffsetX,
19
+ labelStyle,
20
+ labelsOffsetY,
21
+ labelsVisible,
22
+ maxY,
23
+ minX,
24
+ unitWidth
25
+ }) => {
26
+ const FONT_SIZE = 12;
27
+ const labelContainerCSS = css`
28
+ transform: translate(0, ${labelsOffsetX}px);
29
+ `;
30
+ const Label = css`
31
+ align-items: center;
32
+ justify-content: center;
33
+ text-align: center;
34
+ `;
35
+ const LabelCSS = labelStyle === 'italic' ? css`
36
+ fill: ${theme.colors.secondary};
37
+ text-anchor: start;
38
+ font-size: ${FONT_SIZE}px;
39
+ font-family: ${theme.typography.fontFamily};
40
+ text-transform: capitalize;
41
+ cursor: pointer;
42
+ display: inline-block;
43
+ transform-box: fill-box;
44
+ transform: rotateZ(45deg);
45
+ ` : css`
46
+ color: ${theme.colors.secondary};
47
+ text-anchor: middle;
48
+ font-size: ${FONT_SIZE}px;
49
+ font-family: ${theme.typography.fontFamily};
50
+ text-transform: capitalize;
51
+ cursor: pointer;
52
+ display: inline-block;
53
+ word-break: break-word;
54
+ `;
55
+
56
+ if (labelsVisible) {
57
+ let xLabels;
58
+ let yLabels;
59
+ let tile = 4;
60
+ let tile2 = 9;
61
+
62
+ const TiLe = () => {
63
+ if (viewBoxWidth >= 800) {
64
+ return tile;
65
+ } else {
66
+ return tile2;
67
+ }
68
+ };
69
+
70
+ xLabels = labelStyle === 'italic' ? data.map((point, x) => jsx("text", {
71
+ key: x,
72
+ css: LabelCSS,
73
+ fill: labelsColor,
74
+ x: getX(point.x + unitWidth / 2),
75
+ y: getY(0) + labelsHeightX
76
+ }, labelsFormatX(point.name))) : data.map((point, x) => jsx("foreignObject", {
77
+ key: x,
78
+ css: Label,
79
+ fill: labelsColor,
80
+ x: getX(point.x + unitWidth / TiLe()),
81
+ y: getY(0) + labelsHeightX,
82
+ width: "40",
83
+ height: "80"
84
+ }, jsx("span", {
85
+ css: LabelCSS
86
+ }, labelsFormatX(point.name))));
87
+ const yLabelsRange = [];
88
+ const yStep = labelsCountY > 0 ? labelsCountY : 1;
89
+
90
+ for (let i = 0; i <= maxY; i += Math.floor(maxY / yStep)) {
91
+ yLabelsRange.push(i);
92
+ }
93
+
94
+ yLabels = yLabelsRange.map(quantity => jsx("text", {
95
+ key: quantity,
96
+ fill: labelsColor,
97
+ x: getX(minX),
98
+ y: getY(quantity) + labelsHeightX / 3,
99
+ transform: `translate(-${labelsOffsetY}, 0)`,
100
+ textAnchor: "end",
101
+ style: {
102
+ fill: theme.colors.secondary,
103
+ fontSize: FONT_SIZE,
104
+ cursor: 'pointer',
105
+ fontFamily: theme.typography.fontFamily
106
+ }
107
+ }, labelsFormatY(quantity)));
108
+ return jsx("g", {
109
+ className: 'DGN-Labels-BarChart'
110
+ }, xLabels && jsx("g", {
111
+ className: 'DGN-AxisX',
112
+ css: labelContainerCSS
113
+ }, xLabels), yLabels && jsx("g", {
114
+ className: 'DGN-AxisY'
115
+ }, yLabels));
116
+ } else {
117
+ return null;
118
+ }
119
+ };
120
+
121
+ Labels.defaultProps = {
122
+ getX: x => x,
123
+ getY: quantity => quantity,
124
+ labelsCharacterWidth: 10,
125
+ labelsColor: theme.colors.secondary,
126
+ labelsCountY: 5,
127
+ labelsFormatX: label => label,
128
+ labelsFormatY: quantity => quantity,
129
+ labelsHeightX: 5,
130
+ labelsOffsetX: 10,
131
+ labelsOffsetY: 10,
132
+ labelsStepX: 1,
133
+ labelsVisible: true,
134
+ unitWidth: 1,
135
+ labelStyle: 'italic'
136
+ };
137
+ Labels.propTypes = {
138
+ /** the getX position x on Ox*/
139
+ getX: PropTypes.func,
140
+
141
+ /** the getY position y on Oy */
142
+ getY: PropTypes.func,
143
+
144
+ /** the labelsColor change color */
145
+ labelsColor: PropTypes.string,
146
+
147
+ /** change style show of label ['', 'italic'], default: 'italic' */
148
+ labelStyle: PropTypes.string,
149
+ labelsCountY: PropTypes.number,
150
+ labelsFormatX: PropTypes.func,
151
+ labelsFormatY: PropTypes.func,
152
+ labelsHeightX: PropTypes.number,
153
+ labelsOffsetX: PropTypes.number,
154
+ labelsOffsetY: PropTypes.number,
155
+ labelsStepX: PropTypes.number,
156
+
157
+ /** change show or hiden of label */
158
+ labelsVisible: PropTypes.bool,
159
+
160
+ /** the maxX is maximum of Ox quantity returned by data*/
161
+ maxX: PropTypes.number,
162
+
163
+ /** the maxY is maximum of Oy quantity returned by data*/
164
+ maxY: PropTypes.number,
165
+
166
+ /** the minX is minimum of OX quantity returned by data*/
167
+ minX: PropTypes.number,
168
+
169
+ /** the minY is minimum of Oy quantity returned by data*/
170
+ minY: PropTypes.number,
171
+
172
+ /** the unitWidth */
173
+ unitWidth: PropTypes.number
174
+ };
175
+ export default Labels;
@@ -0,0 +1,111 @@
1
+ /** @jsxRuntime classic */
2
+
3
+ /** @jsx jsx */
4
+ import PropTypes from "prop-types";
5
+ import { jsx } from '@emotion/core';
6
+
7
+ const Points = ({
8
+ data,
9
+ getX,
10
+ getY,
11
+ maxY,
12
+ minX,
13
+ minY,
14
+ pointsColor,
15
+ pointsIsHoverOnZone,
16
+ onHover,
17
+ pointsRadius,
18
+ pointsStrokeColor,
19
+ pointsStrokeWidth,
20
+ pointsVisible,
21
+ unitWidth
22
+ }) => {
23
+ return pointsVisible ? jsx("g", {
24
+ className: 'DGN-Point-BarChart'
25
+ }, data.map((point, i) => {
26
+ return jsx("circle", {
27
+ key: i,
28
+ r: point.active ? pointsRadius * 1.2 : pointsRadius,
29
+ cx: getX(point.x + unitWidth / 2),
30
+ cy: getY(point.quantity),
31
+ onMouseEnter: e => onHover(point, e),
32
+ onMouseLeave: () => onHover(null, null),
33
+ fill: pointsColor,
34
+ stroke: pointsStrokeColor,
35
+ strokeWidth: pointsStrokeWidth
36
+ });
37
+ }), pointsIsHoverOnZone && data.map((point, i) => {
38
+ return jsx("rect", {
39
+ key: i,
40
+ x: getX(point.x > minX ? (data[i].x + data[i - 1].x) / 2 : minX),
41
+ y: getY(maxY),
42
+ fill: 'transparent',
43
+ width: getX(1),
44
+ height: getY(minY),
45
+ onMouseEnter: e => onHover(point, e),
46
+ onMouseLeave: () => onHover(null, null)
47
+ }, jsx("title", null, point.name, " : ", point.quantity));
48
+ })) : null;
49
+ };
50
+
51
+ Points.propTypes = {
52
+ data: PropTypes.arrayOf(PropTypes.shape({
53
+ x: PropTypes.number,
54
+ quantity: PropTypes.number
55
+ })).isRequired,
56
+
57
+ /** the getX position x on Ox*/
58
+ getX: PropTypes.func,
59
+
60
+ /** the getY position y on Oy */
61
+ getY: PropTypes.func,
62
+
63
+ /** the maxX is maximum of Ox quantity returned by data*/
64
+ maxX: PropTypes.number,
65
+
66
+ /** the maxY is maximum of Oy quantity returned by data*/
67
+ maxY: PropTypes.number,
68
+
69
+ /** the minX is minimum of OX quantity returned by data*/
70
+ minX: PropTypes.number,
71
+
72
+ /** the minY is minimum of Oy quantity returned by data*/
73
+ minY: PropTypes.number,
74
+
75
+ /** change the inner color of the point button */
76
+ pointsColor: PropTypes.string,
77
+
78
+ /** show data information when hovering in the area containing the column */
79
+ pointsIsHoverOnZone: PropTypes.bool,
80
+
81
+ /** function change event hover */
82
+ onHover: PropTypes.func,
83
+
84
+ /** change the radius of the point is created */
85
+ pointsRadius: PropTypes.number,
86
+
87
+ /** change the border color of the point button */
88
+ pointsStrokeColor: PropTypes.string,
89
+
90
+ /** the thickness of the inner core point */
91
+ pointsStrokeWidth: PropTypes.number,
92
+
93
+ /** show or hiden point */
94
+ pointsVisible: PropTypes.bool,
95
+
96
+ /** the unitWidth */
97
+ unitWidth: PropTypes.number
98
+ };
99
+ Points.defaultProps = {
100
+ getX: x => x,
101
+ getY: quantity => quantity,
102
+ pointsColor: '#fff',
103
+ pointsIsHoverOnZone: false,
104
+ onHover: () => {},
105
+ pointsRadius: 3,
106
+ pointsStrokeColor: '#111d5e',
107
+ pointsStrokeWidth: 1,
108
+ pointsVisible: false,
109
+ unitWidth: 1
110
+ };
111
+ export default Points;
@@ -0,0 +1,172 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ /** @jsxRuntime classic */
4
+
5
+ /** @jsx jsx */
6
+ import PropTypes from "prop-types";
7
+ import { memo, forwardRef } from "react";
8
+ import { jsx } from '@emotion/core';
9
+ import Axis from './Axis';
10
+ import Points from './Points';
11
+ import Labels from './Labels';
12
+ import Grid from './Grid';
13
+ import Bars from './Bar';
14
+ import { randomString } from '../../../utils';
15
+ const BarChart = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
16
+ labelsVisible,
17
+ labelsCharacterWidth,
18
+ labelsCountY,
19
+ data,
20
+ viewBoxHeight,
21
+ labelsOffsetY,
22
+ viewBoxWidth,
23
+ labelsOffsetX,
24
+ labelsHeightX,
25
+ ...props
26
+ }, ref) => {
27
+ const dataSource = data.map((item, i) => ({ ...item,
28
+ x: i
29
+ }));
30
+ const UNIT_WIDTH = 1;
31
+ const id = 'DGN-CUI-BarChart-' + randomString(6, {
32
+ allowNumber: false,
33
+ allowSymbol: false
34
+ });
35
+
36
+ const round = n => {
37
+ return Math.round(n * 100) / 100;
38
+ };
39
+
40
+ const getMinX = () => {
41
+ return dataSource.length > 0 ? dataSource[0].x : 0;
42
+ };
43
+
44
+ const getMaxX = () => {
45
+ return dataSource.length > 0 ? dataSource[dataSource.length - 1].x : 0;
46
+ };
47
+
48
+ const getMinY = () => {
49
+ return 0;
50
+ };
51
+
52
+ const getMaxY = () => {
53
+ const yStep = labelsCountY > 0 ? labelsCountY : 1;
54
+ const maxY = dataSource.length > 0 ? dataSource.reduce((max, point) => point.quantity > max ? point.quantity : max, dataSource[0].quantity) : 0;
55
+ return maxY ? Math.ceil(maxY / yStep) * yStep : yStep;
56
+ };
57
+
58
+ const getSvgX = x => {
59
+ const minX = getMinX();
60
+ const maxX = getMaxX();
61
+ const paddingLeft = getLabelsYWidth();
62
+ return round((x - minX) / (maxX + 1 - minX) * (Math.abs(viewBoxWidth) - paddingLeft));
63
+ };
64
+
65
+ const getSvgY = y => {
66
+ const paddingBottom = labelsVisible ? labelsHeightX + labelsOffsetX : 0;
67
+ const height = Math.abs(viewBoxHeight) - paddingBottom;
68
+ const maxY = getMaxY();
69
+ return round(height - y / maxY * height);
70
+ };
71
+
72
+ const getLabelsYWidth = () => {
73
+ const maxY = getMaxY();
74
+ return labelsVisible ? maxY.toString().length * labelsCharacterWidth + labelsOffsetY : 0;
75
+ };
76
+
77
+ const minX = getMinX();
78
+ const maxX = getMaxX();
79
+ const maxY = getMaxY();
80
+ const minY = getMinY();
81
+ const commonProps = {
82
+ getX: getSvgX.bind(),
83
+ getY: getSvgY.bind(),
84
+ maxX: maxX,
85
+ maxY: maxY,
86
+ minX: minX,
87
+ minY: minY,
88
+ round: round,
89
+ labelsWidthY: getLabelsYWidth(),
90
+ unitWidth: UNIT_WIDTH
91
+ };
92
+ return jsx("svg", {
93
+ id: id,
94
+ viewBox: `0 0 ${Math.abs(viewBoxWidth)} ${Math.abs(viewBoxHeight)}`,
95
+ style: {
96
+ display: 'block',
97
+ overflow: 'visible',
98
+ margin: `${getLabelsYWidth() * 2}`
99
+ }
100
+ }, jsx(Axis, _extends({}, props, commonProps)), jsx(Grid, _extends({}, props, commonProps)), jsx(Bars, _extends({
101
+ data: dataSource,
102
+ viewBoxWidth: viewBoxWidth
103
+ }, props, commonProps)), jsx(Labels, _extends({
104
+ data: dataSource,
105
+ viewBoxWidth: viewBoxWidth
106
+ }, props, commonProps)), jsx(Points, _extends({
107
+ data: dataSource
108
+ }, props, commonProps)));
109
+ }));
110
+ BarChart.defaultProps = {
111
+ data: [],
112
+ viewBoxHeight: 200,
113
+ viewBoxWidth: 500,
114
+ ...Bars.defaultProps,
115
+ ...Axis.defaultProps,
116
+ ...Grid.defaultProps,
117
+ ...Points.defaultProps,
118
+ ...Labels.defaultProps
119
+ };
120
+ BarChart.propTypes = {
121
+ data: PropTypes.arrayOf(PropTypes.shape({
122
+ x: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
123
+ quantity: PropTypes.number
124
+ })).isRequired,
125
+
126
+ /** drawn Ratio of viewBoxHeight entered by user, default is: 200px */
127
+ viewBoxHeight: PropTypes.number,
128
+
129
+ /** drawn Ratio of viewBoxWidth entered by user, default is: 500px */
130
+ viewBoxWidth: PropTypes.number,
131
+
132
+ /** change color of Bar in BarChart */
133
+ barsColor: PropTypes.string,
134
+
135
+ /** change ColumB grid display style ['full' , 'horizontal', 'none']*/
136
+ GridLines: PropTypes.string,
137
+ //** change style show of label (default, italic) */
138
+ labelStyle: PropTypes.string,
139
+
140
+ /** the axisVisible Hide or show the Axis axis */
141
+ axisVisible: PropTypes.bool,
142
+
143
+ /** the axisColor change color */
144
+ axisColor: PropTypes.string,
145
+
146
+ /** change color of grid Columb*/
147
+ gridColor: PropTypes.string,
148
+
149
+ /** show data information when hovering in the area containing the column */
150
+ pointsIsHoverOnZone: PropTypes.bool,
151
+
152
+ /** show or hiden point */
153
+ pointsVisible: PropTypes.bool,
154
+
155
+ /** change the inner color of the point button */
156
+ pointsColor: PropTypes.string,
157
+
158
+ /** change the border color of the point button */
159
+ pointsStrokeColor: PropTypes.string,
160
+
161
+ /** the thickness of the inner core point */
162
+ pointsStrokeWidth: PropTypes.number,
163
+
164
+ /** change the radius of the point is created */
165
+ pointsRadius: PropTypes.number,
166
+ ...Bars.propTypes,
167
+ ...Grid.propTypes,
168
+ ...Axis.propTypes,
169
+ ...Points.propTypes,
170
+ ...Labels.propTypes
171
+ };
172
+ export default BarChart;