intelicoreact 1.4.0 → 1.4.2

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 (254) 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 +202 -111
  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 +166 -60
  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/Modal/Modal.js +28 -6
  107. package/dist/Atomic/UI/Modal/ModalHOC.js +9 -1
  108. package/dist/Atomic/UI/Modal/partials/ModalFooter.js +7 -1
  109. package/dist/Atomic/UI/Modal/partials/ModalTitle.js +8 -1
  110. package/dist/Atomic/UI/Modal/partials/useMobileModal.js +49 -32
  111. package/dist/Atomic/UI/ModalBackup/Modal.js +174 -0
  112. package/dist/Atomic/UI/ModalBackup/Modal.scss +333 -0
  113. package/dist/Atomic/UI/ModalBackup/ModalHOC.js +51 -0
  114. package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +24 -0
  115. package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +41 -0
  116. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +21 -6
  117. package/dist/Atomic/UI/NavLine/NavLine.js +55 -26
  118. package/dist/Atomic/UI/NavLine/Tabs.js +3 -2
  119. package/dist/Atomic/UI/PageTitle/PageTitle.js +10 -2
  120. package/dist/Atomic/UI/PieChart/PieChart.js +10 -1
  121. package/dist/Atomic/UI/Price/Price.js +8 -3
  122. package/dist/Atomic/UI/PriceRange/PriceRange.js +7 -1
  123. package/dist/Atomic/UI/ProgressLine/ProgressLine.js +16 -1
  124. package/dist/Atomic/UI/Status/Status.js +8 -1
  125. package/dist/Atomic/UI/Table/Partials/TdCell.js +29 -5
  126. package/dist/Atomic/UI/Table/Partials/TdHeader.js +11 -1
  127. package/dist/Atomic/UI/Table/Partials/TdRow.js +17 -5
  128. package/dist/Atomic/UI/Table/Partials/TdTitle.js +14 -3
  129. package/dist/Atomic/UI/Table/Table.js +12 -1
  130. package/dist/Atomic/UI/Table/TdTypes/TdActions.js +18 -2
  131. package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +9 -1
  132. package/dist/Atomic/UI/Table/TdTypes/TdRange.js +4 -1
  133. package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +13 -1
  134. package/dist/Atomic/UI/Tag/Tag.js +14 -3
  135. package/dist/Atomic/UI/TagList/TagList.js +35 -19
  136. package/dist/Atomic/UI/UserBox/UserBox.js +13 -1
  137. package/dist/Classes/AbortableFetch.js +93 -36
  138. package/dist/Classes/AnimatedHandler.js +7 -3
  139. package/dist/Classes/RESTAPI/index.js +44 -39
  140. package/dist/Classes/RESTAPI/partials/AbortableFetch.js +93 -35
  141. package/dist/Classes/RESTAPI/partials/ApiBase.js +9 -1
  142. package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +32 -24
  143. package/dist/Classes/RESTAPI/partials/ApiUtils.js +41 -34
  144. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +44 -21
  145. package/dist/Classes/RESTAPI/partials/Utils.js +19 -6
  146. package/dist/Classes/RESTAPI/partials/_outerDependencies.js +6 -2
  147. package/dist/Classes/RESTAPI/partials/_utils.js +36 -13
  148. package/dist/Constants/index.constants.js +15 -8
  149. package/dist/Functions/Portal.js +16 -5
  150. package/dist/Functions/customEventListener.js +17 -4
  151. package/dist/Functions/fieldValueFormatters.js +83 -43
  152. package/dist/Functions/hooks/useFormFieldsChangesManager.js +26 -23
  153. package/dist/Functions/locale/createTranslator.js +9 -4
  154. package/dist/Functions/operations.js +22 -12
  155. package/dist/Functions/presets/inputMaskPresets.js +11 -9
  156. package/dist/Functions/presets/inputPresets.js +11 -8
  157. package/dist/Functions/presets/mobileKeyboardTypesPresets.js +9 -7
  158. package/dist/Functions/schemas.js +13 -6
  159. package/dist/Functions/useBodyScrollLock.js +6 -1
  160. package/dist/Functions/useClickOutside.js +4 -0
  161. package/dist/Functions/useDebounce.js +7 -2
  162. package/dist/Functions/useFieldFocus.js +18 -6
  163. package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +9 -0
  164. package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +23 -12
  165. package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +15 -6
  166. package/dist/Functions/useFormTools/functions/General.js +28 -18
  167. package/dist/Functions/useFormTools/functions/RenderFields.js +11 -2
  168. package/dist/Functions/useFormTools/functions/usePrevious.js +5 -1
  169. package/dist/Functions/useFormTools/index.js +144 -85
  170. package/dist/Functions/useInputHighlightError.js +12 -3
  171. package/dist/Functions/useIsMobile.js +13 -7
  172. package/dist/Functions/useKeyPress/useHandleKeyPress.js +7 -1
  173. package/dist/Functions/useKeyPress/useKeyPress.js +9 -1
  174. package/dist/Functions/useLocalStorage.js +9 -1
  175. package/dist/Functions/useLocationParams.js +5 -4
  176. package/dist/Functions/useMediaQuery.js +9 -3
  177. package/dist/Functions/useMetaInfo.js +10 -3
  178. package/dist/Functions/useMouseUpOutside.js +3 -0
  179. package/dist/Functions/useOnlineStatus.js +9 -1
  180. package/dist/Functions/usePasswordChecker.js +20 -4
  181. package/dist/Functions/usePrevious.js +5 -1
  182. package/dist/Functions/useResize.js +10 -2
  183. package/dist/Functions/useScrollTo.js +7 -2
  184. package/dist/Functions/useToggle.js +5 -1
  185. package/dist/Functions/utils.js +131 -56
  186. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +9 -2
  187. package/dist/Molecular/CustomIcons/components/AlertCircle.js +9 -2
  188. package/dist/Molecular/CustomIcons/components/AppStore.js +9 -2
  189. package/dist/Molecular/CustomIcons/components/Arrow.js +9 -2
  190. package/dist/Molecular/CustomIcons/components/ArrowDown.js +9 -2
  191. package/dist/Molecular/CustomIcons/components/ArrowLeft.js +9 -2
  192. package/dist/Molecular/CustomIcons/components/ArrowRight.js +9 -2
  193. package/dist/Molecular/CustomIcons/components/ArrowUp.js +9 -2
  194. package/dist/Molecular/CustomIcons/components/Bell.js +9 -2
  195. package/dist/Molecular/CustomIcons/components/Button.js +9 -2
  196. package/dist/Molecular/CustomIcons/components/Campaigns.js +9 -2
  197. package/dist/Molecular/CustomIcons/components/Check.js +9 -2
  198. package/dist/Molecular/CustomIcons/components/Check2.js +9 -2
  199. package/dist/Molecular/CustomIcons/components/ChevronDown.js +9 -2
  200. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +9 -2
  201. package/dist/Molecular/CustomIcons/components/ChevronLeft.js +9 -2
  202. package/dist/Molecular/CustomIcons/components/ChevronRight.js +9 -2
  203. package/dist/Molecular/CustomIcons/components/ChevronUp.js +9 -2
  204. package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +9 -2
  205. package/dist/Molecular/CustomIcons/components/Close.js +9 -2
  206. package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +9 -2
  207. package/dist/Molecular/CustomIcons/components/Delete.js +9 -2
  208. package/dist/Molecular/CustomIcons/components/Edit.js +9 -2
  209. package/dist/Molecular/CustomIcons/components/Email.js +9 -2
  210. package/dist/Molecular/CustomIcons/components/FinturfLogo.js +9 -2
  211. package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +9 -2
  212. package/dist/Molecular/CustomIcons/components/Flows.js +9 -2
  213. package/dist/Molecular/CustomIcons/components/Gift.js +9 -2
  214. package/dist/Molecular/CustomIcons/components/GoogleAuth.js +9 -2
  215. package/dist/Molecular/CustomIcons/components/GooglePlay.js +9 -2
  216. package/dist/Molecular/CustomIcons/components/HelpCircle.js +9 -2
  217. package/dist/Molecular/CustomIcons/components/HelpCircle2.js +9 -2
  218. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +9 -2
  219. package/dist/Molecular/CustomIcons/components/Home.js +9 -2
  220. package/dist/Molecular/CustomIcons/components/Home2.js +9 -2
  221. package/dist/Molecular/CustomIcons/components/Key.js +9 -2
  222. package/dist/Molecular/CustomIcons/components/Landers.js +9 -2
  223. package/dist/Molecular/CustomIcons/components/Lock.js +9 -2
  224. package/dist/Molecular/CustomIcons/components/Mail.js +9 -2
  225. package/dist/Molecular/CustomIcons/components/Mastercard.js +9 -2
  226. package/dist/Molecular/CustomIcons/components/Minus.js +9 -2
  227. package/dist/Molecular/CustomIcons/components/Offers.js +9 -2
  228. package/dist/Molecular/CustomIcons/components/Pause.js +9 -2
  229. package/dist/Molecular/CustomIcons/components/PayPal.js +9 -2
  230. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +9 -2
  231. package/dist/Molecular/CustomIcons/components/Phone.js +9 -2
  232. package/dist/Molecular/CustomIcons/components/Play.js +9 -2
  233. package/dist/Molecular/CustomIcons/components/Plus.js +9 -2
  234. package/dist/Molecular/CustomIcons/components/Profile.js +9 -2
  235. package/dist/Molecular/CustomIcons/components/QRCode.js +9 -2
  236. package/dist/Molecular/CustomIcons/components/Rectangle.js +9 -2
  237. package/dist/Molecular/CustomIcons/components/Revert.js +9 -2
  238. package/dist/Molecular/CustomIcons/components/Star.js +9 -2
  239. package/dist/Molecular/CustomIcons/components/Star2.js +9 -2
  240. package/dist/Molecular/CustomIcons/components/TrafficSources.js +9 -2
  241. package/dist/Molecular/CustomIcons/components/Trash.js +9 -2
  242. package/dist/Molecular/CustomIcons/components/TrashRed.js +9 -2
  243. package/dist/Molecular/CustomIcons/components/Triggers.js +9 -2
  244. package/dist/Molecular/CustomIcons/components/User.js +9 -2
  245. package/dist/Molecular/CustomIcons/components/Visa.js +9 -2
  246. package/dist/Molecular/CustomIcons/components/X.js +9 -2
  247. package/dist/Molecular/CustomIcons/index.js +122 -0
  248. package/dist/Molecular/FormElement/FormElement.js +12 -1
  249. package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +31 -30
  250. package/dist/Molecular/FormWithDependOn/partials/_utils.js +12 -9
  251. package/dist/Molecular/InputAddress/InputAddress.js +114 -65
  252. package/dist/Molecular/InputPassword/InputPassword.js +19 -5
  253. package/dist/index.js +2 -0
  254. package/package.json +1 -1
