intelicoreact 1.3.92 → 1.3.94

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 (255) hide show
  1. package/dist/Atomic/FormElements/ActionAlert/ActionAlert.js +9 -1
  2. package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +10 -1
  3. package/dist/Atomic/FormElements/Calendar/Calendar.js +24 -4
  4. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +10 -1
  5. package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +14 -2
  6. package/dist/Atomic/FormElements/Datepicker/Datepicker.js +54 -5
  7. package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +21 -3
  8. package/dist/Atomic/FormElements/Dropdown/Dropdown.js +144 -51
  9. package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +7 -1
  10. package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +125 -21
  11. package/dist/Atomic/FormElements/FileLoader/FileLoader.js +15 -3
  12. package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +29 -15
  13. package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +15 -5
  14. package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +26 -6
  15. package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +35 -19
  16. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +38 -9
  17. package/dist/Atomic/FormElements/Input/Input.js +57 -24
  18. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +31 -4
  19. package/dist/Atomic/FormElements/InputColor/InputColor.js +14 -4
  20. package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +29 -6
  21. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +43 -8
  22. package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +21 -3
  23. package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +81 -58
  24. package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +41 -6
  25. package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +8 -1
  26. package/dist/Atomic/FormElements/InputDateRange/dependencies.js +46 -16
  27. package/dist/Atomic/FormElements/InputLink/InputLink.js +23 -6
  28. package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +4 -0
  29. package/dist/Atomic/FormElements/InputMask/InputMask.js +208 -77
  30. package/dist/Atomic/FormElements/InputMask/functions.js +28 -2
  31. package/dist/Atomic/FormElements/InputMask2/InputMask2.js +119 -43
  32. package/dist/Atomic/FormElements/InputMask2/functions.js +28 -2
  33. package/dist/Atomic/FormElements/InputMask3/InputMask3.js +137 -44
  34. package/dist/Atomic/FormElements/InputMask3/functions.js +28 -2
  35. package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +17 -3
  36. package/dist/Atomic/FormElements/InputsRow/InputsRow.js +24 -5
  37. package/dist/Atomic/FormElements/Label/Label.js +9 -1
  38. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +73 -35
  39. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +15 -3
  40. package/dist/Atomic/FormElements/NumericInput/NumericInput.js +44 -23
  41. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +17 -7
  42. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +14 -3
  43. package/dist/Atomic/FormElements/RadioInput/RadioInput.js +10 -1
  44. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +14 -3
  45. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +23 -3
  46. package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +34 -17
  47. package/dist/Atomic/FormElements/RangeList/RangeList.js +25 -6
  48. package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +11 -1
  49. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +72 -14
  50. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +132 -43
  51. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +10 -1
  52. package/dist/Atomic/FormElements/Switcher/Switcher.js +10 -1
  53. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +13 -1
  54. package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +10 -1
  55. package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +17 -2
  56. package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +17 -3
  57. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +11 -1
  58. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +29 -6
  59. package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +3 -2
  60. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +12 -1
  61. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +151 -55
  62. package/dist/Atomic/FormElements/Text/Text.js +16 -10
  63. package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +9 -1
  64. package/dist/Atomic/FormElements/Textarea/Textarea.js +16 -3
  65. package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +35 -6
  66. package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +13 -4
  67. package/dist/Atomic/FormElements/TimeRange/TimeRange.js +21 -7
  68. package/dist/Atomic/FormElements/UserContacts/UserContacts.js +35 -8
  69. package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +91 -0
  70. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +18 -5
  71. package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +10 -3
  72. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +11 -3
  73. package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +2 -1
  74. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +12 -5
  75. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
  76. package/dist/Atomic/Layout/Header/Header.js +15 -3
  77. package/dist/Atomic/Layout/MainMenu/MainMenu.js +20 -3
  78. package/dist/Atomic/Layout/Spinner/Spinner.js +8 -1
  79. package/dist/Atomic/UI/Accordion/Accordion.js +19 -3
  80. package/dist/Atomic/UI/Accordion/AccordionItem.js +23 -9
  81. package/dist/Atomic/UI/AccordionTable/AccordionTable.js +32 -7
  82. package/dist/Atomic/UI/AccordionText/AccordionText.js +15 -3
  83. package/dist/Atomic/UI/AdvancedTag/AdvTag.js +21 -4
  84. package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +15 -3
  85. package/dist/Atomic/UI/Alert/Alert.js +19 -3
  86. package/dist/Atomic/UI/Arrow/Arrow.js +16 -3
  87. package/dist/Atomic/UI/Box/Box.js +9 -3
  88. package/dist/Atomic/UI/Button/Button.js +11 -2
  89. package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +10 -1
  90. package/dist/Atomic/UI/Chart/Chart.js +29 -4
  91. package/dist/Atomic/UI/Chart/partial/Chart.constants.js +19 -11
  92. package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +12 -1
  93. package/dist/Atomic/UI/Chart/partial/datasetSetters.js +34 -11
  94. package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +56 -82
  95. package/dist/Atomic/UI/Chart/partial/optionsSetters.js +19 -15
  96. package/dist/Atomic/UI/Chart/partial/utils.js +20 -6
  97. package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +13 -3
  98. package/dist/Atomic/UI/DateTime/DateTime.js +14 -3
  99. package/dist/Atomic/UI/DebugContainer/DebugContainer.js +16 -4
  100. package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +11 -3
  101. package/dist/Atomic/UI/DoubleString/DoubleString.js +17 -5
  102. package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +10 -3
  103. package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +52 -17
  104. package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +29 -1
  105. package/dist/Atomic/UI/Hint/Hint.js +31 -5
  106. package/dist/Atomic/UI/Hint/Hint.scss +1 -3
  107. package/dist/Atomic/UI/Modal/Modal.js +28 -6
  108. package/dist/Atomic/UI/Modal/ModalHOC.js +9 -1
  109. package/dist/Atomic/UI/Modal/partials/ModalFooter.js +7 -1
  110. package/dist/Atomic/UI/Modal/partials/ModalTitle.js +8 -1
  111. package/dist/Atomic/UI/Modal/partials/useMobileModal.js +49 -32
  112. package/dist/Atomic/UI/ModalBackup/Modal.js +174 -0
  113. package/dist/Atomic/UI/ModalBackup/Modal.scss +333 -0
  114. package/dist/Atomic/UI/ModalBackup/ModalHOC.js +51 -0
  115. package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +24 -0
  116. package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +41 -0
  117. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +21 -6
  118. package/dist/Atomic/UI/NavLine/NavLine.js +55 -26
  119. package/dist/Atomic/UI/NavLine/Tabs.js +3 -2
  120. package/dist/Atomic/UI/PageTitle/PageTitle.js +10 -2
  121. package/dist/Atomic/UI/PieChart/PieChart.js +10 -1
  122. package/dist/Atomic/UI/Price/Price.js +8 -3
  123. package/dist/Atomic/UI/PriceRange/PriceRange.js +7 -1
  124. package/dist/Atomic/UI/ProgressLine/ProgressLine.js +16 -1
  125. package/dist/Atomic/UI/Status/Status.js +8 -1
  126. package/dist/Atomic/UI/Table/Partials/TdCell.js +29 -5
  127. package/dist/Atomic/UI/Table/Partials/TdHeader.js +11 -1
  128. package/dist/Atomic/UI/Table/Partials/TdRow.js +17 -5
  129. package/dist/Atomic/UI/Table/Partials/TdTitle.js +14 -3
  130. package/dist/Atomic/UI/Table/Table.js +12 -1
  131. package/dist/Atomic/UI/Table/TdTypes/TdActions.js +18 -2
  132. package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +9 -1
  133. package/dist/Atomic/UI/Table/TdTypes/TdRange.js +4 -1
  134. package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +13 -1
  135. package/dist/Atomic/UI/Tag/Tag.js +14 -3
  136. package/dist/Atomic/UI/TagList/TagList.js +35 -19
  137. package/dist/Atomic/UI/UserBox/UserBox.js +13 -1
  138. package/dist/Classes/AbortableFetch.js +93 -36
  139. package/dist/Classes/AnimatedHandler.js +7 -3
  140. package/dist/Classes/RESTAPI/index.js +44 -39
  141. package/dist/Classes/RESTAPI/partials/AbortableFetch.js +93 -35
  142. package/dist/Classes/RESTAPI/partials/ApiBase.js +9 -1
  143. package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +32 -24
  144. package/dist/Classes/RESTAPI/partials/ApiUtils.js +41 -34
  145. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +44 -21
  146. package/dist/Classes/RESTAPI/partials/Utils.js +19 -6
  147. package/dist/Classes/RESTAPI/partials/_outerDependencies.js +6 -2
  148. package/dist/Classes/RESTAPI/partials/_utils.js +36 -13
  149. package/dist/Constants/index.constants.js +15 -8
  150. package/dist/Functions/Portal.js +16 -5
  151. package/dist/Functions/customEventListener.js +17 -4
  152. package/dist/Functions/fieldValueFormatters.js +83 -43
  153. package/dist/Functions/hooks/useFormFieldsChangesManager.js +26 -23
  154. package/dist/Functions/locale/createTranslator.js +9 -4
  155. package/dist/Functions/operations.js +22 -12
  156. package/dist/Functions/presets/inputMaskPresets.js +11 -9
  157. package/dist/Functions/presets/inputPresets.js +11 -8
  158. package/dist/Functions/presets/mobileKeyboardTypesPresets.js +9 -7
  159. package/dist/Functions/schemas.js +13 -6
  160. package/dist/Functions/useBodyScrollLock.js +6 -1
  161. package/dist/Functions/useClickOutside.js +4 -0
  162. package/dist/Functions/useDebounce.js +7 -2
  163. package/dist/Functions/useFieldFocus.js +18 -6
  164. package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +9 -0
  165. package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +23 -12
  166. package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +15 -6
  167. package/dist/Functions/useFormTools/functions/General.js +28 -18
  168. package/dist/Functions/useFormTools/functions/RenderFields.js +11 -2
  169. package/dist/Functions/useFormTools/functions/usePrevious.js +5 -1
  170. package/dist/Functions/useFormTools/index.js +144 -85
  171. package/dist/Functions/useInputHighlightError.js +12 -3
  172. package/dist/Functions/useIsMobile.js +13 -7
  173. package/dist/Functions/useKeyPress/useHandleKeyPress.js +7 -1
  174. package/dist/Functions/useKeyPress/useKeyPress.js +9 -1
  175. package/dist/Functions/useLocalStorage.js +9 -1
  176. package/dist/Functions/useLocationParams.js +5 -4
  177. package/dist/Functions/useMediaQuery.js +9 -3
  178. package/dist/Functions/useMetaInfo.js +10 -3
  179. package/dist/Functions/useMouseUpOutside.js +3 -0
  180. package/dist/Functions/useOnlineStatus.js +9 -1
  181. package/dist/Functions/usePasswordChecker.js +20 -4
  182. package/dist/Functions/usePrevious.js +5 -1
  183. package/dist/Functions/useResize.js +10 -2
  184. package/dist/Functions/useScrollTo.js +7 -2
  185. package/dist/Functions/useToggle.js +5 -1
  186. package/dist/Functions/utils.js +131 -56
  187. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +9 -2
  188. package/dist/Molecular/CustomIcons/components/AlertCircle.js +9 -2
  189. package/dist/Molecular/CustomIcons/components/AppStore.js +9 -2
  190. package/dist/Molecular/CustomIcons/components/Arrow.js +9 -2
  191. package/dist/Molecular/CustomIcons/components/ArrowDown.js +9 -2
  192. package/dist/Molecular/CustomIcons/components/ArrowLeft.js +9 -2
  193. package/dist/Molecular/CustomIcons/components/ArrowRight.js +9 -2
  194. package/dist/Molecular/CustomIcons/components/ArrowUp.js +9 -2
  195. package/dist/Molecular/CustomIcons/components/Bell.js +9 -2
  196. package/dist/Molecular/CustomIcons/components/Button.js +9 -2
  197. package/dist/Molecular/CustomIcons/components/Campaigns.js +9 -2
  198. package/dist/Molecular/CustomIcons/components/Check.js +9 -2
  199. package/dist/Molecular/CustomIcons/components/Check2.js +9 -2
  200. package/dist/Molecular/CustomIcons/components/ChevronDown.js +9 -2
  201. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +9 -2
  202. package/dist/Molecular/CustomIcons/components/ChevronLeft.js +9 -2
  203. package/dist/Molecular/CustomIcons/components/ChevronRight.js +9 -2
  204. package/dist/Molecular/CustomIcons/components/ChevronUp.js +9 -2
  205. package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +9 -2
  206. package/dist/Molecular/CustomIcons/components/Close.js +9 -2
  207. package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +9 -2
  208. package/dist/Molecular/CustomIcons/components/Delete.js +9 -2
  209. package/dist/Molecular/CustomIcons/components/Edit.js +9 -2
  210. package/dist/Molecular/CustomIcons/components/Email.js +9 -2
  211. package/dist/Molecular/CustomIcons/components/FinturfLogo.js +9 -2
  212. package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +9 -2
  213. package/dist/Molecular/CustomIcons/components/Flows.js +9 -2
  214. package/dist/Molecular/CustomIcons/components/Gift.js +9 -2
  215. package/dist/Molecular/CustomIcons/components/GoogleAuth.js +9 -2
  216. package/dist/Molecular/CustomIcons/components/GooglePlay.js +9 -2
  217. package/dist/Molecular/CustomIcons/components/HelpCircle.js +9 -2
  218. package/dist/Molecular/CustomIcons/components/HelpCircle2.js +9 -2
  219. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +9 -2
  220. package/dist/Molecular/CustomIcons/components/Home.js +9 -2
  221. package/dist/Molecular/CustomIcons/components/Home2.js +9 -2
  222. package/dist/Molecular/CustomIcons/components/Key.js +9 -2
  223. package/dist/Molecular/CustomIcons/components/Landers.js +9 -2
  224. package/dist/Molecular/CustomIcons/components/Lock.js +9 -2
  225. package/dist/Molecular/CustomIcons/components/Mail.js +9 -2
  226. package/dist/Molecular/CustomIcons/components/Mastercard.js +9 -2
  227. package/dist/Molecular/CustomIcons/components/Minus.js +9 -2
  228. package/dist/Molecular/CustomIcons/components/Offers.js +9 -2
  229. package/dist/Molecular/CustomIcons/components/Pause.js +9 -2
  230. package/dist/Molecular/CustomIcons/components/PayPal.js +9 -2
  231. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +9 -2
  232. package/dist/Molecular/CustomIcons/components/Phone.js +9 -2
  233. package/dist/Molecular/CustomIcons/components/Play.js +9 -2
  234. package/dist/Molecular/CustomIcons/components/Plus.js +9 -2
  235. package/dist/Molecular/CustomIcons/components/Profile.js +9 -2
  236. package/dist/Molecular/CustomIcons/components/QRCode.js +9 -2
  237. package/dist/Molecular/CustomIcons/components/Rectangle.js +9 -2
  238. package/dist/Molecular/CustomIcons/components/Revert.js +9 -2
  239. package/dist/Molecular/CustomIcons/components/Star.js +9 -2
  240. package/dist/Molecular/CustomIcons/components/Star2.js +9 -2
  241. package/dist/Molecular/CustomIcons/components/TrafficSources.js +9 -2
  242. package/dist/Molecular/CustomIcons/components/Trash.js +9 -2
  243. package/dist/Molecular/CustomIcons/components/TrashRed.js +9 -2
  244. package/dist/Molecular/CustomIcons/components/Triggers.js +9 -2
  245. package/dist/Molecular/CustomIcons/components/User.js +9 -2
  246. package/dist/Molecular/CustomIcons/components/Visa.js +9 -2
  247. package/dist/Molecular/CustomIcons/components/X.js +9 -2
  248. package/dist/Molecular/CustomIcons/index.js +122 -0
  249. package/dist/Molecular/FormElement/FormElement.js +12 -1
  250. package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +31 -30
  251. package/dist/Molecular/FormWithDependOn/partials/_utils.js +12 -9
  252. package/dist/Molecular/InputAddress/InputAddress.js +114 -65
  253. package/dist/Molecular/InputPassword/InputPassword.js +19 -5
  254. package/dist/index.js +2 -0
  255. package/package.json +1 -1
