intelicoreact 1.4.76 → 1.4.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/dist/Atomic/FormElements/ActionAlert/ActionAlert.js +9 -1
  2. package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +10 -1
  3. package/dist/Atomic/FormElements/Calendar/Calendar.js +24 -4
  4. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +10 -1
  5. package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +14 -2
  6. package/dist/Atomic/FormElements/Datepicker/Datepicker.js +54 -5
  7. package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +21 -3
  8. package/dist/Atomic/FormElements/Dropdown/Dropdown.js +145 -52
  9. package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +7 -1
  10. package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +91 -25
  11. package/dist/Atomic/FormElements/FileLoader/FileLoader.js +15 -3
  12. package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +29 -15
  13. package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +15 -5
  14. package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.js +23 -4
  15. package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +26 -6
  16. package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +38 -19
  17. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +38 -9
  18. package/dist/Atomic/FormElements/Input/Input.js +60 -25
  19. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +31 -4
  20. package/dist/Atomic/FormElements/InputColor/InputColor.js +14 -4
  21. package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +29 -6
  22. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +43 -8
  23. package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +21 -3
  24. package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +81 -58
  25. package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +41 -6
  26. package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +8 -1
  27. package/dist/Atomic/FormElements/InputDateRange/dependencies.js +46 -16
  28. package/dist/Atomic/FormElements/InputLink/InputLink.js +23 -6
  29. package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +4 -0
  30. package/dist/Atomic/FormElements/InputMask/InputMask.js +208 -77
  31. package/dist/Atomic/FormElements/InputMask/functions.js +28 -2
  32. package/dist/Atomic/FormElements/InputMask2/InputMask2.js +119 -43
  33. package/dist/Atomic/FormElements/InputMask2/functions.js +28 -2
  34. package/dist/Atomic/FormElements/InputMask3/InputMask3.js +137 -44
  35. package/dist/Atomic/FormElements/InputMask3/functions.js +28 -2
  36. package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +17 -3
  37. package/dist/Atomic/FormElements/InputsRow/InputsRow.js +24 -5
  38. package/dist/Atomic/FormElements/Label/Label.js +9 -1
  39. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +73 -35
  40. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +15 -3
  41. package/dist/Atomic/FormElements/NumericInput/NumericInput.js +44 -23
  42. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +17 -7
  43. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +14 -3
  44. package/dist/Atomic/FormElements/RadioInput/RadioInput.js +10 -1
  45. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +14 -3
  46. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +23 -3
  47. package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +34 -17
  48. package/dist/Atomic/FormElements/RangeList/RangeList.js +25 -6
  49. package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +11 -1
  50. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +85 -14
  51. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +132 -43
  52. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +10 -1
  53. package/dist/Atomic/FormElements/Switcher/Switcher.js +10 -1
  54. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +13 -1
  55. package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +10 -1
  56. package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +17 -2
  57. package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +17 -3
  58. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +11 -1
  59. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +29 -6
  60. package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +3 -2
  61. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +12 -1
  62. package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +23 -6
  63. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +223 -105
  64. package/dist/Atomic/FormElements/Text/Text.js +16 -10
  65. package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +9 -1
  66. package/dist/Atomic/FormElements/Textarea/Textarea.js +16 -5
  67. package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +35 -6
  68. package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +13 -4
  69. package/dist/Atomic/FormElements/TimeRange/TimeRange.js +21 -7
  70. package/dist/Atomic/FormElements/UserContacts/UserContacts.js +35 -8
  71. package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +91 -0
  72. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +18 -5
  73. package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +10 -3
  74. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +11 -3
  75. package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +2 -1
  76. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +12 -5
  77. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
  78. package/dist/Atomic/Layout/Header/Header.js +15 -3
  79. package/dist/Atomic/Layout/MainMenu/MainMenu.js +20 -3
  80. package/dist/Atomic/Layout/Spinner/Spinner.js +8 -1
  81. package/dist/Atomic/UI/Accordion/Accordion.js +19 -3
  82. package/dist/Atomic/UI/Accordion/AccordionItem.js +23 -9
  83. package/dist/Atomic/UI/AccordionTable/AccordionTable.js +32 -7
  84. package/dist/Atomic/UI/AccordionText/AccordionText.js +17 -3
  85. package/dist/Atomic/UI/AdvancedTag/AdvTag.js +21 -4
  86. package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +15 -3
  87. package/dist/Atomic/UI/Alert/Alert.js +19 -3
  88. package/dist/Atomic/UI/Arrow/Arrow.js +16 -3
  89. package/dist/Atomic/UI/Box/Box.js +9 -3
  90. package/dist/Atomic/UI/Button/Button.js +11 -2
  91. package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +10 -1
  92. package/dist/Atomic/UI/Chart/Chart.js +29 -4
  93. package/dist/Atomic/UI/Chart/partial/Chart.constants.js +19 -11
  94. package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +12 -1
  95. package/dist/Atomic/UI/Chart/partial/datasetSetters.js +34 -11
  96. package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +56 -82
  97. package/dist/Atomic/UI/Chart/partial/optionsSetters.js +19 -15
  98. package/dist/Atomic/UI/Chart/partial/utils.js +20 -6
  99. package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +13 -3
  100. package/dist/Atomic/UI/DateTime/DateTime.js +14 -3
  101. package/dist/Atomic/UI/DebugContainer/DebugContainer.js +16 -4
  102. package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +11 -3
  103. package/dist/Atomic/UI/DoubleString/DoubleString.js +17 -5
  104. package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +10 -3
  105. package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +52 -17
  106. package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +29 -1
  107. package/dist/Atomic/UI/Hint/Hint.js +39 -13
  108. package/dist/Atomic/UI/Hint/partials/_utils.js +19 -4
  109. package/dist/Atomic/UI/Modal/Modal.js +28 -6
  110. package/dist/Atomic/UI/Modal/ModalHOC.js +9 -1
  111. package/dist/Atomic/UI/Modal/partials/ModalFooter.js +7 -1
  112. package/dist/Atomic/UI/Modal/partials/ModalTitle.js +8 -1
  113. package/dist/Atomic/UI/Modal/partials/useMobileModal.js +49 -32
  114. package/dist/Atomic/UI/ModalBackup/Modal.js +174 -0
  115. package/dist/Atomic/UI/ModalBackup/Modal.scss +333 -0
  116. package/dist/Atomic/UI/ModalBackup/ModalHOC.js +51 -0
  117. package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +24 -0
  118. package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +41 -0
  119. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +21 -6
  120. package/dist/Atomic/UI/NavLine/NavLine.js +55 -26
  121. package/dist/Atomic/UI/NavLine/Tabs.js +3 -2
  122. package/dist/Atomic/UI/PageTitle/PageTitle.js +10 -2
  123. package/dist/Atomic/UI/PieChart/PieChart.js +10 -1
  124. package/dist/Atomic/UI/Price/Price.js +8 -3
  125. package/dist/Atomic/UI/PriceRange/PriceRange.js +7 -1
  126. package/dist/Atomic/UI/ProgressLine/ProgressLine.js +16 -1
  127. package/dist/Atomic/UI/Status/Status.js +8 -1
  128. package/dist/Atomic/UI/Table/Partials/TdCell.js +29 -5
  129. package/dist/Atomic/UI/Table/Partials/TdHeader.js +11 -1
  130. package/dist/Atomic/UI/Table/Partials/TdRow.js +17 -5
  131. package/dist/Atomic/UI/Table/Partials/TdTitle.js +14 -3
  132. package/dist/Atomic/UI/Table/Table.js +12 -1
  133. package/dist/Atomic/UI/Table/TdTypes/TdActions.js +18 -2
  134. package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +9 -1
  135. package/dist/Atomic/UI/Table/TdTypes/TdRange.js +4 -1
  136. package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +13 -1
  137. package/dist/Atomic/UI/Tag/Tag.js +26 -11
  138. package/dist/Atomic/UI/TagList/TagList.js +52 -21
  139. package/dist/Atomic/UI/TagList/TagList.scss +3 -2
  140. package/dist/Atomic/UI/UserBox/UserBox.js +13 -1
  141. package/dist/Atomic/UI/WizardStepper/constructor.js +11 -3
  142. package/dist/Atomic/UI/WizardStepper/index.js +5 -1
  143. package/dist/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.js +10 -0
  144. package/dist/Atomic/UI/WizardStepper/ui/StateIcon/index.js +4 -1
  145. package/dist/Atomic/UI/WizardStepper/ui/StepRow/StepRow.js +17 -2
  146. package/dist/Atomic/UI/WizardStepper/ui/StepRow/index.js +5 -1
  147. package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.js +15 -1
  148. package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/index.js +5 -1
  149. package/dist/Atomic/UI/WizardStepper/ui/icons.js +9 -2
  150. package/dist/Atomic/UI/WizardStepper/ui/index.js +5 -1
  151. package/dist/Classes/AbortableFetch.js +93 -36
  152. package/dist/Classes/AnimatedHandler.js +7 -3
  153. package/dist/Classes/RESTAPI/index.js +43 -39
  154. package/dist/Classes/RESTAPI/partials/AbortableFetch.js +93 -35
  155. package/dist/Classes/RESTAPI/partials/ApiBase.js +9 -1
  156. package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +32 -24
  157. package/dist/Classes/RESTAPI/partials/ApiUtils.js +41 -34
  158. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +46 -21
  159. package/dist/Classes/RESTAPI/partials/Utils.js +19 -6
  160. package/dist/Classes/RESTAPI/partials/_outerDependencies.js +6 -2
  161. package/dist/Classes/RESTAPI/partials/_utils.js +39 -16
  162. package/dist/Constants/index.constants.js +15 -8
  163. package/dist/Functions/Portal.js +16 -5
  164. package/dist/Functions/customEventListener.js +17 -4
  165. package/dist/Functions/fieldValueFormatters.js +83 -43
  166. package/dist/Functions/hooks/useFormFieldsChangesManager.js +26 -23
  167. package/dist/Functions/locale/createTranslator.js +9 -4
  168. package/dist/Functions/operations.js +22 -12
  169. package/dist/Functions/presets/inputMaskPresets.js +11 -9
  170. package/dist/Functions/presets/inputPresets.js +11 -8
  171. package/dist/Functions/presets/mobileKeyboardTypesPresets.js +9 -7
  172. package/dist/Functions/schemas.js +13 -6
  173. package/dist/Functions/useBodyScrollLock.js +6 -1
  174. package/dist/Functions/useClickOutside.js +4 -0
  175. package/dist/Functions/useDebounce.js +7 -2
  176. package/dist/Functions/useFieldFocus.js +18 -6
  177. package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +9 -0
  178. package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +23 -12
  179. package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +15 -6
  180. package/dist/Functions/useFormTools/functions/General.js +28 -18
  181. package/dist/Functions/useFormTools/functions/RenderFields.js +11 -2
  182. package/dist/Functions/useFormTools/functions/usePrevious.js +5 -1
  183. package/dist/Functions/useFormTools/index.js +144 -85
  184. package/dist/Functions/useInputHighlightError.js +12 -3
  185. package/dist/Functions/useIsMobile.js +13 -7
  186. package/dist/Functions/useKeyPress/useHandleKeyPress.js +7 -1
  187. package/dist/Functions/useKeyPress/useKeyPress.js +9 -1
  188. package/dist/Functions/useLocalStorage.js +9 -1
  189. package/dist/Functions/useLocationParams.js +5 -4
  190. package/dist/Functions/useMediaQuery.js +9 -3
  191. package/dist/Functions/useMetaInfo.js +10 -3
  192. package/dist/Functions/useMouseUpOutside.js +3 -0
  193. package/dist/Functions/useOnlineStatus.js +9 -1
  194. package/dist/Functions/usePasswordChecker.js +20 -4
  195. package/dist/Functions/usePrevious.js +5 -1
  196. package/dist/Functions/useResize.js +10 -2
  197. package/dist/Functions/useScrollTo.js +7 -2
  198. package/dist/Functions/useToggle.js +5 -1
  199. package/dist/Functions/utils.js +131 -56
  200. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +9 -2
  201. package/dist/Molecular/CustomIcons/components/AlertCircle.js +9 -2
  202. package/dist/Molecular/CustomIcons/components/AppStore.js +9 -2
  203. package/dist/Molecular/CustomIcons/components/Arrow.js +9 -2
  204. package/dist/Molecular/CustomIcons/components/ArrowDown.js +9 -2
  205. package/dist/Molecular/CustomIcons/components/ArrowLeft.js +9 -2
  206. package/dist/Molecular/CustomIcons/components/ArrowRight.js +9 -2
  207. package/dist/Molecular/CustomIcons/components/ArrowUp.js +9 -2
  208. package/dist/Molecular/CustomIcons/components/Bell.js +9 -2
  209. package/dist/Molecular/CustomIcons/components/Button.js +9 -2
  210. package/dist/Molecular/CustomIcons/components/Campaigns.js +9 -2
  211. package/dist/Molecular/CustomIcons/components/Check.js +9 -2
  212. package/dist/Molecular/CustomIcons/components/Check2.js +9 -2
  213. package/dist/Molecular/CustomIcons/components/ChevronDown.js +9 -2
  214. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +9 -2
  215. package/dist/Molecular/CustomIcons/components/ChevronLeft.js +9 -2
  216. package/dist/Molecular/CustomIcons/components/ChevronRight.js +9 -2
  217. package/dist/Molecular/CustomIcons/components/ChevronUp.js +9 -2
  218. package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +9 -2
  219. package/dist/Molecular/CustomIcons/components/Close.js +9 -2
  220. package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +9 -2
  221. package/dist/Molecular/CustomIcons/components/Delete.js +9 -2
  222. package/dist/Molecular/CustomIcons/components/Edit.js +9 -2
  223. package/dist/Molecular/CustomIcons/components/Email.js +9 -2
  224. package/dist/Molecular/CustomIcons/components/FinturfLogo.js +9 -2
  225. package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +9 -2
  226. package/dist/Molecular/CustomIcons/components/Flows.js +9 -2
  227. package/dist/Molecular/CustomIcons/components/Gift.js +9 -2
  228. package/dist/Molecular/CustomIcons/components/GoogleAuth.js +9 -2
  229. package/dist/Molecular/CustomIcons/components/GooglePlay.js +9 -2
  230. package/dist/Molecular/CustomIcons/components/HelpCircle.js +9 -2
  231. package/dist/Molecular/CustomIcons/components/HelpCircle2.js +9 -2
  232. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +9 -2
  233. package/dist/Molecular/CustomIcons/components/Home.js +9 -2
  234. package/dist/Molecular/CustomIcons/components/Home2.js +9 -2
  235. package/dist/Molecular/CustomIcons/components/Key.js +9 -2
  236. package/dist/Molecular/CustomIcons/components/Landers.js +9 -2
  237. package/dist/Molecular/CustomIcons/components/Lock.js +9 -2
  238. package/dist/Molecular/CustomIcons/components/Mail.js +9 -2
  239. package/dist/Molecular/CustomIcons/components/Mastercard.js +9 -2
  240. package/dist/Molecular/CustomIcons/components/Minus.js +9 -2
  241. package/dist/Molecular/CustomIcons/components/Offers.js +9 -2
  242. package/dist/Molecular/CustomIcons/components/Pause.js +9 -2
  243. package/dist/Molecular/CustomIcons/components/PayPal.js +9 -2
  244. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +9 -2
  245. package/dist/Molecular/CustomIcons/components/Phone.js +9 -2
  246. package/dist/Molecular/CustomIcons/components/Play.js +9 -2
  247. package/dist/Molecular/CustomIcons/components/Plus.js +9 -2
  248. package/dist/Molecular/CustomIcons/components/Profile.js +9 -2
  249. package/dist/Molecular/CustomIcons/components/QRCode.js +9 -2
  250. package/dist/Molecular/CustomIcons/components/Rectangle.js +9 -2
  251. package/dist/Molecular/CustomIcons/components/Revert.js +9 -2
  252. package/dist/Molecular/CustomIcons/components/Star.js +9 -2
  253. package/dist/Molecular/CustomIcons/components/Star2.js +9 -2
  254. package/dist/Molecular/CustomIcons/components/TrafficSources.js +9 -2
  255. package/dist/Molecular/CustomIcons/components/Trash.js +9 -2
  256. package/dist/Molecular/CustomIcons/components/TrashRed.js +9 -2
  257. package/dist/Molecular/CustomIcons/components/Triggers.js +9 -2
  258. package/dist/Molecular/CustomIcons/components/User.js +9 -2
  259. package/dist/Molecular/CustomIcons/components/Visa.js +9 -2
  260. package/dist/Molecular/CustomIcons/components/X.js +9 -2
  261. package/dist/Molecular/CustomIcons/index.js +122 -0
  262. package/dist/Molecular/FormElement/FormElement.js +12 -1
  263. package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +31 -30
  264. package/dist/Molecular/FormWithDependOn/partials/_utils.js +12 -9
  265. package/dist/Molecular/InputAddress/InputAddress.js +114 -65
  266. package/dist/Molecular/InputPassword/InputPassword.js +19 -5
  267. package/dist/index.js +2 -0
  268. package/package.json +1 -1
  269. package/dist/Atomic/UI/Hint/partial/_utils.js +0 -52
