intelicoreact 1.4.76 → 1.4.78

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 (269) hide show
  1. package/dist/Atomic/FormElements/ActionAlert/ActionAlert.js +9 -1
  2. package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +10 -1
  3. package/dist/Atomic/FormElements/Calendar/Calendar.js +24 -4
  4. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +10 -1
  5. package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +14 -2
  6. package/dist/Atomic/FormElements/Datepicker/Datepicker.js +54 -5
  7. package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +21 -3
  8. package/dist/Atomic/FormElements/Dropdown/Dropdown.js +145 -52
  9. package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +7 -1
  10. package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +91 -25
  11. package/dist/Atomic/FormElements/FileLoader/FileLoader.js +15 -3
  12. package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +29 -15
  13. package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +15 -5
  14. package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.js +23 -4
  15. package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +26 -6
  16. package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +38 -19
  17. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +38 -9
  18. package/dist/Atomic/FormElements/Input/Input.js +60 -25
  19. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +31 -4
  20. package/dist/Atomic/FormElements/InputColor/InputColor.js +14 -4
  21. package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +29 -6
  22. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +43 -8
  23. package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +21 -3
  24. package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +81 -58
  25. package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +41 -6
  26. package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +8 -1
  27. package/dist/Atomic/FormElements/InputDateRange/dependencies.js +46 -16
  28. package/dist/Atomic/FormElements/InputLink/InputLink.js +23 -6
  29. package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +4 -0
  30. package/dist/Atomic/FormElements/InputMask/InputMask.js +208 -77
  31. package/dist/Atomic/FormElements/InputMask/functions.js +28 -2
  32. package/dist/Atomic/FormElements/InputMask2/InputMask2.js +119 -43
  33. package/dist/Atomic/FormElements/InputMask2/functions.js +28 -2
  34. package/dist/Atomic/FormElements/InputMask3/InputMask3.js +137 -44
  35. package/dist/Atomic/FormElements/InputMask3/functions.js +28 -2
  36. package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +17 -3
  37. package/dist/Atomic/FormElements/InputsRow/InputsRow.js +24 -5
  38. package/dist/Atomic/FormElements/Label/Label.js +9 -1
  39. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +73 -35
  40. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +15 -3
  41. package/dist/Atomic/FormElements/NumericInput/NumericInput.js +44 -23
  42. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +17 -7
  43. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +14 -3
  44. package/dist/Atomic/FormElements/RadioInput/RadioInput.js +10 -1
  45. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +14 -3
  46. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +23 -3
  47. package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +34 -17
  48. package/dist/Atomic/FormElements/RangeList/RangeList.js +25 -6
  49. package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +11 -1
  50. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +85 -14
  51. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +132 -43
  52. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +10 -1
  53. package/dist/Atomic/FormElements/Switcher/Switcher.js +10 -1
  54. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +13 -1
  55. package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +10 -1
  56. package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +17 -2
  57. package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +17 -3
  58. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +11 -1
  59. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +29 -6
  60. package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +3 -2
  61. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +12 -1
  62. package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +23 -6
  63. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +223 -105
  64. package/dist/Atomic/FormElements/Text/Text.js +16 -10
  65. package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +9 -1
  66. package/dist/Atomic/FormElements/Textarea/Textarea.js +16 -5
  67. package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +35 -6
  68. package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +13 -4
  69. package/dist/Atomic/FormElements/TimeRange/TimeRange.js +21 -7
  70. package/dist/Atomic/FormElements/UserContacts/UserContacts.js +35 -8
  71. package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +91 -0
  72. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +18 -5
  73. package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +10 -3
  74. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +11 -3
  75. package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +2 -1
  76. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +12 -5
  77. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
  78. package/dist/Atomic/Layout/Header/Header.js +15 -3
  79. package/dist/Atomic/Layout/MainMenu/MainMenu.js +20 -3
  80. package/dist/Atomic/Layout/Spinner/Spinner.js +8 -1
  81. package/dist/Atomic/UI/Accordion/Accordion.js +19 -3
  82. package/dist/Atomic/UI/Accordion/AccordionItem.js +23 -9
  83. package/dist/Atomic/UI/AccordionTable/AccordionTable.js +32 -7
  84. package/dist/Atomic/UI/AccordionText/AccordionText.js +17 -3
  85. package/dist/Atomic/UI/AdvancedTag/AdvTag.js +21 -4
  86. package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +15 -3
  87. package/dist/Atomic/UI/Alert/Alert.js +19 -3
  88. package/dist/Atomic/UI/Arrow/Arrow.js +16 -3
  89. package/dist/Atomic/UI/Box/Box.js +9 -3
  90. package/dist/Atomic/UI/Button/Button.js +11 -2
  91. package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +10 -1
  92. package/dist/Atomic/UI/Chart/Chart.js +29 -4
  93. package/dist/Atomic/UI/Chart/partial/Chart.constants.js +19 -11
  94. package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +12 -1
  95. package/dist/Atomic/UI/Chart/partial/datasetSetters.js +34 -11
  96. package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +56 -82
  97. package/dist/Atomic/UI/Chart/partial/optionsSetters.js +19 -15
  98. package/dist/Atomic/UI/Chart/partial/utils.js +20 -6
  99. package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +13 -3
  100. package/dist/Atomic/UI/DateTime/DateTime.js +14 -3
  101. package/dist/Atomic/UI/DebugContainer/DebugContainer.js +16 -4
  102. package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +11 -3
  103. package/dist/Atomic/UI/DoubleString/DoubleString.js +17 -5
  104. package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +10 -3
  105. package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +52 -17
  106. package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +29 -1
  107. package/dist/Atomic/UI/Hint/Hint.js +39 -13
  108. package/dist/Atomic/UI/Hint/partials/_utils.js +19 -4
  109. package/dist/Atomic/UI/Modal/Modal.js +28 -6
  110. package/dist/Atomic/UI/Modal/ModalHOC.js +9 -1
  111. package/dist/Atomic/UI/Modal/partials/ModalFooter.js +7 -1
  112. package/dist/Atomic/UI/Modal/partials/ModalTitle.js +8 -1
  113. package/dist/Atomic/UI/Modal/partials/useMobileModal.js +49 -32
  114. package/dist/Atomic/UI/ModalBackup/Modal.js +174 -0
  115. package/dist/Atomic/UI/ModalBackup/Modal.scss +333 -0
  116. package/dist/Atomic/UI/ModalBackup/ModalHOC.js +51 -0
  117. package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +24 -0
  118. package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +41 -0
  119. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +21 -6
  120. package/dist/Atomic/UI/NavLine/NavLine.js +55 -26
  121. package/dist/Atomic/UI/NavLine/Tabs.js +3 -2
  122. package/dist/Atomic/UI/PageTitle/PageTitle.js +10 -2
  123. package/dist/Atomic/UI/PieChart/PieChart.js +10 -1
  124. package/dist/Atomic/UI/Price/Price.js +8 -3
  125. package/dist/Atomic/UI/PriceRange/PriceRange.js +7 -1
  126. package/dist/Atomic/UI/ProgressLine/ProgressLine.js +16 -1
  127. package/dist/Atomic/UI/Status/Status.js +8 -1
  128. package/dist/Atomic/UI/Table/Partials/TdCell.js +29 -5
  129. package/dist/Atomic/UI/Table/Partials/TdHeader.js +11 -1
  130. package/dist/Atomic/UI/Table/Partials/TdRow.js +17 -5
  131. package/dist/Atomic/UI/Table/Partials/TdTitle.js +14 -3
  132. package/dist/Atomic/UI/Table/Table.js +12 -1
  133. package/dist/Atomic/UI/Table/TdTypes/TdActions.js +18 -2
  134. package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +9 -1
  135. package/dist/Atomic/UI/Table/TdTypes/TdRange.js +4 -1
  136. package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +13 -1
  137. package/dist/Atomic/UI/Tag/Tag.js +26 -11
  138. package/dist/Atomic/UI/TagList/TagList.js +52 -21
  139. package/dist/Atomic/UI/TagList/TagList.scss +3 -2
  140. package/dist/Atomic/UI/UserBox/UserBox.js +13 -1
  141. package/dist/Atomic/UI/WizardStepper/constructor.js +11 -3
  142. package/dist/Atomic/UI/WizardStepper/index.js +5 -1
  143. package/dist/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.js +10 -0
  144. package/dist/Atomic/UI/WizardStepper/ui/StateIcon/index.js +4 -1
  145. package/dist/Atomic/UI/WizardStepper/ui/StepRow/StepRow.js +17 -2
  146. package/dist/Atomic/UI/WizardStepper/ui/StepRow/index.js +5 -1
  147. package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.js +15 -1
  148. package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/index.js +5 -1
  149. package/dist/Atomic/UI/WizardStepper/ui/icons.js +9 -2
  150. package/dist/Atomic/UI/WizardStepper/ui/index.js +5 -1
  151. package/dist/Classes/AbortableFetch.js +93 -36
  152. package/dist/Classes/AnimatedHandler.js +7 -3
  153. package/dist/Classes/RESTAPI/index.js +43 -39
  154. package/dist/Classes/RESTAPI/partials/AbortableFetch.js +93 -35
  155. package/dist/Classes/RESTAPI/partials/ApiBase.js +9 -1
  156. package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +32 -24
  157. package/dist/Classes/RESTAPI/partials/ApiUtils.js +41 -34
  158. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +46 -21
  159. package/dist/Classes/RESTAPI/partials/Utils.js +19 -6
  160. package/dist/Classes/RESTAPI/partials/_outerDependencies.js +6 -2
  161. package/dist/Classes/RESTAPI/partials/_utils.js +39 -16
  162. package/dist/Constants/index.constants.js +15 -8
  163. package/dist/Functions/Portal.js +16 -5
  164. package/dist/Functions/customEventListener.js +17 -4
  165. package/dist/Functions/fieldValueFormatters.js +83 -43
  166. package/dist/Functions/hooks/useFormFieldsChangesManager.js +26 -23
  167. package/dist/Functions/locale/createTranslator.js +9 -4
  168. package/dist/Functions/operations.js +22 -12
  169. package/dist/Functions/presets/inputMaskPresets.js +11 -9
  170. package/dist/Functions/presets/inputPresets.js +11 -8
  171. package/dist/Functions/presets/mobileKeyboardTypesPresets.js +9 -7
  172. package/dist/Functions/schemas.js +13 -6
  173. package/dist/Functions/useBodyScrollLock.js +6 -1
  174. package/dist/Functions/useClickOutside.js +4 -0
  175. package/dist/Functions/useDebounce.js +7 -2
  176. package/dist/Functions/useFieldFocus.js +18 -6
  177. package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +9 -0
  178. package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +23 -12
  179. package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +15 -6
  180. package/dist/Functions/useFormTools/functions/General.js +28 -18
  181. package/dist/Functions/useFormTools/functions/RenderFields.js +11 -2
  182. package/dist/Functions/useFormTools/functions/usePrevious.js +5 -1
  183. package/dist/Functions/useFormTools/index.js +144 -85
  184. package/dist/Functions/useInputHighlightError.js +12 -3
  185. package/dist/Functions/useIsMobile.js +13 -7
  186. package/dist/Functions/useKeyPress/useHandleKeyPress.js +7 -1
  187. package/dist/Functions/useKeyPress/useKeyPress.js +9 -1
  188. package/dist/Functions/useLocalStorage.js +9 -1
  189. package/dist/Functions/useLocationParams.js +5 -4
  190. package/dist/Functions/useMediaQuery.js +9 -3
  191. package/dist/Functions/useMetaInfo.js +10 -3
  192. package/dist/Functions/useMouseUpOutside.js +3 -0
  193. package/dist/Functions/useOnlineStatus.js +9 -1
  194. package/dist/Functions/usePasswordChecker.js +20 -4
  195. package/dist/Functions/usePrevious.js +5 -1
  196. package/dist/Functions/useResize.js +10 -2
  197. package/dist/Functions/useScrollTo.js +7 -2
  198. package/dist/Functions/useToggle.js +5 -1
  199. package/dist/Functions/utils.js +131 -56
  200. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +9 -2
  201. package/dist/Molecular/CustomIcons/components/AlertCircle.js +9 -2
  202. package/dist/Molecular/CustomIcons/components/AppStore.js +9 -2
  203. package/dist/Molecular/CustomIcons/components/Arrow.js +9 -2
  204. package/dist/Molecular/CustomIcons/components/ArrowDown.js +9 -2
  205. package/dist/Molecular/CustomIcons/components/ArrowLeft.js +9 -2
  206. package/dist/Molecular/CustomIcons/components/ArrowRight.js +9 -2
  207. package/dist/Molecular/CustomIcons/components/ArrowUp.js +9 -2
  208. package/dist/Molecular/CustomIcons/components/Bell.js +9 -2
  209. package/dist/Molecular/CustomIcons/components/Button.js +9 -2
  210. package/dist/Molecular/CustomIcons/components/Campaigns.js +9 -2
  211. package/dist/Molecular/CustomIcons/components/Check.js +9 -2
  212. package/dist/Molecular/CustomIcons/components/Check2.js +9 -2
  213. package/dist/Molecular/CustomIcons/components/ChevronDown.js +9 -2
  214. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +9 -2
  215. package/dist/Molecular/CustomIcons/components/ChevronLeft.js +9 -2
  216. package/dist/Molecular/CustomIcons/components/ChevronRight.js +9 -2
  217. package/dist/Molecular/CustomIcons/components/ChevronUp.js +9 -2
  218. package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +9 -2
  219. package/dist/Molecular/CustomIcons/components/Close.js +9 -2
  220. package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +9 -2
  221. package/dist/Molecular/CustomIcons/components/Delete.js +9 -2
  222. package/dist/Molecular/CustomIcons/components/Edit.js +9 -2
  223. package/dist/Molecular/CustomIcons/components/Email.js +9 -2
  224. package/dist/Molecular/CustomIcons/components/FinturfLogo.js +9 -2
  225. package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +9 -2
  226. package/dist/Molecular/CustomIcons/components/Flows.js +9 -2
  227. package/dist/Molecular/CustomIcons/components/Gift.js +9 -2
  228. package/dist/Molecular/CustomIcons/components/GoogleAuth.js +9 -2
  229. package/dist/Molecular/CustomIcons/components/GooglePlay.js +9 -2
  230. package/dist/Molecular/CustomIcons/components/HelpCircle.js +9 -2
  231. package/dist/Molecular/CustomIcons/components/HelpCircle2.js +9 -2
  232. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +9 -2
  233. package/dist/Molecular/CustomIcons/components/Home.js +9 -2
  234. package/dist/Molecular/CustomIcons/components/Home2.js +9 -2
  235. package/dist/Molecular/CustomIcons/components/Key.js +9 -2
  236. package/dist/Molecular/CustomIcons/components/Landers.js +9 -2
  237. package/dist/Molecular/CustomIcons/components/Lock.js +9 -2
  238. package/dist/Molecular/CustomIcons/components/Mail.js +9 -2
  239. package/dist/Molecular/CustomIcons/components/Mastercard.js +9 -2
  240. package/dist/Molecular/CustomIcons/components/Minus.js +9 -2
  241. package/dist/Molecular/CustomIcons/components/Offers.js +9 -2
  242. package/dist/Molecular/CustomIcons/components/Pause.js +9 -2
  243. package/dist/Molecular/CustomIcons/components/PayPal.js +9 -2
  244. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +9 -2
  245. package/dist/Molecular/CustomIcons/components/Phone.js +9 -2
  246. package/dist/Molecular/CustomIcons/components/Play.js +9 -2
  247. package/dist/Molecular/CustomIcons/components/Plus.js +9 -2
  248. package/dist/Molecular/CustomIcons/components/Profile.js +9 -2
  249. package/dist/Molecular/CustomIcons/components/QRCode.js +9 -2
  250. package/dist/Molecular/CustomIcons/components/Rectangle.js +9 -2
  251. package/dist/Molecular/CustomIcons/components/Revert.js +9 -2
  252. package/dist/Molecular/CustomIcons/components/Star.js +9 -2
  253. package/dist/Molecular/CustomIcons/components/Star2.js +9 -2
  254. package/dist/Molecular/CustomIcons/components/TrafficSources.js +9 -2
  255. package/dist/Molecular/CustomIcons/components/Trash.js +9 -2
  256. package/dist/Molecular/CustomIcons/components/TrashRed.js +9 -2
  257. package/dist/Molecular/CustomIcons/components/Triggers.js +9 -2
  258. package/dist/Molecular/CustomIcons/components/User.js +9 -2
  259. package/dist/Molecular/CustomIcons/components/Visa.js +9 -2
  260. package/dist/Molecular/CustomIcons/components/X.js +9 -2
  261. package/dist/Molecular/CustomIcons/index.js +122 -0
  262. package/dist/Molecular/FormElement/FormElement.js +12 -1
  263. package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +31 -30
  264. package/dist/Molecular/FormWithDependOn/partials/_utils.js +12 -9
  265. package/dist/Molecular/InputAddress/InputAddress.js +114 -65
  266. package/dist/Molecular/InputPassword/InputPassword.js +19 -5
  267. package/dist/index.js +2 -0
  268. package/package.json +1 -1
  269. package/dist/Atomic/UI/Hint/partial/_utils.js +0 -52
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.MASK_PRESETS = void 0;
7
+
7
8
  /**
8
9
  * @param type: 'inputMask',
9
10
  * @param maskPattern: 'DD.DD.DDDD',
@@ -26,7 +27,6 @@ const DATE_PRESET = {
26
27
  autocomplete: "bday",
27
28
  focusSelector: "input"
28
29
  };
29
-
30
30
  /**
31
31
  * @param type: 'inputMask',
32
32
  * @param maskPattern: 'DDDDD',
@@ -38,6 +38,7 @@ const DATE_PRESET = {
38
38
  * @param autocomplete: 'postal-code',
39
39
  * @param rules: 'fieldZip'
40
40
  */