@@ -1,25 +1,43 @@
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
9
12
  var _react = _interopRequireWildcard(require("react"));
13
+
10
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
+
16
+ var _reactDom = require("react-dom");
17
+
11
18
  var _reactFeather = require("react-feather");
19
+
12
20
  var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
21
+
13
22
  var _useDebounce = require("../../../Functions/useDebounce");
23
+
14
24
  var _useIsMobile = _interopRequireDefault(require("../../../Functions/useIsMobile"));
25
+
15
26
  var _Spinner = _interopRequireDefault(require("../../Layout/Spinner/Spinner"));
27
+
16
28
  var _RadioInput = _interopRequireDefault(require("../RadioInput/RadioInput"));
29
+
17
30
  require("./DropdownLiveSearch.scss");
18
- 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); }
19
- 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; }
31
+
32
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
+
34
+ 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; }
35
+
20
36
  const RC = "dropdown-live-search";
37
+
21
38
  const DropdownLiveSearch = _ref => {
22
39
  var _dropdownListRef$curr5, _dropdownListRef$curr6, _tabIndex$toString;
40
+
23
41
  let {
24
42
  label,
25
43
  value,
@@ -42,7 +60,7 @@ const DropdownLiveSearch = _ref => {
42
60
  withMobileLogic,
43
61
  tabIndex
44
62
  } = _ref;
45
- const dropdownId = fieldKey || id;
63
+ const [dropdownId, setDropdownId] = (0, _react.useState)(id || fieldKey || Math.random().toString(16).slice(2));
46
64
  const [isOpen, setIsOpen] = (0, _react.useState)(false);
47
65
  const [isValueDeleted, setIsValueDeleted] = (0, _react.useState)(false);
48
66
  const {
@@ -51,7 +69,8 @@ const DropdownLiveSearch = _ref => {
51
69
  const isMobile = isMobileProp && withMobileLogic && window.screen.width <= 768;
52
70
  const labelByValue = (0, _react.useMemo)(() => {
53
71
  var _options$find;
54
- return (options === null || options === void 0 || (_options$find = options.find(item => item.value === value)) === null || _options$find === void 0 ? void 0 : _options$find.label) || "";
72
+
73
+ return (options === null || options === void 0 ? void 0 : (_options$find = options.find(item => item.value === value)) === null || _options$find === void 0 ? void 0 : _options$find.label) || "";
55
74
  }, [value]);
56
75
  const [searchValue, setSV] = (0, _react.useState)(labelByValue);
57
76
  const dropdownLiveSearchRef = (0, _react.useRef)(null);
@@ -66,10 +85,12 @@ const DropdownLiveSearch = _ref => {
66
85
  const [isFixedMaxHeight, setIsFixedMaxHeight] = (0, _react.useState)(false);
67
86
  const [scrollTop, setScrollTop] = (0, _react.useState)(0);
68
87
  const [scrollHeight, setScrollHeight] = (0, _react.useState)(1);
88
+
69
89
  const setSearchValue = val => {
70
90
  setSV(val);
71
91
  searchValueRef.current = val;
72
92
  };
93
+
73
94
  const onWrapperClick = e => {
74
95
  if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
75
96
  e.stopPropagation();
@@ -77,19 +98,24 @@ const DropdownLiveSearch = _ref => {
77
98
  setIsOpen(false);
78
99
  }
79
100
  };
101
+
80
102
  const [isFocusedByClick, setIsFocusedByClick] = (0, _react.useState)(false);
81
103
  const debouncedSearchTerm = (0, _useDebounce.useDebounce)({
82
104
  searchValue,
83
105
  delay: 600
84
106
  });
85
107
  if (!options) return null;
108
+
86
109
  const handleClickOutside = event => {
87
110
  if (!dropdownLiveSearchRef.current.contains(event.target)) setIsOpen(false);
88
111
  };
112
+
89
113
  const highlightedText = (text, postfix) => {
90
114
  if (!isSearchable) return text;else {
91
115
  var _text;
116
+
92
117
  const prepare = text => text === null || text === void 0 ? void 0 : text.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
118
+
93
119
  text = text.replace(/["&<>]/g, a => {
94
120
  return {
95
121
  '"': "&quot;",
@@ -103,13 +129,15 @@ const DropdownLiveSearch = _ref => {
103
129
  return main + postfixPart;
104
130
  }
105
131
  };
132
+
106
133
  const getMarkupForElement = (item, index, optTestId) => {
107
- var _item$value, _item$value2, _item$customMobileIco;
134
+ var _item$value, _item$value$toString, _item$value2, _item$value2$toString, _item$customMobileIco;
135
+
108
136
  const lowerLabel = item.label.toLowerCase();
109
137
  const lowerSearchValue = searchValue.toLowerCase();
110
138
  return /*#__PURE__*/_react.default.createElement("button", {
111
- "data-testid": "dropdown-live-search--button--key-".concat(optTestId || (item === null || item === void 0 || (_item$value = item.value) === null || _item$value === void 0 || (_item$value = _item$value.toString()) === null || _item$value === void 0 ? void 0 : _item$value.replace(/\s/, "-")) || (item === null || item === void 0 ? void 0 : item.key) || "item", "--option"),
112
- key: (_item$value2 = item.value) === null || _item$value2 === void 0 || (_item$value2 = _item$value2.toString()) === null || _item$value2 === void 0 ? void 0 : _item$value2.replace(/ /g, "_"),
139
+ "data-testid": "dropdown-live-search--button--key-".concat(optTestId || (item === null || item === void 0 ? void 0 : (_item$value = item.value) === null || _item$value === void 0 ? void 0 : (_item$value$toString = _item$value.toString()) === null || _item$value$toString === void 0 ? void 0 : _item$value$toString.replace(/\s/, "-")) || (item === null || item === void 0 ? void 0 : item.key) || "item", "--option"),
140
+ key: (_item$value2 = item.value) === null || _item$value2 === void 0 ? void 0 : (_item$value2$toString = _item$value2.toString()) === null || _item$value2$toString === void 0 ? void 0 : _item$value2$toString.replace(/ /g, "_"),
113
141
  onClick: () => {
114
142
  onChange(item.value);
115
143
  setIsOpen(false);
@@ -134,6 +162,7 @@ const DropdownLiveSearch = _ref => {
134
162
  checked: value
135
163
  }) : "");
136
164
  };
165
+
137
166
  const getListMarkUp = () => {
138
167
  return /*#__PURE__*/_react.default.createElement("div", {
139
168
  className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
@@ -185,16 +214,74 @@ const DropdownLiveSearch = _ref => {
185
214
  size: options.length <= 3 ? "small" : null
186
215
  }))));
187
216
  };
217
+
218
+ const getParentNode = () => {
219
+ var _ref2, _document$querySelect;
220
+
221
+ return (_ref2 = (_document$querySelect = document.querySelector("div#root")) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("div#app")) !== null && _ref2 !== void 0 ? _ref2 : document.querySelector("div#storybook-root");
222
+ };
223
+
224
+ const initListContainer = () => {
225
+ const dropdownList = document.createElement("div");
226
+ dropdownList.setAttribute("id", dropdownId);
227
+ dropdownList.classList.add("dropdown__container");
228
+
229
+ if (isMobile) {
230
+ dropdownList.addEventListener("click", e => {
231
+ if (e.target.id === dropdownId) setIsOpen(false);
232
+ });
233
+ }
234
+
235
+ try {
236
+ var _getListContainer;
237
+
238
+ (_getListContainer = getListContainer()) === null || _getListContainer === void 0 ? void 0 : _getListContainer.remove();
239
+ } finally {
240
+ if (isMobile) {
241
+ var _getParentNode;
242
+
243
+ try {
244
+ var _document$getElementB;
245
+
246
+ (_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
247
+ } catch (e) {}
248
+
249
+ const dropdownMobileListWrapper = document.createElement("div");
250
+ dropdownMobileListWrapper.classList.add("dropdown-live-search-mobile");
251
+ dropdownMobileListWrapper.setAttribute("id", "mlw-".concat(dropdownId));
252
+ dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 ? void 0 : dropdownMobileListWrapper.append(dropdownList);
253
+ (_getParentNode = getParentNode()) === null || _getParentNode === void 0 ? void 0 : _getParentNode.append(dropdownMobileListWrapper);
254
+ } else {
255
+ var _getParentNode2;
256
+
257
+ (_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 ? void 0 : _getParentNode2.append(dropdownList);
258
+ }
259
+ }
260
+ };
261
+
188
262
  const getListContainer = () => {
189
263
  return document.getElementById(dropdownId);
190
264
  };
265
+
266
+ const renderListContainer = () => {
267
+ const lc = getListContainer();
268
+ if (!lc) return null;
269
+ return /*#__PURE__*/(0, _reactDom.createPortal)(getListMarkUp(), lc);
270
+ };
271
+
272
+ (0, _react.useEffect)(() => {
273
+ if (isMobile && withMobileLogic) {
274
+ initListContainer();
275
+ }
276
+ }, [isMobile, withMobileLogic]);
191
277
  (0, _react.useEffect)(() => {
192
278
  if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current && !searchValue) {
193
279
  var _dropdownListRef$curr, _dropdownListRef$curr2, _dropdownListRef$curr3, _dropdownListRef$curr4;
194
- setIsScrollableList((dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr = dropdownListRef.current) === null || _dropdownListRef$curr === void 0 ? void 0 : _dropdownListRef$curr.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr2 = dropdownListRef.current) === null || _dropdownListRef$curr2 === void 0 ? void 0 : _dropdownListRef$curr2.clientHeight));
195
- setIsFixedMaxHeight(isScrollableList || (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr3 = dropdownListRef.current) === null || _dropdownListRef$curr3 === void 0 ? void 0 : _dropdownListRef$curr3.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr4 = dropdownListRef.current) === null || _dropdownListRef$curr4 === void 0 ? void 0 : _dropdownListRef$curr4.clientHeight));
280
+
281
+ setIsScrollableList((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr = dropdownListRef.current) === null || _dropdownListRef$curr === void 0 ? void 0 : _dropdownListRef$curr.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr2 = dropdownListRef.current) === null || _dropdownListRef$curr2 === void 0 ? void 0 : _dropdownListRef$curr2.clientHeight));
282
+ setIsFixedMaxHeight(isScrollableList || (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr3 = dropdownListRef.current) === null || _dropdownListRef$curr3 === void 0 ? void 0 : _dropdownListRef$curr3.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr4 = dropdownListRef.current) === null || _dropdownListRef$curr4 === void 0 ? void 0 : _dropdownListRef$curr4.clientHeight));
196
283
  }
197
- }, [isOpen, isMobile, isScrollableList, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr5 = dropdownListRef.current) === null || _dropdownListRef$curr5 === void 0 ? void 0 : _dropdownListRef$curr5.scrollHeight, dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr6 = dropdownListRef.current) === null || _dropdownListRef$curr6 === void 0 ? void 0 : _dropdownListRef$curr6.clientHeight]);
284
+ }, [isOpen, isMobile, isScrollableList, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr5 = dropdownListRef.current) === null || _dropdownListRef$curr5 === void 0 ? void 0 : _dropdownListRef$curr5.scrollHeight, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr6 = dropdownListRef.current) === null || _dropdownListRef$curr6 === void 0 ? void 0 : _dropdownListRef$curr6.clientHeight]);
198
285
  (0, _react.useEffect)(() => {
199
286
  if (!value) setSearchValue("");
200
287
  }, [value]);