@@ -1,28 +1,46 @@
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 _Input = _interopRequireDefault(require("../../../Atomic/FormElements/Input/Input"));
21
+
14
22
  var _RadioInput = _interopRequireDefault(require("../../../Atomic/FormElements/RadioInput/RadioInput"));
23
+
15
24
  var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
25
+
16
26
  var _useIsMobile = _interopRequireDefault(require("../../../Functions/useIsMobile"));
27
+
17
28
  var _utils = require("../../../Functions/utils");
29
+
18
30
  var _DropdownLoader = _interopRequireDefault(require("./components/DropdownLoader"));
31
+
19
32
  require("./Dropdown.scss");
20
- 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); }
21
- 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; }
33
+
34
+ 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); }
35
+
36
+ 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; }
37
+
22
38
  const RC = "dropdown";
23
39
  const MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH = 10;
40
+
24
41
  const Dropdown = _ref => {
25
- var _options$find, _dropdownListWrapperR3, _dropdownListRef$curr5, _dropdownListRef$curr6, _filteredOptions$find, _tabIndex$toString;
42
+ var _options$find, _dropdownListWrapperR4, _dropdownListWrapperR5, _dropdownListRef$curr5, _dropdownListRef$curr6, _filteredOptions$find, _tabIndex$toString;
43
+
26
44
  let {
27
45
  label,
28
46
  options = [],
@@ -77,24 +95,31 @@ const Dropdown = _ref => {
77
95
  return options === null || options === void 0 ? void 0 : options.reduce((result, item) => {
78
96
  if (item !== null && item !== void 0 && item.list || item !== null && item !== void 0 && item.items) {
79
97
  var _item$list, _item$items;
80
- result += (item === null || item === void 0 || (_item$list = item.list) === null || _item$list === void 0 ? void 0 : _item$list.length) || (item === null || item === void 0 || (_item$items = item.items) === null || _item$items === void 0 ? void 0 : _item$items.length) || 0;
98
+
99
+ result += (item === null || item === void 0 ? void 0 : (_item$list = item.list) === null || _item$list === void 0 ? void 0 : _item$list.length) || (item === null || item === void 0 ? void 0 : (_item$items = item.items) === null || _item$items === void 0 ? void 0 : _item$items.length) || 0;
81
100
  } else {
82
101
  ++result;
83
102
  }
103
+
84
104
  return result;
85
105
  }, 0);
86
106
  }, [options]);
107
+
87
108
  if (isMobile) {
88
109
  isSearchable = getTotalOptions() > (minItemsForShowMobileSearch || MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH);
89
110
  }
111
+
90
112
  const moveOtherToEnd = options => {
91
113
  const otherIndex = options === null || options === void 0 ? void 0 : options.findIndex(option => (option === null || option === void 0 ? void 0 : option.value) === "other");
114
+
92
115
  if (otherIndex > -1) {
93
116
  const other = options === null || options === void 0 ? void 0 : options.splice(otherIndex, 1);
94
117
  options.push(...other);
95
118
  }
119
+
96
120
  return options;
97
121
  };
122
+
98
123
  const optionsWithOtherAtTheEnd = moveOtherToEnd(options);
99
124
  options.map(option => {
100
125
  if (option.items) {
@@ -103,40 +128,48 @@ const Dropdown = _ref => {
103
128
  });
104
129
  const filteredGroups = optionsWithOtherAtTheEnd.map(item => {
105
130
  var _item$items2;
106
- return {
107
- ...item,
131
+
132
+ return { ...item,
108
133
  items: !isSearchable || !isSearchChanged ? item === null || item === void 0 ? void 0 : item.items : (_item$items2 = item.items) === null || _item$items2 === void 0 ? void 0 : _item$items2.slice().filter(el => {
109
134
  var _el$label;
110
- return (el === null || el === void 0 || (_el$label = el.label) === null || _el$label === void 0 ? void 0 : _el$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "")) || !(el !== null && el !== void 0 && el.value) || (el === null || el === void 0 ? void 0 : el.value) === "";
135
+
136
+ return (el === null || el === void 0 ? void 0 : (_el$label = el.label) === null || _el$label === void 0 ? void 0 : _el$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "")) || !(el !== null && el !== void 0 && el.value) || (el === null || el === void 0 ? void 0 : el.value) === "";
111
137
  })
112
138
  };
113
139
  }).filter(item => {
114
140
  var _item$items3;
141
+
115
142
  return ((_item$items3 = item.items) === null || _item$items3 === void 0 ? void 0 : _item$items3.length) > 0;
116
143
  });
117
144
  const filteredItems = optionsWithOtherAtTheEnd.filter(item => {
118
145
  var _item$items4;
146
+
119
147
  return !((_item$items4 = item.items) !== null && _item$items4 !== void 0 && _item$items4.length);
120
148
  }).filter(item => {
121
149
  var _item$label;
150
+
122
151
  if (!isSearchable || !isSearchChanged) return true;
123
- return (item === null || item === void 0 || (_item$label = item.label) === null || _item$label === void 0 ? void 0 : _item$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "")) || !(item !== null && item !== void 0 && item.value) || (item === null || item === void 0 ? void 0 : item.value) === "";
152
+ return (item === null || item === void 0 ? void 0 : (_item$label = item.label) === null || _item$label === void 0 ? void 0 : _item$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "")) || !(item !== null && item !== void 0 && item.value) || (item === null || item === void 0 ? void 0 : item.value) === "";
124
153
  });
