@widergy/energy-ui 2.10.1 → 3.0.0

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 (288) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/components/EnergyThemeProvider/index.js +12 -34
  3. package/dist/components/Loading/constants.js +1 -1
  4. package/dist/components/Loading/index.js +12 -10
  5. package/dist/components/Loading/theme.js +6 -3
  6. package/dist/components/UTAlert/AlertHandler.js +74 -99
  7. package/dist/components/UTAlert/index.js +64 -85
  8. package/dist/components/UTAlert/theme.js +34 -32
  9. package/dist/components/UTAttachment/components/Preview/index.js +7 -7
  10. package/dist/components/UTAttachment/constants.js +6 -6
  11. package/dist/components/UTAttachment/index.js +167 -257
  12. package/dist/components/UTAttachment/layout.js +25 -25
  13. package/dist/components/UTAttachment/theme.js +6 -3
  14. package/dist/components/UTAttachment/utils.js +44 -117
  15. package/dist/components/UTAutocomplete/components/ListBox/index.js +12 -19
  16. package/dist/components/UTAutocomplete/components/ListBox/utils.js +11 -12
  17. package/dist/components/UTAutocomplete/constants.js +11 -11
  18. package/dist/components/UTAutocomplete/index.js +53 -92
  19. package/dist/components/UTAutocomplete/theme.js +9 -5
  20. package/dist/components/UTAvatar/constants.js +1 -1
  21. package/dist/components/UTAvatar/index.js +17 -15
  22. package/dist/components/UTBarChart/components/Bars/components/Bar/components/Rect/index.js +21 -20
  23. package/dist/components/UTBarChart/components/Bars/components/Bar/constants.js +2 -1
  24. package/dist/components/UTBarChart/components/Bars/components/Bar/index.js +20 -20
  25. package/dist/components/UTBarChart/components/Bars/constants.js +3 -3
  26. package/dist/components/UTBarChart/components/Bars/index.js +69 -78
  27. package/dist/components/UTBarChart/components/Legend/constants.js +14 -17
  28. package/dist/components/UTBarChart/components/Legend/index.js +74 -91
  29. package/dist/components/UTBarChart/components/Legend/utils.js +2 -5
  30. package/dist/components/UTBarChart/components/Levels/index.js +15 -12
  31. package/dist/components/UTBarChart/components/Levels/utils.js +26 -27
  32. package/dist/components/UTBarChart/components/LinearPlot/constants.js +2 -2
  33. package/dist/components/UTBarChart/components/LinearPlot/index.js +24 -18
  34. package/dist/components/UTBarChart/components/LinearPlot/utils.js +39 -39
  35. package/dist/components/UTBarChart/components/Pagination/constants.js +1 -1
  36. package/dist/components/UTBarChart/components/Pagination/index.js +19 -22
  37. package/dist/components/UTBarChart/components/XAxis/components/AxisElement/index.js +20 -30
  38. package/dist/components/UTBarChart/components/XAxis/components/Decoration/constants.js +2 -2
  39. package/dist/components/UTBarChart/components/XAxis/components/Decoration/index.js +19 -17
  40. package/dist/components/UTBarChart/components/XAxis/constants.js +1 -1
  41. package/dist/components/UTBarChart/components/XAxis/index.js +53 -63
  42. package/dist/components/UTBarChart/components/YAxis/AxisElement/index.js +11 -9
  43. package/dist/components/UTBarChart/components/YAxis/constants.js +1 -1
  44. package/dist/components/UTBarChart/components/YAxis/index.js +29 -35
  45. package/dist/components/UTBarChart/components/YAxis/utils.js +6 -6
  46. package/dist/components/UTBarChart/constants.js +4 -4
  47. package/dist/components/UTBarChart/hooks/use-dynamic-margins.js +22 -38
  48. package/dist/components/UTBarChart/index.js +151 -164
  49. package/dist/components/UTBarChart/theme.js +6 -3
  50. package/dist/components/UTBarChart/types.js +9 -9
  51. package/dist/components/UTBarChart/utils.js +118 -111
  52. package/dist/components/UTBreadcrumbs/constants.js +22 -24
  53. package/dist/components/UTBreadcrumbs/index.js +75 -99
  54. package/dist/components/UTBreadcrumbs/styles.module.scss +1 -0
  55. package/dist/components/UTBreadcrumbs/theme.js +6 -3
  56. package/dist/components/UTButton/constants.js +11 -11
  57. package/dist/components/UTButton/index.js +27 -29
  58. package/dist/components/UTButton/theme.js +26 -24
  59. package/dist/components/UTCBUInput/index.js +35 -38
  60. package/dist/components/UTCBUInput/theme.js +6 -3
  61. package/dist/components/UTCaptcha/index.js +18 -43
  62. package/dist/components/UTCard/components/UTCardFooter/index.js +14 -14
  63. package/dist/components/UTCard/index.js +89 -123
  64. package/dist/components/UTCard/theme.js +13 -13
  65. package/dist/components/UTCard/types.js +1 -1
  66. package/dist/components/UTCarousel/components/Button/index.js +12 -11
  67. package/dist/components/UTCarousel/components/Legend/index.js +12 -13
  68. package/dist/components/UTCarousel/components/Slider/component/Slide/index.js +15 -14
  69. package/dist/components/UTCarousel/components/Slider/constants.js +5 -5
  70. package/dist/components/UTCarousel/components/Slider/index.js +213 -281
  71. package/dist/components/UTCarousel/components/Slider/layout.js +66 -92
  72. package/dist/components/UTCarousel/index.js +13 -13
  73. package/dist/components/UTCarousel/theme.js +6 -3
  74. package/dist/components/UTCheckList/constants.js +1 -1
  75. package/dist/components/UTCheckList/index.js +71 -91
  76. package/dist/components/UTCheckList/theme.js +34 -32
  77. package/dist/components/UTCheckbox/constants.js +2 -4
  78. package/dist/components/UTCheckbox/index.js +32 -43
  79. package/dist/components/UTCheckbox/theme.js +37 -35
  80. package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicator/index.js +8 -7
  81. package/dist/components/UTConsumptionBar/constants.js +3 -3
  82. package/dist/components/UTConsumptionBar/index.js +52 -78
  83. package/dist/components/UTCuit/index.js +114 -137
  84. package/dist/components/UTCuit/theme.js +52 -53
  85. package/dist/components/UTDatePicker/components/Day/constants.js +1 -1
  86. package/dist/components/UTDatePicker/components/Day/index.js +11 -10
  87. package/dist/components/UTDatePicker/constants.js +21 -22
  88. package/dist/components/UTDatePicker/index.js +60 -102
  89. package/dist/components/UTDatePicker/theme.js +8 -4
  90. package/dist/components/UTDatePicker/types.js +1 -1
  91. package/dist/components/UTDatePicker/utils.js +4 -6
  92. package/dist/components/UTDialog/constants.js +2 -2
  93. package/dist/components/UTDialog/index.js +37 -35
  94. package/dist/components/UTDialog/theme.js +6 -3
  95. package/dist/components/UTDialog/types.js +1 -1
  96. package/dist/components/UTDotMenu/index.js +40 -61
  97. package/dist/components/UTEmojiPicker/constants.js +14 -18
  98. package/dist/components/UTEmojiPicker/index.js +46 -64
  99. package/dist/components/UTEmojiPicker/styles.module.scss +1 -1
  100. package/dist/components/UTEmojiPicker/theme.js +6 -3
  101. package/dist/components/UTEmojiPicker/utils.js +24 -52
  102. package/dist/components/UTExternalLink/constants.js +2 -2
  103. package/dist/components/UTExternalLink/index.js +17 -13
  104. package/dist/components/UTExternalLink/theme.js +11 -7
  105. package/dist/components/UTFileInput/constants.js +2 -2
  106. package/dist/components/UTFileInput/index.js +6 -29
  107. package/dist/components/UTFileInput/layout.js +72 -96
  108. package/dist/components/UTIconButton/index.js +48 -70
  109. package/dist/components/UTIconButton/theme.js +6 -3
  110. package/dist/components/UTImageRadio/components/ImageRadioCard/index.js +52 -56
  111. package/dist/components/UTImageRadio/constants.js +3 -3
  112. package/dist/components/UTImageRadio/index.js +38 -45
  113. package/dist/components/UTImageRadio/theme.js +13 -13
  114. package/dist/components/UTImageRadio/types.js +1 -1
  115. package/dist/components/UTImageRadio/utils.js +4 -6
  116. package/dist/components/UTLabel/constants.js +13 -11
  117. package/dist/components/UTLabel/index.js +17 -18
  118. package/dist/components/UTLabel/theme.js +19 -16
  119. package/dist/components/UTList/index.js +14 -16
  120. package/dist/components/UTLoading/index.js +14 -13
  121. package/dist/components/UTMap/components/GoogleMaps/constants.js +9 -10
  122. package/dist/components/UTMap/components/GoogleMaps/index.js +62 -89
  123. package/dist/components/UTMap/constants.js +6 -6
  124. package/dist/components/UTMap/index.js +162 -196
  125. package/dist/components/UTMap/types.js +3 -3
  126. package/dist/components/UTMap/utils.js +35 -46
  127. package/dist/components/UTMap/withGoogleMapScript.js +11 -15
  128. package/dist/components/UTMenu/index.js +51 -67
  129. package/dist/components/UTMenu/styles.module.scss +5 -5
  130. package/dist/components/UTMenu/theme.js +8 -4
  131. package/dist/components/UTMenu/utils.js +10 -12
  132. package/dist/components/UTModal/constants.js +13 -17
  133. package/dist/components/UTModal/index.js +25 -28
  134. package/dist/components/UTModal/styles.module.scss +1 -1
  135. package/dist/components/UTModal/theme.js +6 -3
  136. package/dist/components/UTPagination/components/PageSizeSelector/index.js +10 -8
  137. package/dist/components/UTPagination/components/PageSizeSelector/utils.js +9 -14
  138. package/dist/components/UTPagination/components/Pagination/components/NavigationButton/index.js +11 -10
  139. package/dist/components/UTPagination/components/Pagination/index.js +31 -45
  140. package/dist/components/UTPagination/components/Pagination/utils.js +10 -15
  141. package/dist/components/UTPagination/constants.js +3 -3
  142. package/dist/components/UTPagination/index.js +15 -15
  143. package/dist/components/UTPagination/theme.js +6 -3
  144. package/dist/components/UTPanel/index.js +37 -42
  145. package/dist/components/UTPasswordField/components/PasswordValidations/components/Error/index.js +12 -8
  146. package/dist/components/UTPasswordField/components/PasswordValidations/components/Validation/index.js +21 -17
  147. package/dist/components/UTPasswordField/components/PasswordValidations/index.js +62 -48
  148. package/dist/components/UTPasswordField/components/PasswordWarning/index.js +24 -24
  149. package/dist/components/UTPasswordField/index.js +25 -21
  150. package/dist/components/UTPasswordField/theme.js +6 -3
  151. package/dist/components/UTPhoneInput/constants.js +3 -3
  152. package/dist/components/UTPhoneInput/index.js +185 -209
  153. package/dist/components/UTPhoneInput/theme.js +79 -77
  154. package/dist/components/UTPieChart/components/ArrowLabel/constants.js +4 -4
  155. package/dist/components/UTPieChart/components/ArrowLabel/index.js +23 -21
  156. package/dist/components/UTPieChart/components/Legend/contants.js +3 -3
  157. package/dist/components/UTPieChart/components/Legend/index.js +26 -22
  158. package/dist/components/UTPieChart/constants.js +13 -13
  159. package/dist/components/UTPieChart/hooks/use-animated-value/index.js +14 -31
  160. package/dist/components/UTPieChart/index.js +72 -74
  161. package/dist/components/UTPieChart/theme.js +6 -3
  162. package/dist/components/UTPieChart/utils.js +6 -3
  163. package/dist/components/UTProgressBar/constants.js +2 -2
  164. package/dist/components/UTProgressBar/index.js +14 -15
  165. package/dist/components/UTProgressBar/theme.js +6 -3
  166. package/dist/components/UTProgressBar/types.js +1 -1
  167. package/dist/components/UTRadioGroup/index.js +55 -81
  168. package/dist/components/UTRadioGroup/theme.js +54 -52
  169. package/dist/components/UTRating/components/Circle/index.js +40 -54
  170. package/dist/components/UTRating/components/Faces/assets/mood-confuzed.svg +3 -0
  171. package/dist/components/UTRating/components/Faces/assets/mood-empty.svg +3 -0
  172. package/dist/components/UTRating/components/Faces/assets/mood-happy.svg +3 -0
  173. package/dist/components/UTRating/components/Faces/assets/mood-sad.svg +3 -0
  174. package/dist/components/UTRating/components/Faces/assets/mood-smile.svg +3 -0
  175. package/dist/components/UTRating/components/Faces/constants.js +80 -0
  176. package/dist/components/UTRating/components/Faces/index.js +76 -0
  177. package/dist/components/UTRating/components/Faces/styles.module.scss +78 -0
  178. package/dist/components/UTRating/components/Star/index.js +35 -38
  179. package/dist/components/UTRating/constants.js +5 -4
  180. package/dist/components/UTRating/index.js +35 -46
  181. package/dist/components/UTRating/styles.module.scss +1 -0
  182. package/dist/components/UTRating/theme.js +52 -3
  183. package/dist/components/UTRipple/Ripple.js +21 -37
  184. package/dist/components/UTRipple/index.js +17 -35
  185. package/dist/components/UTSelect/components/Option/index.js +12 -11
  186. package/dist/components/UTSelect/constants.js +4 -4
  187. package/dist/components/UTSelect/index.js +62 -83
  188. package/dist/components/UTSelect/theme.js +9 -5
  189. package/dist/components/UTSelect/utils.js +5 -14
  190. package/dist/components/UTSidebar/components/ListOption/index.js +33 -47
  191. package/dist/components/UTSidebar/components/LogosContainer/components/DynamicIcon/index.js +7 -6
  192. package/dist/components/UTSidebar/components/LogosContainer/index.js +13 -12
  193. package/dist/components/UTSidebar/components/Option/constants.js +1 -1
  194. package/dist/components/UTSidebar/components/Option/index.js +27 -30
  195. package/dist/components/UTSidebar/components/Toggler/index.js +10 -9
  196. package/dist/components/UTSidebar/index.js +41 -51
  197. package/dist/components/UTSidebar/theme.js +6 -3
  198. package/dist/components/UTSidebar/types.js +5 -5
  199. package/dist/components/UTSkeleton/index.js +9 -34
  200. package/dist/components/UTStatus/constants.js +4 -4
  201. package/dist/components/UTStatus/index.js +15 -13
  202. package/dist/components/UTStatus/theme.js +75 -59
  203. package/dist/components/UTSwitch/constants.js +3 -3
  204. package/dist/components/UTSwitch/index.js +41 -55
  205. package/dist/components/UTSwitch/theme.js +6 -3
  206. package/dist/components/UTTable/components/ActionIcons/constants.js +1 -1
  207. package/dist/components/UTTable/components/ActionIcons/index.js +46 -83
  208. package/dist/components/UTTable/components/Cell/components/ActionButton/index.js +9 -10
  209. package/dist/components/UTTable/components/Cell/index.js +17 -21
  210. package/dist/components/UTTable/components/HeaderCell/constants.js +1 -1
  211. package/dist/components/UTTable/components/HeaderCell/index.js +22 -28
  212. package/dist/components/UTTable/components/HeaderCell/utils.js +5 -4
  213. package/dist/components/UTTable/components/PrimaryAction/index.js +11 -9
  214. package/dist/components/UTTable/components/ResponsiveCell/index.js +18 -18
  215. package/dist/components/UTTable/components/Status/index.js +17 -17
  216. package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/index.js +9 -7
  217. package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/utils.js +9 -14
  218. package/dist/components/UTTable/components/TableFooter/components/Pagination/components/NavigationButton/index.js +11 -10
  219. package/dist/components/UTTable/components/TableFooter/components/Pagination/index.js +22 -36
  220. package/dist/components/UTTable/components/TableFooter/components/Pagination/utils.js +10 -15
  221. package/dist/components/UTTable/components/TableFooter/constants.js +1 -1
  222. package/dist/components/UTTable/components/TableFooter/index.js +14 -13
  223. package/dist/components/UTTable/components/TableHeader/index.js +10 -10
  224. package/dist/components/UTTable/components/TableRow/constants.js +2 -4
  225. package/dist/components/UTTable/components/TableRow/index.js +79 -93
  226. package/dist/components/UTTable/constants.js +26 -24
  227. package/dist/components/UTTable/hook.js +13 -27
  228. package/dist/components/UTTable/index.js +125 -213
  229. package/dist/components/UTTable/theme.js +19 -18
  230. package/dist/components/UTTable/types.js +4 -4
  231. package/dist/components/UTTable/utils.js +80 -75
  232. package/dist/components/UTTabs/components/TooltipTab/index.js +19 -28
  233. package/dist/components/UTTabs/constants.js +4 -4
  234. package/dist/components/UTTabs/index.js +56 -84
  235. package/dist/components/UTTabs/theme.js +6 -3
  236. package/dist/components/UTTabs/utils.js +3 -2
  237. package/dist/components/UTTextArea/constants.js +2 -4
  238. package/dist/components/UTTextArea/index.js +22 -21
  239. package/dist/components/UTTextArea/theme.js +6 -3
  240. package/dist/components/UTTextInput/constants.js +1 -1
  241. package/dist/components/UTTextInput/index.js +138 -165
  242. package/dist/components/UTTextInput/theme.js +9 -5
  243. package/dist/components/UTThirdPartyCookieChecker/index.js +16 -19
  244. package/dist/components/UTToggle/components/ToggleOption/index.js +15 -15
  245. package/dist/components/UTToggle/index.js +24 -24
  246. package/dist/components/UTToggle/theme.js +6 -3
  247. package/dist/components/UTTooltip/index.js +22 -28
  248. package/dist/components/UTTooltip/theme.js +6 -3
  249. package/dist/components/UTTopbar/components/Notifications/index.js +10 -12
  250. package/dist/components/UTTopbar/components/UserMenu/index.js +18 -17
  251. package/dist/components/UTTopbar/components/UserMenu/styles.module.scss +1 -1
  252. package/dist/components/UTTopbar/index.js +27 -29
  253. package/dist/components/UTTopbar/theme.js +6 -3
  254. package/dist/components/UTTopbar/types.js +4 -4
  255. package/dist/components/UTTouchableWithoutFeedback/index.js +15 -27
  256. package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/constants.js +2 -2
  257. package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/index.js +33 -29
  258. package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/utils.js +6 -5
  259. package/dist/components/UTVirtualizedList/components/VirtualizedData/constants.js +6 -6
  260. package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-ledger.js +7 -16
  261. package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-virtualized-data.js +22 -45
  262. package/dist/components/UTVirtualizedList/components/VirtualizedData/index.js +30 -32
  263. package/dist/components/UTVirtualizedList/components/VirtualizedData/utils.js +89 -94
  264. package/dist/components/UTVirtualizedList/constants.js +4 -4
  265. package/dist/components/UTVirtualizedList/index.js +25 -36
  266. package/dist/components/UTWorkflowContainer/components/ActionButton/index.js +14 -17
  267. package/dist/components/UTWorkflowContainer/constants.js +3 -3
  268. package/dist/components/UTWorkflowContainer/hooks/use-previous.js +5 -4
  269. package/dist/components/UTWorkflowContainer/index.js +31 -49
  270. package/dist/components/UTWorkflowContainer/theme.js +62 -54
  271. package/dist/components/UTWorkflowContainer/types.js +1 -1
  272. package/dist/components/WithLoading/index.js +9 -13
  273. package/dist/components/WithTheme/index.js +9 -15
  274. package/dist/components/WithTheme/layout.js +21 -26
  275. package/dist/components/WithTouch/index.js +11 -17
  276. package/dist/constants/UTTable.js +1 -1
  277. package/dist/index.js +58 -58
  278. package/dist/theme.js +8 -4
  279. package/dist/types/commonTypes.js +2 -2
  280. package/dist/types/consumptionTypes.js +2 -2
  281. package/dist/types/formTypes.js +3 -3
  282. package/dist/types/tableTypes.js +1 -1
  283. package/dist/utils/classesUtils.js +7 -13
  284. package/dist/utils/componentUtils.js +8 -10
  285. package/dist/utils/helperFunctions.js +6 -5
  286. package/dist/utils/shadowUtils.js +15 -12
  287. package/dist/utils/useScreenSize.js +1 -1
  288. package/package.json +29 -70
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -10,31 +9,32 @@ var _propTypes = require("prop-types");
10
9
  var _Divider = _interopRequireDefault(require("@material-ui/core/Divider"));
