intelicoreact 1.3.6 → 1.3.7

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 (250) hide show
  1. package/dist/Atomic/FormElements/ActionAlert/ActionAlert.js +23 -15
  2. package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +23 -15
  3. package/dist/Atomic/FormElements/Calendar/Calendar.js +124 -69
  4. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +36 -27
  5. package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +39 -23
  6. package/dist/Atomic/FormElements/Datepicker/Datepicker.js +246 -110
  7. package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +85 -44
  8. package/dist/Atomic/FormElements/Dropdown/Dropdown.js +414 -246
  9. package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +9 -5
  10. package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +165 -93
  11. package/dist/Atomic/FormElements/FileLoader/FileLoader.js +64 -39
  12. package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +132 -51
  13. package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +73 -34
  14. package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +75 -54
  15. package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +110 -67
  16. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +71 -27
  17. package/dist/Atomic/FormElements/Input/Input.js +253 -161
  18. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +102 -48
  19. package/dist/Atomic/FormElements/InputColor/InputColor.js +40 -27
  20. package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +44 -21
  21. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +185 -95
  22. package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +57 -32
  23. package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +302 -184
  24. package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +164 -82
  25. package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +16 -11
  26. package/dist/Atomic/FormElements/InputDateRange/dependencies.js +193 -76
  27. package/dist/Atomic/FormElements/InputLink/InputLink.js +58 -34
  28. package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +12 -8
  29. package/dist/Atomic/FormElements/InputMask/InputMask.js +964 -554
  30. package/dist/Atomic/FormElements/InputMask/config.js +1 -1
  31. package/dist/Atomic/FormElements/InputMask/functions.js +43 -17
  32. package/dist/Atomic/FormElements/InputMask2/InputMask2.js +404 -268
  33. package/dist/Atomic/FormElements/InputMask2/config.js +1 -1
  34. package/dist/Atomic/FormElements/InputMask2/functions.js +43 -17
  35. package/dist/Atomic/FormElements/InputMask3/InputMask3.js +459 -299
  36. package/dist/Atomic/FormElements/InputMask3/config.js +1 -1
  37. package/dist/Atomic/FormElements/InputMask3/functions.js +43 -17
  38. package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +113 -53
  39. package/dist/Atomic/FormElements/InputsRow/InputsRow.js +118 -64
  40. package/dist/Atomic/FormElements/Label/Label.js +23 -13
  41. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +349 -217
  42. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +47 -25
  43. package/dist/Atomic/FormElements/NumericInput/NumericInput.js +207 -133
  44. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +61 -29
  45. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +42 -20
  46. package/dist/Atomic/FormElements/RadioInput/RadioInput.js +33 -22
  47. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +43 -20
  48. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +101 -54
  49. package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +102 -59
  50. package/dist/Atomic/FormElements/RangeList/RangeList.js +150 -89
  51. package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +29 -23
  52. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +300 -135
  53. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +571 -381
  54. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +24 -14
  55. package/dist/Atomic/FormElements/Switcher/Switcher.js +29 -24
  56. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +47 -25
  57. package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +32 -20
  58. package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +55 -32
  59. package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +42 -22
  60. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +33 -23
  61. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +120 -51
  62. package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +3 -2
  63. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +46 -23
  64. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +409 -251
  65. package/dist/Atomic/FormElements/Text/Text.js +53 -47
  66. package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +31 -21
  67. package/dist/Atomic/FormElements/Textarea/Textarea.js +27 -16
  68. package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +128 -68
  69. package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +36 -25
  70. package/dist/Atomic/FormElements/TimeRange/TimeRange.js +70 -33
  71. package/dist/Atomic/FormElements/UserContacts/UserContacts.js +124 -58
  72. package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +91 -0
  73. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +80 -48
  74. package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +42 -32
  75. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +60 -40
  76. package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +3 -2
  77. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +69 -50
  78. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
  79. package/dist/Atomic/Layout/Header/Header.js +48 -21
  80. package/dist/Atomic/Layout/MainMenu/MainMenu.js +79 -36
  81. package/dist/Atomic/Layout/Spinner/Spinner.js +14 -8
  82. package/dist/Atomic/UI/Accordion/Accordion.js +48 -18
  83. package/dist/Atomic/UI/Accordion/AccordionItem.js +60 -35
  84. package/dist/Atomic/UI/AccordionTable/AccordionTable.js +106 -49
  85. package/dist/Atomic/UI/AccordionText/AccordionText.js +37 -13
  86. package/dist/Atomic/UI/AdvancedTag/AdvTag.js +94 -48
  87. package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +50 -22
  88. package/dist/Atomic/UI/Alert/Alert.js +44 -20
  89. package/dist/Atomic/UI/Arrow/Arrow.js +35 -15
  90. package/dist/Atomic/UI/Box/Box.js +21 -14
  91. package/dist/Atomic/UI/Button/Button.js +33 -25
  92. package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +31 -22
  93. package/dist/Atomic/UI/Chart/Chart.js +86 -45
  94. package/dist/Atomic/UI/Chart/partial/Chart.constants.js +24 -14
  95. package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +22 -13
  96. package/dist/Atomic/UI/Chart/partial/datasetSetters.js +113 -68
  97. package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +140 -158
  98. package/dist/Atomic/UI/Chart/partial/optionsSetters.js +42 -26
  99. package/dist/Atomic/UI/Chart/partial/utils.js +48 -20
  100. package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +42 -22
  101. package/dist/Atomic/UI/DateTime/DateTime.js +38 -23
  102. package/dist/Atomic/UI/DebugContainer/DebugContainer.js +36 -12
  103. package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +21 -5
  104. package/dist/Atomic/UI/DoubleString/DoubleString.js +50 -27
  105. package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +63 -15
  106. package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +157 -62
  107. package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +110 -47
  108. package/dist/Atomic/UI/Hint/Hint.js +94 -49
  109. package/dist/Atomic/UI/Modal/Modal.js +179 -149
  110. package/dist/Atomic/UI/Modal/ModalHOC.js +21 -12
  111. package/dist/Atomic/UI/Modal/partials/ModalFooter.js +12 -7
  112. package/dist/Atomic/UI/Modal/partials/ModalTitle.js +21 -17
  113. package/dist/Atomic/UI/Modal/partials/useMobileModal.js +151 -93
  114. package/dist/Atomic/UI/ModalBackup/Modal.js +90 -65
  115. package/dist/Atomic/UI/ModalBackup/ModalHOC.js +21 -12
  116. package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +11 -6
  117. package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +19 -15
  118. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +62 -32
  119. package/dist/Atomic/UI/NavLine/NavLine.js +211 -120
  120. package/dist/Atomic/UI/NavLine/Tabs.js +3 -2
  121. package/dist/Atomic/UI/PageTitle/PageTitle.js +17 -13
  122. package/dist/Atomic/UI/PieChart/PieChart.js +21 -11
  123. package/dist/Atomic/UI/Price/Price.js +13 -10
  124. package/dist/Atomic/UI/PriceRange/PriceRange.js +11 -7
  125. package/dist/Atomic/UI/ProgressLine/ProgressLine.js +56 -27
  126. package/dist/Atomic/UI/Status/Status.js +30 -19
  127. package/dist/Atomic/UI/Table/Partials/TdCell.js +71 -28
  128. package/dist/Atomic/UI/Table/Partials/TdHeader.js +16 -7
  129. package/dist/Atomic/UI/Table/Partials/TdRow.js +65 -29
  130. package/dist/Atomic/UI/Table/Partials/TdTitle.js +40 -16
  131. package/dist/Atomic/UI/Table/Table.js +47 -27
  132. package/dist/Atomic/UI/Table/TdTypes/TdActions.js +48 -18
  133. package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +19 -9
  134. package/dist/Atomic/UI/Table/TdTypes/TdRange.js +8 -5
  135. package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +47 -25
  136. package/dist/Atomic/UI/Tag/Tag.js +48 -20
  137. package/dist/Atomic/UI/TagList/TagList.js +150 -80
  138. package/dist/Atomic/UI/UserBox/UserBox.js +26 -14
  139. package/dist/Classes/AbortableFetch.js +422 -283
  140. package/dist/Classes/AnimatedHandler.js +56 -44
  141. package/dist/Classes/RESTAPI/index.js +433 -154
  142. package/dist/Classes/RESTAPI/partials/AbortableFetch.js +428 -290
  143. package/dist/Classes/RESTAPI/partials/ApiBase.js +67 -24
  144. package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +275 -57
  145. package/dist/Classes/RESTAPI/partials/ApiUtils.js +377 -146
  146. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +403 -155
  147. package/dist/Classes/RESTAPI/partials/Utils.js +135 -81
  148. package/dist/Classes/RESTAPI/partials/_outerDependencies.js +6 -2
  149. package/dist/Classes/RESTAPI/partials/_utils.js +395 -101
  150. package/dist/Constants/index.constants.js +15 -8
  151. package/dist/Functions/Portal.js +33 -14
  152. package/dist/Functions/customEventListener.js +20 -5
  153. package/dist/Functions/fieldValueFormatters.js +211 -148
  154. package/dist/Functions/hooks/useFormFieldsChangesManager.js +137 -75
  155. package/dist/Functions/locale/createTranslator.js +27 -13
  156. package/dist/Functions/operations.js +49 -35
  157. package/dist/Functions/presets/inputMaskPresets.js +27 -25
  158. package/dist/Functions/presets/inputPresets.js +22 -19
  159. package/dist/Functions/presets/mobileKeyboardTypesPresets.js +9 -7
  160. package/dist/Functions/schemas.js +15 -6
  161. package/dist/Functions/useClickOutside.js +7 -3
  162. package/dist/Functions/useDebounce.js +25 -11
  163. package/dist/Functions/useFieldFocus.js +67 -42
  164. package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +54 -35
  165. package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +95 -74
  166. package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +91 -55
  167. package/dist/Functions/useFormTools/functions/General.js +99 -80
  168. package/dist/Functions/useFormTools/functions/RenderFields.js +72 -45
  169. package/dist/Functions/useFormTools/functions/usePrevious.js +7 -3
  170. package/dist/Functions/useFormTools/index.js +598 -382
  171. package/dist/Functions/useInputHighlightError.js +52 -27
  172. package/dist/Functions/useIsMobile.js +36 -13
  173. package/dist/Functions/useLocalStorage.js +22 -7
  174. package/dist/Functions/useLocationParams.js +27 -16
  175. package/dist/Functions/useMetaInfo.js +50 -19
  176. package/dist/Functions/useMouseUpOutside.js +5 -2
  177. package/dist/Functions/useOnlineStatus.js +26 -7
  178. package/dist/Functions/usePasswordChecker.js +77 -42
  179. package/dist/Functions/usePrevious.js +7 -3
  180. package/dist/Functions/useResize.js +32 -12
  181. package/dist/Functions/useScrollTo.js +20 -6
  182. package/dist/Functions/useToggle.js +30 -10
  183. package/dist/Functions/utils.js +366 -186
  184. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +32 -21
  185. package/dist/Molecular/CustomIcons/components/AlertCircle.js +32 -21
  186. package/dist/Molecular/CustomIcons/components/AppStore.js +36 -25
  187. package/dist/Molecular/CustomIcons/components/Arrow.js +42 -31
  188. package/dist/Molecular/CustomIcons/components/ArrowDown.js +24 -13
  189. package/dist/Molecular/CustomIcons/components/ArrowLeft.js +27 -16
  190. package/dist/Molecular/CustomIcons/components/ArrowRight.js +27 -16
  191. package/dist/Molecular/CustomIcons/components/ArrowUp.js +24 -13
  192. package/dist/Molecular/CustomIcons/components/Bell.js +22 -11
  193. package/dist/Molecular/CustomIcons/components/Button.js +22 -11
  194. package/dist/Molecular/CustomIcons/components/Campaigns.js +23 -12
  195. package/dist/Molecular/CustomIcons/components/Check.js +23 -12
  196. package/dist/Molecular/CustomIcons/components/Check2.js +22 -11
  197. package/dist/Molecular/CustomIcons/components/ChevronDown.js +22 -11
  198. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +22 -11
  199. package/dist/Molecular/CustomIcons/components/ChevronLeft.js +22 -11
  200. package/dist/Molecular/CustomIcons/components/ChevronRight.js +22 -11
  201. package/dist/Molecular/CustomIcons/components/ChevronUp.js +22 -11
  202. package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +37 -26
  203. package/dist/Molecular/CustomIcons/components/Close.js +24 -13
  204. package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +49 -38
  205. package/dist/Molecular/CustomIcons/components/Delete.js +23 -12
  206. package/dist/Molecular/CustomIcons/components/Edit.js +22 -11
  207. package/dist/Molecular/CustomIcons/components/Email.js +40 -29
  208. package/dist/Molecular/CustomIcons/components/FinturfLogo.js +30 -19
  209. package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +38 -27
  210. package/dist/Molecular/CustomIcons/components/Flows.js +22 -11
  211. package/dist/Molecular/CustomIcons/components/Gift.js +27 -16
  212. package/dist/Molecular/CustomIcons/components/GoogleAuth.js +36 -25
  213. package/dist/Molecular/CustomIcons/components/GooglePlay.js +36 -25
  214. package/dist/Molecular/CustomIcons/components/HelpCircle.js +25 -14
  215. package/dist/Molecular/CustomIcons/components/HelpCircle2.js +26 -15
  216. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +25 -14
  217. package/dist/Molecular/CustomIcons/components/Home.js +25 -14
  218. package/dist/Molecular/CustomIcons/components/Home2.js +28 -17
  219. package/dist/Molecular/CustomIcons/components/Key.js +30 -19
  220. package/dist/Molecular/CustomIcons/components/Landers.js +26 -15
  221. package/dist/Molecular/CustomIcons/components/Lock.js +22 -11
  222. package/dist/Molecular/CustomIcons/components/Mail.js +30 -19
  223. package/dist/Molecular/CustomIcons/components/Mastercard.js +72 -61
  224. package/dist/Molecular/CustomIcons/components/Minus.js +35 -24
  225. package/dist/Molecular/CustomIcons/components/Offers.js +23 -12
  226. package/dist/Molecular/CustomIcons/components/Pause.js +35 -24
  227. package/dist/Molecular/CustomIcons/components/PayPal.js +49 -38
  228. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +36 -25
  229. package/dist/Molecular/CustomIcons/components/Phone.js +37 -26
  230. package/dist/Molecular/CustomIcons/components/Play.js +35 -24
  231. package/dist/Molecular/CustomIcons/components/Plus.js +35 -24
  232. package/dist/Molecular/CustomIcons/components/Profile.js +27 -16
  233. package/dist/Molecular/CustomIcons/components/QRCode.js +37 -26
  234. package/dist/Molecular/CustomIcons/components/Rectangle.js +22 -11
  235. package/dist/Molecular/CustomIcons/components/Revert.js +25 -14
  236. package/dist/Molecular/CustomIcons/components/Star.js +21 -10
  237. package/dist/Molecular/CustomIcons/components/Star2.js +23 -12
  238. package/dist/Molecular/CustomIcons/components/TrafficSources.js +25 -14
  239. package/dist/Molecular/CustomIcons/components/Trash.js +22 -11
  240. package/dist/Molecular/CustomIcons/components/TrashRed.js +22 -11
  241. package/dist/Molecular/CustomIcons/components/Triggers.js +22 -11
  242. package/dist/Molecular/CustomIcons/components/User.js +27 -16
  243. package/dist/Molecular/CustomIcons/components/Visa.js +38 -27
  244. package/dist/Molecular/CustomIcons/components/X.js +22 -11
  245. package/dist/Molecular/CustomIcons/index.js +183 -61
  246. package/dist/Molecular/FormElement/FormElement.js +27 -18
  247. package/dist/Molecular/InputAddress/InputAddress.js +312 -176
  248. package/dist/Molecular/InputPassword/InputPassword.js +39 -15
  249. package/dist/index.js +3 -1
  250. package/package.json +1 -1