@@ -1,26 +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
+
11
16
  var _reactDom = require("react-dom");
17
+
12
18
  var _reactFeather = require("react-feather");
19
+
13
20
  var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
21
+
14
22
  var _useDebounce = require("../../../Functions/useDebounce");
23
+
15
24
  var _useIsMobile = _interopRequireDefault(require("../../../Functions/useIsMobile"));
25
+
16
26
  var _Spinner = _interopRequireDefault(require("../../Layout/Spinner/Spinner"));
27
+
17
28
  var _RadioInput = _interopRequireDefault(require("../RadioInput/RadioInput"));
29
+
18
30
  require("./DropdownLiveSearch.scss");
19
- 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); }
20
- 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
+
21
36
  const RC = "dropdown-live-search";
37
+
22
38
  const DropdownLiveSearch = _ref => {
23
39
  var _dropdownListRef$curr5, _dropdownListRef$curr6, _tabIndex$toString;
40
+
24
41
  let {
25
42
  label,
26
43
  value,
@@ -43,34 +60,68 @@ const DropdownLiveSearch = _ref => {
43
60
  withMobileLogic,
44
61
  tabIndex
45
62
  } = _ref;
46
- const [dropdownId, setDropdownId] = (0, _react.useState)(id || fieldKey || Math.random().toString(16).slice(2));
47
- const [isOpen, setIsOpen] = (0, _react.useState)(false);
63
+ const [dropdownId] = (0, _react.useState)(id || fieldKey || Math.random().toString(16).slice(2));
64
+ const [isOpen, setIsOpenState] = (0, _react.useState)(false);
48
65
  const [isValueDeleted, setIsValueDeleted] = (0, _react.useState)(false);
49
66
  const {
50
67
  isMobile: isMobileProp
51
68
  } = (0, _useIsMobile.default)();
52
69
  const isMobile = isMobileProp && withMobileLogic && window.screen.width <= 768;
53
70
  const labelByValue = (0, _react.useMemo)(() => {
54
- var _options$find;
55
- return (options === null || options === void 0 || (_options$find = options.find(item => item.value === value)) === null || _options$find === void 0 ? void 0 : _options$find.label) || "";
71
+ var _options$find$label, _options$find;
72
+
73
+ return (_options$find$label = 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) !== null && _options$find$label !== void 0 ? _options$find$label : "";
56
74
  }, [value]);
57
- const [searchValue, setSV] = (0, _react.useState)(labelByValue);
75
+ const [searchValue, setSV] = (0, _react.useState)("");
76
+ const [isSearchValueChangedAfterOpen, setIsSearchValueChangedAfterOpen] = (0, _react.useState)(false);
58
77
  const dropdownLiveSearchRef = (0, _react.useRef)(null);
59
78
  const dropdownListBoxRef = (0, _react.useRef)(null);
60
79
  const dropdownListRef = (0, _react.useRef)(null);
61
80
  const dropdownListHeaderRef = (0, _react.useRef)(null);
62
81
  const searchInputRef = (0, _react.useRef)(null);
63
82
  const searchInputModalRef = (0, _react.useRef)(null);
64
- const searchValueRef = (0, _react.useRef)(labelByValue);
83
+ const searchValueRef = (0, _react.useRef)(null);
65
84
  const wrapperRef = (0, _react.useRef)(null);
85
+ const [isFocusedByClick, setIsFocusedByClick] = (0, _react.useState)(false);
66
86
  const [isScrollableList, setIsScrollableList] = (0, _react.useState)(null);
67
87
  const [isFixedMaxHeight, setIsFixedMaxHeight] = (0, _react.useState)(false);
68
88
  const [scrollTop, setScrollTop] = (0, _react.useState)(0);
69
89
  const [scrollHeight, setScrollHeight] = (0, _react.useState)(1);
70
- const setSearchValue = val => {
90
+ const debouncedSearchTerm = (0, _useDebounce.useDebounce)({
91
+ searchValue,
92
+ delay: 600
93
+ });
94
+ const doScrollCallback = (0, _react.useCallback)(e => {
95
+ if (doRequest && typeof doRequest === "function") {
96
+ if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight) {
97
+ doRequest(searchValueRef.current, true);
98
+ }
99
+ }
100
+ }, [options]);
101
+
102
+ const setSearchValue = function (val) {
103
+ let isChanged = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
104
+ if (isChanged) setIsSearchValueChangedAfterOpen(true);
71
105
  setSV(val);
72
106
  searchValueRef.current = val;
73
107
  };
108
+
109
+ const setIsOpen = v => {
110
+ setIsOpenState(v);
111
+ setSearchValue("", false);
112
+ if (!v) setIsSearchValueChangedAfterOpen(false);
113
+ };
114
+
115
+ const getParentNode = () => {
116
+ var _ref2, _document$querySelect;
117
+
118
+ 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");
119
+ };
120
+
121
+ const getListContainer = () => {
122
+ return document.getElementById(dropdownId);
123
+ };
124
+
74
125
  const onWrapperClick = e => {
75
126
  if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
76
127
  e.stopPropagation();
@@ -78,20 +129,58 @@ const DropdownLiveSearch = _ref => {
78
129
  setIsOpen(false);
79
130
  }
80
131
  };
81
- const [isFocusedByClick, setIsFocusedByClick] = (0, _react.useState)(false);
82
- const debouncedSearchTerm = (0, _useDebounce.useDebounce)({
83
- searchValue,
84
- delay: 600
85
- });
86
- if (!options) return null;
132
+
133
+ const onSearchableInputFocus = e => {
134
+ if (!isOpen) {
135
+ e.preventDefault();
136
+ e.stopPropagation();
137
+ }
138
+ };
139
+
87
140
  const handleClickOutside = event => {
88
141
  var _getListContainer;
142
+
89
143
  if (!dropdownLiveSearchRef.current.contains(event.target) && (!getListContainer() || !((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(event.target)))) setIsOpen(false);
90
144
  };
145
+
146
+ const closeListViaEsc = e => {
147
+ if ([27].includes(e.keyCode)) setIsOpen(false);
148
+ };
149
+
150
+ const closeList = isOpen ? handleClickOutside : () => {};
151
+ const handle = {
152
+ onInputClick: e => {
153
+ if (!isOpen) setIsOpen(true);
154
+
155
+ if (isMobile && withMobileLogic) {
156
+ e.preventDefault();
157
+ e.stopPropagation();
158
+ e.target.blur();
159
+ } else {
160
+ e.target.select();
161
+ }
162
+ },
163
+ onInputChange: e => {
164
+ let inputValue = e.target.value;
165
+ if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
166
+ setSearchValue(inputValue);
167
+
168
+ if ((searchValue || !isSearchValueChangedAfterOpen) && !e.target.value) {
169
+ onChange("");
170
+ setSearchValue("");
171
+ setIsValueDeleted(true);
172
+ } else setIsValueDeleted(false);
173
+ }
174
+ };
175
+
91
176
  const highlightedText = (text, postfix) => {
92
177
  if (!isSearchable) return text;else {
93
178
  var _text;
179
+
180
+ const preparedSearchValue = isSearchValueChangedAfterOpen || isMobile && withMobileLogic ? searchValue : labelByValue;
181
+
94
182
  const prepare = text => text === null || text === void 0 ? void 0 : text.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
183
+
95
184
  text = text.replace(/["&<>]/g, a => {
96
185
  return {
97
186
  '"': "&quot;",
@@ -100,22 +189,23 @@ const DropdownLiveSearch = _ref => {
100
189
  ">": "&gt;"
101
190
  }[a];
102
191
  });
103
- const main = searchValue ? (_text = text) === null || _text === void 0 ? void 0 : _text.replace(new RegExp(prepare(searchValue), "i"), match => "<span class=\"bg--yellow\">".concat(match, "</span>")) : text;
192
+ const main = preparedSearchValue ? (_text = text) === null || _text === void 0 ? void 0 : _text.replace(new RegExp(prepare(preparedSearchValue), "i"), match => "<span class=\"bg--yellow\">".concat(match, "</span>")) : text;
104
193
  const postfixPart = postfix ? "<span class=\"dropdown__list-item-postfix\">".concat(postfix, "</span>") : "";
105
194
  return main + postfixPart;
106
195
  }
107
196
  };
197
+
108
198
  const getMarkupForElement = (item, index, optTestId) => {
109
- var _item$value, _item$value2, _item$customMobileIco;
199
+ var _item$value, _item$value$toString, _item$value2, _item$value2$toString, _item$customMobileIco;
200
+
110
201
  const lowerLabel = item.label.toLowerCase();
111
- const lowerSearchValue = searchValue.toLowerCase();
202
+ const lowerSearchValue = searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase();
112
203
  return /*#__PURE__*/_react.default.createElement("button", {
113
- "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"),
114
- 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, "_"),
204
+ "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"),
205
+ 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, "_"),
115
206
  onClick: () => {
116
207
  onChange(item.value);
117
208
  setIsOpen(false);
118
- if (!withMobileLogic) setSearchValue(item.label);
119
209
  },
120
210
  className: (0, _classnames.default)("".concat(RC, "__list-item"), {
121
211
  ["".concat(RC, "__list-item_active")]: item.value === value,
@@ -136,6 +226,7 @@ const DropdownLiveSearch = _ref => {
136
226
  checked: value
137
227
  }) : "");
138
228
  };
229
+
139
230
  const getListMarkUp = () => {
140
231
  return /*#__PURE__*/_react.default.createElement("div", {
141
232
  className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
@@ -174,7 +265,7 @@ const DropdownLiveSearch = _ref => {
174
265
  value: isOpen ? searchValue : labelByValue,
175
266
  onChange: handle.onInputChange,
176
267
  placeholder: placeholder,
177
- onFocus: searchableInputFocus,
268
+ onFocus: onSearchableInputFocus,
178
269
  tabIndex: -1
179
270
  }, attributesOfNativeInput))), /*#__PURE__*/_react.default.createElement("div", {
180
271
  className: (0, _classnames.default)("".concat(RC, "__list"), {
@@ -187,151 +278,120 @@ const DropdownLiveSearch = _ref => {
187
278
  size: options.length <= 3 ? "small" : null
188
279
  }))));
189
280
  };
190
- const getParentNode = () => {
191
- var _ref2, _document$querySelect;
192
- 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");
193
- };
281
+
194
282
  const initListContainer = () => {
195
283
  const dropdownList = document.createElement("div");
196
284
  dropdownList.setAttribute("id", dropdownId);
197
285
  dropdownList.classList.add("dropdown__container");
286
+
198
287
  if (isMobile) {
199
288
  dropdownList.addEventListener("click", e => {
200
289
  if (e.target.id === dropdownId) setIsOpen(false);
201
290
  });
202
291
  }
292
+
203
293
  try {
204
294
  var _getListContainer2;
205
- (_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 || _getListContainer2.remove();
295
+
296
+ (_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 ? void 0 : _getListContainer2.remove();
206
297
  } finally {
207
298
  if (isMobile) {
208
299
  var _getParentNode;
300
+
209
301
  try {
210
302
  var _document$getElementB;
211
- (_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
303
+
304
+ (_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
212
305
  } catch (e) {}
306
+
213
307
  const dropdownMobileListWrapper = document.createElement("div");
214
308
  dropdownMobileListWrapper.classList.add("dropdown-live-search-mobile");
215
309
  dropdownMobileListWrapper.setAttribute("id", "mlw-".concat(dropdownId));
216
- dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 || dropdownMobileListWrapper.append(dropdownList);
217
- (_getParentNode = getParentNode()) === null || _getParentNode === void 0 || _getParentNode.append(dropdownMobileListWrapper);
310
+ dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 ? void 0 : dropdownMobileListWrapper.append(dropdownList);
311
+ (_getParentNode = getParentNode()) === null || _getParentNode === void 0 ? void 0 : _getParentNode.append(dropdownMobileListWrapper);
218
312
  } else {
219
313
  var _getParentNode2;
220
- (_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 || _getParentNode2.append(dropdownList);
314
+
315
+ (_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 ? void 0 : _getParentNode2.append(dropdownList);
221
316
  }
222
317
  }
223
318
  };
224
- const getListContainer = () => {
225
- return document.getElementById(dropdownId);
226
- };
319
+
227
320
  const renderListContainer = () => {
228
321
  const lc = getListContainer();
229
322
  if (!lc) return null;
230
323
  return /*#__PURE__*/(0, _reactDom.createPortal)(getListMarkUp(), lc);
231
324
  };
232
- (0, _react.useEffect)(() => {
233
- if (isMobile && withMobileLogic) {
234
- initListContainer();
235
- }
236
- }, [isMobile, withMobileLogic]);
237
- (0, _react.useEffect)(() => {
238
- if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current && !searchValue) {
239
- var _dropdownListRef$curr, _dropdownListRef$curr2, _dropdownListRef$curr3, _dropdownListRef$curr4;
240
- 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));
241
- 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));
242
- }
243
- }, [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]);
244
- (0, _react.useEffect)(() => {
245
- if (!value) setSearchValue("");
246
- }, [value]);
325
+
247
326
  (0, _react.useEffect)(() => {
248
327
  document.addEventListener("click", handleClickOutside, true);
249
328
  return () => document.removeEventListener("click", handleClickOutside, true);
250
- }, [value]);
329
+ }, []);
251
330
  (0, _react.useEffect)(() => {
252
331
  if (options.length === 1 && searchValue === options[0].label) {
253
332
  setSearchValue(options[0].label);
254
333
  onChange(options[0].value);
255
334
  }
256
335
  }, [options]);