41
+
41
42
  const ZIP_PRESET = {
42
43
  type: "inputMask",
43
44
  focusSelector: "input",
@@ -49,7 +50,6 @@ const ZIP_PRESET = {
49
50
  autocomplete: "postal-code",
50
51
  rules: "fieldZip"
51
52
  };
52
-
53
53
  /**
54
54
  * @param type: 'inputMask',
55
55
  * @param maskPattern: 'DDDDDDDDD',
@@ -59,6 +59,7 @@ const ZIP_PRESET = {
59
59
  * @param showErrors: false,
60
60
  * @param focusSelector: 'input',
61
61
  */
62
+
62
63
  const SSN_PRESET = {
63
64
  type: "inputMask",
64
65
  maskPattern: "DDDDDDDDD",
@@ -68,7 +69,6 @@ const SSN_PRESET = {
68
69
  blinkErrors: true,
69
70
  showErrors: false
70
71
  };
71
-
72
72
  /**
73
73
  * @param type: 'inputMask',
74
74
  * @param maskPattern: 'DDD-DDD-DDDD',
@@ -79,6 +79,7 @@ const SSN_PRESET = {
79
79
  * @param focusSelector: 'input',
80
80
  * @param autocomplete: 'tel-national',
81
81
  */
82
+
82
83
  const MOBILE_PHONE_PRESET = {
83
84
  type: "inputMask",
84
85
  // maskPattern: 'DDD-DDD-DDDD',
@@ -90,7 +91,6 @@ const MOBILE_PHONE_PRESET = {
90
91
  showErrors: false,
91
92
  autocomplete: "tel-national"
92
93
  };
93
-
94
94
  /**
95
95
  * @param type: 'inputMask3',
96
96
  * @param maskPattern: 'DDDD',
@@ -99,6 +99,7 @@ const MOBILE_PHONE_PRESET = {
99
99
  * @param blinkErrors: true,
100
100
  * @param showErrors: false,
101
101
  */
102
+
102
103
  const SHORT_SSN_PRESET = {
103
104
  type: "inputMask3",
104
105
  maskPattern: "DDDD",
@@ -108,7 +109,6 @@ const SHORT_SSN_PRESET = {
108
109
  blinkErrors: true,
109
110
  showErrors: false
110
111
  };
111
-
112
112
  /**
113
113
  * @param type: 'inputMask',
114
114
  * @param maskPattern: 'DDDDDDDDD',
@@ -117,6 +117,7 @@ const SHORT_SSN_PRESET = {
117
117
  * @param blinkErrors: true,
118
118
  * @param showErrors: false,
119
119
  */
120
+
120
121
  const ABA_PRESET = {
121
122
  type: "inputMask",
122
123
  maskPattern: "DDDDDDDDD",
@@ -125,7 +126,6 @@ const ABA_PRESET = {
125
126
  blinkErrors: true,
126
127
  showErrors: false
127
128
  };
128
-
129
129
  /**
130
130
  * @param type: 'inputMask',
131
131
  * @param maskPattern: 'MM/YY',
@@ -136,6 +136,7 @@ const ABA_PRESET = {
136
136
  * @param showErrors: false,
137
137
  * @param focusSelector: 'input',
138
138
  */
139
+
139
140
  const CC_EXPIRATION_DATE = {
140
141
  type: "inputMask",
141
142
  maskPattern: "MM/YY",
@@ -146,7 +147,6 @@ const CC_EXPIRATION_DATE = {
146
147
  showErrors: false,
147
148
  focusSelector: "input"
148
149
  };
149
-
150
150
  /**
151
151
  * @param type: 'inputMask',
152
152
  * @param maskPattern: 'DDDDDDDDDD',
@@ -155,6 +155,7 @@ const CC_EXPIRATION_DATE = {
155
155
  * @param blinkErrors: true,
156
156
  * @param showErrors: false,
157
157
  */
158
+
158
159
  const BANK_ACCOUNT = {
159
160
  type: "inputMask",
160
161
  maskPattern: "DDDDDDDDDD",
@@ -163,7 +164,7 @@ const BANK_ACCOUNT = {
163
164
  blinkErrors: true,
164
165
  showErrors: false
165
166
  };
166
- const MASK_PRESETS = exports.MASK_PRESETS = {
167
+ const MASK_PRESETS = {
167
168
  BANK_ACCOUNT,
168
169
  CC_EXPIRATION_DATE,
169
170
  DATE_PRESET,
@@ -172,4 +173,5 @@ const MASK_PRESETS = exports.MASK_PRESETS = {
172
173
  MOBILE_PHONE_PRESET,
173
174
  SHORT_SSN_PRESET,
174
175
  ABA_PRESET
175
- };
176
+ };
177
+ exports.MASK_PRESETS = MASK_PRESETS;
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.INPUT_PRESETS = void 0;
7
+
7
8
  var _fieldValueFormatters = require("../fieldValueFormatters");
9
+
8
10
  const NAME_SYMBOLS_EXCLUDER = {
9
11
  /**
10
12
  * @name fieldChangesMiddleware
@@ -17,12 +19,12 @@ const NAME_SYMBOLS_EXCLUDER = {
17
19
  */
18
20
  fieldChangesMiddleware: value => {
19
21
  // remove invalid characters
20
- const invalidCharacters = new RegExp(/[^a-zA-Z-\s']/g);
21
- // handle any two '-' or ''' should not be side by side
22
- const sideBySideHyphenOrApostrophe = new RegExp(/['-]{2,}/g);
23
- // replace sequence of spaces with single space
24
- const multipleSpaces = new RegExp(/\s{2,}/g);
25
- // remove '-' or ''' if they are followed by a space
22
+ const invalidCharacters = new RegExp(/[^a-zA-Z-\s']/g); // handle any two '-' or ''' should not be side by side
23
+
24
+ const sideBySideHyphenOrApostrophe = new RegExp(/['-]{2,}/g); // replace sequence of spaces with single space
25
+
26
+ const multipleSpaces = new RegExp(/\s{2,}/g); // remove '-' or ''' if they are followed by a space
27
+
26
28
  const beforeSpace = new RegExp(/['-](?=\s)/g);
27
29
  const sanitizedValue = (0, _fieldValueFormatters.getSafelyValue)(value).replace(invalidCharacters, "").replace(sideBySideHyphenOrApostrophe, "").replace(multipleSpaces, " ").replace(beforeSpace, "");
28
30
  return sanitizedValue;
@@ -48,7 +50,8 @@ const ONLY_STRING_AND_DASH = {
48
50
  return sanitizedInput.replace(nonAlphabeticAndNotSingleDash, "").replace(consecutiveDashes, "-");
49
51
  }
50
52
  };
51
- const INPUT_PRESETS = exports.INPUT_PRESETS = {
53
+ const INPUT_PRESETS = {
52
54
  NAME_SYMBOLS_EXCLUDER,
53
55
  ONLY_STRING_AND_DASH
54
- };
56
+ };
57
+ exports.INPUT_PRESETS = INPUT_PRESETS;
@@ -5,16 +5,15 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.NUMERIC_KEYBOARD = exports.EMAIL_KEYBOARD = exports.ALL_KEYBOARD_TYPES = void 0;
7
7
  //? Удобно использовать для расширения объекта атрибутов
8
- const ALL_KEYBOARD_TYPES = exports.ALL_KEYBOARD_TYPES = {
8
+ const ALL_KEYBOARD_TYPES = {
9
9
  numeric: {
10
10
  inputMode: "numeric"
11
11
  },
12
12
  email: {
13
13
  inputMode: "email"
14
14
  }
15
- };
15
+ }; //? Например:
16
16
 
17
- //? Например:
18
17
  /*
19
18
  const constructor = [
20
19
  ...
@@ -30,10 +29,10 @@ const ALL_KEYBOARD_TYPES = exports.ALL_KEYBOARD_TYPES = {
30
29
  ];
31
30
 
32
31
  */
33
-
34
32
  // *****************************
35
33
  //? Удобно использовать для расширения объекта филда, если в филде более не добавляются другие атрибуты
36
34
  //? Например:
35
+
37
36
  /*
38
37
  const constructor = [
39
38
  ...
@@ -47,9 +46,12 @@ const ALL_KEYBOARD_TYPES = exports.ALL_KEYBOARD_TYPES = {
47
46
 
48
47
  */
49
48
 
50
- const NUMERIC_KEYBOARD = exports.NUMERIC_KEYBOARD = {
49
+ exports.ALL_KEYBOARD_TYPES = ALL_KEYBOARD_TYPES;
50
+ const NUMERIC_KEYBOARD = {
51
51
  attributesOfNativeInput: ALL_KEYBOARD_TYPES.numeric
52
52
  };
53
- const EMAIL_KEYBOARD = exports.EMAIL_KEYBOARD = {
53
+ exports.NUMERIC_KEYBOARD = NUMERIC_KEYBOARD;
54
+ const EMAIL_KEYBOARD = {
54
55
  attributesOfNativeInput: ALL_KEYBOARD_TYPES.email
55
- };
56
+ };
57
+ exports.EMAIL_KEYBOARD = EMAIL_KEYBOARD;
@@ -4,22 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.registerSchema = exports.loginSchema = exports.forgotSchema = void 0;
7
+
7
8
  var yup = _interopRequireWildcard(require("yup"));
8
- 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); }
9
- 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; }
10
- const forgotSchema = exports.forgotSchema = yup.object().shape({
9
+
10
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
+
12
+ 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; }
13
+
14
+ const forgotSchema = yup.object().shape({
11
15
  email: yup.string().email("Invalid email").required("E-mail is required")
12
16
  });
13
- const loginSchema = exports.loginSchema = yup.object().shape({
17
+ exports.forgotSchema = forgotSchema;
18
+ const loginSchema = yup.object().shape({
14
19
  email: yup.string().email("Invalid email").required("E-mail is required"),
15
20
  password: yup.string().required("No password provided").min(8, "Password is too short - should be 8 chars minimum").matches(/[a-zA-Z]/, "Password can only contain Latin letters"),
16
21
  remember: yup.bool()
17
22
  });
18
- const registerSchema = exports.registerSchema = yup.object().shape({
23
+ exports.loginSchema = loginSchema;
24
+ const registerSchema = yup.object().shape({
19
25
  name: yup.string().required("Name is required"),
20
26
  email: yup.string().email("Invalid email").required("E-mail is required"),
21
27
  password: yup.string().required("No password provided").min(8, "Password is too short - should be 8 chars minimum").matches(/[a-zA-Z]/, "Password can only contain Latin letters"),
22
28
  confirmPassword: yup.string().required("Confirm password").oneOf([yup.ref("password")], "Passwords must match"),
23
29
  promo: yup.string(),
24
30
  recaptcha: yup.bool().oneOf([true], "Field must be checked")
25
- });
31
+ });
32
+ exports.registerSchema = registerSchema;
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+
7
8
  var _react = require("react");
9
+
8
10
  const useBodyScrollLock = isScrollBodyLocked => {
9
11
  (0, _react.useEffect)(() => {
10
12
  if (isScrollBodyLocked) {
@@ -12,9 +14,12 @@ const useBodyScrollLock = isScrollBodyLocked => {
12
14
  } else {
13
15
  document.body.style.overflow = "auto";
14
16
  }
17
+
15
18
  return () => {
16
19
  document.body.style.overflow = "auto";
17
20
  };
18
21
  }, [isScrollBodyLocked]);
19
22
  };
20
- var _default = exports.default = useBodyScrollLock;
23
+
24
+ var _default = useBodyScrollLock;
25
+ exports.default = _default;
@@ -4,13 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useClickOutside = void 0;
7
+
7
8
  var _react = require("react");
9
+
8
10
  const useClickOutside = (ref, setOut, open) => {
9
11
  function handleClickOutside(event) {
10
12
  if (ref.current && !ref.current.contains(event.target)) {
11
13
  setOut(open);
12
14
  }
13
15
  }
16
+
14
17
  (0, _react.useEffect)(() => {
15
18
  document.addEventListener("mousedown", handleClickOutside);
16
19
  return () => {
@@ -18,4 +21,5 @@ const useClickOutside = (ref, setOut, open) => {
18
21
  };
19
22
  }, [ref]);
20
23
  };
24
+
21
25
  exports.useClickOutside = useClickOutside;
@@ -4,9 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.useDebounce = void 0;
7
+
7
8
  var _react = _interopRequireWildcard(require("react"));
8
- 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); }
9
- 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; }
9
+
10
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
+
12
+ 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; }
13
+
10
14
  const useDebounce = _ref => {
11
15
  let {
12
16
  searchValue,
@@ -23,4 +27,5 @@ const useDebounce = _ref => {
23
27
  }, [searchValue, delay]);
24
28
  return debouncedValue;
25
29
  };
30
+
26
31
  exports.useDebounce = useDebounce;
@@ -4,39 +4,45 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = useFieldsFocus;
7
+
7
8
  var _react = require("react");
9
+
8
10
  function useFieldsFocus(_ref) {
9
11
  let {
10
12
  form,
11
13
  setForm
12
14
  } = _ref;
13
15
  const isFormAsObject = Boolean(typeof form === "object" && !Array.isArray(form));
16
+
14
17
  const getField = key => {
15
18
  if (isFormAsObject) {
16
19
  var _form$key, _Object$values;
20
+
17
21
  return (_form$key = form === null || form === void 0 ? void 0 : form[key]) !== null && _form$key !== void 0 ? _form$key : (_Object$values = Object.values(form)) === null || _Object$values === void 0 ? void 0 : _Object$values.find(field => field.key === key);
18
22
  } else {
19
23
  return form === null || form === void 0 ? void 0 : form.find(field => field.key === key);
20
24
  }
21
25
  };
26
+
22
27
  const getErroredFields = () => {
23
28
  if (isFormAsObject) {
24
29
  var _Object$values2;
30
+
25
31
  return (_Object$values2 = Object.values(form)) === null || _Object$values2 === void 0 ? void 0 : _Object$values2.filter(field => field.error);
26
32
  } else {
27
33
  return form === null || form === void 0 ? void 0 : form.filter(f => f === null || f === void 0 ? void 0 : f.error);
28
34
  }
29
35
  };
36
+
30
37
  const addRefsToFields = () => {
31
38
  if (isFormAsObject) {
32
39
  setForm(form => {
33
40
  var _Object$keys;
41
+
34
42
  return (_Object$keys = Object.keys(form)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.reduce((result, key) => {
35
43
  const field = form[key];
36
- return {
37
- ...result,
38
- [key]: {
39
- ...field,
44
+ return { ...result,
45
+ [key]: { ...field,
40
46
  ref: /*#__PURE__*/(0, _react.createRef)(),
41
47
  wrapperRef: /*#__PURE__*/(0, _react.createRef)()
42
48
  }
@@ -53,6 +59,7 @@ function useFieldsFocus(_ref) {
53
59
  });
54
60
  }
55
61
  };
62
+
56
63
  const toggleFieldFocus = _ref2 => {
57
64
  let {
58
65
  field,
@@ -60,10 +67,12 @@ function useFieldsFocus(_ref) {
60
67
  } = _ref2;
61
68
  if (!field || !(field !== null && field !== void 0 && field.ref)) return null;
62
69
  setTimeout(() => {
63
- var _field$ref$current;
64
- (_field$ref$current = field.ref.current) === null || _field$ref$current === void 0 || (_field$ref$current = _field$ref$current.querySelector((field === null || field === void 0 ? void 0 : field.focusSelector) || "input")) === null || _field$ref$current === void 0 || _field$ref$current[action]();
70
+ var _field$ref$current, _field$ref$current$qu;
71
+
72
+ (_field$ref$current = field.ref.current) === null || _field$ref$current === void 0 ? void 0 : (_field$ref$current$qu = _field$ref$current.querySelector((field === null || field === void 0 ? void 0 : field.focusSelector) || "input")) === null || _field$ref$current$qu === void 0 ? void 0 : _field$ref$current$qu[action]();
65
73
  }, 50);
66
74
  };
75
+
67
76
  const setFocusTo = key => {
68
77
  const field = getField(key);
69
78
  if (!field) return false;
@@ -71,14 +80,17 @@ function useFieldsFocus(_ref) {
71
80
  field
72
81
  });
73
82
  };
83
+
74
84
  const setFocusToErroredField = () => {
75
85
  var _getErroredFields;
86
+
76
87
  const field = (_getErroredFields = getErroredFields()) === null || _getErroredFields === void 0 ? void 0 : _getErroredFields[0];
77
88
  if (!field) return false;
78
89
  toggleFieldFocus({
79
90
  field
80
91
  });
81
92
  };
93
+
82
94
  (0, _react.useEffect)(() => {
83
95
  addRefsToFields();
84
96
  }, [form === null || form === void 0 ? void 0 : form.length]);
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = ArrayWithObjects;
9
+
8
10
  var _General = _interopRequireDefault(require("../functions/General"));
11
+
9
12
  function ArrayWithObjects(_ref) {
10
13
  let {
11
14
  form,
@@ -22,20 +25,26 @@ function ArrayWithObjects(_ref) {
22
25
  } = (0, _General.default)({
23
26
  FormFields
24
27
  });
28
+
25
29
  const getFormField = function (key) {
26
30
  var _getFormFields;
31
+
27
32
  let argForm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : form;
28
33
  return (_getFormFields = getFormFields(argForm)) === null || _getFormFields === void 0 ? void 0 : _getFormFields.find(f => f.key === key);
29
34
  };
35
+
30
36
  const setFormFields = data => {
31
37
  const isFunction = typeof data === "function";
32
38
  setForm(state => isFunction ? data(state) : data);
33
39
  };
40
+
34
41
  const setFormField = function (data) {
35
42
  let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
36
43
  return setFormFields(fields => updateFormField(fields, data, key));
37
44
  };
45
+
38
46
  const removeAllFormFields = () => setFormFields([]);
47
+
39
48
  return {
40
49
  joinData,
41
50
  getFieldData,
@@ -4,16 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = ObjectWithIterableObjects;
7
+
7
8
  function ObjectWithIterableObjects(_ref) {
8
9
  let {
9
10
  form,
10
11
  setForm,
11
12
  FormFields
12
13
  } = _ref;
14
+
13
15
  const joinData = function () {
14
16
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
15
17
  args[_key] = arguments[_key];
16
18
  }
19
+
17
20
  const [mainArg] = args;
18
21
  const MainArgProto = Array.isArray(mainArg) ? "Array" : typeof mainArg === "object" ? "Object" : undefined;
19
22
  const template = Array.isArray(mainArg) ? [] : typeof mainArg === "object" ? {} : null;
@@ -26,8 +29,7 @@ function ObjectWithIterableObjects(_ref) {
26
29
  return [...result, item];
27
30
  }
28
31
  } else if (MainArgProto === "Object") {
29
- return {
30
- ...result,
32
+ return { ...result,
31
33
  ...item
32
34
  };
33
35
  } else {
@@ -35,6 +37,7 @@ function ObjectWithIterableObjects(_ref) {
35
37
  }
36
38
  }, template);
37
39
  };
40
+
38
41
  const getFieldData = key => {
39
42
  if (Array.isArray(FormFields)) {
40
43
  return FormFields[key] || FormFields.find(f => f.key === key);
@@ -44,14 +47,15 @@ function ObjectWithIterableObjects(_ref) {
44
47
  return undefined;
45
48
  }
46
49
  };
50
+
47
51
  const getFormFields = () => {
48
52
  return form.fields || form;
49
53
  };
54
+
50
55
  const getFormField = key => {
51
56
  // eslint-disable-next-line no-undef
52
57
  if (FormProto === "Array") {
53
- return getFormFields().find(field => field.key === key);
54
- // eslint-disable-next-line no-undef
58
+ return getFormFields().find(field => field.key === key); // eslint-disable-next-line no-undef
55
59
  } else if (FormProto === "Object") {
56
60
  return Object.values(getFormFields()).find(field => field.key === key) || Object.keys(getFormFields()).reduce((result, field) => {
57
61
  if (field === key) result = getFormFields()[field];
@@ -61,12 +65,12 @@ function ObjectWithIterableObjects(_ref) {
61
65
  return undefined;
62
66
  }
63
67
  };
68
+
64
69
  const setFormFields = data => {
65
70
  const isFunction = typeof data === "function";
66
71
  setForm(state => {
67
72
  if (state.fields) {
68
- return {
69
- ...state,
73
+ return { ...state,
70
74
  fields: isFunction ? data(state.fields) : data
71
75
  };
72
76
  } else {
@@ -74,6 +78,7 @@ function ObjectWithIterableObjects(_ref) {
74
78
  }
75
79
  });
76
80
  };
81
+
77
82
  const setFormField = function (data) {
78
83
  let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
79
84
  const isFunction = typeof data === "function";
@@ -85,8 +90,10 @@ function ObjectWithIterableObjects(_ref) {
85
90
  };
86
91
  result.item = fields[key] || fields.find(f => f.key === key);
87
92
  if (!result.item) return result;
93
+
88
94
  if (Array.isArray(fields)) {
89
95
  const index = parseInt(key, 10);
96
+
90
97
  if (!isNaN(index)) {
91
98
  result.fields.splice(key, 1);
92
99
  } else {
@@ -97,43 +104,47 @@ function ObjectWithIterableObjects(_ref) {
97
104
  let {
98
105
  key: fKey
99
106
  } = _ref2;
107
+
100
108
  if (key !== fKey) {
101
109
  object[key] = fields[key];
102
110
  }
111
+
103
112
  return object;
104
113
  }, {});
105
114
  }
115
+
106
116
  return result;
107
117
  };
118
+
108
119
  const update = fields => {
109
120
  //KEY is NULLable
110
121
  if (!key) {
111
122
  return data.key ? Object.values(fields).reduce((result, field, i) => {
112
123
  const index = fields[field.key] ? field.key : i;
113
- return {
114
- ...result,
124
+ return { ...result,
115
125
  [index]: data.key === field.key ? isFunction ? data(field) : data : field
116
126
  };
117
- }, {}) : {
118
- ...fields,
127
+ }, {}) : { ...fields,
119
128
  [fields.length || 0]: isFunction ? data({}) : data
120
129
  };
121
130
  }
131
+
122
132
  const {
123
133
  fields: filtered,
124
134
  item: field
125
135
  } = pop(fields, key);
126
- const updatedField = isFunction ? data(field || {}) : {
127
- ...field,
136
+ const updatedField = isFunction ? data(field || {}) : { ...field,
128
137
  ...data
129
138
  };
130
139
  return joinData(filtered, fields[key] ? {
131
140
  [key]: updatedField
132
141
  } : updatedField);
133
142
  };
143
+
134
144
  return update(fields);
135
145
  });
136
146
  };
147
+
137
148
  return {
138
149
  joinData,
139
150
  getFieldData,
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = ObjectWithNamedKeyObjects;
9
+
8
10
  var _General = _interopRequireDefault(require("../functions/General"));
11
+
9
12
  const noop = () => {};
13
+
10
14
  function ObjectWithNamedKeyObjects() {
11
15
  let {
12
16
  form,
@@ -23,20 +27,22 @@ function ObjectWithNamedKeyObjects() {
23
27
  } = (0, _General.default)({
24
28
  FormFields
25
29
  });
30
+
26
31
  const getFormField = function (key) {
27
32
  var _Object$values, _Object$keys;
33
+
28
34
  let argForm = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : form;
29
35
  return ((_Object$values = Object.values(getFormFields(argForm))) === null || _Object$values === void 0 ? void 0 : _Object$values.find(field => (field === null || field === void 0 ? void 0 : field.key) === key)) || ((_Object$keys = Object.keys(getFormFields(argForm))) === null || _Object$keys === void 0 ? void 0 : _Object$keys.reduce((result, field) => {
30
36
  if (field === key) result = getFormFields(argForm)[field];
31
37
  return result;
32
38
  }, null));
33
39
  };
40
+
34
41
  const setFormFields = data => {
35
42
  const isFunction = typeof data === "function";
36
43
  setForm(state => {
37
44
  if (state.fields) {
38
- return {
39
- ...state,
45
+ return { ...state,
40
46
  fields: isFunction ? data(state.fields) : data
41
47
  };
42
48
  } else {
@@ -44,22 +50,25 @@ function ObjectWithNamedKeyObjects() {
44
50
  }
45
51
  });
46
52
  };
53
+
47
54
  const setFormField = function (data) {
48
55
  let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
49
56
  return setFormFields(fields => updateFormField(fields, data, key));
50
57
  };
58
+
51
59
  const removeAllFormFields = () => setFormFields({});
52
- const removeFormField = key => setFormFields(state => Object.keys(state).filter(fKey => fKey !== key).reduce((obj, key) => ({
53
- ...obj,
60
+
61
+ const removeFormField = key => setFormFields(state => Object.keys(state).filter(fKey => fKey !== key).reduce((obj, key) => ({ ...obj,
54
62
  [key]: state[key]
55
63
  }), {}));
64
+
56
65
  const removeFormFields = _ref => {
57
66
  let [...keys] = _ref;
58
- return setFormFields(state => Object.keys(state).filter(fKey => !keys.includes(fKey)).reduce((obj, key) => ({
59
- ...obj,
67
+ return setFormFields(state => Object.keys(state).filter(fKey => !keys.includes(fKey)).reduce((obj, key) => ({ ...obj,
60
68
  [key]: state[key]
61
69
  }), {}));
62
70
  };
71
+
63
72
  return {
64
73
  joinData,
65
74
  getFieldData,