@@ -208,15 +295,18 @@ const DropdownLiveSearch = _ref => {
208
295
  onChange(options[0].value);
209
296
  }
210
297
  }, [options]);
298
+
211
299
  const searchableInputFocus = e => {
212
300
  if (!isOpen) {
213
301
  e.preventDefault();
214
302
  e.stopPropagation();
215
303
  }
216
304
  };
305
+
217
306
  const handle = {
218
307
  onInputClick: e => {
219
308
  if (!isOpen) setIsOpen(true);
309
+
220
310
  if (isMobile && withMobileLogic) {
221
311
  e.preventDefault();
222
312
  e.stopPropagation();
@@ -229,6 +319,7 @@ const DropdownLiveSearch = _ref => {
229
319
  let inputValue = e.target.value;
230
320
  if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
231
321
  setSearchValue(inputValue);
322
+
232
323
  if (searchValue && !e.target.value) {
233
324
  onChange("");
234
325
  setSearchValue("");
@@ -241,9 +332,11 @@ const DropdownLiveSearch = _ref => {
241
332
  doRequest(debouncedSearchTerm);
242
333
  }
243
334
  }, [debouncedSearchTerm, isValueDeleted]);
335
+
244
336
  const closeListViaEsc = e => {
245
337
  if ([27].includes(e.keyCode)) setIsOpen(false);
246
338
  };
339
+
247
340
  (0, _react.useLayoutEffect)(() => {
248
341
  window.addEventListener("keyup", closeListViaEsc);
249
342
  return () => {
@@ -252,9 +345,11 @@ const DropdownLiveSearch = _ref => {
252
345
  }, [getListContainer]);
253
346
  (0, _react.useLayoutEffect)(() => {
254
347
  const list = document.getElementById("dropdown-live-search-list");
348
+
255
349
  if ((list || isOpen) && !withMobileLogic) {
256
350
  var _dropdownLiveSearchRe;
257
- const dropdownWidth = dropdownLiveSearchRef === null || dropdownLiveSearchRef === void 0 || (_dropdownLiveSearchRe = dropdownLiveSearchRef.current) === null || _dropdownLiveSearchRe === void 0 ? void 0 : _dropdownLiveSearchRe.clientWidth;
351
+
352
+ const dropdownWidth = dropdownLiveSearchRef === null || dropdownLiveSearchRef === void 0 ? void 0 : (_dropdownLiveSearchRe = dropdownLiveSearchRef.current) === null || _dropdownLiveSearchRe === void 0 ? void 0 : _dropdownLiveSearchRe.clientWidth;
258
353
  list.style.width = "".concat(dropdownWidth, "px");
259
354
  }
260
355
  }, [dropdownLiveSearchRef, isOpen, withMobileLogic]);
@@ -270,22 +365,27 @@ const DropdownLiveSearch = _ref => {
270
365
  setIsFocusedByClick(false);
271
366
  if (withMobileLogic) setSearchValue("");
272
367
  }
368
+
273
369
  if (isOpen && dropdownListRef && dropdownListRef.current) {
274
370
  if (isMobile && withMobileLogic) {
275
- var _dropdownListBoxRef$c, _dropdownListHeaderRe, _searchInputModalRef$;
371
+ var _dropdownListBoxRef$c, _dropdownListBoxRef$c2, _dropdownListHeaderRe, _dropdownListHeaderRe2, _searchInputModalRef$;
372
+
276
373
  doRequest("");
277
- dropdownListRef.current.style.maxHeight = "".concat((dropdownListBoxRef === null || dropdownListBoxRef === void 0 || (_dropdownListBoxRef$c = dropdownListBoxRef.current) === null || _dropdownListBoxRef$c === void 0 || (_dropdownListBoxRef$c = _dropdownListBoxRef$c.getBoundingClientRect()) === null || _dropdownListBoxRef$c === void 0 ? void 0 : _dropdownListBoxRef$c.height) - (dropdownListHeaderRef === null || dropdownListHeaderRef === void 0 || (_dropdownListHeaderRe = dropdownListHeaderRef.current) === null || _dropdownListHeaderRe === void 0 || (_dropdownListHeaderRe = _dropdownListHeaderRe.getBoundingClientRect()) === null || _dropdownListHeaderRe === void 0 ? void 0 : _dropdownListHeaderRe.height), "px");
278
- searchInputModalRef === null || searchInputModalRef === void 0 || (_searchInputModalRef$ = searchInputModalRef.current) === null || _searchInputModalRef$ === void 0 || _searchInputModalRef$.focus();
374
+ dropdownListRef.current.style.maxHeight = "".concat((dropdownListBoxRef === null || dropdownListBoxRef === void 0 ? void 0 : (_dropdownListBoxRef$c = dropdownListBoxRef.current) === null || _dropdownListBoxRef$c === void 0 ? void 0 : (_dropdownListBoxRef$c2 = _dropdownListBoxRef$c.getBoundingClientRect()) === null || _dropdownListBoxRef$c2 === void 0 ? void 0 : _dropdownListBoxRef$c2.height) - (dropdownListHeaderRef === null || dropdownListHeaderRef === void 0 ? void 0 : (_dropdownListHeaderRe = dropdownListHeaderRef.current) === null || _dropdownListHeaderRe === void 0 ? void 0 : (_dropdownListHeaderRe2 = _dropdownListHeaderRe.getBoundingClientRect()) === null || _dropdownListHeaderRe2 === void 0 ? void 0 : _dropdownListHeaderRe2.height), "px");
375
+ searchInputModalRef === null || searchInputModalRef === void 0 ? void 0 : (_searchInputModalRef$ = searchInputModalRef.current) === null || _searchInputModalRef$ === void 0 ? void 0 : _searchInputModalRef$.focus();
279
376
  }
377
+
280
378
  dropdownListRef.current.addEventListener("scroll", doScrollCallback);
281
379
  }
380
+
282
381
  return () => {
283
382
  removeEventListener("scroll", doScrollCallback);
284
383
  };
285
384
  }, [isOpen, dropdownListRef]);
286
385
  const closeList = isOpen ? handleClickOutside : () => {};
287
386
  (0, _react.useLayoutEffect)(() => {
288
- var _getListContainer;
387
+ var _getListContainer2;
388
+
289
389
  if (!isMobile) {
290
390
  window.addEventListener("mousewheel", closeList);
291
391
  window.addEventListener("scroll", closeList);
@@ -295,13 +395,15 @@ const DropdownLiveSearch = _ref => {
295
395
  window.removeEventListener("scroll", closeList);
296
396
  window.removeEventListener("touchmove", closeList);
297
397
  }
298
- (_getListContainer = getListContainer()) === null || _getListContainer === void 0 || _getListContainer.addEventListener("click", closeList);
398
+
399
+ (_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 ? void 0 : _getListContainer2.addEventListener("click", closeList);
299
400
  return () => {
300
- var _getListContainer2;
401
+ var _getListContainer3;
402
+
301
403
  window.removeEventListener("mousewheel", closeList);
302
404
  window.removeEventListener("scroll", closeList);
303
405
  window.removeEventListener("touchmove", closeList);
304
- (_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 || _getListContainer2.removeEventListener("click", closeList);
406
+ (_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.removeEventListener("click", closeList);
305
407
  };
306
408
  }, [getListContainer]);
307
409
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -316,7 +418,7 @@ const DropdownLiveSearch = _ref => {
316
418
  onClick: () => !isSearchable ? setIsOpen(!isOpen) : null,
317
419
  onMouseDown: () => setIsFocusedByClick(true),
318
420
  onFocus: () => !isFocusedByClick ? setIsOpen(true) : null,
319
- tabIndex: tabIndex === null || tabIndex === void 0 || (_tabIndex$toString = tabIndex.toString) === null || _tabIndex$toString === void 0 ? void 0 : _tabIndex$toString.call(tabIndex)
421
+ tabIndex: tabIndex === null || tabIndex === void 0 ? void 0 : (_tabIndex$toString = tabIndex.toString) === null || _tabIndex$toString === void 0 ? void 0 : _tabIndex$toString.call(tabIndex)
320
422
  }, isSearchable ? /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
321
423
  ref: searchInputRef,
322
424
  className: "".concat(RC, "__input"),
@@ -335,6 +437,8 @@ const DropdownLiveSearch = _ref => {
335
437
  onClick: () => setIsOpen(!isOpen)
336
438
  }, isMobile ? /*#__PURE__*/_react.default.createElement(_reactFeather.Code, {
337
439
  className: "mobile-icon"
338
- }) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, null) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, null))), isOpen && getListMarkUp());
440
+ }) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, null) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, null))), isOpen && (isMobile && withMobileLogic ? renderListContainer() : getListMarkUp()));
339
441
  };