257
- const searchableInputFocus = e => {
258
- if (!isOpen) {
259
- e.preventDefault();
260
- e.stopPropagation();
261
- }
262
- };
263
- const handle = {
264
- onInputClick: e => {
265
- if (!isOpen) setIsOpen(true);
266
- if (isMobile && withMobileLogic) {
267
- e.preventDefault();
268
- e.stopPropagation();
269
- e.target.blur();
270
- } else {
271
- e.target.select();
272
- }
273
- },
274
- onInputChange: e => {
275
- let inputValue = e.target.value;
276
- if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
277
- setSearchValue(inputValue);
278
- if (searchValue && !e.target.value) {
279
- onChange("");
280
- setSearchValue("");
281
- setIsValueDeleted(true);
282
- } else setIsValueDeleted(false);
283
- }
284
- };
285
336
  (0, _react.useEffect)(() => {
286
- if (isSearchable && debouncedSearchTerm || isValueDeleted) {
337
+ if (isSearchable && (debouncedSearchTerm || isValueDeleted)) {
287
338
  doRequest(debouncedSearchTerm);
339
+ if (isValueDeleted) setIsValueDeleted(false);
288
340
  }
289
341
  }, [debouncedSearchTerm, isValueDeleted]);
290
- const closeListViaEsc = e => {
291
- if ([27].includes(e.keyCode)) setIsOpen(false);
292
- };
293
- (0, _react.useLayoutEffect)(() => {
294
- window.addEventListener("keyup", closeListViaEsc);
295
- return () => {
296
- window.removeEventListener("keyup", closeListViaEsc);
297
- };
298
- }, [getListContainer]);
342
+ (0, _react.useEffect)(() => {
343
+ if (isMobile && withMobileLogic) {
344
+ initListContainer();
345
+ }
346
+ }, [isMobile, withMobileLogic]);
347
+ (0, _react.useEffect)(() => {
348
+ if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current && !searchValue) {
349
+ var _dropdownListRef$curr, _dropdownListRef$curr2, _dropdownListRef$curr3, _dropdownListRef$curr4;
350
+
351
+ 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));
352
+ 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));
353
+ }
354
+ }, [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]);
299
355
  (0, _react.useLayoutEffect)(() => {
300
356
  const list = document.getElementById("dropdown-live-search-list");
301
- if ((list || isOpen) && !withMobileLogic) {
357
+
358
+ if ((list || isOpen) && (!withMobileLogic || !isMobile)) {
302
359
  var _dropdownLiveSearchRe;
303
- const dropdownWidth = dropdownLiveSearchRef === null || dropdownLiveSearchRef === void 0 || (_dropdownLiveSearchRe = dropdownLiveSearchRef.current) === null || _dropdownLiveSearchRe === void 0 ? void 0 : _dropdownLiveSearchRe.clientWidth;
304
- list.style.width = "".concat(dropdownWidth, "px");
360
+
361
+ const dropdownWidth = dropdownLiveSearchRef === null || dropdownLiveSearchRef === void 0 ? void 0 : (_dropdownLiveSearchRe = dropdownLiveSearchRef.current) === null || _dropdownLiveSearchRe === void 0 ? void 0 : _dropdownLiveSearchRe.clientWidth;
362
+ list.style.minWidth = "".concat(dropdownWidth, "px");
305
363
  }
306
364
  }, [dropdownLiveSearchRef, isOpen, withMobileLogic]);
307
- const doScrollCallback = (0, _react.useCallback)(e => {
308
- if (doRequest && typeof doRequest === "function") {
309
- if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight) {
310
- doRequest(searchValueRef.current, true);
311
- }
312
- }
313
- }, [options]);
314
365
  (0, _react.useEffect)(() => {
315
366
  if (!isOpen) {
316
367
  setIsFocusedByClick(false);
317
- if (withMobileLogic) setSearchValue("");
368
+ if (withMobileLogic && isMobile) setSearchValue("");
318
369
  }
370
+
319
371
  if (isOpen && dropdownListRef && dropdownListRef.current) {
320
372
  if (isMobile && withMobileLogic) {
321
- var _dropdownListBoxRef$c, _dropdownListHeaderRe, _searchInputModalRef$;
322
- doRequest("");
323
- 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");
324
- searchInputModalRef === null || searchInputModalRef === void 0 || (_searchInputModalRef$ = searchInputModalRef.current) === null || _searchInputModalRef$ === void 0 || _searchInputModalRef$.focus();
373
+ var _searchInputModalRef$;
374
+
375
+ doRequest("").then(() => {
376
+ setTimeout(() => {
377
+ var _dropdownListBoxRef$c, _dropdownListBoxRef$c2, _dropdownListHeaderRe, _dropdownListHeaderRe2;
378
+
379
+ 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");
380
+ }, 1);
381
+ });
382
+ searchInputModalRef === null || searchInputModalRef === void 0 ? void 0 : (_searchInputModalRef$ = searchInputModalRef.current) === null || _searchInputModalRef$ === void 0 ? void 0 : _searchInputModalRef$.focus();
325
383
  }
384
+
326
385
  dropdownListRef.current.addEventListener("scroll", doScrollCallback);
327
386
  }
387
+
328
388
  return () => {
329
389
  removeEventListener("scroll", doScrollCallback);
330
390
  };
331
391
  }, [isOpen, dropdownListRef]);
