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,433 @@
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, useRef, forwardRef, useImperativeHandle } from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import { jsx, css } from '@emotion/core';
9
+ import { InputBase, Label, HelperText, Typography } from '../../';
10
+ import { Vietnam, England } from '../../../icons';
11
+ const ensigns = {
12
+ Vietnam: {
13
+ icon: jsx(Vietnam, null),
14
+ countryCode: 84,
15
+ mark: '___ ___ ___'
16
+ },
17
+ England: {
18
+ icon: jsx(England, null),
19
+ countryCode: 44,
20
+ mark: '____ _______'
21
+ }
22
+ };
23
+ const PhoneInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
24
+ viewType,
25
+ ensign,
26
+ required,
27
+ hiddenEnsign,
28
+ label,
29
+ defaultValue,
30
+ value,
31
+ placeholder,
32
+ autoComplete,
33
+ autoFocus,
34
+ disabled,
35
+ readOnly,
36
+ multiline,
37
+ onConfirm,
38
+ refs,
39
+ inputRef,
40
+ inputProps,
41
+ iconStyle,
42
+ inputStyle,
43
+ labelProps,
44
+ errorProps,
45
+ error,
46
+ onChange,
47
+ onBlur,
48
+ onFocus,
49
+ onInput,
50
+ onKeyDown,
51
+ onKeyUp,
52
+ ...props
53
+ }, reference) => {
54
+ const ref = useRef(null);
55
+
56
+ if (!inputRef) {
57
+ inputRef = useRef(null);
58
+ }
59
+ /* Start styled */
60
+
61
+
62
+ const PhoneInputRoot = css`
63
+ display: block;
64
+ position: relative;
65
+ `;
66
+ const PhoneInputEnsign = css`
67
+ display: inline-flex;
68
+ position: relative;
69
+ max-height: 24px;
70
+ align-items: center;
71
+ svg {
72
+ margin-right: 4px;
73
+ }
74
+ `;
75
+ /* End styled */
76
+
77
+ let currentKey,
78
+ isUnicode = 0,
79
+ isFocus = false,
80
+ isPaste = false,
81
+ clipboardText = '';
82
+ /* Start handler */
83
+
84
+ const replaceMark = value => {
85
+ let result = ensigns[ensign].mark;
86
+
87
+ if (value) {
88
+ value = value.replaceAll(' ', '').replace(/_+$/, '');
89
+ const length = value.length;
90
+
91
+ if (length) {
92
+ for (let i = 0; i < length; i++) {
93
+ result = result.replace('_', value[i]);
94
+ }
95
+ }
96
+ }
97
+
98
+ return result;
99
+ };
100
+
101
+ const onFocusHandler = e => {
102
+ document.addEventListener('mouseup', onMouseUpHandler);
103
+ isFocus = true;
104
+ !!onFocus && onFocus(e);
105
+ };
106
+
107
+ const onMouseUpHandler = () => {
108
+ const text = window.getSelection().toString(); // Start focus and don't selection any text
109
+
110
+ if (!text) {
111
+ const value = inputRef.current.value;
112
+ const markFirstIndex = value.indexOf('_');
113
+ let cursor = inputRef.current.selectionStart;
114
+
115
+ if (isFocus) {
116
+ isFocus = false;
117
+
118
+ if (markFirstIndex !== -1) {
119
+ inputRef.current.setSelectionRange(markFirstIndex, markFirstIndex);
120
+ }
121
+
122
+ return;
123
+ }
124
+
125
+ if (value[cursor] === ' ') {
126
+ inputRef.current.setSelectionRange(cursor + 1, cursor + 1);
127
+ return;
128
+ }
129
+
130
+ if (markFirstIndex !== -1 && markFirstIndex < cursor) {
131
+ inputRef.current.setSelectionRange(markFirstIndex, markFirstIndex);
132
+ }
133
+ }
134
+ };
135
+
136
+ const onBlurHandler = e => {
137
+ document.removeEventListener('mouseup', onMouseUpHandler);
138
+ !!onBlur && onBlur(e);
139
+ };
140
+
141
+ const onKeyDownHandler = e => {
142
+ const key = e.key;
143
+ const keyCode = e.keyCode;
144
+
145
+ if (/Arrow|Home|End/.test(key) || /a|x|c|v/i.test(key) && e.ctrlKey) {
146
+ return;
147
+ }
148
+
149
+ if (keyCode === 231) {
150
+ isUnicode = isUnicode > 0 ? 0 : 1;
151
+ e.preventDefault();
152
+ return false;
153
+ }
154
+
155
+ if (keyCode === 8 && /^[12]$/.test(isUnicode)) {
156
+ isUnicode++;
157
+ e.preventDefault();
158
+ return false;
159
+ }
160
+
161
+ if (!/[0-9]|Backspace|Delete/.test(key)) {
162
+ isUnicode = -1;
163
+ currentKey = key;
164
+ e.preventDefault();
165
+ return false;
166
+ }
167
+
168
+ const {
169
+ value,
170
+ selectionStart: cursor
171
+ } = inputRef.current;
172
+
173
+ if (key === 'ArrowRight') {
174
+ if (value[cursor] === '_') {
175
+ e.preventDefault();
176
+ return false;
177
+ }
178
+
179
+ if (!value[cursor + 1].trim()) {
180
+ inputRef.current.setSelectionRange(cursor + 1, cursor + 1);
181
+ }
182
+ }
183
+
184
+ if (/[0-9]/.test(key) && !value[cursor]) {
185
+ e.preventDefault();
186
+ return false;
187
+ }
188
+
189
+ isUnicode = 0;
190
+ currentKey = key;
191
+ !!onKeyDown && onKeyDown(e);
192
+ };
193
+
194
+ const onPasteHandler = e => {
195
+ clipboardText = (e.clipboardData || window.clipboardData).getData('text');
196
+
197
+ if (!/\d+/.test(clipboardText)) {
198
+ e.preventDefault();
199
+ return;
200
+ }
201
+
202
+ isPaste = true;
203
+ };
204
+
205
+ const onChangeHandler = e => {
206
+ let value = e.target.value;
207
+ let cursor = e.target.selectionStart;
208
+
209
+ if (isPaste) {
210
+ isPaste = false;
211
+ value = value.replace(/\s/g, '');
212
+ const index = value.indexOf(clipboardText);
213
+
214
+ if (!index && value[0] === '0') {
215
+ value = value.slice(1);
216
+ }
217
+
218
+ const cursorOnPaste = index + clipboardText.length;
219
+ const mark = ensigns[ensign].mark;
220
+ const lengthOfMark = mark.length;
221
+
222
+ if (cursorOnPaste < lengthOfMark) {
223
+ let newCursor = cursorOnPaste;
224
+
225
+ while (mark.slice(0, newCursor).match(/_/g).length < cursorOnPaste && newCursor < lengthOfMark) {
226
+ newCursor++;
227
+ }
228
+
229
+ if (!mark[newCursor].trim()) {
230
+ newCursor++;
231
+ }
232
+
233
+ cursor = newCursor;
234
+ }
235
+ }
236
+
237
+ const result = replaceMark(value);
238
+
239
+ if (/\d/.test(currentKey)) {
240
+ if (result[cursor] && (!result[cursor].trim() || !result[cursor - 1].trim())) {
241
+ cursor++;
242
+ }
243
+ } else if (['Backspace', 'Delete'].includes(currentKey)) {
244
+ if (currentKey === 'Backspace' && value[cursor - 1] && !value[cursor - 1].trim()) {
245
+ cursor--;
246
+ }
247
+ }
248
+
249
+ e.target.value = result;
250
+ e.target.setSelectionRange(cursor, cursor);
251
+
252
+ if (onChange) {
253
+ const el = { ...e
254
+ };
255
+ el.target = { ...e.targe
256
+ };
257
+ el.target.value = '(+' + ensigns[ensign].countryCode + ') ' + result.replaceAll('_', '');
258
+ el.value = '0' + result.replace(/\s|_/g, '');
259
+ el.countryCode = ensigns[ensign].countryCode;
260
+ onChange(el);
261
+ }
262
+ };
263
+
264
+ useEffect(() => {
265
+ !!refs && refs(ref);
266
+
267
+ if (defaultValue !== undefined && defaultValue !== '') {
268
+ inputRef.current.value = replaceMark(defaultValue.replace(/^0/, ''));
269
+ }
270
+
271
+ if (autoFocus) {
272
+ inputRef.current.focus();
273
+ const value = inputRef.current.value;
274
+ let markIndex = value.indexOf('_');
275
+ markIndex = markIndex !== -1 ? markIndex : ensigns[ensign].mark.length;
276
+ inputRef.current.setSelectionRange(markIndex, markIndex);
277
+ }
278
+
279
+ return () => {
280
+ document.removeEventListener('mouseup', onMouseUpHandler);
281
+ };
282
+ }, []);
283
+ useEffect(() => {
284
+ if (placeholder !== undefined) {
285
+ inputRef.current.placeholder = placeholder;
286
+ }
287
+ }, [placeholder]);
288
+ useEffect(() => {
289
+ if (value !== undefined) {
290
+ inputRef.current.value = replaceMark(value.replace(/^0/, ''));
291
+ }
292
+ }, [value]);
293
+ /* End handler */
294
+
295
+ useImperativeHandle(reference, () => ({
296
+ get: () => ref.current
297
+ }));
298
+ return jsx("div", _extends({
299
+ ref: ref,
300
+ css: PhoneInputRoot,
301
+ style: {
302
+ marginBottom: '20px'
303
+ }
304
+ }, props), jsx(Label, {
305
+ required: required,
306
+ disabled: disabled
307
+ }, label), jsx(InputBase, {
308
+ inputRef: inputRef,
309
+ viewType: viewType,
310
+ defaultValue: ensigns[ensign].mark,
311
+ value: value,
312
+ placeholder: placeholder,
313
+ disabled: disabled,
314
+ readOnly: readOnly,
315
+ multiline: multiline,
316
+ status: error ? 'danger' : 'default',
317
+ inputProps: inputProps,
318
+ inputStyle: inputStyle,
319
+ onChange: onChangeHandler,
320
+ onBlur: onBlurHandler,
321
+ onFocus: onFocusHandler,
322
+ onInput: onInput,
323
+ onKeyDown: onKeyDownHandler,
324
+ onKeyUp: onKeyUp,
325
+ onPaste: onPasteHandler,
326
+ startIcon: jsx("span", {
327
+ css: PhoneInputEnsign
328
+ }, !hiddenEnsign && ensigns[ensign].icon, " ", jsx(Typography, null, "(+", ensigns[ensign].countryCode, ")")),
329
+ startIconProps: {
330
+ className: 'non-effect'
331
+ }
332
+ }), !!error && jsx(HelperText, {
333
+ disabled: disabled
334
+ }, error));
335
+ }));
336
+ PhoneInput.defaultProps = {
337
+ viewType: 'underlined',
338
+ ensign: 'Vietnam',
339
+ label: '',
340
+ placeholder: '',
341
+ error: '',
342
+ autoFocus: true,
343
+ disabled: false,
344
+ hiddenEnsign: false,
345
+ multiline: false,
346
+ readOnly: false,
347
+ required: false,
348
+ inputProps: {}
349
+ };
350
+ PhoneInput.propTypes = {
351
+ /** the type of border you want to display */
352
+ viewType: PropTypes.oneOf(['underlined', 'outlined']),
353
+
354
+ /** the ensign to determinate */
355
+ ensign: PropTypes.oneOf(['Vietnam', 'England']),
356
+
357
+ /** label for input */
358
+ label: PropTypes.string,
359
+
360
+ /** default value is displayed for first render */
361
+ defaultValue: PropTypes.string,
362
+
363
+ /** the displayed value for each change */
364
+ value: PropTypes.string,
365
+
366
+ /** hints for input */
367
+ placeholder: PropTypes.string,
368
+
369
+ /** error for input */
370
+ error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
371
+
372
+ /** type auto complete of input (like new-password) */
373
+ autoComplete: PropTypes.string,
374
+
375
+ /** prevent all event if true, hide all icon */
376
+ disabled: PropTypes.bool,
377
+
378
+ /** hidden ensign icon if true */
379
+ hiddenEnsign: PropTypes.bool,
380
+
381
+ /** prevent all event if true */
382
+ readOnly: PropTypes.bool,
383
+
384
+ /** auto focus after first render */
385
+ autoFocus: PropTypes.bool,
386
+
387
+ /** At least one character is required */
388
+ required: PropTypes.bool,
389
+
390
+ /** props of input in PhoneInput component */
391
+ inputProps: PropTypes.object,
392
+
393
+ /** style inline of input in PhoneInput component */
394
+ inputStyle: PropTypes.object,
395
+
396
+ /** any props of label in PhoneInput component */
397
+ labelProps: PropTypes.object,
398
+
399
+ /** any props of error in PhoneInput component */
400
+ errorProps: PropTypes.object,
401
+
402
+ /** The function to get ref of Dropdown component */
403
+ refs: PropTypes.func,
404
+
405
+ /** on key down function */
406
+ onKeyDown: PropTypes.func,
407
+
408
+ /** on key up function */
409
+ onKeyUp: PropTypes.func,
410
+
411
+ /** on input function */
412
+ onInput: PropTypes.func,
413
+
414
+ /**
415
+ * on change function. Return a object, example:<br/>
416
+ * {<br/>
417
+ * &nbsp;&nbsp;&nbsp;&nbsp;target: {value: "(+84) 123 456 789", ...}<br/>
418
+ * &nbsp;&nbsp;&nbsp;&nbsp;value: 0123456789<br/>
419
+ * &nbsp;&nbsp;&nbsp;&nbsp;countryCode: 84<br/>
420
+ * }
421
+ */
422
+ onChange: PropTypes.func,
423
+
424
+ /** on blur function */
425
+ onBlur: PropTypes.func,
426
+
427
+ /** on focus function */
428
+ onFocus: PropTypes.func,
429
+
430
+ /** inputRef of PhoneInput component */
431
+ inputRef: PropTypes.any
432
+ };
433
+ export default PhoneInput;
@@ -0,0 +1,263 @@
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 { css, jsx } from '@emotion/core';
7
+ import PropTypes from 'prop-types';
8
+ import { forwardRef, memo, useState, useEffect, useRef } from 'react';
9
+ import theme from '../../../theme/settings';
10
+ import { randomString } from '../../../utils';
11
+ const Radio = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
12
+ id,
13
+ disabled,
14
+ name,
15
+ defaultChecked,
16
+ checked,
17
+ value,
18
+ label,
19
+ className,
20
+ onChange,
21
+ inputRef,
22
+ inputProps,
23
+ ...props
24
+ }, ref) => {
25
+ if (!inputRef) {
26
+ inputRef = useRef(null);
27
+ }
28
+
29
+ const [unique] = useState(randomString(10, {
30
+ allowNumber: false,
31
+ allowSymbol: false
32
+ }));
33
+ const formCheck = css`
34
+ display: block;
35
+ position: relative;
36
+ cursor: pointer;
37
+ user-select: none;
38
+ &.disabled {
39
+ pointer-events: none;
40
+ }
41
+ width: max-content;
42
+ `;
43
+ const formCheckInput = css`
44
+ display: none;
45
+ position: absolute;
46
+ box-sizing: border-box;
47
+ padding-left: 2.19rem;
48
+ height: 1.57rem;
49
+ line-height: 1.57rem;
50
+ font-size: 16px;
51
+ &:disabled + label {
52
+ pointer-events: none;
53
+ }
54
+ &:checked + label::after {
55
+ background-color: ${theme.colors.primary};
56
+ border: 1px solid ${theme.colors.primary};
57
+ transform: scale(.5);
58
+ z-index: 0;
59
+ -webkit-transform: scale(.6);
60
+ -ms-transform: scale(.6);
61
+ }
62
+ &:checked + label::before {
63
+ border: 1px solid ${theme.colors.primary};
64
+ }
65
+ &:not(:checked) + label:hover::after,
66
+ &:not(:checked) + label:hover::before {
67
+ background: ${theme.colors.hover};
68
+ border: 1px solid ${theme.colors.primary};
69
+ }
70
+ &:not(:checked) + label::after,
71
+ &:not(:checked) + label::before {
72
+ background-color: white;
73
+ border: 1px solid ${theme.colors.border};
74
+ }
75
+ &:checked:disabled + label::after{
76
+ pointer-events: none;
77
+ cursor: not-allowed;
78
+ background: ${theme.colors.disabled};
79
+ border: 1px solid ${theme.colors.disabled};
80
+ }
81
+ &:checked:disabled + label::before{
82
+ pointer-events: none;
83
+ cursor: not-allowed;
84
+ background: ${theme.colors.bgDisabled};
85
+ border: 1px solid ${theme.colors.disabled};
86
+ }
87
+ &:not(:checked):disabled + label::after{
88
+ pointer-events: none;
89
+ cursor: not-allowed;
90
+ background:${theme.colors.bgDisabled};
91
+ border: 1px solid ${theme.colors.disabled};
92
+ }
93
+ &:not(:checked):disabled + label::before{
94
+ pointer-events: none;
95
+ cursor: not-allowed;
96
+ background: ${theme.colors.bgDisabled};
97
+ border: 1px solid ${theme.colors.disabled};
98
+ }
99
+
100
+ `;
101
+ const formCheckLabel = css`
102
+ display: block;
103
+ cursor: pointer;
104
+ position: relative;
105
+ padding-left: 2.19rem;
106
+ line-height: 1.57rem;
107
+ font-size: 1rem;
108
+ font-size: 16px;
109
+ font-weight: 500;
110
+ font-family: ${theme.typography.fontFamily};
111
+ margin-bottom: 0;
112
+ transition: .28s ease;
113
+ -o-transition: .28s ease;
114
+ -webkit-transition: .28s ease;
115
+ &::after {
116
+ box-sizing: border-box;
117
+ content: "";
118
+ position: absolute;
119
+ height: 18px;
120
+ left: 0;
121
+ margin: 2px;
122
+ transition: .28s ease;
123
+ top: 0;
124
+ width: 18px;
125
+ z-index: 0;
126
+ border-radius: 50%;
127
+ -webkit-transition: .28s ease;
128
+ }
129
+ &::before {
130
+ box-sizing: border-box;
131
+ content: "";
132
+ position: absolute;
133
+ height: 18px;
134
+ left: 0;
135
+ margin: 2px;
136
+ transition: .28s ease;
137
+ top: 0;
138
+ width: 18px;
139
+ z-index: 0;
140
+ border-radius: 50%;
141
+ -webkit-transition: .28s ease;
142
+ }
143
+ &:hover::after{
144
+ background: ${theme.colors.hover};
145
+ border: 1px solid ${theme.colors.primary};
146
+ }
147
+ &:hover::before{
148
+ background: ${theme.colors.hover};
149
+ border: 1px solid ${theme.colors.primary};
150
+ }
151
+ &:hover::after {
152
+ box-shadow:
153
+ 0 0 2px 2px ${theme.colors.focus};
154
+ background-color:${theme.colors.focus};
155
+ }
156
+ &:hover::before {
157
+ box-shadow:
158
+ 0 0 2px 2px ${theme.colors.focus};
159
+ background-color:${theme.colors.focus};
160
+ }
161
+ `;
162
+
163
+ const handleChange = e => {
164
+ const el = { ...e
165
+ };
166
+ el.value = value || label;
167
+ onChange(el);
168
+ };
169
+
170
+ useEffect(() => {
171
+ if (disabled) {
172
+ inputRef.current.disabled = disabled;
173
+ inputRef.current.parentNode.classList.add('disabled');
174
+ }
175
+
176
+ return () => {
177
+ if (disabled) {
178
+ inputRef.current.disabled = false;
179
+ inputRef.current.parentNode.classList.remove('disabled');
180
+ }
181
+ };
182
+ }, [disabled, onChange]);
183
+ useEffect(() => {
184
+ if (typeof checked === 'boolean') {
185
+ inputRef.current.checked = checked;
186
+ }
187
+
188
+ return () => {
189
+ if (typeof checked === 'boolean' && inputRef.current) {
190
+ inputRef.current.checked = null;
191
+ }
192
+ };
193
+ }, [checked]);
194
+ return jsx("div", _extends({
195
+ id: 'DGN-Core-Radio-' + (id || unique),
196
+ css: formCheck,
197
+ className: ['DGN-UI-Radio', disabled ? 'disabled' : '', className].join(' ').trim(),
198
+ ref: ref
199
+ }, props), jsx("input", _extends({}, inputProps, {
200
+ disabled: disabled,
201
+ ref: inputRef,
202
+ name: name,
203
+ hidden: true,
204
+ type: "radio",
205
+ defaultChecked: defaultChecked,
206
+ css: formCheckInput,
207
+ id: id || unique,
208
+ onChange: !!onChange ? handleChange : null
209
+ })), jsx("label", {
210
+ css: formCheckLabel,
211
+ htmlFor: id || unique
212
+ }, " ", label || value));
213
+ }));
214
+ Radio.defaultProps = {
215
+ disabled: false,
216
+ defaultChecked: false,
217
+ label: '',
218
+ value: '',
219
+ className: ''
220
+ };
221
+ Radio.propTypes = {
222
+ /**
223
+ * If `true`, the component is disabled.
224
+ */
225
+ disabled: PropTypes.bool,
226
+
227
+ /**
228
+ * If `true`, the component is checked.
229
+ */
230
+ checked: PropTypes.bool,
231
+
232
+ /**
233
+ * If `true`, the component is defaultChecked.
234
+ */
235
+ defaultChecked: PropTypes.bool,
236
+
237
+ /** Id is randomized randomly to avoid duplication. */
238
+ id: PropTypes.string,
239
+
240
+ /** The id of the `input` element. */
241
+ name: PropTypes.string,
242
+
243
+ /** The value of the component. The DOM API casts this to a string. */
244
+ value: PropTypes.string,
245
+
246
+ /** The name of the Radio is displayed on the interface */
247
+ label: PropTypes.string,
248
+
249
+ /** The class for Radio component */
250
+ className: PropTypes.string,
251
+
252
+ /** props for input */
253
+ inputProps: PropTypes.object,
254
+
255
+ /** Callback fired when the state is changed.
256
+ *
257
+ * @param {object} event The event source of the callback.
258
+ * You can pull out the new value by accessing `event.target.value` (string).
259
+ * You can pull out the new checked state by accessing `event.target.checked` (boolean).
260
+ * */
261
+ onChange: PropTypes.func
262
+ };
263
+ export default Radio;