125
154
  const filteredOptions = [...filteredItems, ...filteredGroups];
126
155
  const modalBtnTrigger = entity && entity !== "" && typeof entity === "string";
156
+
127
157
  const onChangeHandler = item => {
128
158
  setIsOpen(false);
129
159
  onChange(item.value);
130
160
  };
161
+
131
162
  const onKeyDown = e => {
132
163
  if (![9, 13].includes(e.keyCode)) return false;
133
164
  setIsOpen(false);
134
165
  };
166
+
135
167
  const onKeyUp = e => {
136
168
  if (![9, 13].includes(e.keyCode)) return false;
137
169
  setIsOpen(true);
138
- };
139
- // decorator
170
+ }; // decorator
171
+
172
+
140
173
  const getDepends = getDependsTrigger => {
141
174
  const newOnChange = e => {
142
175
  if (e.value === "open_modal") {
@@ -144,9 +177,9 @@ const Dropdown = _ref => {
144
177
  } else {
145
178
  onChangeHandler(e);
146
179
  }
147
- };
180
+ }; // add pseudo option
181
+
148
182
 
149
- // add pseudo option
150
183
  const newOptions = [{
151
184
  label: "New ".concat(entity),
152
185
  value: "open_modal",
@@ -159,18 +192,22 @@ const Dropdown = _ref => {
159
192
  options: getDependsTrigger ? newOptions : options
160
193
  };
161
194
  };
195
+
162
196
  const handleClickOutside = event => {
163
197
  var _getListContainer;
198
+
164
199
  if (!((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(event === null || event === void 0 ? void 0 : event.target)) && !(dropdownRef !== null && dropdownRef !== void 0 && dropdownRef.current.contains(event === null || event === void 0 ? void 0 : event.target))) {
165
200
  setIsOpen(false);
166
201
  }
167
202
  };
203
+
168
204
  const onSearchHandler = name => {
169
205
  let inputValue = name;
170
206
  if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
171
207
  setIsSearchChanged(true);
172
208
  setSearchValue(inputValue);
173
209
  };
210
+
174
211
  const onWrapperClick = e => {
175
212
  if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
176
213
  e.stopPropagation();
@@ -178,9 +215,12 @@ const Dropdown = _ref => {
178
215
  setIsOpen(false);
179
216
  }
180
217
  };
218
+
181
219
  const hightlightedText = (text, postfix, description) => {
182
220
  var _text;
221
+
183
222
  const prepare = text => text === null || text === void 0 ? void 0 : text.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
223
+
184
224
  text = text.replace(/["&<>]/g, a => {
185
225
  return {
186
226
  '"': "&quot;",
@@ -194,12 +234,15 @@ const Dropdown = _ref => {
194
234
  const descriptionPart = description ? "<span class=\"dropdown__list-item-description\">".concat(description, "</span>") : "";
195
235
  return main + postfixPart + descriptionPart;
196
236
  };
237
+
197
238
  const depend = getDepends(modalBtnTrigger);
239
+
198
240
  const getMarkupForElement = (item, index, optTestId) => {
199
- var _item$value, _item$value2, _item$customMobileIco;
241
+ var _item$value, _item$value$toString, _item$value2, _item$value2$toString, _item$customMobileIco;
242
+
200
243
  return /*#__PURE__*/_react.default.createElement("button", {
201
- "data-testid": "dropdown--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"),
202
- 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, "_"),
244
+ "data-testid": "dropdown--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"),
245
+ 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, "_"),
203
246
  onMouseDown: () => depend.onChange(item),
204
247
  className: (0, _classnames.default)("".concat(RC, "__list-item"), {
205
248
  ["".concat(RC, "__list-item_active")]: item.value === value,
@@ -219,18 +262,22 @@ const Dropdown = _ref => {
219
262
  checked: value
220
263
  }) : "");
221
264
  };
265
+
222
266
  const filteredOptionList = filteredOption => {
223
- var _filteredOption$items, _filteredOption$label;
267
+ var _filteredOption$items, _filteredOption$label, _filteredOption$label2;
268
+
224
269
  return ((_filteredOption$items = filteredOption.items) === null || _filteredOption$items === void 0 ? void 0 : _filteredOption$items.length) > 0 ? /*#__PURE__*/_react.default.createElement("div", {
225
- key: (_filteredOption$label = filteredOption.label) === null || _filteredOption$label === void 0 || (_filteredOption$label = _filteredOption$label.toString()) === null || _filteredOption$label === void 0 ? void 0 : _filteredOption$label.replace(/ /g, "_").concat(Date.now()),
270
+ key: (_filteredOption$label = filteredOption.label) === null || _filteredOption$label === void 0 ? void 0 : (_filteredOption$label2 = _filteredOption$label.toString()) === null || _filteredOption$label2 === void 0 ? void 0 : _filteredOption$label2.replace(/ /g, "_").concat(Date.now()),
226
271
  className: (0, _classnames.default)("".concat(RC, "-group"), filteredOption.className)
227
272
  }, /*#__PURE__*/_react.default.createElement("div", {
228
273
  className: "".concat(RC, "-group__name")
229
274
  }, filteredOption.label), filteredOption.items.map((el, index) => getMarkupForElement(el, index, el === null || el === void 0 ? void 0 : el.testId))) : null;
230
275
  };
276
+
231
277
  const selectedLabel = ((_options$find = options.find(el => el.value === value)) === null || _options$find === void 0 ? void 0 : _options$find.label) || options.reduce((acc, item) => {
232
- var _item$items5;
233
- return acc || ((_item$items5 = item.items) === null || _item$items5 === void 0 || (_item$items5 = _item$items5.find(el => el.value === value)) === null || _item$items5 === void 0 ? void 0 : _item$items5.label);
278
+ var _item$items5, _item$items5$find;
279
+
280
+ return acc || ((_item$items5 = item.items) === null || _item$items5 === void 0 ? void 0 : (_item$items5$find = _item$items5.find(el => el.value === value)) === null || _item$items5$find === void 0 ? void 0 : _item$items5$find.label);
234
281
  }, null);
235
282
  const doScrollCallback = (0, _react.useCallback)(e => {
236
283
  const {
@@ -238,55 +285,70 @@ const Dropdown = _ref => {
238
285
  isWithAnyScrolling,
239
286
  scrollingInaccuracy = 0
240
287
  } = scrollReactionObj || {};
288
+
241
289
  if (callback && typeof callback === "function") {
242
290
  if (isWithAnyScrolling) callback(e);else if (Math.round(e.target.clientHeight + e.target.scrollTop + scrollingInaccuracy) >= e.target.scrollHeight) {
243
291
  callback(e);
244
292
  }
245
293
  }
246
294
  }, [filteredOptions]);
295
+
247
296
  const getParentNode = () => {
248
297
  var _ref2, _document$querySelect;
298
+
249
299
  if (isDoNotPullOutListOfMainContainer) return dropdownRef.current;
250
300
  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");
251
301
  };
302
+
252
303
  const initListContainer = () => {
253
304
  const dropdownList = document.createElement("div");
254
305
  dropdownList.setAttribute("id", dropdownId);
255
306
  dropdownList.classList.add("dropdown__container");
307
+
256
308
  if (isMobile) {
257
309
  dropdownList.addEventListener("click", e => {
258
310
  if (e.target.id === dropdownId) setIsOpen(false);
259
311
  });
260
312
  }
313
+
261
314
  try {
262
315
  var _getListContainer2;
263
- (_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 || _getListContainer2.remove();
316
+
317
+ (_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 ? void 0 : _getListContainer2.remove();
264
318
  } finally {
265
319
  if (isMobile) {
266
320
  var _getParentNode;
321
+
267
322
  try {
268
323
  var _document$getElementB;
269
- (_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
324
+
325
+ (_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
270
326
  } catch (e) {}
327
+
271
328
  const dropdownMobileListWrapper = document.createElement("div");
272
329
  dropdownMobileListWrapper.classList.add("dropdown-mobile");
273
330
  dropdownMobileListWrapper.setAttribute("id", "mlw-".concat(dropdownId));
274
- dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 || dropdownMobileListWrapper.append(dropdownList);
275
- (_getParentNode = getParentNode()) === null || _getParentNode === void 0 || _getParentNode.append(dropdownMobileListWrapper);
331
+ dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 ? void 0 : dropdownMobileListWrapper.append(dropdownList);
332
+ (_getParentNode = getParentNode()) === null || _getParentNode === void 0 ? void 0 : _getParentNode.append(dropdownMobileListWrapper);
276
333
  } else {
277
334
  var _getParentNode2;
278
- (_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 || _getParentNode2.append(dropdownList);
335
+
336
+ (_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 ? void 0 : _getParentNode2.append(dropdownList);
279
337
  }
280
338
  }
281
339
  };
340
+
282
341
  const getListContainer = () => {
283
342
  return document.getElementById(dropdownId);
284
343
  };
344
+
285
345
  const getListContainerWrapper = () => {
286
346
  return document.getElementById("mlw-".concat(dropdownId));
287
347
  };
348
+
288
349
  const setListContainerStyles = () => {
289
- var _dropdownRef$current$, _dropdownListWrapperR, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$max, _getComputedStyle2, _sw$getBoundingClient, _dropdownListWrapperR2, _lh$getBoundingClient, _getComputedStyle$hei, _getComputedStyle3;
350
+ var _dropdownRef$current$, _dropdownListWrapperR, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$mar2, _getComputedStyle$max, _getComputedStyle2, _getComputedStyle2$ma, _sw$getBoundingClient, _dropdownListWrapperR2, _dropdownListWrapperR3, _lh$getBoundingClient, _getComputedStyle$hei, _getComputedStyle3, _getComputedStyle3$he;
351
+
290
352
  const lc = getListContainer();
291
353
  if (!lc || !isOpen) return false;
292
354
  const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
@@ -297,27 +359,30 @@ const Dropdown = _ref => {
297
359
  top
298
360
  } = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0 ? void 0 : dropdownRef.current.getBoundingClientRect()) !== null && _dropdownRef$current$ !== void 0 ? _dropdownRef$current$ : {};
299
361
  const sw = lc.getElementsByClassName("dropdown__list")[0];
300
- const lh = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 || (_dropdownListWrapperR = dropdownListWrapperRef.current) === null || _dropdownListWrapperR === void 0 ? void 0 : _dropdownListWrapperR.getElementsByClassName("dropdown__list-header")[0];
301
- const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current)) === null || _getComputedStyle === void 0 || (_getComputedStyle = _getComputedStyle.marginTop) === null || _getComputedStyle === void 0 ? void 0 : _getComputedStyle.replace("px", "")) !== null && _getComputedStyle$mar !== void 0 ? _getComputedStyle$mar : 0, 10);
302
- const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(sw)) === null || _getComputedStyle2 === void 0 || (_getComputedStyle2 = _getComputedStyle2.maxHeight) === null || _getComputedStyle2 === void 0 ? void 0 : _getComputedStyle2.replace("px", "")) !== null && _getComputedStyle$max !== void 0 ? _getComputedStyle$max : 0, 10);
362
+ const lh = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperR = dropdownListWrapperRef.current) === null || _dropdownListWrapperR === void 0 ? void 0 : _dropdownListWrapperR.getElementsByClassName("dropdown__list-header")[0];
363
+ const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current)) === null || _getComputedStyle === void 0 ? void 0 : (_getComputedStyle$mar2 = _getComputedStyle.marginTop) === null || _getComputedStyle$mar2 === void 0 ? void 0 : _getComputedStyle$mar2.replace("px", "")) !== null && _getComputedStyle$mar !== void 0 ? _getComputedStyle$mar : 0, 10);
364
+ const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(sw)) === null || _getComputedStyle2 === void 0 ? void 0 : (_getComputedStyle2$ma = _getComputedStyle2.maxHeight) === null || _getComputedStyle2$ma === void 0 ? void 0 : _getComputedStyle2$ma.replace("px", "")) !== null && _getComputedStyle$max !== void 0 ? _getComputedStyle$max : 0, 10);
303
365
  if (initListHeight === null) setInitListHeight(maxHeight);
