linear-react-components-ui 1.1.13 → 1.1.14-beta.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 (368) hide show
  1. package/.eslintrc.json +77 -45
  2. package/.gitlab-ci.yml +5 -13
  3. package/.tool-versions +1 -0
  4. package/.vscode/settings.json +3 -12
  5. package/babel.config.json +4 -4
  6. package/lib/@types/SizePixels.d.ts +1 -1
  7. package/lib/alerts/AlertContainer.js +56 -47
  8. package/lib/alerts/AlertProvider.js +51 -33
  9. package/lib/alerts/BaseAlert.js +18 -11
  10. package/lib/alerts/Message.d.ts +1 -1
  11. package/lib/alerts/Message.js +44 -77
  12. package/lib/alerts/helpers.js +3 -2
  13. package/lib/alerts/index.js +3 -2
  14. package/lib/alerts/types.d.ts +0 -1
  15. package/lib/alerts/withAlert.js +9 -8
  16. package/lib/assets/styles/alerts.scss +7 -4
  17. package/lib/assets/styles/button.scss +9 -11
  18. package/lib/assets/styles/checkbox.scss +38 -45
  19. package/lib/assets/styles/colors.scss +1 -3
  20. package/lib/assets/styles/commons.scss +0 -1
  21. package/lib/assets/styles/dialog.scss +20 -37
  22. package/lib/assets/styles/drawers.scss +6 -9
  23. package/lib/assets/styles/fieldset.scss +0 -3
  24. package/lib/assets/styles/gridlayout.scss +2 -0
  25. package/lib/assets/styles/hint.scss +0 -21
  26. package/lib/assets/styles/icon.scss +4 -31
  27. package/lib/assets/styles/input.scss +7 -7
  28. package/lib/assets/styles/multiSelect.scss +1 -6
  29. package/lib/assets/styles/radio.scss +35 -37
  30. package/lib/assets/styles/select.scss +7 -13
  31. package/lib/assets/styles/table.scss +1 -9
  32. package/lib/assets/styles/tabs.scss +18 -28
  33. package/lib/avatar/index.js +39 -39
  34. package/lib/badge/index.js +13 -11
  35. package/lib/buttons/ActivateButton.js +7 -4
  36. package/lib/buttons/AddButton.js +10 -7
  37. package/lib/buttons/Button.js +9 -8
  38. package/lib/buttons/ButtonGroups.js +4 -5
  39. package/lib/buttons/CancelButton.js +5 -6
  40. package/lib/buttons/DangerButton.js +5 -6
  41. package/lib/buttons/DefaultButton.js +85 -85
  42. package/lib/buttons/DestroyButton.js +5 -6
  43. package/lib/buttons/EditButton.js +7 -4
  44. package/lib/buttons/InactivateButton.js +7 -4
  45. package/lib/buttons/InfoButton.js +5 -6
  46. package/lib/buttons/PrimaryButton.js +5 -6
  47. package/lib/buttons/RestoreButton.js +7 -4
  48. package/lib/buttons/SaveButton.js +5 -6
  49. package/lib/buttons/SuccessButton.js +5 -6
  50. package/lib/buttons/WarningButton.js +5 -6
  51. package/lib/buttons/button_container/index.js +19 -15
  52. package/lib/buttons/index.js +16 -15
  53. package/lib/buttons/split_button/index.js +23 -20
  54. package/lib/buttons/types.d.ts +0 -1
  55. package/lib/calendar/DangerCalendar.js +5 -6
  56. package/lib/calendar/InfoCalendar.js +5 -6
  57. package/lib/calendar/PrimaryCalendar.js +5 -6
  58. package/lib/calendar/SuccessCalendar.js +5 -6
  59. package/lib/calendar/WarningCalendar.js +5 -6
  60. package/lib/calendar/base/Day.js +11 -12
  61. package/lib/calendar/base/Month.js +17 -12
  62. package/lib/calendar/base/Week.js +17 -12
  63. package/lib/calendar/base/helpers.js +11 -11
  64. package/lib/calendar/base/index.js +43 -29
  65. package/lib/calendar/index.js +7 -6
  66. package/lib/checkbox/Label.js +9 -19
  67. package/lib/checkbox/index.d.ts +2 -2
  68. package/lib/checkbox/index.js +95 -81
  69. package/lib/checkbox/types.d.ts +1 -2
  70. package/lib/dialog/Alert.js +4 -3
  71. package/lib/dialog/Custom.js +16 -14
  72. package/lib/dialog/Error.js +4 -3
  73. package/lib/dialog/Information.js +4 -3
  74. package/lib/dialog/Question.js +12 -11
  75. package/lib/dialog/Warning.js +5 -5
  76. package/lib/dialog/base/Content.js +5 -7
  77. package/lib/dialog/base/Footer.js +7 -4
  78. package/lib/dialog/base/Header.js +28 -28
  79. package/lib/dialog/base/index.d.ts +2 -8
  80. package/lib/dialog/base/index.js +104 -108
  81. package/lib/dialog/base/style.js +10 -7
  82. package/lib/dialog/form/index.js +35 -36
  83. package/lib/dialog/index.js +8 -7
  84. package/lib/dialog/types.d.ts +13 -8
  85. package/lib/drawer/Content.js +10 -11
  86. package/lib/drawer/Drawer.js +83 -69
  87. package/lib/drawer/Header.js +36 -33
  88. package/lib/drawer/helpers.js +3 -2
  89. package/lib/drawer/index.js +4 -3
  90. package/lib/dropdown/Popup.d.ts +1 -1
  91. package/lib/dropdown/Popup.js +39 -38
  92. package/lib/dropdown/helper.js +5 -3
  93. package/lib/dropdown/types.d.ts +0 -1
  94. package/lib/dropdown/withDropdown.js +58 -37
  95. package/lib/fieldset/index.js +56 -50
  96. package/lib/fieldset/types.d.ts +0 -2
  97. package/lib/form/Field.d.ts +0 -2
  98. package/lib/form/Field.js +74 -68
  99. package/lib/form/FieldArray.d.ts +0 -2
  100. package/lib/form/FieldArray.js +90 -66
  101. package/lib/form/FieldNumber.d.ts +0 -2
  102. package/lib/form/FieldNumber.js +53 -33
  103. package/lib/form/FieldPeriod.d.ts +0 -2
  104. package/lib/form/FieldPeriod.js +52 -46
  105. package/lib/form/helpers.d.ts +0 -2
  106. package/lib/form/helpers.js +26 -21
  107. package/lib/form/index.d.ts +0 -2
  108. package/lib/form/index.js +143 -111
  109. package/lib/form/types.d.ts +4 -7
  110. package/lib/form/withFieldHOC.d.ts +0 -2
  111. package/lib/form/withFieldHOC.js +38 -31
  112. package/lib/form/withFormSecurity.d.ts +0 -2
  113. package/lib/form/withFormSecurity.js +34 -26
  114. package/lib/gridlayout/GridCol.js +13 -13
  115. package/lib/gridlayout/GridRow.js +11 -17
  116. package/lib/gridlayout/index.js +3 -2
  117. package/lib/gridlayout/types.d.ts +1 -1
  118. package/lib/hint/index.d.ts +1 -2
  119. package/lib/hint/index.js +28 -17
  120. package/lib/hint/types.d.ts +0 -3
  121. package/lib/icons/helper.d.ts +0 -4
  122. package/lib/icons/helper.js +4 -7
  123. package/lib/icons/index.d.ts +2 -3
  124. package/lib/icons/index.js +47 -42
  125. package/lib/icons/types.d.ts +9 -22
  126. package/lib/index.d.ts +1 -2
  127. package/lib/index.js +9 -9
  128. package/lib/inputs/base/InputTextBase.d.ts +0 -2
  129. package/lib/inputs/base/InputTextBase.js +111 -143
  130. package/lib/inputs/base/helpers.d.ts +2 -3
  131. package/lib/inputs/base/helpers.js +25 -20
  132. package/lib/inputs/base/types.d.ts +3 -17
  133. package/lib/inputs/color/index.js +38 -27
  134. package/lib/inputs/date/Dialog.d.ts +0 -2
  135. package/lib/inputs/date/Dialog.js +9 -8
  136. package/lib/inputs/date/Dropdown.d.ts +0 -2
  137. package/lib/inputs/date/Dropdown.js +10 -11
  138. package/lib/inputs/date/helpers.d.ts +0 -2
  139. package/lib/inputs/date/helpers.js +13 -13
  140. package/lib/inputs/date/index.d.ts +0 -2
  141. package/lib/inputs/date/index.js +150 -125
  142. package/lib/inputs/date/types.d.ts +1 -4
  143. package/lib/inputs/file/DefaultFile.d.ts +0 -2
  144. package/lib/inputs/file/DefaultFile.js +72 -45
  145. package/lib/inputs/file/DragDropFile.d.ts +0 -2
  146. package/lib/inputs/file/DragDropFile.js +147 -95
  147. package/lib/inputs/file/File.d.ts +1 -3
  148. package/lib/inputs/file/File.js +28 -22
  149. package/lib/inputs/file/FileButtonSettings.d.ts +0 -2
  150. package/lib/inputs/file/FileButtonSettings.js +12 -12
  151. package/lib/inputs/file/helpers.d.ts +0 -2
  152. package/lib/inputs/file/helpers.js +6 -4
  153. package/lib/inputs/file/index.d.ts +0 -2
  154. package/lib/inputs/file/index.js +4 -3
  155. package/lib/inputs/file/types.d.ts +0 -2
  156. package/lib/inputs/inputHOC.d.ts +1 -2
  157. package/lib/inputs/inputHOC.js +32 -19
  158. package/lib/inputs/mask/BaseMask.d.ts +5 -4
  159. package/lib/inputs/mask/BaseMask.js +34 -121
  160. package/lib/inputs/mask/Cnpj.d.ts +0 -2
  161. package/lib/inputs/mask/Cnpj.js +29 -16
  162. package/lib/inputs/mask/Cpf.d.ts +0 -2
  163. package/lib/inputs/mask/Cpf.js +35 -18
  164. package/lib/inputs/mask/Phone.d.ts +0 -2
  165. package/lib/inputs/mask/Phone.js +4 -5
  166. package/lib/inputs/mask/ZipCode.d.ts +0 -2
  167. package/lib/inputs/mask/ZipCode.js +7 -4
  168. package/lib/inputs/mask/helpers.d.ts +12 -53
  169. package/lib/inputs/mask/helpers.js +36 -90
  170. package/lib/inputs/{errorMessage/index.d.ts → mask/imaskHOC.d.ts} +7 -5
  171. package/lib/inputs/mask/imaskHOC.js +224 -0
  172. package/lib/inputs/mask/index.d.ts +2 -4
  173. package/lib/inputs/mask/index.js +6 -5
  174. package/lib/inputs/mask/types.d.ts +18 -22
  175. package/lib/inputs/multiSelect/ActionButtons.d.ts +0 -2
  176. package/lib/inputs/multiSelect/ActionButtons.js +21 -22
  177. package/lib/inputs/multiSelect/Dropdown.d.ts +0 -2
  178. package/lib/inputs/multiSelect/Dropdown.js +65 -48
  179. package/lib/inputs/multiSelect/helper.d.ts +0 -2
  180. package/lib/inputs/multiSelect/helper.js +7 -8
  181. package/lib/inputs/multiSelect/index.d.ts +0 -2
  182. package/lib/inputs/multiSelect/index.js +132 -80
  183. package/lib/inputs/multiSelect/types.d.ts +0 -2
  184. package/lib/inputs/number/BaseNumber.d.ts +2 -3
  185. package/lib/inputs/number/BaseNumber.js +21 -22
  186. package/lib/inputs/number/Currency.d.ts +2 -3
  187. package/lib/inputs/number/Currency.js +6 -6
  188. package/lib/inputs/number/Decimal.d.ts +2 -3
  189. package/lib/inputs/number/Decimal.js +5 -2
  190. package/lib/inputs/number/format_number.js +5 -5
  191. package/lib/inputs/number/index.d.ts +2 -3
  192. package/lib/inputs/number/index.js +49 -18
  193. package/lib/inputs/number/types.d.ts +14 -15
  194. package/lib/inputs/period/Dialog.d.ts +1 -3
  195. package/lib/inputs/period/Dialog.js +9 -8
  196. package/lib/inputs/period/Dropdown.d.ts +0 -2
  197. package/lib/inputs/period/Dropdown.js +8 -7
  198. package/lib/inputs/period/PeriodList.d.ts +0 -2
  199. package/lib/inputs/period/PeriodList.js +12 -13
  200. package/lib/inputs/period/helper.d.ts +0 -2
  201. package/lib/inputs/period/helper.js +36 -33
  202. package/lib/inputs/period/index.d.ts +0 -2
  203. package/lib/inputs/period/index.js +194 -160
  204. package/lib/inputs/period/types.d.ts +1 -3
  205. package/lib/inputs/search/index.d.ts +1 -2
  206. package/lib/inputs/search/index.js +63 -40
  207. package/lib/inputs/select/ActionButtons.d.ts +1 -2
  208. package/lib/inputs/select/ActionButtons.js +34 -24
  209. package/lib/inputs/select/Dropdown.d.ts +1 -2
  210. package/lib/inputs/select/Dropdown.js +58 -39
  211. package/lib/inputs/select/helper.d.ts +1 -2
  212. package/lib/inputs/select/helper.js +43 -49
  213. package/lib/inputs/select/index.d.ts +0 -2
  214. package/lib/inputs/select/index.js +8 -9
  215. package/lib/inputs/select/multiple/Selecteds.d.ts +1 -3
  216. package/lib/inputs/select/multiple/Selecteds.js +21 -16
  217. package/lib/inputs/select/multiple/index.d.ts +0 -2
  218. package/lib/inputs/select/multiple/index.js +176 -128
  219. package/lib/inputs/select/simple/index.d.ts +0 -2
  220. package/lib/inputs/select/simple/index.js +179 -151
  221. package/lib/inputs/select/types.d.ts +2 -5
  222. package/lib/inputs/text/index.js +5 -2
  223. package/lib/inputs/textarea/index.d.ts +0 -2
  224. package/lib/inputs/textarea/index.js +9 -9
  225. package/lib/inputs/textarea/types.d.ts +0 -2
  226. package/lib/inputs/types.d.ts +7 -12
  227. package/lib/internals/colorStyles.js +3 -2
  228. package/lib/internals/constants.js +4 -2
  229. package/lib/internals/types.d.ts +2 -5
  230. package/lib/internals/withTooltip.d.ts +2 -3
  231. package/lib/internals/withTooltip.js +74 -74
  232. package/lib/labelMessages/index.js +41 -21
  233. package/lib/labels/DangerLabel.js +5 -6
  234. package/lib/labels/DefaultLabel.js +39 -25
  235. package/lib/labels/InfoLabel.js +5 -6
  236. package/lib/labels/PrimaryLabel.js +5 -6
  237. package/lib/labels/SuccessLabel.js +5 -6
  238. package/lib/labels/WarningLabel.js +5 -6
  239. package/lib/labels/index.js +8 -7
  240. package/lib/labels/label_container/index.js +7 -7
  241. package/lib/list/Header.js +7 -8
  242. package/lib/list/Item.js +68 -72
  243. package/lib/list/Separator.js +7 -4
  244. package/lib/list/helpers.js +5 -3
  245. package/lib/list/index.js +100 -73
  246. package/lib/menus/float/MenuItem.js +19 -18
  247. package/lib/menus/float/SubMenuContainer.js +32 -26
  248. package/lib/menus/float/helpers.js +3 -2
  249. package/lib/menus/float/index.js +17 -16
  250. package/lib/menus/float/types.d.ts +1 -1
  251. package/lib/menus/index.js +2 -1
  252. package/lib/menus/sidenav/ExpandMenu.js +7 -8
  253. package/lib/menus/sidenav/MenuLink.js +8 -9
  254. package/lib/menus/sidenav/NavMenuGroup.js +11 -12
  255. package/lib/menus/sidenav/NavMenuItem.js +60 -46
  256. package/lib/menus/sidenav/NavSubMenuItem.js +24 -19
  257. package/lib/menus/sidenav/helpers.js +8 -5
  258. package/lib/menus/sidenav/index.js +111 -83
  259. package/lib/menus/sidenav/popup_menu_search/EmptyList.js +6 -6
  260. package/lib/menus/sidenav/popup_menu_search/index.js +83 -63
  261. package/lib/menus/sidenav/types.d.ts +1 -1
  262. package/lib/noPermission/index.js +16 -13
  263. package/lib/panel/Content.d.ts +1 -1
  264. package/lib/panel/Content.js +56 -43
  265. package/lib/panel/DangerPanel.d.ts +1 -1
  266. package/lib/panel/DangerPanel.js +7 -4
  267. package/lib/panel/Default.d.ts +1 -1
  268. package/lib/panel/Default.js +56 -41
  269. package/lib/panel/Header.d.ts +1 -1
  270. package/lib/panel/Header.js +26 -28
  271. package/lib/panel/InfoPanel.d.ts +1 -1
  272. package/lib/panel/InfoPanel.js +7 -4
  273. package/lib/panel/PrimaryPanel.d.ts +1 -1
  274. package/lib/panel/PrimaryPanel.js +7 -4
  275. package/lib/panel/SuccessPanel.d.ts +1 -1
  276. package/lib/panel/SuccessPanel.js +7 -4
  277. package/lib/panel/ToolBar.d.ts +1 -1
  278. package/lib/panel/ToolBar.js +4 -5
  279. package/lib/panel/WarningPanel.d.ts +1 -1
  280. package/lib/panel/WarningPanel.js +7 -4
  281. package/lib/panel/helpers.d.ts +2 -7
  282. package/lib/panel/helpers.js +23 -11
  283. package/lib/panel/index.d.ts +1 -1
  284. package/lib/panel/index.js +9 -8
  285. package/lib/panel/types.d.ts +5 -46
  286. package/lib/permissionValidations.js +29 -24
  287. package/lib/popover/PopoverText.js +4 -5
  288. package/lib/popover/PopoverTitle.js +4 -5
  289. package/lib/popover/index.js +18 -14
  290. package/lib/progress/Bar.js +36 -30
  291. package/lib/progress/index.js +18 -16
  292. package/lib/radio/index.js +55 -34
  293. package/lib/shortcuts/index.js +8 -9
  294. package/lib/skeleton/SkeletonContainer.js +10 -9
  295. package/lib/skeleton/index.js +32 -25
  296. package/lib/spinner/SpinnerLoading.js +7 -6
  297. package/lib/spinner/index.js +36 -22
  298. package/lib/split/Split.js +110 -93
  299. package/lib/split/SplitSide.js +18 -19
  300. package/lib/split/helpers.js +3 -2
  301. package/lib/split/index.js +3 -2
  302. package/lib/table/Body.js +44 -41
  303. package/lib/table/Header.js +31 -28
  304. package/lib/table/HeaderColumn.d.ts +1 -1
  305. package/lib/table/HeaderColumn.js +21 -34
  306. package/lib/table/Row.js +47 -44
  307. package/lib/table/RowColumn.js +37 -36
  308. package/lib/table/helpers.js +12 -6
  309. package/lib/table/index.js +98 -78
  310. package/lib/table/types.d.ts +0 -3
  311. package/lib/tabs/{MenuTabs.d.ts → DropdownItems.d.ts} +3 -3
  312. package/lib/tabs/DropdownItems.js +65 -0
  313. package/lib/tabs/Menu.d.ts +1 -1
  314. package/lib/tabs/Menu.js +20 -32
  315. package/lib/tabs/MenuItems.d.ts +11 -0
  316. package/lib/tabs/MenuItems.js +76 -0
  317. package/lib/tabs/Panel.d.ts +1 -1
  318. package/lib/tabs/Panel.js +65 -69
  319. package/lib/tabs/index.d.ts +1 -1
  320. package/lib/tabs/index.js +221 -42
  321. package/lib/tabs/tabHelpers.d.ts +15 -4
  322. package/lib/tabs/tabHelpers.js +41 -36
  323. package/lib/tabs/types.d.ts +15 -48
  324. package/lib/toolbar/ButtonBar.js +39 -35
  325. package/lib/toolbar/LabelBar.js +36 -32
  326. package/lib/toolbar/Separator.js +7 -4
  327. package/lib/toolbar/ToolBarGroup.js +6 -6
  328. package/lib/toolbar/helpers.js +3 -2
  329. package/lib/toolbar/index.js +21 -19
  330. package/lib/toolbar/types.d.ts +0 -1
  331. package/lib/tooltip/index.js +32 -27
  332. package/lib/treetable/Body.js +32 -20
  333. package/lib/treetable/Header.js +14 -11
  334. package/lib/treetable/Row.js +137 -85
  335. package/lib/treetable/helpers.js +24 -15
  336. package/lib/treetable/index.js +10 -8
  337. package/lib/treeview/Header.js +6 -7
  338. package/lib/treeview/Node.js +132 -92
  339. package/lib/treeview/constants.js +2 -1
  340. package/lib/treeview/index.js +214 -148
  341. package/lib/treeview_old/Header.js +28 -0
  342. package/lib/treeview_old/Node.js +88 -0
  343. package/lib/treeview_old/index.js +42 -0
  344. package/lib/types-c2a0f035.d.ts +50 -0
  345. package/lib/uitour/helpers.js +7 -4
  346. package/lib/uitour/index.d.ts +1 -2
  347. package/lib/uitour/index.js +99 -112
  348. package/lib/uitour/types.d.ts +1 -9
  349. package/package.json +82 -77
  350. package/tsconfig.json +0 -1
  351. package/.eslintcache +0 -1
  352. package/.nvmrc +0 -1
  353. package/lib/assets/styles/error.scss +0 -9
  354. package/lib/assets/styles/textContent.scss +0 -9
  355. package/lib/hint/helpers.d.ts +0 -3
  356. package/lib/hint/helpers.js +0 -21
  357. package/lib/inputs/base/Label.d.ts +0 -14
  358. package/lib/inputs/base/Label.js +0 -35
  359. package/lib/inputs/errorMessage/index.js +0 -26
  360. package/lib/tabs/DropdownTabs.d.ts +0 -11
  361. package/lib/tabs/DropdownTabs.js +0 -71
  362. package/lib/tabs/MenuTabs.js +0 -82
  363. package/lib/tabs/context.d.ts +0 -12
  364. package/lib/tabs/context.js +0 -130
  365. package/lib/tabs/useTabs.d.ts +0 -11
  366. package/lib/tabs/useTabs.js +0 -11
  367. package/lib/textContent/index.d.ts +0 -8
  368. package/lib/textContent/index.js +0 -30