11
10
  var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
12
11
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
13
- var _excluded = ["expression"];
14
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
19
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
20
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
21
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
22
- var PasswordWarning = function PasswordWarning(_ref) {
23
- var classes = _ref.classes,
24
- passwordValidationsWarning = _ref.passwordValidationsWarning,
25
- value = _ref.value,
26
- WarningIcon = _ref.WarningIcon;
27
- var warningDivider = classes.warningDivider;
28
- var validatedRegExps = passwordValidationsWarning.map(function (_ref2) {
29
- var expression = _ref2.expression,
30
- regex = _objectWithoutProperties(_ref2, _excluded);
31
- return _objectSpread({
32
- assertion: new RegExp(expression).test(value)
33
- }, regex);
13
+ const PasswordWarning = _ref => {
14
+ let {
15
+ classes,
16
+ passwordValidationsWarning,
17
+ value,
18
+ WarningIcon
19
+ } = _ref;
20
+ const {
21
+ warningDivider
22
+ } = classes;
23
+ const validatedRegExps = passwordValidationsWarning.map(_ref2 => {
24
+ let {
25
+ expression,
26
+ ...regex
27
+ } = _ref2;
28
+ return {
29
+ assertion: new RegExp(expression).test(value),
30
+ ...regex
31
+ };
34
32
  });
35
- return validatedRegExps.map(function (_ref3) {
36
- var error = _ref3.error,
37
- assertion = _ref3.assertion;
33
+ return validatedRegExps.map(_ref3 => {
34
+ let {
35
+ error,
36
+ assertion
37
+ } = _ref3;
38
38
  return /*#__PURE__*/_react.default.createElement("div", {
39
39
  className: assertion ? _stylesModule.default.hide : _stylesModule.default.warningContainer
40
40
  }, /*#__PURE__*/_react.default.createElement(_Divider.default, {
@@ -12,29 +12,33 @@ var _formTypes = require("../../types/formTypes");
12
12
  var _theme = require("./theme");
13
13
  var _PasswordValidations = _interopRequireDefault(require("./components/PasswordValidations"));
14
14
  var _PasswordWarning = _interopRequireDefault(require("./components/PasswordWarning"));
15
- var _excluded = ["field", "input", "classes", "ValidationPassedIcon", "ValidationFailedIcon", "NoValueIcon", "ErrorIcon", "meta", "disabled", "WarningIcon"];
16
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
16
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
18
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
19
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
- var UTPasswordField = function UTPasswordField(_ref) {
21
- var field = _ref.field,
22
- input = _ref.input,
23
- _ref$classes = _ref.classes,
24
- classes = _ref$classes === void 0 ? {} : _ref$classes,
25
- ValidationPassedIcon = _ref.ValidationPassedIcon,
26
- ValidationFailedIcon = _ref.ValidationFailedIcon,
27
- NoValueIcon = _ref.NoValueIcon,
28
- ErrorIcon = _ref.ErrorIcon,
29
- meta = _ref.meta,
30
- disabled = _ref.disabled,
31
- WarningIcon = _ref.WarningIcon,
32
- otherProps = _objectWithoutProperties(_ref, _excluded);
33
- var passwordValidations = field.passwordValidations,
34
- showValidations = field.showValidations,
35
- passwordValidationsWarning = field.passwordValidationsWarning;
36
- var value = input.value;
37
- var validationContainer = classes.validationContainer;
17
+ const UTPasswordField = _ref => {
18
+ let {
19
+ field,
20
+ input,
21
+ classes = {},
22
+ ValidationPassedIcon,
23
+ ValidationFailedIcon,
24
+ NoValueIcon,
25
+ ErrorIcon,
26
+ meta,
27
+ disabled,
28
+ WarningIcon,
29
+ ...otherProps
30
+ } = _ref;
31
+ const {
32
+ passwordValidations,
33
+ showValidations,
34
+ passwordValidationsWarning
35
+ } = field;
36
+ const {
37
+ value
38
+ } = input;
39
+ const {
40
+ validationContainer
41
+ } = classes;
38
42
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_UTTextInput.default, _extends({
39
43
  field: field,
40
44
  input: input,
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.retrieveStyle = void 0;
7
7
  var _classesUtils = require("../../utils/classesUtils");
8
- var retrieveStyle = exports.retrieveStyle = function retrieveStyle(_ref) {
8
+ const retrieveStyle = _ref => {
9
9
  var _theme$UTPasswordFiel, _theme$UTPasswordFiel2, _theme$UTPasswordFiel3, _theme$UTPasswordFiel4;
10
- var theme = _ref.theme;
10
+ let {
11
+ theme
12
+ } = _ref;
11
13
  return {
12
14
  iconStyle: {
13
15
  height: (theme === null || theme === void 0 || (_theme$UTPasswordFiel = theme.UTPasswordField) === null || _theme$UTPasswordFiel === void 0 || (_theme$UTPasswordFiel = _theme$UTPasswordFiel.icon) === null || _theme$UTPasswordFiel === void 0 ? void 0 : _theme$UTPasswordFiel.size) || '1rem',
@@ -31,4 +33,5 @@ var retrieveStyle = exports.retrieveStyle = function retrieveStyle(_ref) {
31
33
  margin: (0, _classesUtils.withImportant)(theme === null || theme === void 0 || (_theme$UTPasswordFiel4 = theme.UTPasswordField) === null || _theme$UTPasswordFiel4 === void 0 || (_theme$UTPasswordFiel4 = _theme$UTPasswordFiel4.validationContainer) === null || _theme$UTPasswordFiel4 === void 0 ? void 0 : _theme$UTPasswordFiel4.margin)
32
34
  }
33
35
  };
34
- };
36
+ };
37
+ exports.retrieveStyle = retrieveStyle;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.AREA_CODE_PLACEHOLDER = exports.AREA_CODE_LABEL = exports.AREA_CODES = void 0;
7
- var AREA_CODES = exports.AREA_CODES = [{
7
+ const AREA_CODES = exports.AREA_CODES = [{
8
8
  code: '11',
9
9
  city: 'AMBA'
10
10
  }, {
@@ -908,5 +908,5 @@ var AREA_CODES = exports.AREA_CODES = [{
908
908
  code: '3894',
909
909
  city: 'BURRUYACÚ'
910
910
  }];
911
- var AREA_CODE_PLACEHOLDER = exports.AREA_CODE_PLACEHOLDER = 'Sin 0';
912
- var AREA_CODE_LABEL = exports.AREA_CODE_LABEL = 'Cod. área';
911
+ const AREA_CODE_PLACEHOLDER = exports.AREA_CODE_PLACEHOLDER = 'Sin 0';
912
+ const AREA_CODE_LABEL = exports.AREA_CODE_LABEL = 'Cod. área';
@@ -19,268 +19,244 @@ var _theme = require("./theme");
19
19
  var _constants = require("./constants");
20
20
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
21
21
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
23
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
23
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
24
24
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
25
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
26
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
27
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
28
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
29
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
30
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
31
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
32
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
34
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
35
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
36
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
38
25
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
39
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
40
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
41
- var UTPhoneInput = /*#__PURE__*/function (_PureComponent) {
42
- _inherits(UTPhoneInput, _PureComponent);
43
- var _super = _createSuper(UTPhoneInput);
44
- function UTPhoneInput() {
45
- var _this;
46
- _classCallCheck(this, UTPhoneInput);
47
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
48
- args[_key] = arguments[_key];
49
- }
50
- _this = _super.call.apply(_super, [this].concat(args));
51
- _defineProperty(_assertThisInitialized(_this), "state", {
26
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
27
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
28
+ class UTPhoneInput extends _react.PureComponent {
29
+ constructor(props) {
30
+ super(props);
31
+ _defineProperty(this, "cleanField", () => this.setState({
52
32
  areaCode: '',
53
- phoneNumber: '',
54
- city: null,
55
- initialized: false
56
- });
57
- _defineProperty(_assertThisInitialized(_this), "componentDidMount", function () {
58
- if (_this.props.input && _this.props.input.value && !_this.state.initialized) {
59
- _this.handleInitializeField();
60
- }
61
- });
62
- _defineProperty(_assertThisInitialized(_this), "cleanField", function () {
63
- return _this.setState({
64
- areaCode: '',
65
- phoneNumber: ''
66
- });
67
- });
68
- _defineProperty(_assertThisInitialized(_this), "handleInitializeField", function () {
69
- var areaCode;
70
- var phoneNumber;
71
- var value = _this.props.input.value;
72
- if (_typeof(value) === 'object' && _this.props.childKeys) {
73
- areaCode = value[_this.props.childKeys[0]];
33
+ phoneNumber: ''
34
+ }));
35
+ _defineProperty(this, "handleInitializeField", () => {
36
+ let areaCode;
37
+ let phoneNumber;
38
+ const {
39
+ value
40
+ } = this.props.input;
41
+ if (typeof value === 'object' && this.props.childKeys) {
42
+ areaCode = value[this.props.childKeys[0]];
74
43
  areaCode = typeof areaCode === 'number' ? areaCode.toString() : areaCode;
75
- phoneNumber = value[_this.props.childKeys[1]];
44
+ phoneNumber = value[this.props.childKeys[1]];
76
45
  phoneNumber = typeof phoneNumber === 'number' ? phoneNumber.toString() : phoneNumber;
77
46
  } else {
78
- var stringValue = value.toString();
47
+ const stringValue = value.toString();
79
48
  areaCode = stringValue.slice(0, stringValue.indexOf('-'));
80
49
  phoneNumber = stringValue.slice(stringValue.indexOf('-') + 1);
81
50
  }
82
- _this.setState({
51
+ this.setState({
83
52
  initialized: true
84
53
  });
85
- _this.setState({
86
- areaCode: areaCode,
87
- phoneNumber: phoneNumber
88
- }, function () {
89
- return _this.handleValidateAreaCode(_this.state.areaCode);
90
- });
54
+ this.setState({
55
+ areaCode,
56
+ phoneNumber
57
+ }, () => this.handleValidateAreaCode(this.state.areaCode));
91
58
  });
92
- _defineProperty(_assertThisInitialized(_this), "handleValidateAreaCode", function (areaCode) {
59
+ _defineProperty(this, "handleValidateAreaCode", areaCode => {
93
60
  if (areaCode.slice(0, 1) === '0') {
94
- _this.setState({
95
- error: _this.props.errors.codeWithZero,
61
+ this.setState({
62
+ error: this.props.errors.codeWithZero,
96
63
  city: undefined
97
64
  });
98
65
  } else {
99
- var code = _constants.AREA_CODES.find(function (element) {
100
- return element.code === areaCode;
101
- });
102
- var error = areaCode.length && !code && _this.props.errors.invalidCode;
103
- _this.setState({
104
- error: error,
66
+ const code = _constants.AREA_CODES.find(element => element.code === areaCode);
67
+ const error = areaCode.length && !code && this.props.errors.invalidCode;
68
+ this.setState({
69
+ error,
105
70
  city: code && code.city
106
- }, function () {
107
- if (_this.state.city && !error) _this.handleValidatePhoneNumber(_this.state.phoneNumber);
71
+ }, () => {
72
+ if (this.state.city && !error) this.handleValidatePhoneNumber(this.state.phoneNumber);
108
73
  });
109
74
  }
110
75
  });
111
- _defineProperty(_assertThisInitialized(_this), "handleCleanPhoneNumber", function () {
112
- return _this.setState({
113
- phoneNumber: ''
114
- });
115
- });
116
- _defineProperty(_assertThisInitialized(_this), "handleValidatePhoneNumber", function (phoneNumber) {
76
+ _defineProperty(this, "handleCleanPhoneNumber", () => this.setState({
77
+ phoneNumber: ''
78
+ }));
79
+ _defineProperty(this, "handleValidatePhoneNumber", phoneNumber => {
117
80
  if (phoneNumber.slice(0, 1) === '0') {
118
- _this.setState({
119
- error: _this.props.errors.phoneWithZero
81
+ this.setState({
82
+ error: this.props.errors.phoneWithZero
120
83
  });
121
84
  } else if (phoneNumber.slice(0, 2) === '15') {
122
- _this.setState({
123
- error: _this.props.errors.phoneWithFifteen
85
+ this.setState({
86
+ error: this.props.errors.phoneWithFifteen
124
87
  });
125
88
  } else if (phoneNumber.length === 0) {
126
- _this.setState({
127
- error: _this.props.errors.numberNotEmpty
89
+ this.setState({
90
+ error: this.props.errors.numberNotEmpty
128
91
  });
129
- } else _this.setState({
92
+ } else this.setState({
130
93
  error: undefined
131
94
  });
132
95
  });
133
- _defineProperty(_assertThisInitialized(_this), "handleChangeAreaCode", function (event) {
134
- _this.setState({
96
+ _defineProperty(this, "handleChangeAreaCode", event => {
97
+ this.setState({
135
98
  initialized: true
136
99
  });
137
- var areaCode = event.target.value.slice(0, 4);
100
+ const areaCode = event.target.value.slice(0, 4);
138
101
  if (!areaCode) {
139
- _this.setState({
140
- areaCode: areaCode
141
- }, function () {
142
- _this.handleChange("".concat(_this.state.areaCode).concat(_this.state.phoneNumber));
102
+ this.setState({
103
+ areaCode
104
+ }, () => {
105
+ this.handleChange("".concat(this.state.areaCode).concat(this.state.phoneNumber));
143
106
  });
144
107
  } else {
145
- _this.setState({
146
- areaCode: areaCode
147
- }, function () {
148
- _this.handleChange("".concat(_this.state.areaCode, "-").concat(_this.state.phoneNumber));
108
+ this.setState({
109
+ areaCode
110
+ }, () => {
111
+ this.handleChange("".concat(this.state.areaCode, "-").concat(this.state.phoneNumber));
149
112
  });
150
113
  }
151
- _this.handleCleanPhoneNumber();
152
- _this.handleValidateAreaCode(areaCode);
114
+ this.handleCleanPhoneNumber();
115
+ this.handleValidateAreaCode(areaCode);
153
116
  });
154
- _defineProperty(_assertThisInitialized(_this), "handleChangePhone", function (event) {
155
- var phoneNumber = event.target.value.slice(0, 10 - _this.state.areaCode.length);
156
- _this.setState({
157
- phoneNumber: phoneNumber
158
- }, function () {
159
- _this.handleChange("".concat(_this.state.areaCode, "-").concat(_this.state.phoneNumber));
117
+ _defineProperty(this, "handleChangePhone", event => {
118
+ const phoneNumber = event.target.value.slice(0, 10 - this.state.areaCode.length);
119
+ this.setState({
120
+ phoneNumber
121
+ }, () => {
122
+ this.handleChange("".concat(this.state.areaCode, "-").concat(this.state.phoneNumber));
160
123
  });
161
- _this.handleValidatePhoneNumber(phoneNumber);
124
+ this.handleValidatePhoneNumber(phoneNumber);
162
125
  });
163
- _defineProperty(_assertThisInitialized(_this), "handleKeyPress", function (event) {
164
- var regexp = /[0-9]+/g;
126
+ _defineProperty(this, "handleKeyPress", event => {
127
+ const regexp = /[0-9]+/g;
165
128
  if (!regexp.test(event.key)) {
166
129
  event.preventDefault();
167
130
  }
168
131
  });
169
- _defineProperty(_assertThisInitialized(_this), "handleChange", function (initialValue) {
170
- var value = initialValue;
171
- var _this$props = _this.props,
172
- childKeys = _this$props.childKeys,
173
- field = _this$props.field,
174
- input = _this$props.input;
132
+ _defineProperty(this, "handleChange", initialValue => {
133
+ let value = initialValue;
134
+ const {
135
+ childKeys,
136
+ field,
137
+ input
138
+ } = this.props;
175
139
  if (childKeys) {
176
- var splittedPhone = value.split('-');
177
- value = _objectSpread(_objectSpread({}, !(0, _array.isEmpty)(splittedPhone[0]) && _defineProperty({}, childKeys[0], splittedPhone[0])), !(0, _array.isEmpty)(splittedPhone[1]) && _defineProperty({}, childKeys[1], splittedPhone[1]));
140
+ const splittedPhone = value.split('-');
141
+ value = {
142
+ ...(!(0, _array.isEmpty)(splittedPhone[0]) && {
143
+ [childKeys[0]]: splittedPhone[0]
144
+ }),
145
+ ...(!(0, _array.isEmpty)(splittedPhone[1]) && {
146
+ [childKeys[1]]: splittedPhone[1]
147
+ })
148
+ };
178
149
  } else if (field.configuration && field.configuration.without_dash) {
179
150
  value = initialValue.replace('-', '');
180
151
  }
181
152
  input.onChange(value);
182
153
  });
183
- return _this;
154
+ this.state = {
155
+ areaCode: '',
156
+ phoneNumber: '',
157
+ city: null,
158
+ initialized: false
159
+ };
184
160
  }
185
- _createClass(UTPhoneInput, [{
186
- key: "componentDidUpdate",
187
- value: function componentDidUpdate(prevProps) {
188
- if (this.props.input && this.props.input.value && !this.state.areaCode && !this.state.initialized) {
189
- this.handleInitializeField();
190
- }
191
- if (this.state.initialized && prevProps.input && prevProps.input.value && this.props.input && (!this.props.input.value || this.props.input.value.length === 0)) {
192
- this.cleanField();
193
- }
161
+ componentDidMount() {
162
+ if (this.props.input && this.props.input.value && !this.state.initialized) {
163
+ this.handleInitializeField();
164
+ }
165
+ }
166
+ componentDidUpdate(prevProps) {
167
+ if (this.props.input && this.props.input.value && !this.state.areaCode && !this.state.initialized) {
168
+ this.handleInitializeField();
194
169
  }
195
- }, {
196
- key: "render",
197
- value: function render() {
198
- var _field$configuration, _field$configuration2;
199
- var _this$props2 = this.props,
200
- areaCodeFieldProps = _this$props2.areaCodeFieldProps,
201
- phoneNumberFieldProps = _this$props2.phoneNumberFieldProps,
202
- field = _this$props2.field,
203
- input = _this$props2.input,
204
- disabled = _this$props2.disabled,
205
- meta = _this$props2.meta,
206
- _this$props2$classes = _this$props2.classes,
207
- themeClasses = _this$props2$classes === void 0 ? {} : _this$props2$classes,
208
- placeholder = _this$props2.placeholder,
209
- label = _this$props2.label,
210
- variant = _this$props2.variant,
211
- inputClassName = _this$props2.inputClassName,
212
- classNames = _this$props2.classNames;
213
- var _this$state = this.state,
214
- areaCode = _this$state.areaCode,
215
- city = _this$state.city,
216
- error = _this$state.error,
217
- phoneNumber = _this$state.phoneNumber;
218
- var classes = (0, _classesUtils.mergeClasses)(themeClasses, classNames);
219
- return /*#__PURE__*/_react.default.createElement("div", {
220
- className: "".concat(_stylesModule.default.container, " ").concat(this.props.style)
221
- }, /*#__PURE__*/_react.default.createElement("div", {
222
- className: _stylesModule.default.inputContainer
223
- }, /*#__PURE__*/_react.default.createElement("div", {
224
- className: "".concat(_stylesModule.default.areaCode, " ").concat(_stylesModule.default["".concat(variant, "AreaCode")], " ").concat(classes.areaCodeContainer)
225
- }, /*#__PURE__*/_react.default.createElement(_TextField.default, _extends({
226
- name: "area_code",
227
- type: "tel",
228
- label: ((_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.area_code_label) || _constants.AREA_CODE_LABEL,
229
- placeholder: ((_field$configuration2 = field.configuration) === null || _field$configuration2 === void 0 ? void 0 : _field$configuration2.area_code_placeholder) || _constants.AREA_CODE_PLACEHOLDER,
230
- autoComplete: "off",
231
- fullWidth: true,
232
- margin: "none",
233
- onKeyPress: this.handleKeyPress,
234
- onFocus: this.handleFocus,
235
- onChange: this.handleChangeAreaCode,
236
- onBlur: this.handleBlur,
237
- value: areaCode,
238
- error: Boolean(error || (0, _form.shouldShowErrors)(meta)),
239
- disabled: disabled,
240
- variant: variant,
241
- InputProps: {
242
- classes: {
243
- input: inputClassName
244
- }
170
+ if (this.state.initialized && prevProps.input && prevProps.input.value && this.props.input && (!this.props.input.value || this.props.input.value.length === 0)) {
171
+ this.cleanField();
172
+ }
173
+ }
174
+ render() {
175
+ var _field$configuration, _field$configuration2;
176
+ const {
177
+ areaCodeFieldProps,
178
+ phoneNumberFieldProps,
179
+ field,
180
+ input,
181
+ disabled,
182
+ meta,
183
+ classes: themeClasses = {},
184
+ placeholder,
185
+ label,
186
+ variant,
187
+ inputClassName,
188
+ classNames
189
+ } = this.props;
190
+ const {
191
+ areaCode,
192
+ city,
193
+ error,
194
+ phoneNumber
195
+ } = this.state;
196
+ const classes = (0, _classesUtils.mergeClasses)(themeClasses, classNames);
197
+ return /*#__PURE__*/_react.default.createElement("div", {
198
+ className: "".concat(_stylesModule.default.container, " ").concat(this.props.style)
199
+ }, /*#__PURE__*/_react.default.createElement("div", {
200
+ className: _stylesModule.default.inputContainer
201
+ }, /*#__PURE__*/_react.default.createElement("div", {
202
+ className: "".concat(_stylesModule.default.areaCode, " ").concat(_stylesModule.default["".concat(variant, "AreaCode")], " ").concat(classes.areaCodeContainer)
203
+ }, /*#__PURE__*/_react.default.createElement(_TextField.default, _extends({
204
+ name: "area_code",
205
+ type: "tel",
206
+ label: ((_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.area_code_label) || _constants.AREA_CODE_LABEL,
207
+ placeholder: ((_field$configuration2 = field.configuration) === null || _field$configuration2 === void 0 ? void 0 : _field$configuration2.area_code_placeholder) || _constants.AREA_CODE_PLACEHOLDER,
208
+ autoComplete: "off",
209
+ fullWidth: true,
210
+ margin: "none",
211
+ onKeyPress: this.handleKeyPress,
212
+ onFocus: this.handleFocus,
213
+ onChange: this.handleChangeAreaCode,
214
+ onBlur: this.handleBlur,
215
+ value: areaCode,
216
+ error: Boolean(error || (0, _form.shouldShowErrors)(meta)),
217
+ disabled: disabled,
218
+ variant: variant,
219
+ InputProps: {
220
+ classes: {
221
+ input: inputClassName
245
222
  }
246
- }, areaCodeFieldProps)), /*#__PURE__*/_react.default.createElement(_UTTooltip.default, {
247
- stringContentClassName: classes.tooltip,
248
- content: city || ' '
249
- }, /*#__PURE__*/_react.default.createElement("span", {
250
- className: "".concat(_stylesModule.default.icon, " ").concat(_stylesModule.default["".concat(variant, "Icon")], " ").concat(city && _stylesModule.default.showCheckedIcon)
251
- }, /*#__PURE__*/_react.default.createElement(_CheckCircleOutline.default, {
252
- tabIndex: "-1",
253
- className: "".concat(_stylesModule.default.checkedIcon, " ").concat(classes.areaCodeIcon)
254
- })))), /*#__PURE__*/_react.default.createElement("div", {
255
- className: "".concat(_stylesModule.default.phoneNumber, " ").concat(classes.phoneNumberContainer)
256
- }, /*#__PURE__*/_react.default.createElement(_TextField.default, _extends({
257
- name: "phone_number",
258
- type: "tel",
259
- margin: "none",
260
- placeholder: placeholder,
261
- label: label,
262
- onKeyPress: this.handleKeyPress,
263
- autoComplete: "off",
264
- fullWidth: true,
265
- error: Boolean(error || (0, _form.shouldShowErrors)(meta)),
266
- onFocus: input.onFocus,
267
- onChange: this.handleChangePhone,
268
- disabled: !city || disabled,
269
- value: phoneNumber,
270
- variant: variant,
271
- InputProps: {
272
- classes: {
273
- input: inputClassName
274
- }
223
+ }
224
+ }, areaCodeFieldProps)), /*#__PURE__*/_react.default.createElement(_UTTooltip.default, {
225
+ stringContentClassName: classes.tooltip,
226
+ content: city || ' '
227
+ }, /*#__PURE__*/_react.default.createElement("span", {
228
+ className: "".concat(_stylesModule.default.icon, " ").concat(_stylesModule.default["".concat(variant, "Icon")], " ").concat(city && _stylesModule.default.showCheckedIcon)
229
+ }, /*#__PURE__*/_react.default.createElement(_CheckCircleOutline.default, {
230
+ tabIndex: "-1",
231
+ className: "".concat(_stylesModule.default.checkedIcon, " ").concat(classes.areaCodeIcon)
232
+ })))), /*#__PURE__*/_react.default.createElement("div", {
233
+ className: "".concat(_stylesModule.default.phoneNumber, " ").concat(classes.phoneNumberContainer)
234
+ }, /*#__PURE__*/_react.default.createElement(_TextField.default, _extends({
235
+ name: "phone_number",
236
+ type: "tel",
237
+ margin: "none",
238
+ placeholder: placeholder,
239
+ label: label,
240
+ onKeyPress: this.handleKeyPress,
241
+ autoComplete: "off",
242
+ fullWidth: true,
243
+ error: Boolean(error || (0, _form.shouldShowErrors)(meta)),
244
+ onFocus: input.onFocus,
245
+ onChange: this.handleChangePhone,
246
+ disabled: !city || disabled,
247
+ value: phoneNumber,
248
+ variant: variant,
249
+ InputProps: {
250
+ classes: {
251
+ input: inputClassName
275
252
  }
276
- }, phoneNumberFieldProps)))), (error || (0, _form.shouldShowErrors)(meta)) && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
277
- colorTheme: "error",
278
- variant: "small"
279
- }, error || meta.error));
280
- }
281
- }]);
282
- return UTPhoneInput;
283
- }(_react.PureComponent);
253
+ }
254
+ }, phoneNumberFieldProps)))), (error || (0, _form.shouldShowErrors)(meta)) && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
255
+ colorTheme: "error",
256
+ variant: "small"
257
+ }, error || meta.error));
258
+ }
259
+ }
284
260
  UTPhoneInput.propTypes = {
285
261
  input: _formTypes.inputPropTypes,
286
262
  meta: _formTypes.metaPropTypes,