340
- var _default = exports.default = DropdownLiveSearch;
442
+
443
+ var _default = DropdownLiveSearch;
444
+ exports.default = _default;
@@ -1,18 +1,28 @@
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 = _interopRequireWildcard(require("react"));
11
+
9
12
  var _classnames = _interopRequireDefault(require("classnames"));
13
+
10
14
  var _LoadZone = _interopRequireDefault(require("./partial/LoadZone"));
15
+
11
16
  var _LoadedContent = _interopRequireDefault(require("./partial/LoadedContent"));
17
+
12
18
  require("./FileLoader.scss");
13
- 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); }
14
- 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; }
19
+
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
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
+
15
24
  const RC = "file-loader";
25
+
16
26
  const FileLoader = props => {
17
27
  const {
18
28
  // будет использован в качестве id инпута в LoadZone, обязателен для корректной работы
@@ -73,4 +83,6 @@ const FileLoader = props => {
73
83
  attributesOfNativeInput: attributesOfNativeInput
74
84
  }));
75
85
  };
76
- var _default = exports.default = FileLoader;
86
+
87
+ var _default = FileLoader;
88
+ exports.default = _default;
@@ -1,18 +1,28 @@
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
9
12
  var _react = _interopRequireWildcard(require("react"));
13
+
10
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
+
11
16
  require("../FileLoader.scss");