@@ -4,8 +4,6 @@ import '../../@types/Align.js';
4
4
  import '../../@types/PermissionAttr.js';
5
5
  import '../base/types.js';
6
6
  import '../../@types/Period.js';
7
- import '../../internals/types.js';
8
- import '../../@types/Position.js';
9
7
 
10
8
  declare const PhoneField: (props: IPhoneFieldProps) => JSX.Element;
11
9
 
@@ -8,12 +8,11 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _BaseMask = _interopRequireDefault(require("./BaseMask"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
  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); }
11
- const PhoneField = props => {
12
- const {
13
- cellNumber
14
- } = props;
11
+ var PhoneField = function PhoneField(props) {
12
+ var cellNumber = props.cellNumber;
15
13
  return /*#__PURE__*/_react.default.createElement(_BaseMask.default, _extends({}, props, {
16
14
  mask: cellNumber ? '(00) 00000-0000' : '(00) 0000-0000'
17
15
  }));
18
16
  };
19
- var _default = exports.default = PhoneField;
17
+ var _default = PhoneField;
18
+ exports.default = _default;
@@ -4,8 +4,6 @@ import '../../@types/Align.js';
4
4
  import '../../@types/PermissionAttr.js';
5
5
  import '../base/types.js';
6
6
  import '../../@types/Period.js';
7
- import '../../internals/types.js';
8
- import '../../@types/Position.js';
9
7
 
10
8
  declare const ZipCodeField: (props: IZipCode) => JSX.Element;
11
9
 
@@ -8,7 +8,10 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _BaseMask = _interopRequireDefault(require("./BaseMask"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
  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); }
11
- const ZipCodeField = props => /*#__PURE__*/_react.default.createElement(_BaseMask.default, _extends({}, props, {
12
- mask: "00000-000"
13
- }));
14
- var _default = exports.default = ZipCodeField;
11
+ var ZipCodeField = function ZipCodeField(props) {
12
+ return /*#__PURE__*/_react.default.createElement(_BaseMask.default, _extends({}, props, {
13
+ mask: "00000-000"
14
+ }));
15
+ };
16
+ var _default = ZipCodeField;
17
+ exports.default = _default;
@@ -1,59 +1,18 @@
1
- import { TextAlign } from '../../@types/Align.js';
2
- import { OnDenied, PermissionAttr } from '../../@types/PermissionAttr.js';
3
- import * as React from 'react';
4
- import { CustomInputEvent } from '../base/types.js';
5
- import { IBaseMaskProps } from './types.js';
1
+ import { AnyMaskedOptions } from 'imask';
2
+ import { IMaskHOCProps } from '../types.js';
3
+ import 'react';
4
+ import '../../@types/PermissionAttr.js';
5
+ import '../../@types/DataCombo.js';
6
+ import '../base/types.js';
7
+ import '../../@types/Align.js';
6
8
  import '../../@types/Period.js';
7
- import '../../internals/types.js';
9
+ import '../../drawer/types.js';
8
10
  import '../../@types/Position.js';
11
+ import '../../@types/Icon.js';
12
+ import '../../icons/helper.js';
9
13
 
10
- declare const getMaskOptions: ({ isDateField, placeholderChar, min, max, lazy, pattern, radix, thousandsSeparator, mapToRadix, scale, normalizeZeros, padFractionalZeros, rightElements, ...rest }: IBaseMaskProps) => {
11
- value?: string | number | undefined;
12
- onBlur?: ((e: CustomInputEvent) => void) | undefined;
13
- onKeyDown?: ((e: CustomInputEvent | React.KeyboardEvent<Element>) => void) | undefined;
14
- defaultValue?: string | undefined;
15
- isNumeric?: boolean | undefined;
16
- blocks?: any;
17
- leftElements?: JSX.Element | JSX.Element[] | undefined;
18
- handlerSetOnDenied?: ((onDeniedValue: OnDenied) => void) | undefined;
19
- onChange?: ((e: CustomInputEvent, maskValue?: string | undefined, date?: string | undefined) => void) | undefined;
20
- onComplete?: ((e: CustomInputEvent, maskValue?: string | undefined, date?: string | undefined) => void) | undefined;
21
- inputRef?: React.MutableRefObject<HTMLInputElement | HTMLTextAreaElement | null> | ((ref: HTMLInputElement | HTMLTextAreaElement | null) => void) | undefined;
22
- permissionAttr?: PermissionAttr | undefined;
23
- errorMessages?: string[] | undefined;
24
- rounded?: boolean | undefined;
25
- textAlign?: TextAlign | undefined;
26
- customClassForInputContent?: string | undefined;
27
- label?: string | undefined;
28
- name?: string | undefined;
29
- customClassForLabel?: string | undefined;
30
- customClass?: string | undefined;
31
- gridLayout?: string | undefined;
32
- placeHolder?: string | undefined;
33
- readOnly?: boolean | undefined;
34
- labelUppercase?: boolean | undefined;
35
- disabled?: boolean | undefined;
36
- unmask?: boolean | undefined;
37
- onFocus?: ((e: CustomInputEvent) => void) | undefined;
38
- required?: boolean | undefined;
39
- returnFormattedValueOnBlur?: boolean | undefined;
40
- returnFormattedValueOnKeyDown?: boolean | undefined;
41
- autoCompleteMask?: "left" | "right" | undefined;
42
- definitions?: any;
43
- mask?: any;
44
- placeholderChar: string;
45
- min: any;
46
- max: any;
47
- lazy: boolean;
48
- pattern: string;
49
- radix: string;
50
- thousandsSeparator: string;
51
- mapToRadix: string[];
52
- scale: number;
53
- normalizeZeros: boolean;
54
- padFractionalZeros: boolean;
55
- };
14
+ declare function extractNonMaskProps(props: IMaskHOCProps, maskProps: AnyMaskedOptions): any;
56
15
  declare function CPFValidation(cpf?: string, returnMessage?: (msg: string) => void): void | "CPF inválido";
57
16
  declare function CNPJValidation(cnpj?: string, returnMessage?: (msg: string) => void): void | "CNPJ inválido";
58
17
 
59
- export { CNPJValidation, CPFValidation, getMaskOptions };
18
+ export { CNPJValidation, CPFValidation, extractNonMaskProps };
@@ -5,91 +5,37 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.CNPJValidation = CNPJValidation;
7
7
  exports.CPFValidation = CPFValidation;
8
- exports.getMaskOptions = void 0;
8
+ exports.extractNonMaskProps = extractNonMaskProps;
9
9
  var _lodash = require("lodash");
10
- const _excluded = ["isDateField", "placeholderChar", "min", "max", "lazy", "pattern", "radix", "thousandsSeparator", "mapToRadix", "scale", "normalizeZeros", "padFractionalZeros", "rightElements"];
11
- /* eslint-disable @typescript-eslint/no-explicit-any */
12
- 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; }
13
- 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; }
10
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
11
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
13
  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; }
