diginet-core-ui 1.3.36 → 1.3.38

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 (256) hide show
  1. package/assets/avatar/default.svg +3 -3
  2. package/assets/images/icons/wifi.svg +3 -3
  3. package/assets/images/menu/dhr/ALL.svg +6 -6
  4. package/assets/images/menu/dhr/D00.svg +12 -12
  5. package/assets/images/menu/dhr/D09.svg +8 -8
  6. package/assets/images/menu/dhr/D13.svg +10 -10
  7. package/assets/images/menu/dhr/D15.svg +10 -10
  8. package/assets/images/menu/dhr/D21.svg +10 -10
  9. package/assets/images/menu/dhr/D25.svg +11 -11
  10. package/assets/images/menu/dhr/D29.svg +11 -11
  11. package/assets/images/menu/dhr/D38.svg +6 -6
  12. package/assets/images/menu/dhr/D39.svg +10 -10
  13. package/assets/images/menu/dhr/D51.svg +12 -12
  14. package/assets/images/menu/dhr/D52.svg +16 -16
  15. package/assets/images/menu/dhr/D77.svg +16 -16
  16. package/assets/images/menu/dhr/D84.svg +12 -12
  17. package/assets/images/menu/dhr/D89.svg +8 -8
  18. package/assets/images/menu/dhr/Default.svg +13 -13
  19. package/assets/images/menu/dhr/MHRM00N0001.svg +14 -14
  20. package/assets/images/menu/dhr/MHRM09N0002.svg +3 -3
  21. package/assets/images/menu/dhr/MHRM09N0003.svg +25 -25
  22. package/assets/images/menu/dhr/MHRM09N0004.svg +14 -14
  23. package/assets/images/menu/dhr/MHRM09N0005.svg +7 -7
  24. package/assets/images/menu/dhr/MHRM13N0001.svg +16 -16
  25. package/assets/images/menu/dhr/MHRM25N0001.svg +26 -26
  26. package/assets/images/menu/dhr/MHRM29N0001.svg +30 -30
  27. package/assets/images/menu/dhr/MHRM29N0002.svg +13 -0
  28. package/assets/images/menu/dhr/MHRM29N0003.svg +17 -0
  29. package/assets/images/menu/dhr/MHRM29N0015.svg +63 -63
  30. package/assets/images/menu/dhr/MHRM39N0012.svg +43 -43
  31. package/assets/images/menu/dhr/MHRM39N0013.svg +24 -24
  32. package/assets/images/menu/dhr/MHRM39N0014.svg +14 -14
  33. package/assets/images/menu/dhr/MHRM39N0015.svg +36 -36
  34. package/assets/images/menu/dhr/MHRM39N0016.svg +23 -23
  35. package/assets/images/menu/dhr/MHRM77N0001.svg +28 -28
  36. package/assets/images/menu/dhr/MHRM84N0001.svg +27 -27
  37. package/assets/images/menu/dhr/MHRM84N0002.svg +24 -24
  38. package/assets/images/menu/dhr/MHRM89N0001.svg +16 -16
  39. package/assets/images/menu/dhr/MHRP00N0001.svg +10 -10
  40. package/assets/images/menu/dhr/MHRP09N0001.svg +22 -22
  41. package/assets/images/menu/dhr/MHRP09N0002.svg +19 -19
  42. package/assets/images/menu/dhr/MHRP09N0003.svg +12 -12
  43. package/assets/images/menu/dhr/MHRP09N0004.svg +6 -6
  44. package/assets/images/menu/dhr/MHRP09N0005.svg +10 -10
  45. package/assets/images/menu/dhr/MHRP09N0006.svg +17 -17
  46. package/assets/images/menu/dhr/MHRP09N0007.svg +15 -15
  47. package/assets/images/menu/dhr/MHRP09N0008.svg +8 -8
  48. package/assets/images/menu/dhr/MHRP09N0009.svg +10 -10
  49. package/assets/images/menu/dhr/MHRP09N0010.svg +12 -12
  50. package/assets/images/menu/dhr/MHRP09N0011.svg +16 -16
  51. package/assets/images/menu/dhr/MHRP09N0012.svg +6 -6
  52. package/assets/images/menu/dhr/MHRP09N0013.svg +8 -8
  53. package/assets/images/menu/dhr/MHRP09N0014.svg +11 -11
  54. package/assets/images/menu/dhr/MHRP09N0015.svg +12 -12
  55. package/assets/images/menu/dhr/MHRP09N0016.svg +18 -18
  56. package/assets/images/menu/dhr/MHRP09N0017.svg +18 -18
  57. package/assets/images/menu/dhr/MHRP09N0018.svg +12 -12
  58. package/assets/images/menu/dhr/MHRP09N0019.svg +13 -13
  59. package/assets/images/menu/dhr/MHRP09N0020.svg +17 -17
  60. package/assets/images/menu/dhr/MHRP09N0021.svg +10 -10
  61. package/assets/images/menu/dhr/MHRP09N0022.svg +16 -16
  62. package/assets/images/menu/dhr/MHRP09N0023.svg +8 -8
  63. package/assets/images/menu/dhr/MHRP09N0024.svg +15 -15
  64. package/assets/images/menu/dhr/MHRP09N0025.svg +16 -16
  65. package/assets/images/menu/dhr/MHRP09N0026.svg +13 -13
  66. package/assets/images/menu/dhr/MHRP09N0027.svg +10 -10
  67. package/assets/images/menu/dhr/MHRP09N0028.svg +6 -6
  68. package/assets/images/menu/dhr/MHRP09N0029.svg +14 -14
  69. package/assets/images/menu/dhr/MHRP09N0030.svg +4 -4
  70. package/assets/images/menu/dhr/MHRP09N0031.svg +5 -5
  71. package/assets/images/menu/dhr/MHRP09N0032.svg +7 -7
  72. package/assets/images/menu/dhr/MHRP13N0001.svg +9 -9
  73. package/assets/images/menu/dhr/MHRP21N0001.svg +12 -12
  74. package/assets/images/menu/dhr/MHRP21N0002.svg +13 -13
  75. package/assets/images/menu/dhr/MHRP25N0001.svg +13 -13
  76. package/assets/images/menu/dhr/MHRP25N0002.svg +16 -16
  77. package/assets/images/menu/dhr/MHRP25N0003.svg +38 -38
  78. package/assets/images/menu/dhr/MHRP25N0004.svg +17 -17
  79. package/assets/images/menu/dhr/MHRP25N0005.svg +20 -20
  80. package/assets/images/menu/dhr/MHRP29N0001.svg +18 -18
  81. package/assets/images/menu/dhr/MHRP29N0002.svg +15 -15
  82. package/assets/images/menu/dhr/MHRP29N0003.svg +20 -20
  83. package/assets/images/menu/dhr/MHRP29N0004.svg +21 -21
  84. package/assets/images/menu/dhr/MHRP29N0005.svg +21 -21
  85. package/assets/images/menu/dhr/MHRP29N0006.svg +14 -14
  86. package/assets/images/menu/dhr/MHRP29N0007.svg +19 -19
  87. package/assets/images/menu/dhr/MHRP29N0008.svg +20 -20
  88. package/assets/images/menu/dhr/MHRP29N0009.svg +11 -11
  89. package/assets/images/menu/dhr/MHRP29N0010.svg +11 -11
  90. package/assets/images/menu/dhr/MHRP29N0011.svg +12 -12
  91. package/assets/images/menu/dhr/MHRP29N0012.svg +7 -7
  92. package/assets/images/menu/dhr/MHRP29N0013.svg +27 -27
  93. package/assets/images/menu/dhr/MHRP29N0014.svg +32 -32
  94. package/assets/images/menu/dhr/MHRP29N0016.svg +54 -54
  95. package/assets/images/menu/dhr/MHRP29N0017.svg +24 -24
  96. package/assets/images/menu/dhr/MHRP29N0018.svg +44 -44
  97. package/assets/images/menu/dhr/MHRP29N0019.svg +17 -17
  98. package/assets/images/menu/dhr/MHRP29N0020.svg +11 -11
  99. package/assets/images/menu/dhr/MHRP29N0021.svg +8 -8
  100. package/assets/images/menu/dhr/MHRP29N0022.svg +9 -9
  101. package/assets/images/menu/dhr/MHRP29N0023.svg +22 -22
  102. package/assets/images/menu/dhr/MHRP38N0001.svg +13 -13
  103. package/assets/images/menu/dhr/MHRP38N0002.svg +14 -14
  104. package/assets/images/menu/dhr/MHRP39N0001.svg +15 -15
  105. package/assets/images/menu/dhr/MHRP39N0002.svg +13 -13
  106. package/assets/images/menu/dhr/MHRP39N0003.svg +16 -16
  107. package/assets/images/menu/dhr/MHRP39N0004.svg +22 -22
  108. package/assets/images/menu/dhr/MHRP39N0005.svg +16 -16
  109. package/assets/images/menu/dhr/MHRP39N0006.svg +17 -17
  110. package/assets/images/menu/dhr/MHRP39N0007.svg +13 -13
  111. package/assets/images/menu/dhr/MHRP39N0008.svg +3 -3
  112. package/assets/images/menu/dhr/MHRP39N0009.svg +3 -3
  113. package/assets/images/menu/dhr/MHRP39N0010.svg +7 -7
  114. package/assets/images/menu/dhr/MHRP39N0011.svg +14 -14
  115. package/assets/images/menu/dhr/MHRP39N0013.svg +10 -10
  116. package/assets/images/menu/dhr/MHRP39N0014.svg +11 -11
  117. package/assets/images/menu/dhr/MHRP39N0015.svg +5 -5
  118. package/assets/images/menu/dhr/MHRP39N0017.svg +11 -11
  119. package/assets/images/menu/dhr/MHRP39N0018.svg +11 -0
  120. package/assets/images/menu/dhr/MHRP39N1222.svg +12 -12
  121. package/assets/images/menu/dhr/MHRP51N0001.svg +9 -9
  122. package/assets/images/menu/dhr/MHRP51N0002.svg +13 -13
  123. package/assets/images/menu/dhr/MHRP52N0001.svg +21 -21
  124. package/assets/images/menu/dhr/MHRP52N0002.svg +21 -21
  125. package/assets/images/menu/dhr/MHRP52N0003.svg +16 -16
  126. package/assets/images/menu/dhr/MHRP75N0001.svg +19 -19
  127. package/assets/images/menu/dhr/MHRP75N0002.svg +25 -25
  128. package/assets/images/menu/dhr/MHRP75N0003.svg +3 -3
  129. package/assets/images/menu/dhr/MHRP75N0006.svg +14 -14
  130. package/assets/images/menu/dhr/MHRP75N0007.svg +19 -19
  131. package/assets/images/menu/dhr/MHRP75N0008.svg +19 -19
  132. package/assets/images/menu/dhr/MHRP77N0007.svg +28 -28
  133. package/assets/images/menu/dhr/MHRP77N0008.svg +17 -17
  134. package/assets/images/menu/dhr/MHRP77N0009.svg +19 -19
  135. package/assets/images/menu/dhr/MHRP77N0010.svg +20 -20
  136. package/assets/images/menu/dhr/MHRP89N1000.svg +6 -6
  137. package/assets/images/menu/dhr/MHRP89N1001.svg +6 -6
  138. package/assets/images/menu/dhr/TASK.svg +9 -9
  139. package/assets/images/menu/dhr/W00F0001.svg +3 -3
  140. package/assets/images/menu/dhr/W00F0002.svg +3 -3
  141. package/assets/images/menu/dhr/W00F0003.svg +3 -3
  142. package/assets/images/menu/dhr/W00F0004.svg +3 -3
  143. package/assets/images/menu/dhr/W09F2000-WEB5.svg +17 -17
  144. package/assets/images/menu/dhr/W09F2000.svg +6 -6
  145. package/assets/images/menu/dhr/W09F2002-WEB5.svg +21 -21
  146. package/assets/images/menu/dhr/W09F2005-WEB5.svg +13 -13
  147. package/assets/images/menu/dhr/W09F2020-WEB5.svg +16 -16
  148. package/assets/images/menu/dhr/W09F2022-WEB5.svg +20 -20
  149. package/assets/images/menu/dhr/W09F2150-WEB5.svg +16 -16
  150. package/assets/images/menu/dhr/W09F2152-WEB5.svg +20 -20
  151. package/assets/images/menu/dhr/W09F2160-WEB5.svg +14 -14
  152. package/assets/images/menu/dhr/W09F2162-WEB5.svg +18 -18
  153. package/assets/images/menu/dhr/W29F4006-WEB5.svg +19 -19
  154. package/assets/images/menu/dhr/W75F2260-WEB5.svg +15 -15
  155. package/assets/images/menu/dhr/W75F2261-WEB5.svg +19 -19
  156. package/assets/images/menu/dhr/W75F3005-WEB5.svg +13 -13
  157. package/assets/images/menu/dhr/W75F4070-WEB5.svg +21 -21
  158. package/assets/images/menu/dhr/W75F4071-WEB5.svg +17 -17
  159. package/assets/images/menu/dhr/W75F4100-WEB5.svg +14 -14
  160. package/assets/images/menu/dhr/W77F1011.svg +19 -19
  161. package/assets/images/menu/dhr/W77F1013.svg +22 -22
  162. package/assets/images/menu/erp/D05.svg +8 -8
  163. package/assets/images/menu/erp/D06.svg +4 -4
  164. package/assets/images/menu/erp/D90R.svg +9 -9
  165. package/assets/images/menu/erp/DBC.svg +9 -9
  166. package/assets/images/menu/erp/W00F0001.svg +3 -3
  167. package/assets/images/menu/erp/W00F0002.svg +3 -3
  168. package/assets/images/menu/erp/W00F0003.svg +3 -3
  169. package/assets/images/menu/erp/W00F0004.svg +3 -3
  170. package/assets/images/menu/erp/W05F0001.svg +16 -16
  171. package/assets/images/menu/erp/W05F0001N0000.svg +16 -16
  172. package/assets/images/menu/erp/W05F0004N0000.svg +6 -6
  173. package/assets/images/menu/erp/W05F0006N0000.svg +30 -30
  174. package/assets/images/menu/erp/W05F0007N0000.svg +6 -6
  175. package/assets/images/menu/erp/W05F0008N0000.svg +14 -14
  176. package/assets/images/menu/erp/W05F0011N0000.svg +20 -20
  177. package/assets/images/menu/erp/W05F0013N0000.svg +9 -9
  178. package/assets/images/menu/erp/W05F4000N0000.svg +9 -9
  179. package/assets/images/menu/erp/W06F0001.svg +17 -17
  180. package/assets/images/menu/erp/W06F0001N0000.svg +17 -17
  181. package/assets/images/menu/erp/W06F0004N0000.svg +22 -22
  182. package/assets/images/menu/erp/W06F0005N0000.svg +22 -22
  183. package/assets/images/menu/erp/W06F0006N0000.svg +55 -55
  184. package/assets/images/menu/erp/W06F0008N0000.svg +17 -17
  185. package/assets/images/menu/erp/W94F1000N0000.svg +9 -9
  186. package/assets/images/menu/erp/W94F1000N0001.svg +9 -9
  187. package/assets/images/menu/erp/WA3F1025.svg +5 -5
  188. package/assets/images/menu/erp/WA3F2100.svg +10 -10
  189. package/components/accordion/css.js +42 -35
  190. package/components/accordion/details.js +48 -42
  191. package/components/accordion/group.js +88 -82
  192. package/components/accordion/index.js +54 -48
  193. package/components/accordion/summary.js +52 -43
  194. package/components/alert/index.js +115 -103
  195. package/components/alert/notify.js +16 -18
  196. package/components/badge/index.js +5 -5
  197. package/components/button/icon.js +21 -21
  198. package/components/button/index.js +13 -13
  199. package/components/chart/Pie/Sector.js +2 -2
  200. package/components/chart/Pie-v2/Sector.js +2 -2
  201. package/components/chip/attach.js +5 -5
  202. package/components/chip/index.js +13 -10
  203. package/components/divider/index.js +17 -15
  204. package/components/form-control/attachment/index.js +1 -0
  205. package/components/form-control/calendar/function.js +295 -289
  206. package/components/form-control/calendar/index.js +16 -16
  207. package/components/form-control/checkbox/index.js +5 -5
  208. package/components/form-control/date-picker/index.js +7 -3
  209. package/components/form-control/date-range-picker/index.js +12 -8
  210. package/components/form-control/dropdown/index.js +139 -81
  211. package/components/form-control/input-base/index.js +32 -27
  212. package/components/form-control/money-input/index.js +17 -17
  213. package/components/form-control/number-input/index.js +11 -11
  214. package/components/form-control/number-input/index2.js +432 -0
  215. package/components/form-control/phone-input/index.js +7 -7
  216. package/components/form-control/radio/index.js +98 -146
  217. package/components/form-control/text-input/index.js +4 -4
  218. package/components/form-control/time-picker/index.js +305 -300
  219. package/components/form-control/toggle/index.js +92 -90
  220. package/components/index.js +1 -1
  221. package/components/modal/header.js +63 -65
  222. package/components/modal/modal.js +84 -130
  223. package/components/paging/page-selector.js +53 -49
  224. package/components/popup/index.js +5 -1
  225. package/components/popup/proposals_popup.js +5 -1
  226. package/components/popup/v2/index.js +12 -8
  227. package/components/progress/circular.js +12 -12
  228. package/components/rating/index.js +3 -3
  229. package/components/slider/slider-item.js +65 -25
  230. package/components/tab/tab-container.js +2 -2
  231. package/components/tab/tab-header.js +2 -2
  232. package/components/tab/tab-panel.js +2 -2
  233. package/components/tab/tab.js +2 -2
  234. package/components/transfer/index.js +3 -3
  235. package/components/tree-view/index.js +38 -38
  236. package/components/typography/index.js +10 -10
  237. package/icons/basic.js +75 -408
  238. package/icons/effect.js +15 -15
  239. package/package.json +45 -45
  240. package/readme.md +677 -654
  241. package/styles/color-helper.js +103 -103
  242. package/styles/colors.js +7 -7
  243. package/styles/general.js +40 -12
  244. package/styles/utils.js +5 -5
  245. package/theme/set-theme.js +3 -3
  246. package/theme/settings.js +3 -2
  247. package/utils/array/array.js +36 -36
  248. package/utils/date.js +56 -56
  249. package/utils/error/error.js +2 -2
  250. package/utils/error/errors.js +99 -99
  251. package/utils/number.js +6 -6
  252. package/utils/render-portal.js +5 -1
  253. package/utils/renderIcon.js +5 -5
  254. package/utils/useOnClickOutside.js +2 -2
  255. package/utils/usePortal.js +9 -9
  256. package/utils/validate.js +33 -33