12
- 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); }
13
- 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; }
17
+
18
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
+
20
+ 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; }
21
+
14
22
  const DEFAULT_MAX_FILE_SIZE = 1024 * 1024; //1Мб
23
+
15
24
  const FILTER_FILES_DEFAULT = file => file.size <= DEFAULT_MAX_FILE_SIZE ? file : null;
25
+
16
26
  const LoadZone = _ref => {
17
27
  let {
18
28
  RC,
@@ -31,14 +41,16 @@ const LoadZone = _ref => {
31
41
  const dropZoneId = "dropZone-".concat(fieldKey);
32
42
  const handle = {
33
43
  change: async e => {
34
- setIsLoadContent === null || setIsLoadContent === void 0 || setIsLoadContent(true);
44
+ setIsLoadContent === null || setIsLoadContent === void 0 ? void 0 : setIsLoadContent(true);
35
45
  const file = e.type === "change" ? e.target.files[0] : e.dataTransfer.files[0];
36
46
  const validatedFile = filterFiles ? await filterFiles(file) : file;
37
47
  if (processErrors && !validatedFile) await processErrors(file);
48
+
38
49
  if (!isBlockNullValues || validatedFile) {
39
50
  onChange(await doLoad(validatedFile).catch(() => null));
40
51
  }
41
- setIsLoadContent === null || setIsLoadContent === void 0 || setIsLoadContent(false);
52
+
53
+ setIsLoadContent === null || setIsLoadContent === void 0 ? void 0 : setIsLoadContent(false);
42
54
  },
43
55
  dragover: e => {
44
56
  e.stopPropagation();
@@ -67,17 +79,17 @@ const LoadZone = _ref => {
67
79
  };
68
80
  (0, _react.useEffect)(() => {
69
81
  const dropbox = document.getElementById(dropZoneId);
70
- dropbox === null || dropbox === void 0 || dropbox.addEventListener("dragenter", handle.dragenter, false);
71
- dropbox === null || dropbox === void 0 || dropbox.addEventListener("dragover", handle.dragover, false);
72
- dropbox === null || dropbox === void 0 || dropbox.addEventListener("dragleave", handle.dragleave, false);
73
- dropbox === null || dropbox === void 0 || dropbox.addEventListener("drop", handle.drop, false);
74
- dropbox === null || dropbox === void 0 || dropbox.addEventListener("dragend", handle.dragleave, false);
82
+ dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener("dragenter", handle.dragenter, false);
83
+ dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener("dragover", handle.dragover, false);
84
+ dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener("dragleave", handle.dragleave, false);
85
+ dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener("drop", handle.drop, false);
86
+ dropbox === null || dropbox === void 0 ? void 0 : dropbox.addEventListener("dragend", handle.dragleave, false);
75
87
  return () => {
76
- dropbox === null || dropbox === void 0 || dropbox.removeEventListener("dragenter", handle.dragenter, false);
77
- dropbox === null || dropbox === void 0 || dropbox.removeEventListener("dragover", handle.dragover, false);
78
- dropbox === null || dropbox === void 0 || dropbox.removeEventListener("dragleave", handle.dragleave, false);
79
- dropbox === null || dropbox === void 0 || dropbox.removeEventListener("drop", handle.drop, false);
80
- dropbox === null || dropbox === void 0 || dropbox.removeEventListener("dragend", handle.dragleave, false);
88
+ dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener("dragenter", handle.dragenter, false);
89
+ dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener("dragover", handle.dragover, false);
90
+ dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener("dragleave", handle.dragleave, false);
91
+ dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener("drop", handle.drop, false);
92
+ dropbox === null || dropbox === void 0 ? void 0 : dropbox.removeEventListener("dragend", handle.dragleave, false);
81
93
  };
82
94
  }, [fieldKey, doLoad]);
83
95
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon && /*#__PURE__*/_react.default.createElement("div", {
@@ -95,4 +107,6 @@ const LoadZone = _ref => {
95
107
  onChange: handle.change
96
108
  }, attributesOfNativeInput))));
97
109
  };
98
- var _default = exports.default = LoadZone;
110
+
111
+ var _default = LoadZone;
112
+ exports.default = _default;
@@ -1,17 +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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
9
12
  var _react = _interopRequireWildcard(require("react"));
13
+
10
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
+
11
16
  var _utils = require("../../../../Functions/utils");
17
+
12
18
  require("../FileLoader.scss");
13
- 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); }
14
- 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; }
19
+
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
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
+
15
24
  const LoadedContent = props => {
16
25
  const {
17
26
  RC,
@@ -34,8 +43,7 @@ const LoadedContent = props => {
34
43
  });
35
44
  }