15
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
16
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
17
- 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; }
18
- 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; }
19
- const momentFormat = 'DD/MM/YYYY';
20
- const getMaskOptions = _ref => {
21
- let {
22
- isDateField,
23
- placeholderChar = '_',
24
- min,
25
- max,
26
- lazy = false,
27
- pattern = '',
28
- radix = ' ',
29
- thousandsSeparator = '',
30
- mapToRadix = [],
31
- scale = 2,
32
- normalizeZeros = true,
33
- padFractionalZeros = true,
34
- rightElements
35
- } = _ref,
36
- rest = _objectWithoutProperties(_ref, _excluded);
37
- // TODO: essa etapa deverá ser feita junto com o refactory dos componentes Date e Period.
38
- // if (isDateField) {
39
- // return {
40
- // mask: Date,
41
- // min: min || new Date(1900, 0, 1),
42
- // max: max || new Date(9999, 0, 1),
43
- // pattern: momentFormat,
44
- // lazy,
45
- // format: (date: moment.MomentInput) => moment(date).format(momentFormat),
46
- // parse: (str) => moment(str, momentFormat).toDate(),
47
- // blocks: {
48
- // DD: {
49
- // mask: IMask.MaskedRange,
50
- // from: 1,
51
- // to: 31,
52
- // maxLength: 2,
53
- // },
54
- // MM: {
55
- // mask: IMask.MaskedRange,
56
- // from: 1,
57
- // to: 12,
58
- // maxLength: 2,
59
- // },
60
- // YYYY: {
61
- // mask: IMask.MaskedRange,
62
- // from: 1900,
63
- // to: 9999,
64
- // },
65
- // },
66
- // } satisfies ReactMaskOpts;
67
- // }
68
-
69
- return _objectSpread({
70
- placeholderChar: placeholderChar === '' ? ' ' : placeholderChar,
71
- min,
72
- max,
73
- lazy,
74
- pattern,
75
- radix,
76
- thousandsSeparator,
77
- mapToRadix,
78
- scale,
79
- normalizeZeros,
80
- padFractionalZeros
81
- }, rest);
14
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
15
+ 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); }
16
+ /* eslint-disable no-plusplus */
17
+ function extractNonMaskProps(props, maskProps) {
18
+ var nonMask = _objectSpread({}, props);
19
+ Object.keys(maskProps).forEach(function (maskProp) {
20
+ delete nonMask[maskProp];
21
+ });
22
+ delete nonMask.value;
23
+ delete nonMask.onChange;
24
+ return nonMask;
25
+ }
26
+ var allEqualDigits = function allEqualDigits(input) {
27
+ return input.split('').every(function (char) {
28
+ return char === input[0];
29
+ });
82
30
  };