@@ -1,21 +1,26 @@
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 = void 0;
9
+
8
10
  var _react = _interopRequireDefault(require("react"));
11
+
9
12
  var _classnames = _interopRequireDefault(require("classnames"));
10
- const ModalFooter = _ref => {
11
- let {
12
- className = '',
13
- children,
14
- wrapperRef
15
- } = _ref;
13
+
14
+ var ModalFooter = function ModalFooter(_ref) {
15
+ var _ref$className = _ref.className,
16
+ className = _ref$className === void 0 ? '' : _ref$className,
17
+ children = _ref.children,
18
+ wrapperRef = _ref.wrapperRef;
16
19
  return /*#__PURE__*/_react.default.createElement("div", {
17
20
  ref: wrapperRef,
18
21
  className: (0, _classnames.default)('modal__footer', className)
19
22
  }, children);
20
23
  };
21
- var _default = exports.default = ModalFooter;
24
+
25
+ var _default = ModalFooter;
26
+ exports.default = _default;
@@ -1,32 +1,34 @@
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 = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
8
12
  var _react = _interopRequireDefault(require("react"));
13
+
9
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
+
10
16
  var _reactFeather = require("react-feather");
11
- const ModalTitle = _ref => {
12
- let {
13
- variant = 'primary',
14
- children,
15
- isForced,
16
- onClose,
17
- noHeaderCloseBtn,
18
- className,
19
- wrapperRef
20
- } = _ref;
17
+
18
+ var ModalTitle = function ModalTitle(_ref) {
19
+ var _ref$variant = _ref.variant,
20
+ variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
21
+ children = _ref.children,
22
+ isForced = _ref.isForced,
23
+ onClose = _ref.onClose,
24
+ noHeaderCloseBtn = _ref.noHeaderCloseBtn,
25
+ className = _ref.className,
26
+ wrapperRef = _ref.wrapperRef;
21
27
  return /*#__PURE__*/_react.default.createElement("div", {
22
28
  ref: wrapperRef,
23
- className: (0, _classnames.default)('modal__header', className, {
24
- ["modal__header-".concat(variant)]: variant
25
- })
29
+ className: (0, _classnames.default)('modal__header', className, (0, _defineProperty2.default)({}, "modal__header-".concat(variant), variant))
26
30
  }, /*#__PURE__*/_react.default.createElement("span", {
27
- className: (0, _classnames.default)('modal__header-title', {
28
- ["modal__header-".concat(variant, "-title")]: variant
29
- })
31
+ className: (0, _classnames.default)('modal__header-title', (0, _defineProperty2.default)({}, "modal__header-".concat(variant, "-title"), variant))
30
32
  }, children), !isForced && /*#__PURE__*/_react.default.createElement("div", {
31
33
  "data-testid": 'modal--button-closeCross',
32
34
  onClick: onClose,
@@ -37,4 +39,6 @@ const ModalTitle = _ref => {
37
39
  className: "modal-close-icon"
38
40
  })));
39
41
  };
40
- var _default = exports.default = ModalTitle;
42
+
43
+ var _default = ModalTitle;
44
+ exports.default = _default;
@@ -1,159 +1,217 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
4
7
  Object.defineProperty(exports, "__esModule", {
5
8
  value: true
6
9
  });
7
10
  exports.default = useMobileModal;
11
+
12
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
13
+
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
+
8
16
  var _react = _interopRequireWildcard(require("react"));
9
- var _useIsMobile = _interopRequireDefault(require("../../../../Functions/useIsMobile"));
10
- 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); }
11
- 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; }
12
- const SCROLL_DIRECTION = {
17
+
18
+ var _useIsMobile2 = _interopRequireDefault(require("../../../../Functions/useIsMobile"));
19
+
20
+ 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); }
21
+
22
+ 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; }
23
+
24
+ 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; }
25
+
26
+ 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) { (0, _defineProperty2.default)(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; }
27
+
28
+ var SCROLL_DIRECTION = {
13
29
  UP: 'up',
14
30
  DOWN: 'down'
15
31
  };
32
+
16
33
  function useMobileModal(_ref) {
17
- var _modalMobileHeaderRef3, _modalMobileFooterRef3;
18
- let {
19
- modalRef = null,
20
- withMobileLogic = false,
21
- isOpen
22
- } = _ref;
23
- const modalMobileContainerRef = (0, _react.useRef)(null);
24
- const modalMobileHeaderRef = (0, _react.useRef)(null);
25
- const modalMobileFooterRef = (0, _react.useRef)(null);
26
- const modalMobileBodyRef = (0, _react.useRef)(null);
27
- const {
28
- isMobile
29
- } = (0, _useIsMobile.default)();
30
- const [modalHeight, setModalHeight] = (0, _react.useState)(0);
31
- const [modalsLogic, setModalsLogic] = (0, _react.useState)({
34
+ var _modalMobileHeaderRef5, _modalMobileHeaderRef6, _modalMobileFooterRef5, _modalMobileFooterRef6;
35
+
36
+ var _ref$modalRef = _ref.modalRef,
37
+ modalRef = _ref$modalRef === void 0 ? null : _ref$modalRef,
38
+ _ref$withMobileLogic = _ref.withMobileLogic,
39
+ withMobileLogic = _ref$withMobileLogic === void 0 ? false : _ref$withMobileLogic,
40
+ isOpen = _ref.isOpen;
41
+ var modalMobileContainerRef = (0, _react.useRef)(null);
42
+ var modalMobileHeaderRef = (0, _react.useRef)(null);
43
+ var modalMobileFooterRef = (0, _react.useRef)(null);
44
+ var modalMobileBodyRef = (0, _react.useRef)(null);
45
+
46
+ var _useIsMobile = (0, _useIsMobile2.default)(),
47
+ isMobile = _useIsMobile.isMobile;
48
+
49
+ var _useState = (0, _react.useState)(0),
50
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
51
+ modalHeight = _useState2[0],
52
+ setModalHeight = _useState2[1];
53
+
54
+ var _useState3 = (0, _react.useState)({
32
55
  IS_HEADER_HIDDEN: false,
33
56
  IS_HEADER_STICKY: false,
34
57
  IS_FOOTER_HIDDEN: false,
35
58
  IS_FOOTER_STICKY: false
36
- });
37
- const [modalsLogicProps, setModalsLogicProps] = (0, _react.useState)({
59
+ }),
60
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
61
+ modalsLogic = _useState4[0],
62
+ setModalsLogic = _useState4[1];
63
+
64
+ var _useState5 = (0, _react.useState)({
38
65
  headerHeight: 0,
39
66
  footerHeight: 0
40
- });
41
- const [scrollDirection, setScrollDirection] = (0, _react.useState)(SCROLL_DIRECTION.UP);
42
- const [scrollTopPrev, setScrollTopPrev] = (0, _react.useState)(0);
43
- const [scrollTop, setScrollTop] = (0, _react.useState)(0);
44
- const [scrollHeight, setScrollHeight] = (0, _react.useState)(1);
67
+ }),
68
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
69
+ modalsLogicProps = _useState6[0],
70
+ setModalsLogicProps = _useState6[1];
71
+
72
+ var _useState7 = (0, _react.useState)(SCROLL_DIRECTION.UP),
73
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
74
+ scrollDirection = _useState8[0],
75
+ setScrollDirection = _useState8[1];
76
+
77
+ var _useState9 = (0, _react.useState)(0),
78
+ _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
79
+ scrollTopPrev = _useState10[0],
80
+ setScrollTopPrev = _useState10[1];
45
81
 
82
+ var _useState11 = (0, _react.useState)(0),
83
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
84
+ scrollTop = _useState12[0],
85
+ setScrollTop = _useState12[1];
86
+
87
+ var _useState13 = (0, _react.useState)(1),
88
+ _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
89
+ scrollHeight = _useState14[0],
90
+ setScrollHeight = _useState14[1];
46
91
  /* MODALS LOGIC | BEGIN */
47
92
  // Count ScrollTop
48
- (0, _react.useLayoutEffect)(() => {
49
- const el = modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current;
93
+
94
+
95
+ (0, _react.useLayoutEffect)(function () {
96
+ var el = modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current;
97
+
50
98
  if (el) {
51
- el.addEventListener('scroll', () => {
52
- setScrollTop(scrollTop => {
99
+ el.addEventListener('scroll', function () {
100
+ setScrollTop(function (scrollTop) {
53
101
  if (scrollTop !== el.scrollTop) setScrollTopPrev(scrollTop);
54
102
  return el.scrollTop;
55
103
  });
56
104
  });
57
105
  }
58
- }, [modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current]);
59
- // Count ScrollDirection
60
- (0, _react.useEffect)(() => {
61
- setScrollDirection(prevScrollDirection => scrollTop < scrollTopPrev ? SCROLL_DIRECTION.UP : scrollTop > scrollTopPrev ? SCROLL_DIRECTION.DOWN : prevScrollDirection);
62
- }, [scrollTop, scrollTopPrev]);
63
- // Dynamic Modal Positioning
64
- (0, _react.useLayoutEffect)(() => {
106
+ }, [modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current]); // Count ScrollDirection
107
+
108
+ (0, _react.useEffect)(function () {
109
+ setScrollDirection(function (prevScrollDirection) {
110
+ return scrollTop < scrollTopPrev ? SCROLL_DIRECTION.UP : scrollTop > scrollTopPrev ? SCROLL_DIRECTION.DOWN : prevScrollDirection;
111
+ });
112
+ }, [scrollTop, scrollTopPrev]); // Dynamic Modal Positioning
113
+
114
+ (0, _react.useLayoutEffect)(function () {
65
115
  if (isOpen) {
66
- const modalStyle = modalRef !== null && modalRef !== void 0 && modalRef.current ? (modalRef === null || modalRef === void 0 ? void 0 : modalRef.current.currentStyle) || window.getComputedStyle(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current) : {};
67
- const computedModalHeight = modalRef !== null && modalRef !== void 0 && modalRef.current ? modalHeight + parseFloat((modalStyle === null || modalStyle === void 0 ? void 0 : modalStyle.marginTop) || 0) : 0;
68
- const windowHeight = document.documentElement.clientHeight || window.screen.availHeight || window.screen.height;
116
+ var modalStyle = modalRef !== null && modalRef !== void 0 && modalRef.current ? (modalRef === null || modalRef === void 0 ? void 0 : modalRef.current.currentStyle) || window.getComputedStyle(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current) : {};
117
+ var computedModalHeight = modalRef !== null && modalRef !== void 0 && modalRef.current ? modalHeight + parseFloat((modalStyle === null || modalStyle === void 0 ? void 0 : modalStyle.marginTop) || 0) : 0;
118
+ var windowHeight = document.documentElement.clientHeight || window.screen.availHeight || window.screen.height;
119
+
69
120
  if (modalMobileContainerRef !== null && modalMobileContainerRef !== void 0 && modalMobileContainerRef.current) {
70
121
  if (computedModalHeight <= windowHeight) {
71
122
  modalMobileContainerRef.current.style.display = 'flex';
72
123
  modalMobileContainerRef.current.style.alignItems = 'flex-end';
73
124
  } else {
74
- var _modalMobileContainer, _modalMobileContainer2;
75
- (_modalMobileContainer = modalMobileContainerRef.current) === null || _modalMobileContainer === void 0 || (_modalMobileContainer = _modalMobileContainer.style) === null || _modalMobileContainer === void 0 || _modalMobileContainer.removeProperty('display');
76
- (_modalMobileContainer2 = modalMobileContainerRef.current) === null || _modalMobileContainer2 === void 0 || (_modalMobileContainer2 = _modalMobileContainer2.style) === null || _modalMobileContainer2 === void 0 || _modalMobileContainer2.removeProperty('align-items');
125
+ var _modalMobileContainer, _modalMobileContainer2, _modalMobileContainer3, _modalMobileContainer4;
126
+
127
+ (_modalMobileContainer = modalMobileContainerRef.current) === null || _modalMobileContainer === void 0 ? void 0 : (_modalMobileContainer2 = _modalMobileContainer.style) === null || _modalMobileContainer2 === void 0 ? void 0 : _modalMobileContainer2.removeProperty('display');
128
+ (_modalMobileContainer3 = modalMobileContainerRef.current) === null || _modalMobileContainer3 === void 0 ? void 0 : (_modalMobileContainer4 = _modalMobileContainer3.style) === null || _modalMobileContainer4 === void 0 ? void 0 : _modalMobileContainer4.removeProperty('align-items');
77
129
  }
78
130
  }
79
131
  }
80
- }, [modalsLogicProps, isOpen, isMobile, modalHeight]);
132
+ }, [modalsLogicProps, isOpen, isMobile, modalHeight]); // Calculating
81
133
 
82
- // Calculating
83
- (0, _react.useLayoutEffect)(() => {
134
+ (0, _react.useLayoutEffect)(function () {
84
135
  if (isMobile && isOpen) {
85
- var _modalRef$current;
86
- const newModalHeight = modalRef === null || modalRef === void 0 || (_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 || (_modalRef$current = _modalRef$current.getBoundingClientRect()) === null || _modalRef$current === void 0 ? void 0 : _modalRef$current.height;
136
+ var _modalRef$current, _modalRef$current$get;
137
+
138
+ var newModalHeight = modalRef === null || modalRef === void 0 ? void 0 : (_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 ? void 0 : (_modalRef$current$get = _modalRef$current.getBoundingClientRect()) === null || _modalRef$current$get === void 0 ? void 0 : _modalRef$current$get.height;
139
+
87
140
  if (modalHeight !== newModalHeight) {
88
141
  setModalHeight(newModalHeight);
89
142
  }
90
143
  }
91
144
  });
92
- (0, _react.useEffect)(() => {
145
+ (0, _react.useEffect)(function () {
93
146
  if (isMobile && withMobileLogic) {
94
- const {
95
- footerHeight,
96
- headerHeight
97
- } = modalsLogicProps;
98
- setModalsLogic(prevStickyLogic => ({
99
- IS_HEADER_HIDDEN: scrollDirection === SCROLL_DIRECTION.DOWN || scrollTop === 0,
100
- IS_HEADER_STICKY: scrollDirection === SCROLL_DIRECTION.UP && scrollTop !== 0 && (scrollTop >= headerHeight || prevStickyLogic.IS_HEADER_STICKY),
101
- IS_FOOTER_HIDDEN: scrollDirection === SCROLL_DIRECTION.UP || scrollHeight === parseInt(scrollTop),
102
- IS_FOOTER_STICKY: scrollDirection === SCROLL_DIRECTION.DOWN && (scrollHeight - scrollTop >= footerHeight || prevStickyLogic.IS_FOOTER_STICKY)
103
- }));
104
- }
105
- }, [scrollTop, scrollHeight, isMobile, withMobileLogic, scrollDirection, modalsLogicProps, modalHeight]);
106
- (0, _react.useLayoutEffect)(() => {
107
- var _modalMobileHeaderRef;
108
- if ((modalMobileHeaderRef === null || modalMobileHeaderRef === void 0 || (_modalMobileHeaderRef = modalMobileHeaderRef.current) === null || _modalMobileHeaderRef === void 0 || (_modalMobileHeaderRef = _modalMobileHeaderRef.getBoundingClientRect()) === null || _modalMobileHeaderRef === void 0 ? void 0 : _modalMobileHeaderRef.height) !== undefined) {
109
- setModalsLogicProps(state => {
110
- var _modalMobileHeaderRef2;
147
+ var footerHeight = modalsLogicProps.footerHeight,
148
+ headerHeight = modalsLogicProps.headerHeight;
149
+ setModalsLogic(function (prevStickyLogic) {
111
150
  return {
112
- ...state,
113
- headerHeight: modalMobileHeaderRef === null || modalMobileHeaderRef === void 0 || (_modalMobileHeaderRef2 = modalMobileHeaderRef.current) === null || _modalMobileHeaderRef2 === void 0 || (_modalMobileHeaderRef2 = _modalMobileHeaderRef2.getBoundingClientRect()) === null || _modalMobileHeaderRef2 === void 0 ? void 0 : _modalMobileHeaderRef2.height
151
+ IS_HEADER_HIDDEN: scrollDirection === SCROLL_DIRECTION.DOWN || scrollTop === 0,
152
+ IS_HEADER_STICKY: scrollDirection === SCROLL_DIRECTION.UP && scrollTop !== 0 && (scrollTop >= headerHeight || prevStickyLogic.IS_HEADER_STICKY),
153
+ IS_FOOTER_HIDDEN: scrollDirection === SCROLL_DIRECTION.UP || scrollHeight === parseInt(scrollTop),
154
+ IS_FOOTER_STICKY: scrollDirection === SCROLL_DIRECTION.DOWN && (scrollHeight - scrollTop >= footerHeight || prevStickyLogic.IS_FOOTER_STICKY)
114
155
  };
115
156
  });
116
157
  }
117
- }, [modalMobileHeaderRef === null || modalMobileHeaderRef === void 0 || (_modalMobileHeaderRef3 = modalMobileHeaderRef.current) === null || _modalMobileHeaderRef3 === void 0 || (_modalMobileHeaderRef3 = _modalMobileHeaderRef3.getBoundingClientRect()) === null || _modalMobileHeaderRef3 === void 0 ? void 0 : _modalMobileHeaderRef3.height]);
118
- (0, _react.useLayoutEffect)(() => {
119
- var _modalMobileFooterRef;
120
- if ((modalMobileFooterRef === null || modalMobileFooterRef === void 0 || (_modalMobileFooterRef = modalMobileFooterRef.current) === null || _modalMobileFooterRef === void 0 || (_modalMobileFooterRef = _modalMobileFooterRef.getBoundingClientRect()) === null || _modalMobileFooterRef === void 0 ? void 0 : _modalMobileFooterRef.height) !== undefined) {
121
- setModalsLogicProps(state => {
122
- var _modalMobileFooterRef2;
123
- return {
124
- ...state,
125
- footerHeight: modalMobileFooterRef === null || modalMobileFooterRef === void 0 || (_modalMobileFooterRef2 = modalMobileFooterRef.current) === null || _modalMobileFooterRef2 === void 0 || (_modalMobileFooterRef2 = _modalMobileFooterRef2.getBoundingClientRect()) === null || _modalMobileFooterRef2 === void 0 ? void 0 : _modalMobileFooterRef2.height
126
- };
158
+ }, [scrollTop, scrollHeight, isMobile, withMobileLogic, scrollDirection, modalsLogicProps, modalHeight]);
159
+ (0, _react.useLayoutEffect)(function () {
160
+ var _modalMobileHeaderRef, _modalMobileHeaderRef2;
161
+
162
+ if ((modalMobileHeaderRef === null || modalMobileHeaderRef === void 0 ? void 0 : (_modalMobileHeaderRef = modalMobileHeaderRef.current) === null || _modalMobileHeaderRef === void 0 ? void 0 : (_modalMobileHeaderRef2 = _modalMobileHeaderRef.getBoundingClientRect()) === null || _modalMobileHeaderRef2 === void 0 ? void 0 : _modalMobileHeaderRef2.height) !== undefined) {
163
+ setModalsLogicProps(function (state) {
164
+ var _modalMobileHeaderRef3, _modalMobileHeaderRef4;
165
+
166
+ return _objectSpread(_objectSpread({}, state), {}, {
167
+ headerHeight: modalMobileHeaderRef === null || modalMobileHeaderRef === void 0 ? void 0 : (_modalMobileHeaderRef3 = modalMobileHeaderRef.current) === null || _modalMobileHeaderRef3 === void 0 ? void 0 : (_modalMobileHeaderRef4 = _modalMobileHeaderRef3.getBoundingClientRect()) === null || _modalMobileHeaderRef4 === void 0 ? void 0 : _modalMobileHeaderRef4.height
168
+ });
127
169
  });
128
170
  }
129
- }, [modalMobileFooterRef === null || modalMobileFooterRef === void 0 || (_modalMobileFooterRef3 = modalMobileFooterRef.current) === null || _modalMobileFooterRef3 === void 0 || (_modalMobileFooterRef3 = _modalMobileFooterRef3.getBoundingClientRect()) === null || _modalMobileFooterRef3 === void 0 ? void 0 : _modalMobileFooterRef3.height]);
130
- (0, _react.useEffect)(() => {
171
+ }, [modalMobileHeaderRef === null || modalMobileHeaderRef === void 0 ? void 0 : (_modalMobileHeaderRef5 = modalMobileHeaderRef.current) === null || _modalMobileHeaderRef5 === void 0 ? void 0 : (_modalMobileHeaderRef6 = _modalMobileHeaderRef5.getBoundingClientRect()) === null || _modalMobileHeaderRef6 === void 0 ? void 0 : _modalMobileHeaderRef6.height]);
172
+ (0, _react.useLayoutEffect)(function () {
173
+ var _modalMobileFooterRef, _modalMobileFooterRef2;
174
+
175
+ if ((modalMobileFooterRef === null || modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef = modalMobileFooterRef.current) === null || _modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef2 = _modalMobileFooterRef.getBoundingClientRect()) === null || _modalMobileFooterRef2 === void 0 ? void 0 : _modalMobileFooterRef2.height) !== undefined) {
176
+ setModalsLogicProps(function (state) {
177
+ var _modalMobileFooterRef3, _modalMobileFooterRef4;
178
+
179
+ return _objectSpread(_objectSpread({}, state), {}, {
180
+ footerHeight: modalMobileFooterRef === null || modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef3 = modalMobileFooterRef.current) === null || _modalMobileFooterRef3 === void 0 ? void 0 : (_modalMobileFooterRef4 = _modalMobileFooterRef3.getBoundingClientRect()) === null || _modalMobileFooterRef4 === void 0 ? void 0 : _modalMobileFooterRef4.height
181
+ });
182
+ });
183
+ }
184
+ }, [modalMobileFooterRef === null || modalMobileFooterRef === void 0 ? void 0 : (_modalMobileFooterRef5 = modalMobileFooterRef.current) === null || _modalMobileFooterRef5 === void 0 ? void 0 : (_modalMobileFooterRef6 = _modalMobileFooterRef5.getBoundingClientRect()) === null || _modalMobileFooterRef6 === void 0 ? void 0 : _modalMobileFooterRef6.height]);
185
+ (0, _react.useEffect)(function () {
131
186
  if (modalMobileContainerRef !== null && modalMobileContainerRef !== void 0 && modalMobileContainerRef.current) {
132
- var _modalMobileContainer3, _modalMobileContainer4;
133
- setScrollHeight((modalMobileContainerRef === null || modalMobileContainerRef === void 0 || (_modalMobileContainer3 = modalMobileContainerRef.current) === null || _modalMobileContainer3 === void 0 ? void 0 : _modalMobileContainer3.scrollHeight) - (modalMobileContainerRef === null || modalMobileContainerRef === void 0 || (_modalMobileContainer4 = modalMobileContainerRef.current) === null || _modalMobileContainer4 === void 0 ? void 0 : _modalMobileContainer4.clientHeight));
187
+ var _modalMobileContainer5, _modalMobileContainer6;
188
+
189
+ setScrollHeight((modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : (_modalMobileContainer5 = modalMobileContainerRef.current) === null || _modalMobileContainer5 === void 0 ? void 0 : _modalMobileContainer5.scrollHeight) - (modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : (_modalMobileContainer6 = modalMobileContainerRef.current) === null || _modalMobileContainer6 === void 0 ? void 0 : _modalMobileContainer6.clientHeight));
134
190
  }
135
191
  }, [scrollTop, modalMobileContainerRef === null || modalMobileContainerRef === void 0 ? void 0 : modalMobileContainerRef.current]);
136
192
  /* MODALS LOGIC | END */
137
193
 
138
- const renderMobileModal = modal => {
194
+ var renderMobileModal = function renderMobileModal(modal) {
139
195
  return /*#__PURE__*/_react.default.createElement("div", {
140
196
  className: "modal-mobile-container",
141
197
  ref: modalMobileContainerRef
142
198
  }, modal);
143
199
  };
144
- const renderModal = modal => {
200
+
201
+ var renderModal = function renderModal(modal) {
145
202
  return isMobile && withMobileLogic ? renderMobileModal(modal) : modal;
146
203
  };
204
+
147
205
  return {
148
- modalMobileContainerRef,
149
- modalMobileHeaderRef,
150
- modalMobileBodyRef,
151
- modalMobileFooterRef,
206
+ modalMobileContainerRef: modalMobileContainerRef,
207
+ modalMobileHeaderRef: modalMobileHeaderRef,
208
+ modalMobileBodyRef: modalMobileBodyRef,
209
+ modalMobileFooterRef: modalMobileFooterRef,
152
210
  MODALS_LOGIC: modalsLogic,
153
- SCROLL_DIRECTION,
154
- scrollTop,
155
- scrollHeight,
156
- renderModal,
157
- isMobile
211
+ SCROLL_DIRECTION: SCROLL_DIRECTION,
212
+ scrollTop: scrollTop,
213
+ scrollHeight: scrollHeight,
214
+ renderModal: renderModal,
215
+ isMobile: isMobile
158
216
  };
159
217
  }
@@ -1,101 +1,120 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
4
7
  Object.defineProperty(exports, "__esModule", {
5
8
  value: true
6
9
  });
7
10
  exports.renderModalTitle = exports.default = exports.KEY_CODE = void 0;
11
+
8
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+
9
14
  var _react = _interopRequireWildcard(require("react"));
15
+
10
16
  var _classnames = _interopRequireDefault(require("classnames"));
17
+
11
18
  var _reactFeather = require("react-feather");
19
+
12
20
  var _Button = _interopRequireDefault(require("../Button/Button"));
21
+
13
22
  require("./Modal.scss");
23
+
14
24
  var _ModalFooter = _interopRequireDefault(require("./partials/ModalFooter"));
25
+
15
26
  var _ModalTitle = _interopRequireDefault(require("./partials/ModalTitle"));
16
- 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); }
17
- 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; }
18
- const KEY_CODE = exports.KEY_CODE = Object.freeze({
27
+
28
+ 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); }
29
+
30
+ 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; }
31
+
32
+ var KEY_CODE = Object.freeze({
19
33
  ENTER: 13,
20
34
  ESC: 27
21
35
  });
22
- const renderModalTitle = _ref => {
23
- let {
24
- mode,
25
- title,
26
- onlyTitle
27
- } = _ref;
36
+ exports.KEY_CODE = KEY_CODE;
37
+
38
+ var renderModalTitle = function renderModalTitle(_ref) {
39
+ var mode = _ref.mode,
40
+ title = _ref.title,
41
+ onlyTitle = _ref.onlyTitle;
28
42
  if (mode && mode !== 'default' && !onlyTitle) return "".concat(mode[0].toUpperCase() + mode.slice(1), " ").concat(title);
29
43
  return title;
30
44
  };
45
+
31
46
  exports.renderModalTitle = renderModalTitle;
32
- const Modal = _ref2 => {
33
- let {
34
- zIndex = 100,
35
- isOpen,
36
- onConfirm,
37
- onDecline,
38
- closeModal,
39
- children,
40
- className,
41
- title,
42
- variant,
43
- onlyTitle,
44
- mode,
45
- size,
46
- atributesForModalBody = {},
47
- confirmBtnClassName,
48
- confirmBtnLabel,
49
- confirmBtnVariant = 'primary',
50
- confirmBtnDisable,
51
- confirmBtnIcon,
52
- isConfirmBtnIconPositionRight,
53
- noConfirmBtn,
54
- noCloseBtn,
55
- noFooter,
56
- noHeader,
57
- closeBtnClassName,
58
- closeBtnText,
59
- closeBtnVariant,
60
- closeBtnDisable,
61
- closeBtnIcon,
62
- forced,
63
- btnClassNames,
64
- isCloseBtnIconPositionRight,
65
- submitOnEnter = false,
66
- closeOnEsc = false,
67
- leftContentOfFooter,
68
- testId,
69
- noHeaderCloseBtn
70
- } = _ref2;
47
+
48
+ var Modal = function Modal(_ref2) {
49
+ var _ref2$zIndex = _ref2.zIndex,
50
+ zIndex = _ref2$zIndex === void 0 ? 100 : _ref2$zIndex,
51
+ isOpen = _ref2.isOpen,
52
+ onConfirm = _ref2.onConfirm,
53
+ onDecline = _ref2.onDecline,
54
+ closeModal = _ref2.closeModal,
55
+ children = _ref2.children,
56
+ className = _ref2.className,
57
+ title = _ref2.title,
58
+ variant = _ref2.variant,
59
+ onlyTitle = _ref2.onlyTitle,
60
+ mode = _ref2.mode,
61
+ size = _ref2.size,
62
+ _ref2$atributesForMod = _ref2.atributesForModalBody,
63
+ atributesForModalBody = _ref2$atributesForMod === void 0 ? {} : _ref2$atributesForMod,
64
+ confirmBtnClassName = _ref2.confirmBtnClassName,
65
+ confirmBtnLabel = _ref2.confirmBtnLabel,
66
+ _ref2$confirmBtnVaria = _ref2.confirmBtnVariant,
67
+ confirmBtnVariant = _ref2$confirmBtnVaria === void 0 ? 'primary' : _ref2$confirmBtnVaria,
68
+ confirmBtnDisable = _ref2.confirmBtnDisable,
69
+ confirmBtnIcon = _ref2.confirmBtnIcon,
70
+ isConfirmBtnIconPositionRight = _ref2.isConfirmBtnIconPositionRight,
71
+ noConfirmBtn = _ref2.noConfirmBtn,
72
+ noCloseBtn = _ref2.noCloseBtn,
73
+ noFooter = _ref2.noFooter,
74
+ noHeader = _ref2.noHeader,
75
+ closeBtnClassName = _ref2.closeBtnClassName,
76
+ closeBtnText = _ref2.closeBtnText,
77
+ closeBtnVariant = _ref2.closeBtnVariant,
78
+ closeBtnDisable = _ref2.closeBtnDisable,
79
+ closeBtnIcon = _ref2.closeBtnIcon,
80
+ forced = _ref2.forced,
81
+ btnClassNames = _ref2.btnClassNames,
82
+ isCloseBtnIconPositionRight = _ref2.isCloseBtnIconPositionRight,
83
+ _ref2$submitOnEnter = _ref2.submitOnEnter,
84
+ submitOnEnter = _ref2$submitOnEnter === void 0 ? false : _ref2$submitOnEnter,
85
+ _ref2$closeOnEsc = _ref2.closeOnEsc,
86
+ closeOnEsc = _ref2$closeOnEsc === void 0 ? false : _ref2$closeOnEsc,
87
+ leftContentOfFooter = _ref2.leftContentOfFooter,
88
+ testId = _ref2.testId,
89
+ noHeaderCloseBtn = _ref2.noHeaderCloseBtn;
71
90
  if (!isOpen) return null;
72
- const handle = {
73
- confirm: () => {
74
- onConfirm === null || onConfirm === void 0 || onConfirm();
91
+ var handle = {
92
+ confirm: function confirm() {
93
+ onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm();
75
94
  },
76
- decline: () => {
95
+ decline: function decline() {
77
96
  //? closeModal используется для ESC и оверлея, давно хотелось иметь возможность разделить
78
97
  //? Теперь можно не передавать closeModal, а для cancel-кнопки передать отдельный обработчик
79
- if (typeof onDecline === 'function') onDecline();else closeModal === null || closeModal === void 0 || closeModal();
98
+ if (typeof onDecline === 'function') onDecline();else closeModal === null || closeModal === void 0 ? void 0 : closeModal();
80
99
  },
81
- pressEnter: event => {
100
+ pressEnter: function pressEnter(event) {
82
101
  if (event.keyCode === KEY_CODE.ENTER && !event.repeat) handle.confirm();
83
102
  },
84
- pressEsc: () => {
85
- if (event.keyCode === KEY_CODE.ESC && !event.repeat) closeModal === null || closeModal === void 0 || closeModal();
103
+ pressEsc: function pressEsc() {
104
+ if (event.keyCode === KEY_CODE.ESC && !event.repeat) closeModal === null || closeModal === void 0 ? void 0 : closeModal();
86
105
  }
87
106
  };
88
- (0, _react.useEffect)(() => {
107
+ (0, _react.useEffect)(function () {
89
108
  if (submitOnEnter) document.addEventListener('keyup', handle.pressEnter);
90
109
  if (closeOnEsc) document.addEventListener('keyup', handle.pressEsc);
91
- return () => {
110
+ return function () {
92
111
  document.removeEventListener('keyup', handle.pressEnter);
93
112
  document.removeEventListener('keyup', handle.pressEsc);
94
113
  };
95
114
  }, [submitOnEnter, closeOnEsc]);
96
115
  return /*#__PURE__*/_react.default.createElement("div", {
97
116
  style: {
98
- zIndex
117
+ zIndex: zIndex
99
118
  },
100
119
  "data-testid": testId,
101
120
  className: "modal-box j5"
@@ -114,9 +133,9 @@ const Modal = _ref2 => {
114
133
  onClose: handle.decline,
115
134
  noHeaderCloseBtn: noHeaderCloseBtn
116
135
  }, /*#__PURE__*/_react.default.createElement("span", null, renderModalTitle({
117
- mode,
118
- title,
119
- onlyTitle
136
+ mode: mode,
137
+ title: title,
138
+ onlyTitle: onlyTitle
120
139
  }))), /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, atributesForModalBody, {
121
140
  className: (0, _classnames.default)('modal__body', {
122
141
  'modal__body--no-footer': noFooter
@@ -129,7 +148,9 @@ const Modal = _ref2 => {
129
148
  testId: "modal",
130
149
  className: (0, _classnames.default)(closeBtnClassName, btnClassNames),
131
150
  variant: closeBtnVariant || 'dark-outline',
132
- onClick: () => handle.decline(),
151
+ onClick: function onClick() {
152
+ return handle.decline();
153
+ },
133
154
  label: closeBtnText || 'Cancel',
134
155
  disabled: closeBtnDisable,
135
156
  icon: closeBtnIcon,
@@ -137,7 +158,9 @@ const Modal = _ref2 => {
137
158
  tabIndex: 1
138
159
  }), !noConfirmBtn && /*#__PURE__*/_react.default.createElement(_Button.default, {
139
160
  testId: "modal",
140
- onClick: () => handle.confirm(),
161
+ onClick: function onClick() {
162
+ return handle.confirm();
163
+ },
141
164
  label: confirmBtnLabel || (mode === null || mode === void 0 ? void 0 : mode[0].toUpperCase()) + (mode === null || mode === void 0 ? void 0 : mode.slice(1)) || 'Apply',
142
165
  className: (0, _classnames.default)('ml5', confirmBtnClassName, btnClassNames),
143
166
  variant: confirmBtnVariant,
@@ -146,4 +169,6 @@ const Modal = _ref2 => {
146
169
  isIconRight: isConfirmBtnIconPositionRight
147
170
  })))));
148
171
  };
149
- var _default = exports.default = Modal;
172
+
173
+ var _default = Modal;
174
+ exports.default = _default;