304
366
  const toTop = top - margin;
305
367
  const toBottom = windowHeight - top - height - margin * 2;
306
- const swHeight = sw === null || sw === void 0 || (_sw$getBoundingClient = sw.getBoundingClientRect()) === null || _sw$getBoundingClient === void 0 ? void 0 : _sw$getBoundingClient.height;
307
- const maxSwHeight = isMobile ? (dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 || (_dropdownListWrapperR2 = dropdownListWrapperRef.current) === null || _dropdownListWrapperR2 === void 0 || (_dropdownListWrapperR2 = _dropdownListWrapperR2.getBoundingClientRect()) === null || _dropdownListWrapperR2 === void 0 ? void 0 : _dropdownListWrapperR2.height) - (lh === null || lh === void 0 || (_lh$getBoundingClient = lh.getBoundingClientRect()) === null || _lh$getBoundingClient === void 0 ? void 0 : _lh$getBoundingClient.height) : toTop >= maxHeight || toBottom >= maxHeight ? maxHeight - 3 * margin : toTop > toBottom ? toTop - 3 * margin : toBottom - 4 * margin;
368
+ const swHeight = sw === null || sw === void 0 ? void 0 : (_sw$getBoundingClient = sw.getBoundingClientRect()) === null || _sw$getBoundingClient === void 0 ? void 0 : _sw$getBoundingClient.height;
369
+ const maxSwHeight = isMobile ? (dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperR2 = dropdownListWrapperRef.current) === null || _dropdownListWrapperR2 === void 0 ? void 0 : (_dropdownListWrapperR3 = _dropdownListWrapperR2.getBoundingClientRect()) === null || _dropdownListWrapperR3 === void 0 ? void 0 : _dropdownListWrapperR3.height) - (lh === null || lh === void 0 ? void 0 : (_lh$getBoundingClient = lh.getBoundingClientRect()) === null || _lh$getBoundingClient === void 0 ? void 0 : _lh$getBoundingClient.height) : toTop >= maxHeight || toBottom >= maxHeight ? maxHeight - 3 * margin : toTop > toBottom ? toTop - 3 * margin : toBottom - 4 * margin;
308
370
  const listPos = toTop < toBottom || toBottom >= swHeight ? "bottom" : "top";