83
- exports.getMaskOptions = getMaskOptions;
84
- const allEqualDigits = input => input.split('').every(char => char === input[0]);
85
31
  function CPFValidation(cpf, returnMessage) {
86
- const stringCpf = cpf ? cpf.replace(/[^\d]+/g, '') : '';
87
- let sum = 0;
88
- let splitRest;
32
+ var stringCpf = cpf ? cpf.replace(/[^\d]+/g, '') : '';
33
+ var sum = 0;
34
+ var splitRest;
89
35
  if (stringCpf === '' || stringCpf.length < 11) return returnMessage ? returnMessage('CPF inválido') : 'CPF inválido';
90
36
  if (allEqualDigits(stringCpf)) return returnMessage ? returnMessage('CPF inválido') : 'CPF inválido';
91
37
  // 1st digit validation
92
- for (let i = 0; i < 9; i++) {
38
+ for (var i = 0; i < 9; i++) {
93
39
  sum += (0, _lodash.parseInt)(stringCpf.charAt(i), 10) * (10 - i);
94
40
  }
95
41
  splitRest = sum * 10 % 11;
@@ -98,8 +44,8 @@ function CPFValidation(cpf, returnMessage) {
98
44
  // 2nd digit validation
99
45
  sum = 0;
100
46
  splitRest = 0;
101
- for (let i = 0; i < 10; i++) {
102
- sum += (0, _lodash.parseInt)(stringCpf.charAt(i), 10) * (11 - i);
47
+ for (var _i = 0; _i < 10; _i++) {
48
+ sum += (0, _lodash.parseInt)(stringCpf.charAt(_i), 10) * (11 - _i);
103
49
  }
104
50
  splitRest = sum * 10 % 11;
105
51
  if (splitRest === 10 || splitRest === 11) splitRest = 0;
@@ -107,28 +53,28 @@ function CPFValidation(cpf, returnMessage) {
107
53
  return returnMessage ? returnMessage('') : undefined;
108
54
  }
109
55
  function CNPJValidation(cnpj, returnMessage) {
110
- const stringCnpj = cnpj ? cnpj.replace(/[^\d]+/g, '') : '';
56
+ var stringCnpj = cnpj ? cnpj.replace(/[^\d]+/g, '') : '';
111
57
  if (stringCnpj === '' || stringCnpj.length !== 14) return returnMessage ? returnMessage('CNPJ inválido') : 'CNPJ inválido';
112
58
  if (allEqualDigits(stringCnpj)) return returnMessage ? returnMessage('CNPJ inválido') : 'CNPJ inválido';
113
- let length = stringCnpj.length - 2;
114
- let numbers = stringCnpj.substring(0, length);
115
- const digits = stringCnpj.substring(length);
116
- let sum = 0;
117
- let pos = length - 7;
59
+ var length = stringCnpj.length - 2;
60
+ var numbers = stringCnpj.substring(0, length);
61
+ var digits = stringCnpj.substring(length);
62
+ var sum = 0;
63
+ var pos = length - 7;
118
64
  // 1° digit validation
119
- for (let i = length; i >= 1; i--) {
65
+ for (var i = length; i >= 1; i--) {
120
66
  sum += (0, _lodash.parseInt)(numbers.charAt(length - i)) * pos--;
121
67
  if (pos < 2) pos = 9;
122
68
  }
123
- let result = sum % 11 < 2 ? 0 : 11 - sum % 11;
69
+ var result = sum % 11 < 2 ? 0 : 11 - sum % 11;
124
70
  if (result.toString() !== digits.charAt(0)) return returnMessage ? returnMessage('CNPJ inválido') : 'CNPJ inválido';
125
71
  length += 1;
126
72
  numbers = stringCnpj.substring(0, length);
127
73
  sum = 0;
128
74
  pos = length - 7;
129
75
  // 2° digit validation
130
- for (let i = length; i >= 1; i--) {
131
- sum += (0, _lodash.parseInt)(numbers.charAt(length - i)) * pos--;
76
+ for (var _i2 = length; _i2 >= 1; _i2--) {
77
+ sum += (0, _lodash.parseInt)(numbers.charAt(length - _i2)) * pos--;
132
78
  if (pos < 2) pos = 9;
133
79
  }
134
80
  result = sum % 11 < 2 ? 0 : 11 - sum % 11;
@@ -1,16 +1,18 @@
1
1
  import React__default from 'react';
2
- import { ErrorProps } from '../types.js';
2
+ import { IMaskHOCProps } from '../types.js';
3
3
  import '../../@types/PermissionAttr.js';
4
4
  import '../../@types/DataCombo.js';
5
5
  import '../base/types.js';
6
6
  import '../../@types/Align.js';
7
7
  import '../../@types/Period.js';
8
- import '../../internals/types.js';
9
- import '../../@types/Position.js';
10
8
  import '../../drawer/types.js';
9
+ import '../../@types/Position.js';
11
10
  import '../../@types/Icon.js';
12
11
  import '../../icons/helper.js';
13
12
 
14
- declare const ErrorMessage: React__default.ForwardRefExoticComponent<ErrorProps & React__default.RefAttributes<HTMLParagraphElement>>;
13
+ declare const IMaskHOC: <ComponentProps extends IMaskHOCProps>(ComposedComponent: React__default.ComponentType<ComponentProps>) => {
14
+ (props: ComponentProps): JSX.Element;
15
+ displayName: string;
16
+ };
15
17
 
16
- export { ErrorMessage, ErrorMessage as default };
18
+ export { IMaskHOC as default };
@@ -0,0 +1,224 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _imask = _interopRequireDefault(require("imask"));
9
+ var helpers = _interopRequireWildcard(require("./helpers"));
10
+ var _permissionValidations = require("../../permissionValidations");
11
+ var _format_number = require("../number/format_number");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+ 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); }
16
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
17
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
18
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
20
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
21
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
22
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
+ var options = [_permissionValidations.OPTIONS_ON_DENIED.disabled, _permissionValidations.OPTIONS_ON_DENIED.unvisible, _permissionValidations.OPTIONS_ON_DENIED.readOnly, _permissionValidations.OPTIONS_ON_DENIED.hideContent];
24
+ var IMaskHOC = function IMaskHOC(ComposedComponent) {
25
+ var MaskedComponent = function MaskedComponent(props) {
26
+ var permissionAttr = props.permissionAttr,
27
+ skeletonize = props.skeletonize,
28
+ _inputRef = props.inputRef,
29
+ _props$placeholderCha = props.placeholderChar,
30
+ placeholderChar = _props$placeholderCha === void 0 ? '_' : _props$placeholderCha,
31
+ _props$lazy = props.lazy,
32
+ lazy = _props$lazy === void 0 ? false : _props$lazy,
33
+ _props$pattern = props.pattern,
34
+ pattern = _props$pattern === void 0 ? '' : _props$pattern,
35
+ _props$radix = props.radix,
36
+ radix = _props$radix === void 0 ? ' ' : _props$radix,
37
+ _props$thousandsSepar = props.thousandsSeparator,
38
+ thousandsSeparator = _props$thousandsSepar === void 0 ? '' : _props$thousandsSepar,
39
+ _props$mapToRadix = props.mapToRadix,
40
+ mapToRadix = _props$mapToRadix === void 0 ? [] : _props$mapToRadix,
41
+ _props$scale = props.scale,
42
+ scale = _props$scale === void 0 ? 2 : _props$scale,
43
+ _props$signed = props.signed,
44
+ signed = _props$signed === void 0 ? false : _props$signed,
45
+ _props$normalizeZeros = props.normalizeZeros,
46
+ normalizeZeros = _props$normalizeZeros === void 0 ? true : _props$normalizeZeros,
47
+ _props$padFractionalZ = props.padFractionalZeros,
48
+ padFractionalZeros = _props$padFractionalZ === void 0 ? true : _props$padFractionalZ,
49
+ mask = props.mask,
50
+ _props$commit = props.commit,
51
+ commit = _props$commit === void 0 ? function () {} : _props$commit,
52
+ parse = props.parse,
53
+ format = props.format,
54
+ definitions = props.definitions,
55
+ groups = props.groups,
56
+ min = props.min,
57
+ max = props.max,
58
+ dispatch = props.dispatch,
59
+ _props$value = props.value,
60
+ value = _props$value === void 0 ? '' : _props$value,
61
+ onChange = props.onChange,
62
+ _props$isDateField = props.isDateField,
63
+ isDateField = _props$isDateField === void 0 ? false : _props$isDateField,
64
+ autoCompleteMask = props.autoCompleteMask;
65
+ var maskOptions = {
66
+ placeholderChar: placeholderChar === '' ? ' ' : placeholderChar,
67
+ lazy: lazy,
68
+ pattern: pattern,
69
+ radix: radix,
70
+ thousandsSeparator: thousandsSeparator,
71
+ mapToRadix: mapToRadix,
72
+ scale: scale,
73
+ signed: signed,
74
+ normalizeZeros: normalizeZeros,
75
+ padFractionalZeros: padFractionalZeros,
76
+ mask: mask,
77
+ commit: commit,
78
+ parse: parse,
79
+ format: format,
80
+ definitions: definitions,
81
+ groups: groups,
82
+ min: min,
83
+ max: max,
84
+ dispatch: dispatch
85
+ };
86
+ var _useState = (0, _react.useState)((0, _permissionValidations.actionsOnPermissionDenied)(options, permissionAttr)),
87
+ _useState2 = _slicedToArray(_useState, 1),
88
+ onDenied = _useState2[0];
89
+ var elementRef = (0, _react.useRef)(null);
90
+ var maskRef = (0, _react.useRef)(null);
91
+ var hideContent = onDenied.hideContent,
92
+ unvisible = onDenied.unvisible,
93
+ disabled = onDenied.disabled,
94
+ readOnly = onDenied.readOnly;
95
+ var dontInitMask = hideContent || unvisible || skeletonize;
96
+ var disableCallbacks = disabled || readOnly;
97
+ var setValue = function setValue(newValue) {
98
+ if (maskRef.current) {
99
+ if (props.unmask) maskRef.current.unmaskedValue = newValue.toString();
100
+ maskRef.current.value = String(newValue);
101
+ }
102
+ };
103
+ var onAccept = (0, _react.useCallback)(function () {
104
+ if (onChange && !disableCallbacks && maskRef.current) {
105
+ var _maskRef$current = maskRef.current,
106
+ unmaskedValue = _maskRef$current.unmaskedValue,
107
+ el = _maskRef$current.el;
108
+ var name = el.name || el.input && el.input.name;
109
+ onChange({
110
+ target: {
111
+ value: unmaskedValue,
112
+ name: name
113
+ }
114
+ }, props.unmask ? unmaskedValue : maskRef.current.value);
115
+ }
116
+ }, [onChange]);
117
+ var onComplete = (0, _react.useCallback)(function () {
118
+ if (props.onComplete && !disableCallbacks && maskRef.current) {
119
+ var _maskRef$current2 = maskRef.current,
120
+ unmaskedValue = _maskRef$current2.unmaskedValue,
121
+ el = _maskRef$current2.el;
122
+ var name = el.name || el.input && el.input.name;
123
+ props.onComplete({
124
+ target: {
125
+ value: unmaskedValue,
126
+ name: name
127
+ }
128
+ }, props.unmask ? unmaskedValue : maskRef.current.value);
129
+ }
130
+ }, [props.onComplete]);
131
+ var autoCompleteMaskValue = (0, _react.useCallback)(function (eventTargetValue) {
132
+ if (autoCompleteMask && eventTargetValue.length && maskRef.current && elementRef.current) {
133
+ var sizeMask = maskRef.current.mask.toString().replace(/\D+/g, '').length;
134
+ if (sizeMask > eventTargetValue.length) {
135
+ switch (autoCompleteMask) {
136
+ case 'left':
137
+ setValue(eventTargetValue.padStart(sizeMask, '0'));
138
+ break;
139
+ case 'right':
140
+ setValue(eventTargetValue.padEnd(sizeMask, '0'));
141
+ break;
142
+ default:
143
+ setValue(eventTargetValue);
144
+ break;
145
+ }
146
+ }
147
+ }
148
+ }, [autoCompleteMask, maskRef.current, elementRef.current]);
149
+ var getMask = function getMask() {
150
+ var element = elementRef.current;
151
+ if (element) {
152
+ var maskCurrent = maskRef.current;
153
+ if (!maskCurrent) {
154
+ maskRef.current = (0, _imask.default)(element, maskOptions);
155
+ if (value && typeof value !== 'number' && value.trim() !== '' || value && typeof value === 'number') onAccept();
156
+ setValue(value);
157
+ } else {
158
+ maskCurrent.updateOptions(maskOptions);
159
+ }
160
+ }
161
+ };
162
+ var destroyMask = function destroyMask() {
163
+ if (maskRef.current) {
164
+ maskRef.current.destroy();
165
+ maskRef.current = null;
166
+ }
167
+ };
168
+ (0, _react.useEffect)(function () {
169
+ if (props.handlerSetOnDenied) props.handlerSetOnDenied(onDenied);
170
+ if (!props.mask || dontInitMask) return;
171
+ getMask();
172
+ }, [maskOptions]);
173
+ (0, _react.useEffect)(function () {
174
+ if (!maskRef.current) return;
175
+ var maskCurrent = maskRef.current;
176
+ maskCurrent.on('accept', onAccept);
177
+ maskCurrent.on('complete', onComplete);
178
+
179
+ // eslint-disable-next-line consistent-return
180
+ return function () {
181
+ maskCurrent.off('accept', onAccept);
182
+ maskCurrent.off('complete', onComplete);
183
+ };
184
+ }, [onAccept, onComplete]);
185
+ (0, _react.useEffect)(function () {
186
+ if (maskOptions.mask && !dontInitMask) {
187
+ if (maskRef.current) {
188
+ var formattedValue = isDateField ? value : (0, _format_number.numberToPtBR)(value) || '';
189
+ setValue(formattedValue);
190
+ } else {
191
+ getMask();
192
+ }
193
+ } else if (!dontInitMask) {
194
+ destroyMask();
195
+ if (value && elementRef.current) elementRef.current.value = value;
196
+ }
197
+ }, [value, isDateField]);
198
+ (0, _react.useEffect)(function () {
199
+ return destroyMask;
200
+ }, []);
201
+ return /*#__PURE__*/_react.default.createElement(ComposedComponent, _extends({}, helpers.extractNonMaskProps(props, maskOptions), {
202
+ onDeniedActions: onDenied,
203
+ defaultValue: value,
204
+ onBlur: function onBlur(e) {
205
+ autoCompleteMaskValue(e.target.value);
206
+ if (props.onBlur) props.onBlur(e);
207
+ },
208
+ onChange: function onChange(e) {
209
+ return setValue(e.target.value);
210
+ },
211
+ inputRef: function inputRef(el) {
212
+ elementRef.current = el;
213
+ if (_inputRef) {
214
+ if (_typeof(_inputRef) === 'object') _inputRef.current = el;else _inputRef(el);
215
+ }
216
+ }
217
+ }));
218
+ };
219
+ var nestedComponentName = ComposedComponent.displayName || ComposedComponent.name || 'Component';
220
+ MaskedComponent.displayName = "IMask(".concat(nestedComponentName, ")");
221
+ return MaskedComponent;
222
+ };
223
+ var _default = IMaskHOC;
224
+ exports.default = _default;
@@ -1,4 +1,4 @@
1
- import BaseMask from './BaseMask.js';
1
+ import _default from './BaseMask.js';
2
2
  export { default as CpfField } from './Cpf.js';
3
3
  export { default as CnpjField } from './Cnpj.js';
4
4
  export { default as PhoneField } from './Phone.js';
@@ -9,9 +9,7 @@ import '../../@types/Align.js';
9
9
  import '../../@types/PermissionAttr.js';
10
10
  import '../base/types.js';
11
11
  import '../../@types/Period.js';
12
- import '../../internals/types.js';
13
- import '../../@types/Position.js';
14
12
 
15
13
 
16
14
 
17
- export { BaseMask as default };
15
+ export { _default as default };
@@ -5,25 +5,25 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "CnpjField", {
7
7
  enumerable: true,
8
- get: function () {
8
+ get: function get() {
9
9
  return _Cnpj.default;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "CpfField", {
13
13
  enumerable: true,
14
- get: function () {
14
+ get: function get() {
15
15
  return _Cpf.default;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "PhoneField", {
19
19
  enumerable: true,
20
- get: function () {
20
+ get: function get() {
21
21
  return _Phone.default;
22
22
  }
23
23
  });
24
24
  Object.defineProperty(exports, "ZipCodeField", {
25
25
  enumerable: true,
26
- get: function () {
26
+ get: function get() {
27
27
  return _ZipCode.default;
28
28
  }
29
29
  });
@@ -34,4 +34,5 @@ var _Cnpj = _interopRequireDefault(require("./Cnpj"));
34
34
  var _Phone = _interopRequireDefault(require("./Phone"));
35
35
  var _ZipCode = _interopRequireDefault(require("./ZipCode"));
36
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
- var _default = exports.default = _BaseMask.default;
37
+ var _default = _BaseMask.default;
38
+ exports.default = _default;