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,69 @@
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
+ import React, { memo, useEffect, useRef, forwardRef } from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import Modal from './modal';
6
+ import Header from './header';
7
+ import Body from './body';
8
+ import Footer from './footer';
9
+ const ModalSample = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
10
+ title,
11
+ style,
12
+ headerStyle,
13
+ bodyStyle,
14
+ footerStyle,
15
+ refs,
16
+ children,
17
+ footer,
18
+ ...props
19
+ }, ref) => {
20
+ if (!ref) {
21
+ ref = useRef(null);
22
+ }
23
+
24
+ useEffect(() => {
25
+ if (refs) refs(ref);
26
+ }, []);
27
+ return /*#__PURE__*/React.createElement(Modal, _extends({
28
+ ref: ref,
29
+ style: style
30
+ }, props), /*#__PURE__*/React.createElement(Header, {
31
+ style: headerStyle
32
+ }, title), /*#__PURE__*/React.createElement(Body, {
33
+ style: bodyStyle
34
+ }, children), footer && /*#__PURE__*/React.createElement(Footer, {
35
+ style: footerStyle
36
+ }, footer));
37
+ }));
38
+ ModalSample.defaultProps = {
39
+ title: ''
40
+ };
41
+ ModalSample.propTypes = {
42
+ /** customize style inline */
43
+ style: PropTypes.object,
44
+
45
+ /** custom style inline for header */
46
+ headerStyle: PropTypes.object,
47
+
48
+ /** custom style inline for body */
49
+ bodyStyle: PropTypes.object,
50
+
51
+ /** custom style inline for footer */
52
+ footerStyle: PropTypes.object,
53
+
54
+ /** get modal ref by function */
55
+ refs: PropTypes.func,
56
+
57
+ /** title for header */
58
+ title: PropTypes.node,
59
+
60
+ /** an element at footer */
61
+ footer: PropTypes.node,
62
+
63
+ /** child content in body */
64
+ children: PropTypes.node,
65
+
66
+ /** any props else */
67
+ props: PropTypes.any
68
+ };
69
+ export default ModalSample;
@@ -0,0 +1,339 @@
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 { memo, useState, useRef, forwardRef, useEffect, useMemo } from 'react';
7
+ import { createPortal } from 'react-dom';
8
+ import PropTypes from 'prop-types';
9
+ import { jsx, css, keyframes } from '@emotion/core';
10
+ import ModalContext from './context';
11
+ import { useTheme } from '../../theme';
12
+ const {
13
+ typography: {
14
+ fontFamily
15
+ }
16
+ } = useTheme();
17
+ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
18
+ open,
19
+ type,
20
+ title,
21
+ moveable,
22
+ dragAnyWhere,
23
+ moveOutScreen,
24
+ style,
25
+ top,
26
+ zIndex,
27
+ pressESCToClose,
28
+ darkTheme,
29
+ autoFocus,
30
+ refs,
31
+ onClose,
32
+ onConfirm,
33
+ onCancel,
34
+ children,
35
+ width,
36
+ ...props
37
+ }, ref) => {
38
+ if (!ref) {
39
+ ref = useRef(null);
40
+ }
41
+
42
+ const modalBoxRef = useRef(null);
43
+ const [openState, setOpenState] = useState(open);
44
+ const ModalContainer = css`
45
+ position: fixed;
46
+ display: flex;
47
+ width: 100%;
48
+ height: 100vh;
49
+ background-color: ${darkTheme ? 'rgba(21, 26, 48, 0.5)' : 'transparent'};
50
+ top: 0;
51
+ left: 0;
52
+ justify-content: center;
53
+ align-items: ${top ? 'inherit' : 'center'};
54
+ padding-top: ${top ? isNaN(top) ? top : top + 'px' : 0};
55
+ opacity: 0;
56
+ transition: opacity 0.3s ease;
57
+ z-index: ${zIndex};
58
+ `;
59
+ const fadeInDown = keyframes`
60
+ 0% {
61
+ opacity: 0;
62
+ -webkit-transform: translate3d(0, -30px, 0);
63
+ transform: translate3d(0, -30px, 0);
64
+ }
65
+ to {
66
+ opacity: 1;
67
+ -webkit-transform: translateZ(0);
68
+ transform: translateZ(0);
69
+ }
70
+ `;
71
+ const fadeOutUp = keyframes`
72
+ 0% {
73
+ opacity: 1;
74
+ }
75
+ to {
76
+ opacity: 0;
77
+ -webkit-transform: translate3d(0, -30px, 0);
78
+ transform: translate3d(0, -30px, 0);
79
+ }
80
+ `;
81
+ const ModalBox = css`
82
+ display: flex;
83
+ flex-direction: column;
84
+ position: relative;
85
+ background-color: white;
86
+ font-family: ${fontFamily};
87
+ height: max-content;
88
+ max-height: calc(100% - ${isNaN(top) ? top : +top + 'px'});
89
+ min-width: 150px;
90
+ max-width: 90%;
91
+ /* min-height: 152px; */
92
+ margin: 0 auto;
93
+ border-radius: 4px;
94
+ box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
95
+ box-sizing: border-box;
96
+ -webkit-box-orient: vertical;
97
+ -webkit-box-direction: normal;
98
+ width: ${isNaN(width) ? width : width + 'px'};
99
+ animation: ${fadeOutUp} 0.2s ease;
100
+ animation-fill-mode: forwards;
101
+ cursor: ${moveable && dragAnyWhere ? 'move' : 'initial'};
102
+ &.show {
103
+ display: flex !important;
104
+ animation: ${fadeInDown} 0.2s ease;
105
+ }
106
+ `;
107
+
108
+ const onShowModal = () => {
109
+ setOpenState(true);
110
+ };
111
+
112
+ const onCloseModal = () => {
113
+ if (onClose) onClose();else {
114
+ setTimeout(() => {
115
+ setOpenState(false);
116
+ }, 500);
117
+ }
118
+ ;
119
+
120
+ if (pressESCToClose) {
121
+ document.removeEventListener('keydown', pressESCHandler);
122
+ }
123
+
124
+ if (ref.current) {
125
+ ref.current.style.opacity = null;
126
+ ref.current.firstChild.classList.remove('show');
127
+ }
128
+ };
129
+
130
+ const pressESCHandler = event => {
131
+ if (event.key === 'Escape') {
132
+ const modals = document.querySelectorAll('.DGN-UI-Portal');
133
+
134
+ if (modals && modals.length > 1 && Array.from(modals)[modals.length - 1] && !Array.from(modals)[modals.length - 1].contains(ref.current)) {
135
+ return;
136
+ }
137
+
138
+ onCloseModal();
139
+ }
140
+
141
+ ;
142
+ };
143
+
144
+ const dragMouseDown = e => {
145
+ let pos1 = 0,
146
+ pos2 = 0,
147
+ pos3 = 0,
148
+ pos4 = 0;
149
+ pos3 = e.clientX;
150
+ pos4 = e.clientY;
151
+ const maxTop = window.innerHeight - modalBoxRef.current.offsetHeight;
152
+ const maxLeft = window.innerWidth - modalBoxRef.current.offsetWidth;
153
+
154
+ if (modalBoxRef.current.style.display !== 'block') {
155
+ const top = modalBoxRef.current.offsetTop;
156
+ const left = modalBoxRef.current.offsetLeft;
157
+ modalBoxRef.current.style.display = 'block';
158
+ modalBoxRef.current.style.position = 'absolute';
159
+ modalBoxRef.current.style.margin = '0px';
160
+ modalBoxRef.current.style.top = top + "px";
161
+ modalBoxRef.current.style.left = left + "px";
162
+ }
163
+
164
+ document.onmouseup = () => {
165
+ /* stop moving when mouse button is released:*/
166
+ document.onmouseup = null;
167
+ document.onmousemove = null;
168
+ }; // call a function whenever the cursor moves:
169
+
170
+
171
+ document.onmousemove = el => {
172
+ pos1 = pos3 - el.clientX;
173
+ pos2 = pos4 - el.clientY;
174
+ pos3 = el.clientX;
175
+ pos4 = el.clientY;
176
+ let newTop = modalBoxRef.current.offsetTop - pos2;
177
+ let newLeft = modalBoxRef.current.offsetLeft - pos1;
178
+
179
+ if (!moveOutScreen) {
180
+ if (newTop > maxTop) {
181
+ newTop = maxTop;
182
+ } else if (newTop < 0) {
183
+ newTop = 0;
184
+ }
185
+
186
+ if (newLeft > maxLeft) {
187
+ newLeft = maxLeft;
188
+ } else if (newLeft < 0) {
189
+ newLeft = 0;
190
+ }
191
+ } // set the element's new position:
192
+
193
+
194
+ modalBoxRef.current.style.top = newTop + "px";
195
+ modalBoxRef.current.style.left = newLeft + "px";
196
+ };
197
+ };
198
+
199
+ useEffect(() => {
200
+ if (open) {
201
+ setOpenState(open);
202
+ }
203
+
204
+ return () => {
205
+ if (open && ref.current) {
206
+ setTimeout(() => {
207
+ setOpenState(!open);
208
+ }, 500);
209
+ }
210
+ };
211
+ }, [open]);
212
+ useEffect(() => {
213
+ return () => {
214
+ if (pressESCToClose) {
215
+ document.removeEventListener('keydown', pressESCHandler);
216
+ }
217
+ };
218
+ }, []);
219
+ useEffect(() => {
220
+ if (openState) {
221
+ if (ref.current) {
222
+ ref.current.style.opacity = 1;
223
+ ref.current.firstChild.classList.add('show');
224
+ const modals = document.querySelectorAll('.DGN-UI-Modal');
225
+
226
+ if (!darkTheme && modals && modals.length > 1) {
227
+ ref.current.style.backgroundColor = 'transparent';
228
+ }
229
+
230
+ if (autoFocus) {
231
+ if (!ref.current.contains(document.activeElement)) {
232
+ ref.current.tabIndex = -1;
233
+ ref.current.focus();
234
+ }
235
+ }
236
+ }
237
+
238
+ document.body.style.overflow = 'hidden'; // Allow press ESC to close popup
239
+
240
+ if (pressESCToClose) {
241
+ document.addEventListener('keydown', pressESCHandler);
242
+ }
243
+
244
+ return () => {
245
+ document.body.style.overflow = null;
246
+ };
247
+ }
248
+ }, [openState]);
249
+ const ModalView = useMemo(() => {
250
+ if (openState) {
251
+ const node = jsx("div", {
252
+ className: 'DGN-UI-Portal DGN-UI-Modal',
253
+ style: {
254
+ position: 'fixed',
255
+ zIndex,
256
+ inset: 0
257
+ }
258
+ }, jsx("div", {
259
+ css: ModalContainer,
260
+ ref: ref
261
+ }, jsx("div", _extends({
262
+ css: ModalBox,
263
+ ref: modalBoxRef
264
+ }, props, {
265
+ onMouseDown: moveable && dragAnyWhere ? dragMouseDown : null,
266
+ style: style
267
+ }), jsx(ModalContext.Provider, {
268
+ value: {
269
+ show: onShowModal,
270
+ close: onCloseModal,
271
+ onMoveModal: moveable && !dragAnyWhere ? dragMouseDown : null
272
+ }
273
+ }, children))));
274
+ return /*#__PURE__*/createPortal(node, document.body);
275
+ }
276
+
277
+ return null;
278
+ });
279
+ return ModalView;
280
+ }));
281
+ Modal.defaultProps = {
282
+ darkTheme: true,
283
+ open: false,
284
+ pressESCToClose: true,
285
+ moveable: false,
286
+ dragAnyWhere: false,
287
+ moveOutScreen: false,
288
+ autoFocus: true,
289
+ top: '',
290
+ width: '80%',
291
+ zIndex: 9000
292
+ };
293
+ Modal.propTypes = {
294
+ /** park a good colored background under the modal box if true */
295
+ darkTheme: PropTypes.bool,
296
+
297
+ /** show modal if true */
298
+ open: PropTypes.bool,
299
+
300
+ /** allow press ESC to close Modal component */
301
+ pressESCToClose: PropTypes.bool,
302
+
303
+ /** allow move the modal by drag and move */
304
+ moveable: PropTypes.bool,
305
+
306
+ /** allow move the modal at any position on Modal */
307
+ dragAnyWhere: PropTypes.bool,
308
+
309
+ /** allows you to drag the Modal out of the screen */
310
+ moveOutScreen: PropTypes.bool,
311
+
312
+ /** focusing after open modal */
313
+ autoFocus: PropTypes.bool,
314
+
315
+ /** z-index style of Modal */
316
+ zIndex: PropTypes.number,
317
+
318
+ /** customize the vertical position of the screen, if not set, the modal will be fixed in the middle of the screen */
319
+ top: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
320
+
321
+ /** width of the modal */
322
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
323
+
324
+ /** customize style inline */
325
+ style: PropTypes.object,
326
+
327
+ /** get modal ref by function */
328
+ refs: PropTypes.func,
329
+
330
+ /** the function to run when close modal */
331
+ onClose: PropTypes.func,
332
+
333
+ /** child content in body */
334
+ children: PropTypes.node,
335
+
336
+ /** any props else */
337
+ props: PropTypes.any
338
+ };
339
+ export default Modal;
@@ -0,0 +1,124 @@
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 { memo, useState, useEffect, useMemo, useRef } from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import { jsx, css } from '@emotion/core';
9
+ import { brand, dark11, dark6, blue13 } from '../../../styles/colors';
10
+ const icons = {
11
+ expand: `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
12
+ <path fillRule="evenodd" clip-rule="evenodd" d="M11.9999 12.0001C11.7729 12.0001 11.5449 11.9231 11.3599 11.7681L5.35989 6.76807C4.93589 6.41407 4.87889 5.78407 5.23189 5.36007C5.58589 4.93507 6.21489 4.87907 6.63989 5.23207L12.0109 9.70707L17.3729 5.39307C17.8029 5.04707 18.4339 5.11507 18.7789 5.54507C19.1259 5.97507 19.0569 6.60407 18.6269 6.95107L12.6269 11.7791C12.4439 11.9261 12.2219 12.0001 11.9999 12.0001ZM12.011 16.7076L17.373 12.3926C17.803 12.0476 18.434 12.1156 18.779 12.5446C19.125 12.9756 19.057 13.6046 18.627 13.9516L12.627 18.7796C12.444 18.9266 12.222 18.9996 12 18.9996C11.772 18.9996 11.545 18.9226 11.36 18.7676L5.35999 13.7676C4.93499 13.4146 4.87799 12.7846 5.23199 12.3596C5.58499 11.9356 6.21499 11.8776 6.63999 12.2316L12.011 16.7076Z" fill="currentColor"/>
13
+ </svg>`,
14
+ collapse: `<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
15
+ <path fillRule="evenodd" clip-rule="evenodd" d="M7.00011 6.99993C7.22711 6.99993 7.45511 7.07693 7.64011 7.23193L13.6401 12.2319C14.0641 12.5859 14.1211 13.2159 13.7681 13.6399C13.4141 14.0649 12.7851 14.1209 12.3601 13.7679L6.98911 9.29293L1.62711 13.6069C1.19711 13.9529 0.566109 13.8849 0.221108 13.4549C-0.125891 13.0249 -0.0568903 12.3959 0.373109 12.0489L6.37311 7.22093C6.55611 7.07393 6.77811 6.99993 7.00011 6.99993ZM6.98901 2.29243L1.62701 6.60743C1.19701 6.95243 0.56601 6.88443 0.22101 6.45543C-0.12499 6.02443 -0.0569899 5.39543 0.37301 5.04843L6.37301 0.220434C6.55601 0.0734332 6.77801 0.000434244 7.00001 0.000434264C7.22801 0.000434283 7.45501 0.077434 7.64001 0.232434L13.64 5.23243C14.065 5.58543 14.122 6.21543 13.768 6.64043C13.415 7.06443 12.785 7.12243 12.36 6.76843L6.98901 2.29243Z" fill="currentColor"/>
16
+ </svg>`
17
+ };
18
+
19
+ const Extra = ({
20
+ type,
21
+ displayText,
22
+ style,
23
+ onClick,
24
+ ...props
25
+ }) => {
26
+ const extraRef = useRef(null);
27
+ const textRef = useRef(null);
28
+ const iconRef = useRef(null);
29
+ const [typeState, setTypeState] = useState(type);
30
+ /* Start styled */
31
+
32
+ const extraIcon = css`
33
+ display: flex;
34
+ align-items: center;
35
+ `;
36
+ const extraText = css`
37
+ margin-left: 9px;
38
+ font-family: sans-serif;
39
+ font-style: normal;
40
+ font-weight: bold;
41
+ font-size: 14px;
42
+ color: ${dark6};
43
+ `;
44
+ const extra = css`
45
+ width: 100%;
46
+ height: 40px;
47
+ background-color: ${dark11};
48
+ display: flex;
49
+ justify-content: center;
50
+ align-items: center;
51
+ color: ${dark6};
52
+ cursor: pointer;
53
+ &:hover {
54
+ background-color: ${blue13};
55
+ .css-${extraIcon.name} {
56
+ color: ${brand};
57
+ path: {
58
+ fill: ${brand};
59
+ }
60
+ }
61
+ .css-${extraText.name} {
62
+ color: ${brand};
63
+ }
64
+ }
65
+ `;
66
+ /* End styled */
67
+
68
+ /* Start handler */
69
+
70
+ const handleClick = () => {
71
+ if (typeState === 'expand') {
72
+ iconRef.current.innerHTML = icons.collapse;
73
+ textRef.current.innerHTML = displayText || 'Thu gọn';
74
+ setTypeState('collapse');
75
+ } else {
76
+ iconRef.current.innerHTML = icons.expand;
77
+ textRef.current.innerHTML = displayText || 'Xem thêm';
78
+ setTypeState('expand');
79
+ }
80
+
81
+ if (onClick) onClick({
82
+ type: typeState === 'expand' ? 'collapse' : 'expand'
83
+ });
84
+ };
85
+
86
+ useEffect(() => {
87
+ iconRef.current.innerHTML = type === 'expand' ? icons.expand : icons.collapse;
88
+ setTypeState(type);
89
+ }, [type]);
90
+ useEffect(() => {
91
+ textRef.current.innerHTML = displayText || (type === 'expand' ? 'Xem thêm' : 'Thu gọn');
92
+ }, [displayText, type]);
93
+ /* End handler */
94
+
95
+ /* Start component */
96
+
97
+ const iconComp = useMemo(() => jsx("div", {
98
+ ref: iconRef,
99
+ css: extraIcon
100
+ }), []);
101
+ const textComp = useMemo(() => jsx("div", {
102
+ ref: textRef,
103
+ css: extraText
104
+ }, displayText), []);
105
+ /* End component */
106
+
107
+ return jsx("div", _extends({}, props, {
108
+ ref: extraRef,
109
+ css: extra,
110
+ onClick: handleClick,
111
+ style: style
112
+ }), iconComp, textComp);
113
+ };
114
+
115
+ Extra.defaultProps = {
116
+ type: 'expand'
117
+ };
118
+ Extra.proptypes = {
119
+ type: PropTypes.string,
120
+ displayText: PropTypes.string,
121
+ style: PropTypes.object,
122
+ onClick: PropTypes.func
123
+ };
124
+ export default /*#__PURE__*/memo(Extra);