intelicoreact 1.8.3 → 1.8.5

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 (264) hide show
  1. package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.jsx +18 -0
  2. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.jsx +121 -0
  3. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.jsx +507 -0
  4. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.jsx +46 -0
  5. package/dist/Atomic/FormElements/NumericInput/NumericInput.jsx +337 -0
  6. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.jsx +66 -0
  7. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.jsx +78 -0
  8. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.jsx +54 -0
  9. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.jsx +183 -0
  10. package/dist/Atomic/FormElements/RangeList/RangeList.jsx +181 -0
  11. package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.jsx +41 -0
  12. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.jsx +449 -0
  13. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.jsx +865 -0
  14. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.jsx +37 -0
  15. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.jsx +48 -0
  16. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.jsx +62 -0
  17. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.jsx +175 -0
  18. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.jsx +65 -0
  19. package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.jsx +118 -0
  20. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.ts +2 -0
  21. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +1 -1
  22. package/dist/Atomic/FormElements/Text/Text.jsx +126 -0
  23. package/dist/Atomic/FormElements/Textarea/Textarea.jsx +61 -0
  24. package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.jsx +181 -0
  25. package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.jsx +60 -0
  26. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.jsx +83 -0
  27. package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.jsx +80 -0
  28. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.jsx +103 -0
  29. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.jsx +115 -0
  30. package/dist/Atomic/Layout/Header/Header.jsx +86 -0
  31. package/dist/Atomic/UI/AccordionTable/AccordionTable.jsx +250 -0
  32. package/dist/Atomic/UI/AccordionText/AccordionText.jsx +68 -0
  33. package/dist/Atomic/UI/Arrow/Arrow.jsx +134 -0
  34. package/dist/Atomic/UI/Box/Box.jsx +53 -0
  35. package/dist/Atomic/UI/Chart/Chart.jsx +178 -0
  36. package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.jsx +78 -0
  37. package/dist/Atomic/UI/Chart/partial/optionsConstructor.jsx +334 -0
  38. package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.jsx +111 -0
  39. package/dist/Atomic/UI/DateTime/DateTime.jsx +57 -0
  40. package/dist/Atomic/UI/DebugContainer/DebugContainer.jsx +44 -0
  41. package/dist/Atomic/UI/DebugContainer/useDebugContainer.jsx +15 -0
  42. package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.jsx +223 -0
  43. package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.jsx +75 -0
  44. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.jsx +86 -0
  45. package/dist/Atomic/UI/PieChart/PieChart.jsx +41 -0
  46. package/dist/Atomic/UI/Table/Partials/TdCell.jsx +87 -0
  47. package/dist/Atomic/UI/Table/Partials/TdHeader.jsx +36 -0
  48. package/dist/Atomic/UI/Table/Partials/TdRow.jsx +103 -0
  49. package/dist/Atomic/UI/Table/Partials/TdTitle.jsx +55 -0
  50. package/dist/Atomic/UI/Table/Table.jsx +63 -0
  51. package/dist/Atomic/UI/Table/TdTypes/TdActions.jsx +80 -0
  52. package/dist/Atomic/UI/Table/TdTypes/TdPriority.jsx +26 -0
  53. package/dist/Atomic/UI/Table/TdTypes/TdRange.jsx +13 -0
  54. package/dist/Atomic/UI/Table/TdTypes/TdWeight.jsx +56 -0
  55. package/dist/Atomic/UI/Tag/Tag.interface.ts +1 -0
  56. package/dist/Atomic/UI/Tag/Tag.js +1 -1
  57. package/dist/Atomic/UI/TagList/TagList.jsx +256 -0
  58. package/dist/Atomic/UI/WizardStepper/constructor.jsx +86 -0
  59. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.jsx +254 -0
  60. package/dist/Functions/customEventListener.jsx +96 -0
  61. package/dist/Functions/operations.jsx +138 -0
  62. package/dist/Functions/useFormTools/functions/RenderFields.jsx +108 -0
  63. package/dist/Functions/useFormTools/index.jsx +777 -0
  64. package/dist/Functions/usePasswordChecker.jsx +128 -0
  65. package/dist/Functions/utils.jsx +492 -0
  66. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.jsx +22 -0
  67. package/dist/Molecular/CustomIcons/components/AlertCircle.jsx +24 -0
  68. package/dist/Molecular/CustomIcons/components/AppStore.jsx +30 -0
  69. package/dist/Molecular/CustomIcons/components/Arrow.jsx +33 -0
  70. package/dist/Molecular/CustomIcons/components/ArrowDown.jsx +18 -0
  71. package/dist/Molecular/CustomIcons/components/ArrowLeft.jsx +23 -0
  72. package/dist/Molecular/CustomIcons/components/ArrowRight.jsx +23 -0
  73. package/dist/Molecular/CustomIcons/components/ArrowUp.jsx +18 -0
  74. package/dist/Molecular/CustomIcons/components/Bell.jsx +16 -0
  75. package/dist/Molecular/CustomIcons/components/Button.jsx +13 -0
  76. package/dist/Molecular/CustomIcons/components/Campaigns.jsx +17 -0
  77. package/dist/Molecular/CustomIcons/components/Check.jsx +15 -0
  78. package/dist/Molecular/CustomIcons/components/Check2.jsx +13 -0
  79. package/dist/Molecular/CustomIcons/components/ChevronDown.jsx +13 -0
  80. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.jsx +12 -0
  81. package/dist/Molecular/CustomIcons/components/ChevronLeft.jsx +12 -0
  82. package/dist/Molecular/CustomIcons/components/ChevronRight.jsx +12 -0
  83. package/dist/Molecular/CustomIcons/components/ChevronUp.jsx +12 -0
  84. package/dist/Molecular/CustomIcons/components/ChevronUpDown.jsx +28 -0
  85. package/dist/Molecular/CustomIcons/components/Close.jsx +15 -0
  86. package/dist/Molecular/CustomIcons/components/ColumnsOrder.jsx +18 -0
  87. package/dist/Molecular/CustomIcons/components/Delete.jsx +17 -0
  88. package/dist/Molecular/CustomIcons/components/Edit.jsx +16 -0
  89. package/dist/Molecular/CustomIcons/components/Email.jsx +32 -0
  90. package/dist/Molecular/CustomIcons/components/FinturfLogo.jsx +19 -0
  91. package/dist/Molecular/CustomIcons/components/FinturfLogo2.jsx +36 -0
  92. package/dist/Molecular/CustomIcons/components/Flows.jsx +16 -0
  93. package/dist/Molecular/CustomIcons/components/Gift.jsx +26 -0
  94. package/dist/Molecular/CustomIcons/components/GoogleAuth.jsx +30 -0
  95. package/dist/Molecular/CustomIcons/components/GooglePlay.jsx +30 -0
  96. package/dist/Molecular/CustomIcons/components/HelpCircle.jsx +20 -0
  97. package/dist/Molecular/CustomIcons/components/HelpCircle2.jsx +21 -0
  98. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.jsx +20 -0
  99. package/dist/Molecular/CustomIcons/components/Home.jsx +17 -0
  100. package/dist/Molecular/CustomIcons/components/Home2.jsx +23 -0
  101. package/dist/Molecular/CustomIcons/components/Key.jsx +24 -0
  102. package/dist/Molecular/CustomIcons/components/Landers.jsx +21 -0
  103. package/dist/Molecular/CustomIcons/components/Lock.jsx +16 -0
  104. package/dist/Molecular/CustomIcons/components/Mail.jsx +27 -0
  105. package/dist/Molecular/CustomIcons/components/Mastercard.jsx +74 -0
  106. package/dist/Molecular/CustomIcons/components/Minus.jsx +26 -0
  107. package/dist/Molecular/CustomIcons/components/Offers.jsx +17 -0
  108. package/dist/Molecular/CustomIcons/components/Pause.jsx +29 -0
  109. package/dist/Molecular/CustomIcons/components/PayPal.jsx +42 -0
  110. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.jsx +29 -0
  111. package/dist/Molecular/CustomIcons/components/Phone.jsx +31 -0
  112. package/dist/Molecular/CustomIcons/components/Play.jsx +26 -0
  113. package/dist/Molecular/CustomIcons/components/Plus.jsx +26 -0
  114. package/dist/Molecular/CustomIcons/components/Profile.jsx +17 -0
  115. package/dist/Molecular/CustomIcons/components/QRCode.jsx +30 -0
  116. package/dist/Molecular/CustomIcons/components/Rectangle.jsx +13 -0
  117. package/dist/Molecular/CustomIcons/components/Revert.jsx +14 -0
  118. package/dist/Molecular/CustomIcons/components/Star.jsx +15 -0
  119. package/dist/Molecular/CustomIcons/components/Star2.jsx +17 -0
  120. package/dist/Molecular/CustomIcons/components/TrafficSources.jsx +15 -0
  121. package/dist/Molecular/CustomIcons/components/Trash.jsx +16 -0
  122. package/dist/Molecular/CustomIcons/components/TrashRed.jsx +16 -0
  123. package/dist/Molecular/CustomIcons/components/Triggers.jsx +16 -0
  124. package/dist/Molecular/CustomIcons/components/User.jsx +26 -0
  125. package/dist/Molecular/CustomIcons/components/Visa.jsx +32 -0
  126. package/dist/Molecular/CustomIcons/components/X.jsx +13 -0
  127. package/dist/Molecular/FormElement/FormElement.jsx +52 -0
  128. package/dist/Molecular/FormWithDependOn/FormWithDependOn.jsx +161 -0
  129. package/dist/Molecular/InputAddress/InputAddress.jsx +641 -0
  130. package/dist/Molecular/InputPassword/InputPassword.jsx +50 -0
  131. package/package.json +13 -6
  132. package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +0 -1
  133. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.js +0 -1
  134. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +0 -1
  135. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +0 -1
  136. package/dist/Atomic/FormElements/NumericInput/NumericInput.js +0 -1
  137. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +0 -1
  138. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +0 -1
  139. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +0 -1
  140. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +0 -1
  141. package/dist/Atomic/FormElements/RangeList/RangeList.js +0 -1
  142. package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +0 -1
  143. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +0 -1
  144. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +0 -1
  145. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +0 -1
  146. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +0 -1
  147. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +0 -1
  148. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.d.ts +0 -16
  149. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +0 -1
  150. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +0 -1
  151. package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.d.ts +0 -9
  152. package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +0 -1
  153. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.d.ts +0 -5
  154. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.d.ts +0 -79
  155. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.js +0 -1
  156. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.interface.js.map +0 -1
  157. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js.map +0 -1
  158. package/dist/Atomic/FormElements/Text/Text.js +0 -1
  159. package/dist/Atomic/FormElements/Textarea/Textarea.js +0 -1
  160. package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +0 -1
  161. package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +0 -1
  162. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +0 -1
  163. package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +0 -1
  164. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +0 -1
  165. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +0 -1
  166. package/dist/Atomic/Layout/Header/Header.js +0 -1
  167. package/dist/Atomic/UI/AccordionTable/AccordionTable.js +0 -1
  168. package/dist/Atomic/UI/AccordionText/AccordionText.js +0 -1
  169. package/dist/Atomic/UI/Arrow/Arrow.js +0 -1
  170. package/dist/Atomic/UI/Box/Box.js +0 -1
  171. package/dist/Atomic/UI/Chart/Chart.js +0 -1
  172. package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +0 -1
  173. package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +0 -1
  174. package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +0 -1
  175. package/dist/Atomic/UI/DateTime/DateTime.js +0 -1
  176. package/dist/Atomic/UI/DebugContainer/DebugContainer.js +0 -1
  177. package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +0 -1
  178. package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +0 -1
  179. package/dist/Atomic/UI/MonoAccordion/MonoAccordion._test.js +0 -1
  180. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +0 -1
  181. package/dist/Atomic/UI/PieChart/PieChart.js +0 -1
  182. package/dist/Atomic/UI/Table/Partials/TdCell.js +0 -1
  183. package/dist/Atomic/UI/Table/Partials/TdHeader.js +0 -1
  184. package/dist/Atomic/UI/Table/Partials/TdRow.js +0 -1
  185. package/dist/Atomic/UI/Table/Partials/TdTitle.js +0 -1
  186. package/dist/Atomic/UI/Table/Table.js +0 -1
  187. package/dist/Atomic/UI/Table/TdTypes/TdActions.js +0 -1
  188. package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +0 -1
  189. package/dist/Atomic/UI/Table/TdTypes/TdRange.js +0 -1
  190. package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +0 -1
  191. package/dist/Atomic/UI/TagList/TagList.js +0 -1
  192. package/dist/Atomic/UI/WizardStepper/constructor.js +0 -1
  193. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +0 -1
  194. package/dist/Functions/customEventListener.js +0 -1
  195. package/dist/Functions/operations.js +0 -1
  196. package/dist/Functions/useFormTools/functions/RenderFields.js +0 -1
  197. package/dist/Functions/useFormTools/index.js +0 -1
  198. package/dist/Functions/usePasswordChecker.js +0 -1
  199. package/dist/Functions/utils.js +0 -1
  200. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +0 -1
  201. package/dist/Molecular/CustomIcons/components/AlertCircle.js +0 -1
  202. package/dist/Molecular/CustomIcons/components/AppStore.js +0 -1
  203. package/dist/Molecular/CustomIcons/components/Arrow.js +0 -1
  204. package/dist/Molecular/CustomIcons/components/ArrowDown.js +0 -1
  205. package/dist/Molecular/CustomIcons/components/ArrowLeft.js +0 -1
  206. package/dist/Molecular/CustomIcons/components/ArrowRight.js +0 -1
  207. package/dist/Molecular/CustomIcons/components/ArrowUp.js +0 -1
  208. package/dist/Molecular/CustomIcons/components/Bell.js +0 -1
  209. package/dist/Molecular/CustomIcons/components/Button.js +0 -1
  210. package/dist/Molecular/CustomIcons/components/Campaigns.js +0 -1
  211. package/dist/Molecular/CustomIcons/components/Check.js +0 -1
  212. package/dist/Molecular/CustomIcons/components/Check2.js +0 -1
  213. package/dist/Molecular/CustomIcons/components/ChevronDown.js +0 -1
  214. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +0 -1
  215. package/dist/Molecular/CustomIcons/components/ChevronLeft.js +0 -1
  216. package/dist/Molecular/CustomIcons/components/ChevronRight.js +0 -1
  217. package/dist/Molecular/CustomIcons/components/ChevronUp.js +0 -1
  218. package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +0 -1
  219. package/dist/Molecular/CustomIcons/components/Close.js +0 -1
  220. package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +0 -1
  221. package/dist/Molecular/CustomIcons/components/Delete.js +0 -1
  222. package/dist/Molecular/CustomIcons/components/Edit.js +0 -1
  223. package/dist/Molecular/CustomIcons/components/Email.js +0 -1
  224. package/dist/Molecular/CustomIcons/components/FinturfLogo.js +0 -1
  225. package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +0 -1
  226. package/dist/Molecular/CustomIcons/components/Flows.js +0 -1
  227. package/dist/Molecular/CustomIcons/components/Gift.js +0 -1
  228. package/dist/Molecular/CustomIcons/components/GoogleAuth.js +0 -1
  229. package/dist/Molecular/CustomIcons/components/GooglePlay.js +0 -1
  230. package/dist/Molecular/CustomIcons/components/HelpCircle.js +0 -1
  231. package/dist/Molecular/CustomIcons/components/HelpCircle2.js +0 -1
  232. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +0 -1
  233. package/dist/Molecular/CustomIcons/components/Home.js +0 -1
  234. package/dist/Molecular/CustomIcons/components/Home2.js +0 -1
  235. package/dist/Molecular/CustomIcons/components/Key.js +0 -1
  236. package/dist/Molecular/CustomIcons/components/Landers.js +0 -1
  237. package/dist/Molecular/CustomIcons/components/Lock.js +0 -1
  238. package/dist/Molecular/CustomIcons/components/Mail.js +0 -1
  239. package/dist/Molecular/CustomIcons/components/Mastercard.js +0 -1
  240. package/dist/Molecular/CustomIcons/components/Minus.js +0 -1
  241. package/dist/Molecular/CustomIcons/components/Offers.js +0 -1
  242. package/dist/Molecular/CustomIcons/components/Pause.js +0 -1
  243. package/dist/Molecular/CustomIcons/components/PayPal.js +0 -1
  244. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +0 -1
  245. package/dist/Molecular/CustomIcons/components/Phone.js +0 -1
  246. package/dist/Molecular/CustomIcons/components/Play.js +0 -1
  247. package/dist/Molecular/CustomIcons/components/Plus.js +0 -1
  248. package/dist/Molecular/CustomIcons/components/Profile.js +0 -1
  249. package/dist/Molecular/CustomIcons/components/QRCode.js +0 -1
  250. package/dist/Molecular/CustomIcons/components/Rectangle.js +0 -1
  251. package/dist/Molecular/CustomIcons/components/Revert.js +0 -1
  252. package/dist/Molecular/CustomIcons/components/Star.js +0 -1
  253. package/dist/Molecular/CustomIcons/components/Star2.js +0 -1
  254. package/dist/Molecular/CustomIcons/components/TrafficSources.js +0 -1
  255. package/dist/Molecular/CustomIcons/components/Trash.js +0 -1
  256. package/dist/Molecular/CustomIcons/components/TrashRed.js +0 -1
  257. package/dist/Molecular/CustomIcons/components/Triggers.js +0 -1
  258. package/dist/Molecular/CustomIcons/components/User.js +0 -1
  259. package/dist/Molecular/CustomIcons/components/Visa.js +0 -1
  260. package/dist/Molecular/CustomIcons/components/X.js +0 -1
  261. package/dist/Molecular/FormElement/FormElement.js +0 -1
  262. package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +0 -1
  263. package/dist/Molecular/InputAddress/InputAddress.js +0 -1
  264. package/dist/Molecular/InputPassword/InputPassword.js +0 -1