36
45
  };
37
- const additionalProps = (0, _react.useMemo)(() => ({
38
- ...(isUseLinkTitle ? {
46
+ const additionalProps = (0, _react.useMemo)(() => ({ ...(isUseLinkTitle ? {
39
47
  title: isLinkTypeDownload ? "Download ".concat(value.name) : value.path
40
48
  } : {}),
41
49
  ...(isLinkTypeDownload ? {
@@ -58,4 +66,6 @@ const LoadedContent = props => {
58
66
  onClick: onDelete
59
67
  }, deleteIcon || "X"));
60
68
  };
61
- var _default = exports.default = LoadedContent;
69
+
70
+ var _default = LoadedContent;
71
+ exports.default = _default;
@@ -1,17 +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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
9
12
  var _react = _interopRequireDefault(require("react"));
13
+
10
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
+
11
16
  var _reactFeather = require("react-feather");
17
+
12
18
  var _utils = require("../../../Functions/utils");
19
+
13
20
  require("./FileLoaderLocal.scss");
21
+
14
22
  const MAX_FILE_SIZE = 10 * 1024 * 1024;
23
+
15
24
  const FileLoaderLocal = _ref => {
16
25
  let {
17
26
  groupId,
@@ -28,10 +37,12 @@ const FileLoaderLocal = _ref => {
28
37
  testId,
29
38
  attributesOfNativeInput = {}
30
39
  } = _ref;
40
+
31
41
  const getFileName = value => {
32
42
  const result = value.match(/[^\\]+$/);
33
43
  return result === null || result === void 0 ? void 0 : result[0];
34
44
  };
45
+
35
46
  const renderRequiredLabel = () => {
36
47
  if (!value) {
37
48
  if (isRequired) return /*#__PURE__*/_react.default.createElement("div", {
@@ -41,20 +52,26 @@ const FileLoaderLocal = _ref => {
41
52
  }, "Optional");
42
53
  }
43
54
  };
55
+
44
56
  const isFileSizeOutOfLimit = file => {
45
57
  var _ref2;
58
+
46
59
  return (_ref2 = file.size > maxItemSizeBytes) !== null && _ref2 !== void 0 ? _ref2 : MAX_FILE_SIZE;
47
60
  };
61
+
48
62
  const checkExtension = valueExtension => {
49
63
  return accept.includes(valueExtension);
50
64
  };
65
+
51
66
  const handle = {
52
67
  change: e => {
53
- var _name$match, _e$target, _e$target2;
68
+ var _name$match, _e$target, _e$target$files, _e$target2, _e$target2$files;
69
+
54
70
  const name = getFileName(e.target.value);
55
- const valueExtension = name === null || name === void 0 || (_name$match = name.match(/[^\.]+$/)) === null || _name$match === void 0 ? void 0 : _name$match[0];
56
- const file = (_e$target = e.target) === null || _e$target === void 0 || (_e$target = _e$target.files) === null || _e$target === void 0 ? void 0 : _e$target[0];
57
- if (isFileSizeOutOfLimit((_e$target2 = e.target) === null || _e$target2 === void 0 || (_e$target2 = _e$target2.files) === null || _e$target2 === void 0 ? void 0 : _e$target2[0])) {
71
+ const valueExtension = name === null || name === void 0 ? void 0 : (_name$match = name.match(/[^\.]+$/)) === null || _name$match === void 0 ? void 0 : _name$match[0];
72
+ const file = (_e$target = e.target) === null || _e$target === void 0 ? void 0 : (_e$target$files = _e$target.files) === null || _e$target$files === void 0 ? void 0 : _e$target$files[0];
73
+
74
+ if (isFileSizeOutOfLimit((_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : (_e$target2$files = _e$target2.files) === null || _e$target2$files === void 0 ? void 0 : _e$target2$files[0])) {
58
75
  onChange({
59
76
  id,
60
77
  name,
@@ -66,7 +83,8 @@ const FileLoaderLocal = _ref => {
66
83
  });
67
84
  } else if (!checkExtension(valueExtension)) {
68
85
  var _accept$replace;
69
- const allowedExtensions = (accept === null || accept === void 0 || (_accept$replace = accept.replace(/\./g, "")) === null || _accept$replace === void 0 ? void 0 : _accept$replace.toUpperCase()) || "JPG, PNG, PDF";
86
+
87
+ const allowedExtensions = (accept === null || accept === void 0 ? void 0 : (_accept$replace = accept.replace(/\./g, "")) === null || _accept$replace === void 0 ? void 0 : _accept$replace.toUpperCase()) || "JPG, PNG, PDF";
70
88
  const uniqExts = (0, _utils.getUniqueFileExtensions)(allowedExtensions);
71
89
  onChange({
72
90
  id,
@@ -123,4 +141,6 @@ const FileLoaderLocal = _ref => {
123
141
  })
124
142
  }), renderRequiredLabel()));
125
143
  };
126
- var _default = exports.default = FileLoaderLocal;
144
+
145
+ var _default = FileLoaderLocal;
146
+ exports.default = _default;