332
- const closeList = isOpen ? handleClickOutside : () => {};
333
392
  (0, _react.useLayoutEffect)(() => {
334
393
  var _getListContainer3;
394
+
335
395
  if (!isMobile) {
336
396
  window.addEventListener("mousewheel", closeList);
337
397
  window.addEventListener("scroll", closeList);
@@ -341,18 +401,47 @@ const DropdownLiveSearch = _ref => {
341
401
  window.removeEventListener("scroll", closeList);
342
402
  window.removeEventListener("touchmove", closeList);
343
403
  }
344
- (_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 || _getListContainer3.addEventListener("click", closeList);
404
+
405
+ (_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.addEventListener("click", closeList);
406
+ window.addEventListener("keyup", closeListViaEsc);
345
407
  return () => {
346
408
  var _getListContainer4;
409
+
347
410
  window.removeEventListener("mousewheel", closeList);
348
411
  window.removeEventListener("scroll", closeList);
349
412
  window.removeEventListener("touchmove", closeList);
350
- (_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 || _getListContainer4.removeEventListener("click", closeList);
413
+ window.removeEventListener("keyup", closeListViaEsc);
414
+ (_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 ? void 0 : _getListContainer4.removeEventListener("click", closeList);
351
415
  };
352
416
  }, [getListContainer]);
417
+ (0, _react.useEffect)(() => {
418
+ const setScrollTopValue = e => {
419
+ setScrollTop(parseInt(e.target.scrollTop, 10));
420
+ };
421
+
422
+ if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
423
+ var _dropdownListRef$curr7;
424
+
425
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
426
+ }
427
+
428
+ return () => {
429
+ var _dropdownListRef$curr8;
430
+
431
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
432
+ };
433
+ }, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
434
+ (0, _react.useEffect)(() => {
435
+ if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
436
+ var _dropdownListRef$curr9, _dropdownListRef$curr10;
437
+
438
+ setScrollHeight(parseInt((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr9 = dropdownListRef.current) === null || _dropdownListRef$curr9 === void 0 ? void 0 : _dropdownListRef$curr9.scrollHeight) - (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr10 = dropdownListRef.current) === null || _dropdownListRef$curr10 === void 0 ? void 0 : _dropdownListRef$curr10.clientHeight), 10));
439
+ }
440
+ }, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
441
+ if (!options) return null;
353
442
  return /*#__PURE__*/_react.default.createElement("div", {
354
443
  className: (0, _classnames.default)(RC, className, {
355
- disabled: disabled,
444
+ disabled,
356
445
  ["".concat(RC, "-mobile")]: isMobile
357
446
  }),
358
447
  ref: dropdownLiveSearchRef
@@ -362,14 +451,14 @@ const DropdownLiveSearch = _ref => {
362
451
  onClick: () => !isSearchable ? setIsOpen(!isOpen) : null,
363
452
  onMouseDown: () => setIsFocusedByClick(true),
364
453
  onFocus: () => !isFocusedByClick ? setIsOpen(true) : null,
365
- tabIndex: tabIndex === null || tabIndex === void 0 || (_tabIndex$toString = tabIndex.toString) === null || _tabIndex$toString === void 0 ? void 0 : _tabIndex$toString.call(tabIndex)
454
+ tabIndex: tabIndex === null || tabIndex === void 0 ? void 0 : (_tabIndex$toString = tabIndex.toString) === null || _tabIndex$toString === void 0 ? void 0 : _tabIndex$toString.call(tabIndex)
366
455
  }, isSearchable ? /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
367
456
  ref: searchInputRef,
368
457
  className: "".concat(RC, "__input"),
369
- value: isOpen ? isMobile && withMobileLogic ? labelByValue : searchValue : labelByValue,
458
+ value: isOpen ? isMobile && withMobileLogic || !isSearchValueChangedAfterOpen ? labelByValue : searchValue : labelByValue,
370
459
  onChange: handle.onInputChange,
371
460
  placeholder: placeholder,
372
- onFocus: searchableInputFocus,
461
+ onFocus: onSearchableInputFocus,
373
462
  onClick: handle.onInputClick,
374
463
  tabIndex: -1
375
464
  }, attributesOfNativeInput)) : /*#__PURE__*/_react.default.createElement("span", {
@@ -383,4 +472,6 @@ const DropdownLiveSearch = _ref => {
383
472
  className: "mobile-icon"
384
473
  }) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, null) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, null))), isOpen && (isMobile && withMobileLogic ? renderListContainer() : getListMarkUp()));
385
474
  };
386
- var _default = exports.default = DropdownLiveSearch;
475
+
476
+ var _default = DropdownLiveSearch;
477
+ 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;