309
371
  lc.style.minWidth = "".concat(width, "px");
310
372
  lc.style.left = "".concat(left, "px");
311
- lc.style.top = "".concat(listPos === "bottom" ? top + height : top - margin * 3 - parseInt((_getComputedStyle$hei = (_getComputedStyle3 = getComputedStyle(dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current)) === null || _getComputedStyle3 === void 0 || (_getComputedStyle3 = _getComputedStyle3.height) === null || _getComputedStyle3 === void 0 ? void 0 : _getComputedStyle3.replace("px", "")) !== null && _getComputedStyle$hei !== void 0 ? _getComputedStyle$hei : 0, 10), "px");
373
+ lc.style.top = "".concat(listPos === "bottom" ? top + height : top - margin * 3 - parseInt((_getComputedStyle$hei = (_getComputedStyle3 = getComputedStyle(dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current)) === null || _getComputedStyle3 === void 0 ? void 0 : (_getComputedStyle3$he = _getComputedStyle3.height) === null || _getComputedStyle3$he === void 0 ? void 0 : _getComputedStyle3$he.replace("px", "")) !== null && _getComputedStyle$hei !== void 0 ? _getComputedStyle$hei : 0, 10), "px");
312
374
  sw.style.maxHeight = "".concat(maxSwHeight, "px");