@@ -0,0 +1,128 @@
1
+ import cn from 'classnames';
2
+
3
+ import { useState } from 'react';
4
+
5
+ export default function usePasswordChecker({ label = 'Password must:' } = {}) {
6
+ const [checkRules, setCheckRules] = useState([]);
7
+ const addCheckRule = data => setCheckRules(state => [...state, data]);
8
+ const handleCheckRule = (type, props = {}, value = '') => {
9
+ const { min, max } = props;
10
+
11
+ switch (type) {
12
+ case 'len':
13
+ if (min && value.length < min) return false;
14
+ if (max && value.length > max) return false;
15
+ return true;
16
+
17
+ case 'lowerCaseContains': {
18
+ const toUpperCase = value.slice().toUpperCase().split('');
19
+ const original = value.slice().split('');
20
+
21
+ return original.reduce((isMatch, char, i) => {
22
+ if (char !== toUpperCase[i]) isMatch = true;
23
+
24
+ return isMatch;
25
+ }, false);
26
+ }
27
+
28
+ case 'upperCaseContains': {
29
+ const toLowerCase = value.slice().toLowerCase().split('');
30
+ const original = value.slice().split('');
31
+
32
+ return original.reduce((isMatch, char, i) => {
33
+ if (char !== toLowerCase[i]) isMatch = true;
34
+
35
+ return isMatch;
36
+ }, false);
37
+ }
38
+
39
+ case 'numberContains': {
40
+ const original = value.slice().split('');
41
+ return original.reduce((isMatch, char) => {
42
+ if (Number.isInteger(Number.parseInt(char, 10))) isMatch = true;
43
+
44
+ return isMatch;
45
+ }, false);
46
+ }
47
+
48
+ case 'specialContains': {
49
+ const original = value.slice().split('');
50
+ return original.reduce((isMatch, char) => {
51
+ if (!Number.isInteger(Number.parseInt(char, 10)) && !char.match(/[a-z]/i))
52
+ isMatch = true;
53
+
54
+ return isMatch;
55
+ }, false);
56
+ }
57
+
58
+ default:
59
+ return false;
60
+ }
61
+ };
62
+ const testCheckRules = (value) => {
63
+ let result = true;
64
+
65
+ setCheckRules((state) => {
66
+ const rules = [...state];
67
+ return rules.map((rule) => {
68
+ const isMatch = handleCheckRule(rule.type, rule.props, value);
69
+ if (!isMatch) result = false;
70
+
71
+ return { ...rule, isMatch };
72
+ });
73
+ });
74
+
75
+ return result;
76
+ };
77
+
78
+ const renderPasswordChecker = () => {
79
+ return (
80
+ <div className="password-checker">
81
+ <div className="password-checker__header">
82
+ <label className="password-checker__header-label">
83
+ {' '}
84
+ {label}
85
+ {' '}
86
+ </label>
87
+ {' '}
88
+ </div>
89
+ {' '}
90
+ <div className="password-checker__body">
91
+ {' '}
92
+ {checkRules.map(({ icon, text, isMatch, key }) => (
93
+ <div
94
+ key={key}
95
+ className={cn('password-checker__body-item', {
96
+ 'password-checker__body-item--match':
97
+ isMatch && isMatch !== null,
98
+ 'password-checker__body-item--dont-match':
99
+ !isMatch && isMatch !== null,
100
+ })}
101
+ >
102
+ <div className="password-checker__body-item__icon">
103
+ {' '}
104
+ {icon}
105
+ {' '}
106
+ </div>
107
+ {' '}
108
+ <div className="password-checker__body-item__text">
109
+ {' '}
110
+ {text}
111
+ {' '}
112
+ </div>
113
+ {' '}
114
+ </div>
115
+ ))}
116
+ {' '}
117
+ </div>
118
+ {' '}
119
+ </div>
120
+ );
121
+ };
122
+
123
+ return {
124
+ addCheckRule,
125
+ testCheckRules,
126
+ renderPasswordChecker,
127
+ };
128
+ }
@@ -0,0 +1,492 @@
1
+ import moment from 'moment-timezone';
2
+
3
+ import { useEffect } from 'react';
4
+
5
+ import { DEFAULT_COLORS, OS } from '../Constants/index.constants';
6
+
7
+ export const uuid = () => Date.now().toString(36) + Math.random().toString(36).substring(2);
8
+
9
+ export function getIsOnlyAnObject(input) {
10
+ return (
11
+ typeof input === 'object' // "отбивает" примитивы и функции
12
+ && input instanceof Object // "отбивает" null
13
+ && !Array.isArray(input) // "отбивает" массивы
14
+ && !(input instanceof Set) // "отбивает" сеты
15
+ && !(input instanceof Map) // "отбивает" мапы
16
+ );
17
+ }
18
+
19
+ export function handleObjectChange(updateObject, updateFunction) {
20
+ return (data, prop = '', isNumber) => {
21
+ let value;
22
+ if (data?.target) {
23
+ value
24
+ = data.target.type === 'checkbox'
25
+ ? data.target.checked
26
+ : data.target.value;
27
+ }
28
+ else {
29
+ value = data;
30
+ }
31
+
32
+ value = isNumber ? Number(value) : value;
33
+
34
+ const props = prop.split('.');
35
+ const currentObject = props.reduce((res, chapter, index) => {
36
+ if (props.length !== index + 1) res = res[chapter];
37
+ return res;
38
+ }, updateObject);
39
+
40
+ currentObject[props.pop()] = value;
41
+ updateFunction();
42
+ }
43
+ }
44
+
45
+ export function useOutsideToggle(ref, setOut, open) {
46
+ function handleClickOutside(event) {
47
+ if (ref.current && !ref.current.contains(event.target)) {
48
+ setOut(open);
49
+ }
50
+ }
51
+ useEffect(() => {
52
+ document.addEventListener('mouseup', handleClickOutside);
53
+ return () => {
54
+ // Unbind the event listener on clean up
55
+ document.removeEventListener('mouseup', handleClickOutside);
56
+ };
57
+ }, [ref]);
58
+ }
59
+
60
+ // export const clone = obj => {
61
+ // const data = obj instanceof Array ? [] : {};
62
+ // for (const i in obj) data[i] = typeof obj[i] === 'object' && obj[i] != null ? clone(obj[i]) : obj[i];
63
+ // return data;
64
+ // };
65
+ // ! Этот правильнее
66
+ export function clone(input) {
67
+ if (input === null || typeof input !== 'object') return input;
68
+ const data = Array.isArray(input) ? [] : {};
69
+ for (const i in input) data[i] = clone(input[i]);
70
+ return data;
71
+ }
72
+
73
+ export async function getResponseClone(res) {
74
+ return await (typeof res?.clone === 'function' ? res.clone() : clone(res))
75
+ }
76
+
77
+ // TimeUtils
78
+ export function transformUTCTimeToLocal(date, format = 'YYYY-MM-DD HH:mm:ss') {
79
+ if (!date) return;
80
+ const utcDate = moment.utc(date).toDate();
81
+ return moment(utcDate, format).local().format(format);
82
+ }
83
+ export function transformLocalTimeToUTC(date, format = 'YYYY-MM-DD HH:mm:ss') {
84
+ if (!date) return;
85
+ return moment(date, format).utc().format(format);
86
+ }
87
+ export function transformUTCHoursToLocal(time, format = 'HH:mm:ss') {
88
+ if (!time) return;
89
+ const splitedTime = time.split(':');
90
+ const offset = moment().utcOffset();
91
+ let HH = Number(splitedTime[0]);
92
+ let mm = Number(splitedTime[1]);
93
+ const ss = splitedTime[2];
94
+ mm = mm + offset;
95
+ while (mm > 59) {
96
+ mm -= 60;
97
+ HH += 1;
98
+ }
99
+ if (HH > 23) HH -= 24;
100
+ while (mm < 0) {
101
+ mm += 60;
102
+ HH -= 1;
103
+ }
104
+ if (HH < 0) HH += 24;
105
+ return `${HH}:${mm}:${ss}`;
106
+ }
107
+
108
+ // ? Намерянно значением по умолчанию назначаю самый информационно-маленький паттерн
109
+ export function transformDateOrTimeOrTogetherToFormat(
110
+ data,
111
+ outputFormat = 'HH:mm',
112
+ additional,
113
+ ) {
114
+ const ERROR_VALUE = 'Invalid date';
115
+ const ERROR_MESSGE = `Invalid input data for ${outputFormat} format`;
116
+ const { parseFormat, isReturnAsMomentInstance } = getIsOnlyAnObject(
117
+ additional,
118
+ )
119
+ ? additional
120
+ : {};
121
+
122
+ if (typeof data !== 'string' && typeof data !== 'number') {
123
+ return isReturnAsMomentInstance ? moment('error') : ERROR_MESSGE;
124
+ }
125
+
126
+ // ? Игнорируем parseFormat, если data пришла как timestamp или если parseFormat не строка
127
+ const momentArgs = [
128
+ data,
129
+ ...(!Number.isNaN(Number(data)) || typeof parseFormat === 'string'
130
+ ? []
131
+ : [parseFormat]),
132
+ ];
133
+
134
+ // ? Задача получить moment-экземпляр, валидный либо невалидный
135
+ const momentInstance = (() => {
136
+ let instance = moment(...momentArgs);
137
+
138
+ // ? Проверяем валидность moment-экземпляр-а путем попытки привести его к выходному формату
139
+ // ? Попадем в этот кейс если
140
+ // ? - data это timestamp
141
+ // ? - data это строка в формате date-time
142
+ // ? - data это строка в формате date (в этом случае время выставится 00:00:00)
143
+ if (instance.format(outputFormat) !== ERROR_VALUE) {
144
+ return instance;
145
+ }
146
+ // ? Если же приведение не удалось, то предполагаем, что data пришла в формате time
147
+ // ? В этом случае создадим объект от текущей даты, распарсим data и установим время
148
+ // ? Корректно обработаются паттерны: 'HH*mm', 'HH*mm*ss', 'HH*mm*ss*любое_количество_ms', где * - любой разделитель
149
+ else if (/^\d\d.\d\d/.test(data)) {
150
+ instance = moment();
151
+ const symbols = data.split('');
152
+
153
+ const timeArr = symbols
154
+ .reduce(
155
+ (acc, symbol, idx) => {
156
+ if (Number.isNaN(Number(symbol))) {
157
+ if (acc.group) acc.result.push(acc.group);
158
+ acc.group = '';
159
+ }
160
+ else {
161
+ acc.group = `${acc.group}${symbol}`;
162
+ }
163
+ if (idx === symbols.length - 1 && acc.group)
164
+ acc.result.push(acc.group);
165
+ return acc;
166
+ },
167
+ { result: [], group: '' },
168
+ )
169
+ // ? reverse используется исключительно для того, чтобы после можно было использовать метод pop, а не shift,
170
+ // ? т.к. методы добавления/извлечения относительно конца массива работают быстрее,
171
+ // ? чем аналогичные относительно начала массива
172
+ .result
173
+ .reverse();
174
+
175
+ instance.hours(Number(timeArr.pop()));
176
+ instance.minutes(Number(timeArr.pop()));
177
+ instance.seconds(timeArr.length ? Number(timeArr.pop()) : 0);
178
+ instance.milliseconds(timeArr.length ? Number(timeArr.pop()) : 0);
179
+ }
180
+ else {
181
+ instance = moment('error');
182
+ } // ? Иначе создаем заведомо невалидный moment-экземпляр
183
+
184
+ return instance;
185
+ })();
186
+
187
+ if (isReturnAsMomentInstance) return momentInstance;
188
+
189
+ const output = momentInstance.format(outputFormat);
190
+ return output === ERROR_VALUE ? ERROR_MESSGE : output;
191
+ }
192
+
193
+ // ? Намерянно значением по умолчанию назначаю самый информационно-маленький паттерн
194
+ export function transformDateOrTimeOrTogetherToFormattedLocal(
195
+ data,
196
+ outputFormat = 'HH:mm',
197
+ additional,
198
+ ) {
199
+ const ERROR_VALUE = 'Invalid date';
200
+ const ERROR_MESSGE = `Invalid input data for ${outputFormat} format`;
201
+
202
+ if (additional && !getIsOnlyAnObject(additional)) {
203
+ throw new Error(
204
+ 'Bad additional [transformDateOrTimeOrTogetherToFormattedLocal]',
205
+ );
206
+ }
207
+
208
+ const compositeAdditional = {
209
+ ...(additional || {}),
210
+ isReturnAsMomentInstance: true,
211
+ };
212
+ const date = transformDateOrTimeOrTogetherToFormat(
213
+ data,
214
+ outputFormat,
215
+ compositeAdditional,
216
+ );
217
+
218
+ const dateWithLocale = date.add(moment().utcOffset(), 'minutes');
219
+ const output = dateWithLocale.format(outputFormat);
220
+
221
+ return output === ERROR_VALUE ? ERROR_MESSGE : output;
222
+ }
223
+
224
+ // принимает обьект и массив ключей обьекта
225
+ // возвращает обьект с теми полями, которых нет в массиве ключей
226
+ export function omitKeys(obj = {}, keys = []) {
227
+ return keys.reduce((acc, key) => {
228
+ const { [key]: omit, ...rest } = acc;
229
+ return rest;
230
+ }, obj)
231
+ }
232
+
233
+ export function logout() {
234
+ window.localStorage.removeItem('accessToken');
235
+ window.localStorage.removeItem('tokenExpires');
236
+ window.location.reload();
237
+ }
238
+
239
+ export function getStyles(el, prop) {
240
+ if (!el) return null;
241
+ if (!prop) return window.getComputedStyle(el);
242
+ return window.getComputedStyle(el).getPropertyValue(prop);
243
+ }
244
+
245
+ export function getColorById(id, colors) {
246
+ if (!id) return '#FF7D00';
247
+
248
+ const idToArr = Array.from(id);
249
+ const colorsArr = colors && colors.length > 0 ? colors : DEFAULT_COLORS;
250
+
251
+ let number = idToArr.reduce((acc, item) => {
252
+ if (Number(item)) {
253
+ return acc + Number(item);
254
+ }
255
+ return acc;
256
+ }, 0);
257
+
258
+ while (number >= colorsArr.length) {
259
+ number -= colorsArr.length;
260
+ }
261
+
262
+ return colorsArr[number];
263
+ }
264
+
265
+ export function debounce(fn, ms) {
266
+ let id = null;
267
+ return (...args) => {
268
+ clearTimeout(id);
269
+ id = setTimeout(() => {
270
+ clearTimeout(id);
271
+ fn(...args);
272
+ }, ms);
273
+ };
274
+ }
275
+
276
+ export function throttle(fn, ms) {
277
+ let id = null;
278
+ return (...args) => {
279
+ if (id) return;
280
+ fn(...args);
281
+ id = setTimeout(() => {
282
+ clearTimeout(id);
283
+ id = null;
284
+ }, ms);
285
+ };
286
+ }
287
+
288
+ export function addBitDepthPoints(value, step = 3) {
289
+ // содержит ли value точку
290
+ const isFraction = value?.includes('.');
291
+
292
+ // взять строку до точки
293
+ const valueBeforeDot = isFraction
294
+ ? value?.slice(0, value?.indexOf('.'))
295
+ : value;
296
+
297
+ // расстановка запятых после каждой 3й цифры с конца
298
+ const intPart = valueBeforeDot
299
+ .split('')
300
+ .reverse()
301
+ .reduce(
302
+ (acc, item, idx) =>
303
+ idx % step === 0 && idx !== 0 ? [...acc, ',', item] : [...acc, item],
304
+ [],
305
+ )
306
+ .reverse()
307
+ .join('');
308
+
309
+ return isFraction ? intPart + value?.slice(value?.indexOf('.')) : intPart;
310
+ }
311
+
312
+ export function changeMeta(key, items = []) {
313
+ const defaultMeta = items.find(i => i.key === 'default');
314
+
315
+ if (key) {
316
+ const item = items.find(i => i.key === key);
317
+ document.title = item?.title ?? defaultMeta?.title;
318
+ document
319
+ .querySelector('meta[name="description"]')
320
+ .setAttribute('content', item?.description ?? defaultMeta?.description);
321
+ }
322
+ }
323
+
324
+ export function firstLetterCapital(str) {
325
+ return typeof str === 'string'
326
+ ? `${str.charAt(0).toUpperCase()}${str.slice(1)}`
327
+ : str
328
+ }
329
+ export const capitalized = firstLetterCapital;
330
+
331
+ export function checkedRef(ref) {
332
+ return ref ? (typeof ref === 'function' ? node => ref(node) : ref) : null
333
+ }
334
+
335
+ export function downloadEmulation(data, filename, type = 'image/*') {
336
+ const file = new Blob([data], { type });
337
+ if (window.navigator.msSaveOrOpenBlob) {
338
+ // IE10+
339
+ window.navigator.msSaveOrOpenBlob(file, filename);
340
+ }
341
+ else {
342
+ // Others
343
+ const a = document.createElement('a');
344
+ const url = URL.createObjectURL(file);
345
+ a.href = url;
346
+ a.download = filename;
347
+ document.body.appendChild(a);
348
+ a.click();
349
+ setTimeout(() => {
350
+ document.body.removeChild(a);
351
+ window.URL.revokeObjectURL(url);
352
+ }, 0);
353
+ }
354
+ }
355
+
356
+ export async function downloadFile({ url, name, type = null }) {
357
+ const response = await fetch(url).then(async res => ({
358
+ data: await res.blob(),
359
+ type: type ?? res.headers.get('content-type'),
360
+ }));
361
+ downloadEmulation(response.data, name, response.type);
362
+ }
363
+
364
+ export function compare(first, second, keys = []) {
365
+ // ? Если типы НЕ равны - не равны априори
366
+ if (typeof first !== typeof second) return false;
367
+ // ? Если ответы на вопрос "массив ли?" не равны, то не равны и типы, значит тоже не равны априори
368
+ if (Array.isArray(first) !== Array.isArray(second)) return false;
369
+ // ? Если прошли if-ку - типы условно равны, можем оценивать тип лишь одного параметра, это будет справедливо и для второго
370
+
371
+ // ? Если примитивы - просто сравниваем. Кейс с null обработан тут.
372
+ if (!(first instanceof Object)) return first === second;
373
+
374
+ // ? Если НЕ приметивы - не важно массив или нет, методы объекта для массива тоже доступны
375
+
376
+ const getComparationStructure = (data) => {
377
+ if (typeof data === 'function') return data.toString();
378
+ if (!(data instanceof Object)) return data;
379
+
380
+ return Object.entries(data)
381
+ .sort((a, b) => (a[0]).localeCompare(b[0]))
382
+ .map(([key, value]) => ([key, getComparationStructure(data[key])]));
383
+ };
384
+
385
+ // ? Получаем структуры для сравнения (с учетом глубины) - массивы массивов, сортируем по ключам,
386
+ const structureForComparingOfFirst = getComparationStructure(first);
387
+ const structureForComparingOfSecond = getComparationStructure(second);
388
+
389
+ return (JSON.stringify(structureForComparingOfFirst) === JSON.stringify(structureForComparingOfSecond));
390
+ }
391
+
392
+ // Set Carret to the End of Input
393
+ export function setCarretToEnd(input) {
394
+ setTimeout(() => {
395
+ const tmp = input.value;
396
+ input.value = '';
397
+ input.value = tmp;
398
+ }, 10);
399
+ }
400
+
401
+ export function compareAlphabetical(a, b, key = 'label') {
402
+ let item1 = a?.[key];
403
+ let item2 = b?.[key];
404
+
405
+ if (typeof item1 !== 'string' || typeof item2 !== 'string') return 0;
406
+
407
+ item1 = item1?.toLowerCase();
408
+ item2 = item2?.toLowerCase();
409
+
410
+ if (item1 < item2) {
411
+ return -1;
412
+ }
413
+ if (item1 > item2) {
414
+ return 1;
415
+ }
416
+ return 0;
417
+ }
418
+
419
+ export function getBase64(file) {
420
+ if (file) {
421
+ return new Promise((resolve, reject) => {
422
+ const reader = new FileReader();
423
+ reader.readAsDataURL(file);
424
+ reader.onload = () => resolve(reader.result);
425
+ reader.onerror = error => reject('Error: ', error);
426
+ });
427
+ }
428
+ }
429
+
430
+ export function renderFileSize(bytes, decimals = 2) {
431
+ if (!Number(bytes)) return '0 Bytes';
432
+
433
+ const k = 1024;
434
+ const dm = decimals < 0 ? 0 : decimals;
435
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
436
+
437
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
438
+
439
+ return `${Number.parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
440
+ }
441
+
442
+ export function getUniqueFileExtensions(extListString) {
443
+ // Split the extensions list into an array
444
+ const extArray = extListString
445
+ ?.split(',')
446
+ .map(ext => ext.trim().toUpperCase());
447
+
448
+ // Remove duplicates using a Set
449
+ const uniqueExts = [...new Set(extArray)];
450
+
451
+ // Join the unique extensions into a string
452
+ return uniqueExts.join(', ');
453
+ }
454
+
455
+ export function getOS() {
456
+ const userAgent = window.navigator.userAgent;
457
+ const platform
458
+ = window.navigator?.userAgentData?.platform || window.navigator.platform;
459
+ const macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'];
460
+ const windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
461
+ const iosPlatforms = ['iPhone', 'iPad', 'iPod'];
462
+ let os = OS.Unknown;
463
+
464
+ if (macosPlatforms.includes(platform)) {
465
+ os = OS.MacOS;
466
+ }
467
+ else if (iosPlatforms.includes(platform)) {
468
+ os = OS.iOS;
469
+ }
470
+ else if (windowsPlatforms.includes(platform)) {
471
+ os = OS.Windows;
472
+ }
473
+ else if (/Android/.test(userAgent)) {
474
+ os = OS.Android;
475
+ }
476
+ else if (/Linux/.test(platform)) {
477
+ os = OS.Linux;
478
+ }
479
+
480
+ return os;
481
+ }
482
+
483
+ String.prototype.longerThan = function (compareWith) {
484
+ return this?.length > compareWith?.length;
485
+ };
486
+ String.prototype.lastIndexEqualsTo = function (index) {
487
+ return this?.length - 1 === index;
488
+ };
489
+
490
+ export function getCorrectTestId({ testId = '', withTier = true }) {
491
+ return testId && testId !== undefined ? `${withTier ? '-' : ''}${testId}` : ''
492
+ }
@@ -0,0 +1,22 @@
1
+ export function AffiliateNetworks(props) {
2
+ return (
3
+ <svg
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ xmlSpace="preserve"
6
+ viewBox="0 0 24 24"
7
+ {...props}
8
+ >
9
+ <path
10
+ fill="none"
11
+ stroke="#9AA0B9"
12
+ d="M17 21v-2c0-2.2-1.8-4-4-4H5c-2.2 0-4 1.8-4 4v2"
13
+ />
14
+ <circle cx={9} cy={7} r={4} fill="none" stroke="#9AA0B9" />
15
+ <path
16
+ fill="none"
17
+ stroke="#9AA0B9"
18
+ d="M23 21v-2c0-1.8-1.2-3.4-3-3.9M16 3.1c2.1.5 3.4 2.7 2.9 4.9-.4 1.4-1.5 2.5-2.9 2.9"
19
+ />
20
+ </svg>
21
+ )
22
+ }
@@ -0,0 +1,24 @@
1
+ export function AlertCircle(props) {
2
+ return (
3
+ <svg
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ xmlSpace="preserve"
6
+ id="Layer_1"
7
+ x={0}
8
+ y={0}
9
+ style={{
10
+ enableBackground: 'new 0 0 24 24',
11
+ }}
12
+ viewBox="0 0 24 24"
13
+ {...props}
14
+ >
15
+ <style>
16
+ {
17
+ '.st0{fill:none;stroke:#f06d8d;strokeWidth:2;strokeLinecap:round;strokeLinejoin:round}'
18
+ }
19
+ </style>
20
+ <circle cx={12} cy={12} r={10} className="st0" />
21
+ <path d="M12 8v4M12 16" className="st0" />
22
+ </svg>
23
+ )
24
+ }