@@ -2,6 +2,7 @@
2
2
 
3
3
  /** @jsx jsx */
4
4
  import { memo, useEffect, useRef, forwardRef, useImperativeHandle } from 'react';
5
+ import useInput from '../../../utils/useInput';
5
6
  import PropTypes from 'prop-types';
6
7
  import { jsx, css } from '@emotion/core';
7
8
  import { renderIcon } from '../../../utils';
@@ -15,7 +16,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
15
16
  type,
16
17
  viewType,
17
18
  defaultValue,
18
- value,
19
+ value: valueProp,
19
20
  placeholder,
20
21
  resize,
21
22
  status,
@@ -31,7 +32,7 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
31
32
  endIcon,
32
33
  startIconProps,
33
34
  endIconProps,
34
- inputRef,
35
+ inputRef: inputBaseRef,
35
36
  inputProps,
36
37
  iconStyle,
37
38
  inputStyle,
@@ -43,10 +44,19 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
43
44
  onInput,
44
45
  onKeyDown,
45
46
  onKeyUp,
47
+ delayOnChange,
46
48
  ...props
47
49
  }, reference) => {
50
+ const {
51
+ bind
52
+ } = useInput({
53
+ defaultValue,
54
+ valueProp,
55
+ onChange,
56
+ delayOnChange
57
+ });
58
+ if (!inputBaseRef) inputBaseRef = useRef(null);
48
59
  const ref = useRef(null);
49
- const inputBaseRef = useRef(null);
50
60
  const valueArray = useRef([]);
51
61
  /* Start styled */
52
62
 
@@ -479,9 +489,9 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
479
489
  useEffect(() => {
480
490
  const defaultHeight = 24;
481
491
 
482
- if (value !== undefined) {
483
- valueArray.current.push(value);
484
- inputBaseRef.current.value = value;
492
+ if (valueProp !== undefined) {
493
+ valueArray.current.push(valueProp);
494
+ inputBaseRef.current.value = valueProp;
485
495
 
486
496
  if (multiline && !/\d+/.test(rows)) {
487
497
  inputBaseRef.current.style.height = 0;
@@ -490,11 +500,11 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
490
500
  }
491
501
 
492
502
  return () => {
493
- if (value !== undefined && multiline && !/\d+/.test(rows) && inputBaseRef.current) {
503
+ if (valueProp !== undefined && multiline && !/\d+/.test(rows) && inputBaseRef.current) {
494
504
  inputBaseRef.current.style.height = defaultHeight + 'px';
495
505
  }
496
506
  };
497
- }, [value]);
507
+ }, [valueProp]);
498
508
  useEffect(() => {
499
509
  if (disabled) {
500
510
  if (ref.current) {
@@ -532,9 +542,9 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
532
542
  onKeyDown: onKeyDown,
533
543
  onKeyUp: onKeyUp,
534
544
  onInput: onInputTextArea,
535
- onChange: onChange,
536
545
  onBlur: onBlur,
537
- onFocus: onFocus
546
+ onFocus: onFocus,
547
+ ...bind
538
548
  }));
539
549
  const InputComp = jsx("div", {
540
550
  css: inputBaseRoot,
@@ -569,9 +579,9 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
569
579
  onKeyDown: onKeyDown,
570
580
  onKeyUp: onKeyUp,
571
581
  onInput: onInput,
572
- onChange: onChange,
573
582
  onBlur: onBlur,
574
- onFocus: onFocus
583
+ onFocus: onFocus,
584
+ ...bind
575
585
  })), !!endIcon && jsx("div", {
576
586
  css: inputBaseIconCSS,
577
587
  ...endIconProps,
@@ -587,22 +597,14 @@ const InputBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
587
597
  const InputBaseComp = multiline ? MultipleInputComp : InputComp;
588
598
  /* End component */
589
599
 
590
- useImperativeHandle(reference, () => ref.current);
591
- useImperativeHandle(inputRef, () => {
592
- inputBaseRef.current.resetValue = () => {
593
- inputBaseRef.current.value = value;
594
- return value;
595
- };
600
+ useImperativeHandle(reference, () => {
601
+ const currentRef = inputBaseRef.current || {};
602
+ const _instance = {}; // methods
596
603
 
597
- inputBaseRef.current.setPreviousValue = () => {
598
- valueArray.current.pop();
599
- const preValue = valueArray.current[valueArray.current.length - 1];
600
- const previousValue = preValue || preValue === 0 ? preValue : defaultValue || '';
601
- inputBaseRef.current.value = previousValue;
602
- return previousValue;
603
- };
604
+ _instance.__proto__ = {}; // hidden methods
604
605
 
605
- return inputBaseRef.current;
606
+ currentRef.instance = _instance;
607
+ return currentRef;
606
608
  });
607
609
  return InputBaseComp;
608
610
  }));
@@ -719,6 +721,9 @@ InputBase.propTypes = {
719
721
  onFocus: PropTypes.func,
720
722
 
721
723
  /** inputRef of InputBase component */
722
- inputRef: PropTypes.any
724
+ inputRef: PropTypes.any,
725
+
726
+ /** delayOnChange of InputBase component */
727
+ delayOnChange: PropTypes.number
723
728
  };
724
729
  export default InputBase;
@@ -142,15 +142,15 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
142
142
 
143
143
  const separatorSymbol = typeof thousandSeparator === 'string' ? thousandSeparator : locale.get() === 'vi' ? '.' : ',';
144
144
  const decimalSymbol = separatorSymbol === '.' ? ',' : '.';
145
- const thousandSeparatorPattern = new RegExp(`[0-9]|Backspace|Delete|Arrow|Home|End|Tab${decimalDigit === 0 ? '' : '|\\' + decimalSymbol}${disabledNegative ? '' : '|\-'}`);
145
+ const thousandSeparatorPattern = new RegExp(`[0-9]|Backspace|Delete|Arrow|Home|End|Tab${decimalDigit === 0 ? '' : '|\\' + decimalSymbol}${disabledNegative ? '' : '|-'}`);
146
146
  const isError = !!error && !value && value !== 0;
147
147
  /* Start styled */
148
148
 
149
149
  const MoneyInputRoot = css`
150
- ${displayBlock}
151
- ${positionRelative}
150
+ ${displayBlock}
151
+ ${positionRelative}
152
152
  margin-bottom: 20px;
153
- `;
153
+ `;
154
154
  /* End styled */
155
155
 
156
156
  /* Start handler */
@@ -277,8 +277,8 @@ const MoneyInput = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
277
277
  const value = e.target.value;
278
278
 
279
279
  if (/[a-z]/i.test(value)) {
280
- const length = value.match(/[a-z]/ig).length;
281
- e.target.value = value.replace(/[a-z]/ig, '');
280
+ const length = value.match(/[a-z]/gi).length;
281
+ e.target.value = value.replace(/[a-z]/gi, '');
282
282
 
283
283
  if (length === 1) {
284
284
  const index = value.match(/[a-z]/i).index;
@@ -552,10 +552,10 @@ MoneyInput.propTypes = {
552
552
  /** The function to get ref of MoneyInput component */
553
553
  refs: PropTypes.func,
554
554
 
555
- /** validation value, argument can:<br/>
556
- * * string: the validation rule. Example required.<br/>
557
- * * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
558
- * * array: the validation rule list, insist object/string
555
+ /** validation value, argument can:<br/>
556
+ * * string: the validation rule. Example required.<br/>
557
+ * * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
558
+ * * array: the validation rule list, insist object/string
559
559
  */
560
560
  validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
561
561
 
@@ -568,13 +568,13 @@ MoneyInput.propTypes = {
568
568
  /** on input function */
569
569
  onInput: PropTypes.func,
570
570
 
571
- /**
572
- * on change function, return an object:<br/>
573
- * {<br/>
574
- * &nbsp;&nbsp;&nbsp;&nbsp;value: is a number or null value<br/>
575
- * &nbsp;&nbsp;&nbsp;&nbsp;target.value: value of input<br/>
576
- * &nbsp;&nbsp;&nbsp;&nbsp;...element<br/>
577
- * }
571
+ /**
572
+ * on change function, return an object:<br/>
573
+ * {<br/>
574
+ * &nbsp;&nbsp;&nbsp;&nbsp;value: is a number or null value<br/>
575
+ * &nbsp;&nbsp;&nbsp;&nbsp;target.value: value of input<br/>
576
+ * &nbsp;&nbsp;&nbsp;&nbsp;...element<br/>
577
+ * }
578
578
  */
579
579
  onChange: PropTypes.func,
580
580
 
@@ -591,23 +591,23 @@ NumberInput.propTypes = {
591
591
  /** any props of error in NumberInput component */
592
592
  errorProps: PropTypes.object,
593
593
 
594
- /**
595
- * the format to display value<br/>
596
- * * function: value => function(value)<br/>
597
- * * string: Example: '#.###', '# ###', '#.### 2%', '#.### %%'<br/>
598
- * &nbsp;&nbsp;&nbsp;&nbsp;#: integer part digit<br/>
599
- * &nbsp;&nbsp;&nbsp;&nbsp;. / '_': separator symbol<br/>
600
- * &nbsp;&nbsp;&nbsp;&nbsp;%: decimal digit, '2%' === '%%'
594
+ /**
595
+ * the format to display value<br/>
596
+ * * function: value => function(value)<br/>
597
+ * * string: Example: '#.###', '# ###', '#.### 2%', '#.### %%'<br/>
598
+ * &nbsp;&nbsp;&nbsp;&nbsp;#: integer part digit<br/>
599
+ * &nbsp;&nbsp;&nbsp;&nbsp;. / '_': separator symbol<br/>
600
+ * &nbsp;&nbsp;&nbsp;&nbsp;%: decimal digit, '2%' === '%%'
601
601
  */
602
602
  format: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
603
603
 
604
604
  /** The function to get ref of NumberInput component */
605
605
  refs: PropTypes.func,
606
606
 
607
- /** validation value, argument can:<br/>
608
- * * string: the validation rule. Example required.<br/>
609
- * * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
610
- * * array: the validation rule list, insist object/string
607
+ /** validation value, argument can:<br/>
608
+ * * string: the validation rule. Example required.<br/>
609
+ * * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
610
+ * * array: the validation rule list, insist object/string
611
611
  */
612
612
  validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
613
613
 
@@ -0,0 +1,432 @@
1
+ /** @jsxRuntime classic */
2
+
3
+ /** @jsx jsx */
4
+ import { useState, useRef, forwardRef, useMemo, useCallback, useEffect, useImperativeHandle } from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { jsx, css } from '@emotion/core';
7
+ import locale from '../../../locale';
8
+ import { InputBase, Label, HelperText } from '../..';
9
+ import { onValidate } from '../../../utils';
10
+ import { getGlobal } from '../../../global';
11
+ /* Start styled */
12
+
13
+ const NumberInputRoot = css`
14
+ display: block;
15
+ position: relative;
16
+ margin-bottom: 20px;
17
+ `;
18
+ const regexValidNumber = /[^0-9.,-]/g;
19
+ const regexThousandNumber = /(\d)(?=(\d{3})+\b)/g;
20
+ const NumberInput = /*#__PURE__*/forwardRef(({
21
+ viewType,
22
+ required,
23
+ disabledNegative,
24
+ nonStyle,
25
+ decimalDigit,
26
+ decimalSymbol,
27
+ thousandSeparator: thousandSymbol,
28
+ label,
29
+ defaultValue,
30
+ value: valueProps,
31
+ min,
32
+ max,
33
+ step,
34
+ placeholder,
35
+ startIcon,
36
+ endIcon,
37
+ autoFocus,
38
+ disabled,
39
+ readOnly,
40
+ inputRef,
41
+ inputProps,
42
+ inputStyle,
43
+ error,
44
+ onChange,
45
+ onFocus,
46
+ onInput,
47
+ onKeyDown,
48
+ onKeyUp,
49
+ validates,
50
+ delayOnChange,
51
+ fixedDecimalDigit,
52
+ className
53
+ }, reference) => {
54
+ inputRef = inputRef || useRef(null);
55
+ const pos = useRef(null);
56
+ const ref = useRef(null);
57
+ const globalRef = useRef({});
58
+ const [value, setValue] = useState(defaultValue); // nếu không cho nhập số âm mà max là âm thì remove giá trị max
59
+
60
+ if (max < 0 && disabledNegative) max = null;
61
+
62
+ if (thousandSymbol) {
63
+ thousandSymbol = useMemo(() => {
64
+ return typeof thousandSymbol === 'string' ? thousandSymbol : decimalSymbol === ',' ? '.' : ',';
65
+ }, [decimalSymbol, thousandSymbol]);
66
+ decimalSymbol = useMemo(() => {
67
+ return thousandSymbol === ',' ? '.' : ',';
68
+ }, [decimalSymbol, decimalSymbol]);
69
+ } else {
70
+ thousandSymbol = '';
71
+ }
72
+
73
+ const validateResult = validates && onValidate(value, validates, true); // Clamp number between two values with the following line:
74
+
75
+ const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
76
+
77
+ if (valueProps || valueProps === 0) valueProps = clamp(valueProps, min, max);
78
+ /**
79
+ * Convert number to format money
80
+ * @param vl {number} - value
81
+ * @type {function(*): number}
82
+ * @return {string}
83
+ * @example 1200300.123 => 1,200,300.123
84
+ * @example 1200300,123 => 1.200.300,123
85
+ */
86
+
87
+ const parseNumberToMoney = useCallback((vl, isNumber) => {
88
+ var _number, _number2, _number$, _number3;
89
+
90
+ const {
91
+ current: {
92
+ selectionStart
93
+ }
94
+ } = inputRef;
95
+ let number = convertMoneyToNumber(vl, isNumber);
96
+ if (disabledNegative && Number(number || 0) < 0) number = clamp(number, min, max);
97
+ if (typeof max !== 'undefined' && Number(number) > max) number = Math.min(number, max); // number = Currency.format(number);
98
+
99
+ if (!number) return number;
100
+ number = (_number = number) === null || _number === void 0 ? void 0 : _number.toString().split('.');
101
+
102
+ if (number.length === 2 && !number[0]) {
103
+ number[0] = '0';
104
+ pos.current = 2;
105
+ }
106
+
107
+ number[0] = (_number2 = number) === null || _number2 === void 0 ? void 0 : _number2[0].replace(regexThousandNumber, '$1' + thousandSymbol); // add thousand symbol to number
108
+
109
+ if (!decimalDigit) number.length = 1;else if (number[1]) number[1] = (_number$ = number[1]) === null || _number$ === void 0 ? void 0 : _number$.slice(0, decimalDigit || 0);
110
+ number = number.join(decimalSymbol); // keep focus position
111
+
112
+ if ((_number3 = number) !== null && _number3 !== void 0 && _number3.indexOf(thousandSymbol) && !pos.current) {
113
+ var _number4;
114
+
115
+ pos.current = selectionStart + (((_number4 = number) === null || _number4 === void 0 ? void 0 : _number4.toString().split(thousandSymbol).length) - (vl === null || vl === void 0 ? void 0 : vl.toString().split(thousandSymbol).length));
116
+ }
117
+
118
+ return number;
119
+ }, [decimalSymbol, max, value]);
120
+ /**
121
+ * Convert money to format number
122
+ * @param vl {string} - value
123
+ * @type {function(*): number}
124
+ * @return {number}
125
+ * @example 1,200,300.123 => 1200300.123
126
+ * @example 1.200.300,123 => 1200300.123
127
+ */
128
+
129
+ const convertMoneyToNumber = useCallback((vl, isNumber) => {
130
+ var _number5, _number5$toString, _number5$toString$rep, _number5$toString$rep2, _number5$toString$rep3;
131
+
132
+ let number = vl === null || vl === void 0 ? void 0 : vl.toString().replace(regexValidNumber, ''); // allow number and , || . || -
133
+ // remove <thousandSymbol> and replace . to <decimalSymbol>
134
+
135
+ if (!isNumber) number = (_number5 = number) === null || _number5 === void 0 ? void 0 : (_number5$toString = _number5.toString()) === null || _number5$toString === void 0 ? void 0 : (_number5$toString$rep = _number5$toString.replaceAll) === null || _number5$toString$rep === void 0 ? void 0 : (_number5$toString$rep2 = (_number5$toString$rep3 = _number5$toString$rep.call(_number5$toString, thousandSymbol, '')).replaceAll) === null || _number5$toString$rep2 === void 0 ? void 0 : _number5$toString$rep2.call(_number5$toString$rep3, decimalSymbol, '.');
136
+ return number;
137
+ }, [decimalSymbol]);
138
+
139
+ const _onInput = e => {
140
+ var _e$target$value;
141
+
142
+ let valueT = (_e$target$value = e.target.value) !== null && _e$target$value !== void 0 ? _e$target$value : e.value;
143
+ if (disabledNegative && Number(valueT || 0) < 0) return;
144
+ valueT = parseNumberToMoney(valueT);
145
+ const returnValue = convertMoneyToNumber(valueT);
146
+ e.value = globalRef.current.value = !isNaN(parseFloat(returnValue)) ? parseFloat(returnValue) : null;
147
+ e.target.value = globalRef.current.valueString = valueT || '';
148
+ onInput === null || onInput === void 0 ? void 0 : onInput(e);
149
+ setValue(valueT);
150
+ };
151
+
152
+ const _onBlur = e => {
153
+ var _e$value;
154
+
155
+ let value = (_e$value = e.value) !== null && _e$value !== void 0 ? _e$value : e.target.value;
156
+ if (fixedDecimalDigit) value = Number(value).toFixed(decimalDigit);
157
+
158
+ if (value && (typeof min !== 'undefined' || typeof max !== 'undefined')) {
159
+ value = convertMoneyToNumber(value);
160
+
161
+ if (Number(value) < min || Number(value) > max) {
162
+ _onInput({ ...e,
163
+ target: { ...e.target,
164
+ value: clamp(value, min, max)
165
+ }
166
+ });
167
+ }
168
+ }
169
+ };
170
+
171
+ const _onKeyDown = e => {
172
+ var _value$split, _value$split$;
173
+
174
+ const {
175
+ keyCode,
176
+ ctrlKey,
177
+ metaKey,
178
+ shiftKey,
179
+ target: {
180
+ value,
181
+ selectionStart,
182
+ selectionEnd
183
+ }
184
+ } = e; // 0-9 only
185
+
186
+ const isNumber = keyCode >= 48 && keyCode <= 57 && shiftKey === false || keyCode >= 96 && keyCode <= 105; // character input type="number"
187
+
188
+ const allowKeyTypeNumber = isNumber || keyCode === 8 || // key backspace
189
+ keyCode > 34 && keyCode < 40 || keyCode === 190 || keyCode === 110 || // .
190
+ keyCode === 188 || // ,
191
+ (ctrlKey || metaKey) && (keyCode === 65 || keyCode === 67 || keyCode === 86) || // ctrl + A, ctrl + C, ctrl + V
192
+ keyCode === 46 || // key delete
193
+ keyCode === 189 || keyCode === 109 || // -
194
+ keyCode === 9; // tab
195
+ // The key is delete (|| remove) and focus after the thousand digit
196
+
197
+ const removeDot = keyCode === 8 && selectionEnd - selectionStart <= 1 && value.charAt(selectionEnd - 1) === thousandSymbol; // Decimal
198
+ // Do not allow the character decimal if decimalDigit is undefined
199
+
200
+ const isDecimalSymbol = decimalSymbol === '.' && (keyCode === 190 || keyCode === 110) || decimalSymbol === ',' && keyCode === 188;
201
+ const disabledDecimalSymbol = isDecimalSymbol && !decimalDigit; // Accepts only one decimal separator
202
+
203
+ const decimalExists = value.includes(decimalSymbol) && isDecimalSymbol; // Do not allow the character thousand
204
+
205
+ const isThousandSymbol = (!thousandSymbol || thousandSymbol === '.') && (keyCode === 190 || keyCode === 110) || thousandSymbol === ',' && keyCode === 188;
206
+ const disabledThousandSymbol = isThousandSymbol; // Disabled typing input when decimal digit to limit and focus is last
207
+
208
+ const disabledTypingDecimal = ((_value$split = value.split(decimalSymbol)) === null || _value$split === void 0 ? void 0 : (_value$split$ = _value$split[1]) === null || _value$split$ === void 0 ? void 0 : _value$split$.length) >= decimalDigit && // total number after decimal symbol > {decimalDigit}
209
+ selectionStart === value.length; // the focus is at the end of the string
210
+ // key arrow up
211
+
212
+ if (keyCode === 38) {
213
+ _onInput({ ...e,
214
+ target: { ...e.target,
215
+ value: Number(convertMoneyToNumber(value) || 0) + step
216
+ }
217
+ });
218
+
219
+ e.preventDefault();
220
+ } // key arrow down
221
+ else if (keyCode === 40) {
222
+ _onInput({ ...e,
223
+ target: { ...e.target,
224
+ value: Number(convertMoneyToNumber(value) || 0) - step
225
+ }
226
+ });
227
+
228
+ e.preventDefault();
229
+ } // disabled negative
230
+
231
+
232
+ const disabled180 = (keyCode === 189 || keyCode === 109) && (disabledNegative || value.includes('-')); // Block event if include conditions
233
+
234
+ if (decimalExists || disabledThousandSymbol || removeDot || isNumber && disabledTypingDecimal || disabledDecimalSymbol || !allowKeyTypeNumber || disabled180) {
235
+ e.preventDefault();
236
+ }
237
+
238
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
239
+ };
240
+
241
+ useEffect(() => {
242
+ inputRef.current.value = value !== null && value !== void 0 ? value : null; // keep focus position
243
+
244
+ if (pos.current) {
245
+ inputRef.current.setSelectionRange(pos.current, pos.current);
246
+ pos.current = null;
247
+ }
248
+ }, [value]);
249
+ useEffect(() => {
250
+ var _valueProps;
251
+
252
+ if (typeof valueProps !== 'undefined') if (disabledNegative && Number(valueProps || 0) < 0) {
253
+ // nếu không cho nhập số âm mà value đầu vào là âm thì reset value về 0
254
+ valueProps = clamp(0, min, max);
255
+ }
256
+ setValue(parseNumberToMoney((_valueProps = valueProps) === null || _valueProps === void 0 ? void 0 : _valueProps.toString().replace(regexValidNumber, ''), true));
257
+ }, [valueProps]);
258
+ useImperativeHandle(reference, () => {
259
+ const currentRef = ref.current || {};
260
+ const _instance = {}; // methods
261
+
262
+ _instance.__proto__ = {}; // hidden methods
263
+
264
+ currentRef.instance = _instance;
265
+ return currentRef;
266
+ });
267
+ return jsx("div", {
268
+ ref: ref,
269
+ css: NumberInputRoot,
270
+ className: ['DGN-UI-NumberInput', className].join(' ').trim().replace(/\s+/g, ' ')
271
+ }, !!label && jsx(Label, {
272
+ required: required,
273
+ disabled: disabled
274
+ }, label), jsx(InputBase, {
275
+ inputRef: inputRef,
276
+ viewType: viewType,
277
+ defaultValue: defaultValue,
278
+ value: value,
279
+ placeholder: placeholder,
280
+ autoFocus: autoFocus,
281
+ disabled: disabled,
282
+ readOnly: readOnly,
283
+ status: !!error || validateResult ? 'danger' : 'default',
284
+ inputProps: inputProps,
285
+ inputStyle: inputStyle,
286
+ startIcon: startIcon,
287
+ endIcon: endIcon,
288
+ nonStyle: nonStyle,
289
+ onFocus: onFocus,
290
+ onInput: _onInput,
291
+ onKeyUp: onKeyUp,
292
+ delayOnChange: delayOnChange,
293
+ onKeyDown: _onKeyDown,
294
+ onChange: e => {
295
+ onChange({ ...e,
296
+ value: globalRef.current.value,
297
+ target: { ...e.target,
298
+ value: globalRef.current.valueString
299
+ }
300
+ });
301
+ },
302
+ onBlur: e => _onBlur(e)
303
+ }), !!error && jsx(HelperText, {
304
+ disabled: disabled
305
+ }, error), !error && validateResult && jsx(HelperText, {
306
+ disabled: disabled
307
+ }, validateResult));
308
+ });
309
+ NumberInput.defaultProps = {
310
+ viewType: 'underlined',
311
+ label: '',
312
+ placeholder: getGlobal('inputPlaceholder'),
313
+ error: '',
314
+ startIcon: '',
315
+ endIcon: '',
316
+ decimalSymbol: locale.get() === 'vi' ? ',' : '.',
317
+ required: false,
318
+ nonStyle: false,
319
+ autoFocus: false,
320
+ disabled: false,
321
+ readOnly: false,
322
+ disabledNegative: false,
323
+ fixedDecimalDigit: false,
324
+ step: 1,
325
+ decimalDigit: 0,
326
+ thousandSeparator: false,
327
+ min: -Infinity,
328
+ max: Infinity,
329
+ className: ''
330
+ };
331
+ NumberInput.propTypes = {
332
+ /** the type of border you want to display */
333
+ viewType: PropTypes.oneOf(['underlined', 'outlined']),
334
+
335
+ /** separator symbol */
336
+ decimalSymbol: PropTypes.oneOf([',', '.']),
337
+
338
+ /** default value is displayed for first render */
339
+ defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
340
+
341
+ /** the displayed value for each change */
342
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
343
+
344
+ /** number of decimal places allowed */
345
+ decimalDigit: PropTypes.number,
346
+
347
+ /** min of value was allowed */
348
+ min: PropTypes.number,
349
+
350
+ /** max of value was allowed */
351
+ max: PropTypes.number,
352
+
353
+ /** step of input */
354
+ step: PropTypes.number,
355
+
356
+ /** label for input */
357
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
358
+
359
+ /** hints for input */
360
+ placeholder: PropTypes.string,
361
+
362
+ /** error for input */
363
+ error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
364
+
365
+ /** icon at start */
366
+ startIcon: PropTypes.any,
367
+
368
+ /** icon at end */
369
+ endIcon: PropTypes.any,
370
+
371
+ /** prevent all event if true, hide all icon */
372
+ disabled: PropTypes.bool,
373
+
374
+ /** transparent border color if true */
375
+ nonStyle: PropTypes.bool,
376
+
377
+ /** prevent all event if true */
378
+ readOnly: PropTypes.bool,
379
+
380
+ /** auto focus after first render */
381
+ autoFocus: PropTypes.bool,
382
+
383
+ /** negative numbers are not allowed if true */
384
+ disabledNegative: PropTypes.bool,
385
+
386
+ /** At least one character is required */
387
+ required: PropTypes.bool,
388
+
389
+ /** props of input in NumberInput component */
390
+ inputProps: PropTypes.object,
391
+
392
+ /** style inline of input in NumberInput component */
393
+ inputStyle: PropTypes.object,
394
+
395
+ /** validation value, argument can:<br/>
396
+ * * string: the validation rule. Example required.<br/>
397
+ * * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
398
+ * * array: the validation rule list, insist object/string
399
+ */
400
+ validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
401
+
402
+ /** on key down function */
403
+ onKeyDown: PropTypes.func,
404
+
405
+ /** on key up function */
406
+ onKeyUp: PropTypes.func,
407
+
408
+ /** on input function */
409
+ onInput: PropTypes.func,
410
+
411
+ /** on change function */
412
+ onChange: PropTypes.func,
413
+
414
+ /** on focus function */
415
+ onFocus: PropTypes.func,
416
+
417
+ /** inputRef of NumberInput component */
418
+ inputRef: PropTypes.any,
419
+
420
+ /** inputRef of fixedDecimalDigit component */
421
+ fixedDecimalDigit: PropTypes.bool,
422
+
423
+ /** inputRef of delayOnChange component */
424
+ delayOnChange: PropTypes.number,
425
+
426
+ /** inputRef of delayOnChange component */
427
+ thousandSeparator: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['.', ','])]),
428
+
429
+ /** className of component */
430
+ className: PropTypes.string
431
+ };
432
+ export default NumberInput;
@@ -410,13 +410,13 @@ PhoneInput.propTypes = {
410
410
  /** on input function */
411
411
  onInput: PropTypes.func,
412
412
 
413
- /**
414
- * on change function. Return a object, example:<br/>
415
- * {<br/>
416
- * &nbsp;&nbsp;&nbsp;&nbsp;target: {value: "(+84) 123 456 789", ...}<br/>
417
- * &nbsp;&nbsp;&nbsp;&nbsp;value: 0123456789<br/>
418
- * &nbsp;&nbsp;&nbsp;&nbsp;countryCode: 84<br/>
419
- * }
413
+ /**
414
+ * on change function. Return a object, example:<br/>
415
+ * {<br/>
416
+ * &nbsp;&nbsp;&nbsp;&nbsp;target: {value: "(+84) 123 456 789", ...}<br/>
417
+ * &nbsp;&nbsp;&nbsp;&nbsp;value: 0123456789<br/>
418
+ * &nbsp;&nbsp;&nbsp;&nbsp;countryCode: 84<br/>
419
+ * }
420
420
  */
421
421
  onChange: PropTypes.func,
422
422