313
375
  };
376
+
314
377
  const renderListContainer = () => {
315
378
  const lc = getListContainer();
316
379
  if (!lc) return null;
317
380
  return /*#__PURE__*/(0, _reactDom.createPortal)(getListMarkUp(), lc);
318
381
  };
382
+
319
383
  const getSortedOptions = data => {
320
384
  let newData = [...data];
385
+
321
386
  if (sortAlphabetical) {
322
387
  const openModalOption = newData.filter(_ref3 => {
323
388
  let {
@@ -341,13 +406,17 @@ const Dropdown = _ref => {
341
406
  if (item !== null && item !== void 0 && item.items) {
342
407
  item.items = [...item.items].sort(_utils.compareAlphabetical);
343
408
  }
409
+
344
410
  return item;
345
411
  });
346
412
  }
413
+
347
414
  return newData;
348
415
  };
416
+
349
417
  const getListMarkUp = () => {
350
418
  var _getSortedOptions;
419
+
351
420
  return /*#__PURE__*/_react.default.createElement("div", {
352
421
  className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
353
422
  ref: wrapperRef,
@@ -396,17 +465,19 @@ const Dropdown = _ref => {
396
465
  ref: dropdownListRef
397
466
  }, (_getSortedOptions = getSortedOptions(depend.options)) === null || _getSortedOptions === void 0 ? void 0 : _getSortedOptions.map(option => {
398
467
  var _option$items, _option$label;
468
+
399
469
  if (option !== null && option !== void 0 && (_option$items = option.items) !== null && _option$items !== void 0 && _option$items.length) {
400
470
  if (!isSearchable || !isSearchChanged) {
401
471
  return filteredOptionList(option);
402
472
  } else {
403
473
  var _option$items2;
474
+
404
475
  const items = (_option$items2 = option.items) === null || _option$items2 === void 0 ? void 0 : _option$items2.slice().filter(el => {
405
476
  var _el$label2;
406
- return (el === null || el === void 0 || (_el$label2 = el.label) === null || _el$label2 === void 0 ? void 0 : _el$label2.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "")) || !(el !== null && el !== void 0 && el.value) || (el === null || el === void 0 ? void 0 : el.value) === "";
477
+
478
+ return (el === null || el === void 0 ? void 0 : (_el$label2 = el.label) === null || _el$label2 === void 0 ? void 0 : _el$label2.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "")) || !(el !== null && el !== void 0 && el.value) || (el === null || el === void 0 ? void 0 : el.value) === "";
407
479
  });
408
- if (items !== null && items !== void 0 && items.length) return filteredOptionList({
409
- ...option,
480
+ if (items !== null && items !== void 0 && items.length) return filteredOptionList({ ...option,
410
481
  items
411
482
  });
412
483
  return null;
@@ -418,12 +489,14 @@ const Dropdown = _ref => {
418
489
  className: "".concat(RC, "__list-item ").concat(RC, "__list-item--no-options")
419
490
  }, noOptionsText), disabled && isOpen && /*#__PURE__*/_react.default.createElement(_DropdownLoader.default, null))));
420
491
  };
492
+
421
493
  const toggleList = e => {
422
- e === null || e === void 0 || e.stopPropagation();
494
+ e === null || e === void 0 ? void 0 : e.stopPropagation();
423
495
  setIsOpen(isOpen => {
424
496
  return !isOpen;
425
497
  });
426
498
  };
499
+
427
500
  const closeList = isOpen ? handleClickOutside : () => {};
428
501
  (0, _react.useEffect)(() => {
429
502
  if (!isDoNotPullOutListOfMainContainer || dropdownRef.current) {
@@ -433,6 +506,7 @@ const Dropdown = _ref => {
433
506
  }, [isDoNotPullOutListOfMainContainer, dropdownRef.current]);
434
507
  (0, _react.useLayoutEffect)(() => {
435
508
  var _getListContainer3;
509
+
436
510
  if (!isMobile) {
437
511
  window.addEventListener("resize", setListContainerStyles);
438
512
  window.addEventListener("mousewheel", closeList);
@@ -444,19 +518,21 @@ const Dropdown = _ref => {
444
518
  window.removeEventListener("scroll", closeList);
445
519
  window.removeEventListener("touchmove", closeList);
446
520
  }
447
- (_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 || _getListContainer3.addEventListener("click", closeList);
521
+
522
+ (_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.addEventListener("click", closeList);
448
523
  return () => {
449
524
  var _getListContainer4;
525
+
450
526
  window.removeEventListener("resize", setListContainerStyles);
451
527
  window.removeEventListener("mousewheel", closeList);
452
528
  window.removeEventListener("scroll", closeList);
453
529
  window.removeEventListener("touchmove", closeList);
454
- (_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 || _getListContainer4.removeEventListener("click", closeList);
530
+ (_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 ? void 0 : _getListContainer4.removeEventListener("click", closeList);
455
531
  };
456
532
  }, [getListContainer]);
457
533
  (0, _react.useLayoutEffect)(() => {
458
534
  setListContainerStyles();
459
- }, [isOpen, searchValue, isMobile, options, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 || (_dropdownListWrapperR3 = dropdownListWrapperRef.current) === null || _dropdownListWrapperR3 === void 0 || (_dropdownListWrapperR3 = _dropdownListWrapperR3.getBoundingClientRect()) === null || _dropdownListWrapperR3 === void 0 ? void 0 : _dropdownListWrapperR3.height]);
535
+ }, [isOpen, searchValue, isMobile, options, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperR4 = dropdownListWrapperRef.current) === null || _dropdownListWrapperR4 === void 0 ? void 0 : (_dropdownListWrapperR5 = _dropdownListWrapperR4.getBoundingClientRect()) === null || _dropdownListWrapperR5 === void 0 ? void 0 : _dropdownListWrapperR5.height]);
460
536
  (0, _react.useEffect)(() => {
461
537
  document.addEventListener("click", handleClickOutside, true);
462
538
  return () => document.removeEventListener("click", handleClickOutside, true);
@@ -465,9 +541,11 @@ const Dropdown = _ref => {
465
541
  if (!isOpen) {
466
542
  setIsSearchChanged(false);
467
543
  }
544
+
468
545
  if (scrollReactionObj && typeof scrollReactionObj === "object" && isOpen && dropdownListRef && dropdownListRef.current) {
469
546
  dropdownListRef.current.addEventListener("scroll", doScrollCallback);
470
547
  }
548
+
471
549
  return () => {
472
550
  if (scrollReactionObj && typeof scrollReactionObj === "object") removeEventListener("scroll", doScrollCallback);
473
551
  };
@@ -477,21 +555,27 @@ const Dropdown = _ref => {
477
555
  setSearchValue(selectedLabel);
478
556
  setTimeout(() => searchInputRef.current.select(), 1);
479
557
  }
558
+
480
559
  if (!isSearchInputFocused && !isOpen) {
481
560
  setSearchValue(null);
482
561
  }
483
562
  }, [isSearchInputFocused]);
484
563
  (0, _react.useEffect)(() => {
485
564
  var _searchInputRef$curre;
486
- if (isOpen && !isSearchInputFocused && searchInputRef !== null && searchInputRef !== void 0 && searchInputRef.current && !isMobile) searchInputRef === null || searchInputRef === void 0 || (_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 || _searchInputRef$curre.focus();
565
+
566
+ if (isOpen && !isSearchInputFocused && searchInputRef !== null && searchInputRef !== void 0 && searchInputRef.current && !isMobile) searchInputRef === null || searchInputRef === void 0 ? void 0 : (_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 ? void 0 : _searchInputRef$curre.focus();
567
+
487
568
  if (isOpen) {
488
569
  var _getListContainer5;
489
- (_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 || _getListContainer5.classList.add("dropdown__container--opened");
570
+
571
+ (_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 ? void 0 : _getListContainer5.classList.add("dropdown__container--opened");
490
572
  } else {
491
573
  var _searchInputRef$curre2, _getListContainer6;
492
- searchInputRef === null || searchInputRef === void 0 || (_searchInputRef$curre2 = searchInputRef.current) === null || _searchInputRef$curre2 === void 0 || _searchInputRef$curre2.blur();
493
- (_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 || _getListContainer6.classList.remove("dropdown__container--opened");
574
+
575
+ searchInputRef === null || searchInputRef === void 0 ? void 0 : (_searchInputRef$curre2 = searchInputRef.current) === null || _searchInputRef$curre2 === void 0 ? void 0 : _searchInputRef$curre2.blur();
576
+ (_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 ? void 0 : _getListContainer6.classList.remove("dropdown__container--opened");
494
577
  }
578
+
495
579
  if (!isOpen && isMobile) {
496
580
  setSearchValue(null);
497
581
  }
@@ -499,34 +583,41 @@ const Dropdown = _ref => {
499
583
  (0, _react.useEffect)(() => {
500
584
  if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current && !searchValue) {
501
585
  var _dropdownListRef$curr, _dropdownListRef$curr2, _dropdownListRef$curr3, _dropdownListRef$curr4;
502
- 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));
503
- 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));
586
+
587
+ 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));
588
+ 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));
504
589
  }
505
- }, [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]);
590
+ }, [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]);
506
591
  (0, _react.useEffect)(() => {
507
592
  const setScrollTopValue = e => {
508
593
  setScrollTop(parseInt(e.target.scrollTop, 10));
509
594
  };
595
+
510
596
  if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
511
597
  var _dropdownListRef$curr7;
512
- dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 || _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
598
+
599
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
513
600
  }
601
+
514
602
  return () => {
515
603
  var _dropdownListRef$curr8;
516
- dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 || _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
604
+
605
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
517
606
  };
518
607
  }, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
519
608
  (0, _react.useEffect)(() => {
520
609
  if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
521
610
  var _dropdownListRef$curr9, _dropdownListRef$curr10;
522
- setScrollHeight(parseInt((dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr9 = dropdownListRef.current) === null || _dropdownListRef$curr9 === void 0 ? void 0 : _dropdownListRef$curr9.scrollHeight) - (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr10 = dropdownListRef.current) === null || _dropdownListRef$curr10 === void 0 ? void 0 : _dropdownListRef$curr10.clientHeight), 10));
611
+
612
+ 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));
523
613
  }
524
614
  }, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
525
615
  (0, _react.useEffect)(() => {
526
616
  return () => {
527
617
  var _getListContainer7, _getListContainerWrap;
528
- (_getListContainer7 = getListContainer()) === null || _getListContainer7 === void 0 || _getListContainer7.remove();
529
- (_getListContainerWrap = getListContainerWrapper()) === null || _getListContainerWrap === void 0 || _getListContainerWrap.remove();
618
+
619
+ (_getListContainer7 = getListContainer()) === null || _getListContainer7 === void 0 ? void 0 : _getListContainer7.remove();
620
+ (_getListContainerWrap = getListContainerWrapper()) === null || _getListContainerWrap === void 0 ? void 0 : _getListContainerWrap.remove();
530
621
  };
531
622
  }, []);
532
623
  const postfixText = selectedLabel && ((_filteredOptions$find = filteredOptions.find(option => option.value === value)) === null || _filteredOptions$find === void 0 ? void 0 : _filteredOptions$find.postfix) || null;
@@ -550,7 +641,7 @@ const Dropdown = _ref => {
550
641
  onClick: () => setIsOpen(true),
551
642
  onKeyDown: onKeyDown,
552
643
  onKeyUp: onKeyUp,
553
- tabIndex: tabIndex === null || tabIndex === void 0 || (_tabIndex$toString = tabIndex.toString) === null || _tabIndex$toString === void 0 ? void 0 : _tabIndex$toString.call(tabIndex)
644
+ tabIndex: tabIndex === null || tabIndex === void 0 ? void 0 : (_tabIndex$toString = tabIndex.toString) === null || _tabIndex$toString === void 0 ? void 0 : _tabIndex$toString.call(tabIndex)
554
645
  }, customTrigger || /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isSearchable && !isMobile ? /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
555
646
  ref: searchInputRef,
556
647
  className: "".concat(RC, "__input"),
@@ -587,4 +678,6 @@ const Dropdown = _ref => {
587
678
  onClick: onActionCancelClick
588
679
  }, /*#__PURE__*/_react.default.createElement(_reactFeather.X, null))), isOpen && renderListContainer());
589
680
  };
590
- var _default = exports.default = Dropdown;
681
+
682
+ var _default = Dropdown;
683
+ exports.default = _default;
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
9
+
8
10
  var _react = _interopRequireDefault(require("react"));
11
+
9
12
  require("./DropdownLoader.scss");
13
+
10
14
  const DropdownLoader = function (_ref) {
11
15
  let {
12
16
  variant
@@ -17,4 +21,6 @@ const DropdownLoader = function (_ref) {
17
21
  className: "lds-ring".concat(variant === "little" ? " lds-ring_little" : "")
18
22
  }, /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null), /*#__PURE__*/_react.default.createElement("div", null)));
19
23
  };
20
- var _default = exports.default = DropdownLoader;
24
+
25
+ var _default = DropdownLoader;
26
+ exports.default = _default;