intelicoreact 1.4.83 → 1.4.84

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 (272) hide show
  1. package/dist/Atomic/FormElements/ActionAlert/ActionAlert.js +14 -22
  2. package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +14 -22
  3. package/dist/Atomic/FormElements/Calendar/Calendar.js +67 -122
  4. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +27 -36
  5. package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +23 -39
  6. package/dist/Atomic/FormElements/Datepicker/Datepicker.js +110 -246
  7. package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +44 -85
  8. package/dist/Atomic/FormElements/Dropdown/Dropdown.js +266 -430
  9. package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +5 -9
  10. package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +161 -283
  11. package/dist/Atomic/FormElements/FileLoader/FileLoader.js +39 -64
  12. package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +51 -132
  13. package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +34 -73
  14. package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.js +79 -138
  15. package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +55 -77
  16. package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +75 -126
  17. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +33 -83
  18. package/dist/Atomic/FormElements/Input/Input.js +160 -256
  19. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +48 -102
  20. package/dist/Atomic/FormElements/InputColor/InputColor.js +26 -41
  21. package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +38 -76
  22. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +109 -177
  23. package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +32 -57
  24. package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +184 -302
  25. package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +85 -157
  26. package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +11 -16
  27. package/dist/Atomic/FormElements/InputDateRange/dependencies.js +77 -194
  28. package/dist/Atomic/FormElements/InputLink/InputLink.js +32 -58
  29. package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +8 -12
  30. package/dist/Atomic/FormElements/InputMask/InputMask.js +554 -964
  31. package/dist/Atomic/FormElements/InputMask/config.js +1 -1
  32. package/dist/Atomic/FormElements/InputMask/functions.js +17 -43
  33. package/dist/Atomic/FormElements/InputMask2/InputMask2.js +268 -404
  34. package/dist/Atomic/FormElements/InputMask2/config.js +1 -1
  35. package/dist/Atomic/FormElements/InputMask2/functions.js +17 -43
  36. package/dist/Atomic/FormElements/InputMask3/InputMask3.js +299 -459
  37. package/dist/Atomic/FormElements/InputMask3/config.js +1 -1
  38. package/dist/Atomic/FormElements/InputMask3/functions.js +17 -43
  39. package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +51 -113
  40. package/dist/Atomic/FormElements/InputsRow/InputsRow.js +64 -118
  41. package/dist/Atomic/FormElements/Label/Label.js +14 -24
  42. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +217 -349
  43. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +25 -47
  44. package/dist/Atomic/FormElements/NumericInput/NumericInput.js +133 -207
  45. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +29 -61
  46. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +20 -42
  47. package/dist/Atomic/FormElements/RadioInput/RadioInput.js +22 -33
  48. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +20 -43
  49. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +54 -101
  50. package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +59 -102
  51. package/dist/Atomic/FormElements/RangeList/RangeList.js +89 -150
  52. package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +23 -29
  53. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +148 -326
  54. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +389 -588
  55. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +14 -24
  56. package/dist/Atomic/FormElements/Switcher/Switcher.js +24 -29
  57. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +23 -41
  58. package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +20 -32
  59. package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +32 -55
  60. package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +22 -42
  61. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +23 -33
  62. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +51 -120
  63. package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +2 -3
  64. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +23 -46
  65. package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +47 -98
  66. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +485 -713
  67. package/dist/Atomic/FormElements/Text/Text.js +47 -53
  68. package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +21 -31
  69. package/dist/Atomic/FormElements/Textarea/Textarea.js +31 -47
  70. package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +68 -128
  71. package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +25 -36
  72. package/dist/Atomic/FormElements/TimeRange/TimeRange.js +33 -70
  73. package/dist/Atomic/FormElements/UserContacts/UserContacts.js +58 -123
  74. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +48 -80
  75. package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +32 -42
  76. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +40 -60
  77. package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +2 -3
  78. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +50 -69
  79. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +3 -3
  80. package/dist/Atomic/Layout/Header/Header.js +21 -48
  81. package/dist/Atomic/Layout/MainMenu/MainMenu.js +35 -77
  82. package/dist/Atomic/Layout/Spinner/Spinner.js +8 -14
  83. package/dist/Atomic/UI/Accordion/Accordion.js +18 -48
  84. package/dist/Atomic/UI/Accordion/AccordionItem.js +35 -60
  85. package/dist/Atomic/UI/AccordionTable/AccordionTable.js +48 -104
  86. package/dist/Atomic/UI/AccordionText/AccordionText.js +21 -54
  87. package/dist/Atomic/UI/AdvancedTag/AdvTag.js +47 -92
  88. package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +22 -50
  89. package/dist/Atomic/UI/Alert/Alert.js +22 -51
  90. package/dist/Atomic/UI/Arrow/Arrow.js +15 -35
  91. package/dist/Atomic/UI/Box/Box.js +14 -21
  92. package/dist/Atomic/UI/Button/Button.js +26 -35
  93. package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +22 -31
  94. package/dist/Atomic/UI/Chart/Chart.js +45 -86
  95. package/dist/Atomic/UI/Chart/partial/Chart.constants.js +14 -24
  96. package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +13 -22
  97. package/dist/Atomic/UI/Chart/partial/datasetSetters.js +68 -113
  98. package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +158 -140
  99. package/dist/Atomic/UI/Chart/partial/optionsSetters.js +26 -42
  100. package/dist/Atomic/UI/Chart/partial/utils.js +20 -48
  101. package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +22 -42
  102. package/dist/Atomic/UI/DateTime/DateTime.js +23 -38
  103. package/dist/Atomic/UI/DebugContainer/DebugContainer.js +13 -37
  104. package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +5 -21
  105. package/dist/Atomic/UI/DoubleString/DoubleString.js +34 -63
  106. package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +15 -63
  107. package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +62 -157
  108. package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +47 -110
  109. package/dist/Atomic/UI/Hint/Hint.js +67 -122
  110. package/dist/Atomic/UI/Hint/partial/_utils.js +52 -0
  111. package/dist/Atomic/UI/Hint/partials/_utils.js +14 -29
  112. package/dist/Atomic/UI/Modal/Modal.js +147 -184
  113. package/dist/Atomic/UI/Modal/ModalHOC.js +15 -26
  114. package/dist/Atomic/UI/Modal/partials/ModalFooter.js +7 -12
  115. package/dist/Atomic/UI/Modal/partials/ModalTitle.js +17 -21
  116. package/dist/Atomic/UI/Modal/partials/useMobileModal.js +99 -161
  117. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +32 -62
  118. package/dist/Atomic/UI/NavLine/NavLine.js +120 -211
  119. package/dist/Atomic/UI/NavLine/Tabs.js +2 -3
  120. package/dist/Atomic/UI/PageTitle/PageTitle.js +13 -17
  121. package/dist/Atomic/UI/PieChart/PieChart.js +11 -21
  122. package/dist/Atomic/UI/Price/Price.js +10 -13
  123. package/dist/Atomic/UI/PriceRange/PriceRange.js +7 -11
  124. package/dist/Atomic/UI/ProgressLine/ProgressLine.js +28 -58
  125. package/dist/Atomic/UI/Status/Status.js +19 -30
  126. package/dist/Atomic/UI/Table/Partials/TdCell.js +28 -71
  127. package/dist/Atomic/UI/Table/Partials/TdHeader.js +7 -16
  128. package/dist/Atomic/UI/Table/Partials/TdRow.js +29 -65
  129. package/dist/Atomic/UI/Table/Partials/TdTitle.js +16 -40
  130. package/dist/Atomic/UI/Table/Table.js +27 -47
  131. package/dist/Atomic/UI/Table/TdTypes/TdActions.js +18 -48
  132. package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +9 -19
  133. package/dist/Atomic/UI/Table/TdTypes/TdRange.js +5 -6
  134. package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +22 -39
  135. package/dist/Atomic/UI/Tag/Tag.js +59 -94
  136. package/dist/Atomic/UI/TagList/TagList.js +81 -144
  137. package/dist/Atomic/UI/UserBox/UserBox.js +14 -26
  138. package/dist/Atomic/UI/WizardStepper/constructor.js +7 -15
  139. package/dist/Atomic/UI/WizardStepper/index.js +1 -5
  140. package/dist/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.js +20 -26
  141. package/dist/Atomic/UI/WizardStepper/ui/StateIcon/index.js +1 -4
  142. package/dist/Atomic/UI/WizardStepper/ui/StepRow/StepRow.js +26 -39
  143. package/dist/Atomic/UI/WizardStepper/ui/StepRow/index.js +1 -5
  144. package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.js +23 -42
  145. package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/index.js +1 -5
  146. package/dist/Atomic/UI/WizardStepper/ui/icons.js +40 -49
  147. package/dist/Atomic/UI/WizardStepper/ui/index.js +1 -5
  148. package/dist/Classes/AbortableFetch.js +283 -422
  149. package/dist/Classes/AnimatedHandler.js +44 -56
  150. package/dist/Classes/RESTAPI/index.js +158 -441
  151. package/dist/Classes/RESTAPI/partials/AbortableFetch.js +290 -428
  152. package/dist/Classes/RESTAPI/partials/ApiBase.js +24 -67
  153. package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +83 -353
  154. package/dist/Classes/RESTAPI/partials/ApiUtils.js +161 -403
  155. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +159 -400
  156. package/dist/Classes/RESTAPI/partials/Utils.js +81 -135
  157. package/dist/Classes/RESTAPI/partials/_outerDependencies.js +2 -6
  158. package/dist/Classes/RESTAPI/partials/_utils.js +103 -398
  159. package/dist/Constants/index.constants.js +8 -15
  160. package/dist/Functions/Portal.js +14 -33
  161. package/dist/Functions/customEventListener.js +9 -24
  162. package/dist/Functions/fieldValueFormatters.js +147 -209
  163. package/dist/Functions/hooks/useFormFieldsChangesManager.js +75 -137
  164. package/dist/Functions/locale/createTranslator.js +13 -28
  165. package/dist/Functions/operations.js +35 -49
  166. package/dist/Functions/presets/inputMaskPresets.js +25 -27
  167. package/dist/Functions/presets/inputPresets.js +19 -22
  168. package/dist/Functions/presets/mobileKeyboardTypesPresets.js +7 -9
  169. package/dist/Functions/schemas.js +6 -15
  170. package/dist/Functions/useBodyScrollLock.js +4 -9
  171. package/dist/Functions/useClickOutside.js +3 -7
  172. package/dist/Functions/useDebounce.js +11 -25
  173. package/dist/Functions/useFieldFocus.js +42 -67
  174. package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +35 -54
  175. package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +74 -95
  176. package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +55 -91
  177. package/dist/Functions/useFormTools/functions/General.js +80 -99
  178. package/dist/Functions/useFormTools/functions/RenderFields.js +45 -72
  179. package/dist/Functions/useFormTools/functions/usePrevious.js +3 -7
  180. package/dist/Functions/useFormTools/index.js +380 -592
  181. package/dist/Functions/useInputHighlightError.js +27 -52
  182. package/dist/Functions/useIsMobile.js +15 -39
  183. package/dist/Functions/useKeyPress/useHandleKeyPress.js +10 -15
  184. package/dist/Functions/useKeyPress/useKeyPress.js +18 -35
  185. package/dist/Functions/useLocalStorage.js +7 -22
  186. package/dist/Functions/useLocationParams.js +16 -27
  187. package/dist/Functions/useMediaQuery.js +10 -27
  188. package/dist/Functions/useMetaInfo.js +19 -50
  189. package/dist/Functions/useMouseUpOutside.js +2 -5
  190. package/dist/Functions/useOnlineStatus.js +7 -26
  191. package/dist/Functions/usePasswordChecker.js +42 -77
  192. package/dist/Functions/usePrevious.js +3 -7
  193. package/dist/Functions/useResize.js +12 -32
  194. package/dist/Functions/useScrollTo.js +6 -20
  195. package/dist/Functions/useToggle.js +10 -30
  196. package/dist/Functions/utils.js +188 -386
  197. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +21 -32
  198. package/dist/Molecular/CustomIcons/components/AlertCircle.js +21 -32
  199. package/dist/Molecular/CustomIcons/components/AppStore.js +25 -36
  200. package/dist/Molecular/CustomIcons/components/Arrow.js +31 -42
  201. package/dist/Molecular/CustomIcons/components/ArrowDown.js +13 -24
  202. package/dist/Molecular/CustomIcons/components/ArrowLeft.js +16 -27
  203. package/dist/Molecular/CustomIcons/components/ArrowRight.js +16 -27
  204. package/dist/Molecular/CustomIcons/components/ArrowUp.js +13 -24
  205. package/dist/Molecular/CustomIcons/components/Bell.js +11 -22
  206. package/dist/Molecular/CustomIcons/components/Button.js +11 -22
  207. package/dist/Molecular/CustomIcons/components/Campaigns.js +12 -23
  208. package/dist/Molecular/CustomIcons/components/Check.js +12 -23
  209. package/dist/Molecular/CustomIcons/components/Check2.js +11 -22
  210. package/dist/Molecular/CustomIcons/components/ChevronDown.js +11 -22
  211. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +11 -22
  212. package/dist/Molecular/CustomIcons/components/ChevronLeft.js +11 -22
  213. package/dist/Molecular/CustomIcons/components/ChevronRight.js +11 -22
  214. package/dist/Molecular/CustomIcons/components/ChevronUp.js +11 -22
  215. package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +26 -37
  216. package/dist/Molecular/CustomIcons/components/Close.js +13 -24
  217. package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +38 -49
  218. package/dist/Molecular/CustomIcons/components/Delete.js +12 -23
  219. package/dist/Molecular/CustomIcons/components/Edit.js +11 -22
  220. package/dist/Molecular/CustomIcons/components/Email.js +29 -40
  221. package/dist/Molecular/CustomIcons/components/FinturfLogo.js +19 -30
  222. package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +27 -38
  223. package/dist/Molecular/CustomIcons/components/Flows.js +11 -22
  224. package/dist/Molecular/CustomIcons/components/Gift.js +16 -27
  225. package/dist/Molecular/CustomIcons/components/GoogleAuth.js +25 -36
  226. package/dist/Molecular/CustomIcons/components/GooglePlay.js +25 -36
  227. package/dist/Molecular/CustomIcons/components/HelpCircle.js +14 -25
  228. package/dist/Molecular/CustomIcons/components/HelpCircle2.js +15 -26
  229. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +14 -25
  230. package/dist/Molecular/CustomIcons/components/Home.js +14 -25
  231. package/dist/Molecular/CustomIcons/components/Home2.js +17 -28
  232. package/dist/Molecular/CustomIcons/components/Key.js +19 -30
  233. package/dist/Molecular/CustomIcons/components/Landers.js +15 -26
  234. package/dist/Molecular/CustomIcons/components/Lock.js +11 -22
  235. package/dist/Molecular/CustomIcons/components/Mail.js +19 -30
  236. package/dist/Molecular/CustomIcons/components/Mastercard.js +61 -72
  237. package/dist/Molecular/CustomIcons/components/Minus.js +24 -35
  238. package/dist/Molecular/CustomIcons/components/Offers.js +12 -23
  239. package/dist/Molecular/CustomIcons/components/Pause.js +24 -35
  240. package/dist/Molecular/CustomIcons/components/PayPal.js +38 -49
  241. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +25 -36
  242. package/dist/Molecular/CustomIcons/components/Phone.js +26 -37
  243. package/dist/Molecular/CustomIcons/components/Play.js +24 -35
  244. package/dist/Molecular/CustomIcons/components/Plus.js +24 -35
  245. package/dist/Molecular/CustomIcons/components/Profile.js +16 -27
  246. package/dist/Molecular/CustomIcons/components/QRCode.js +26 -37
  247. package/dist/Molecular/CustomIcons/components/Rectangle.js +11 -22
  248. package/dist/Molecular/CustomIcons/components/Revert.js +14 -25
  249. package/dist/Molecular/CustomIcons/components/Star.js +10 -21
  250. package/dist/Molecular/CustomIcons/components/Star2.js +12 -23
  251. package/dist/Molecular/CustomIcons/components/TrafficSources.js +14 -25
  252. package/dist/Molecular/CustomIcons/components/Trash.js +11 -22
  253. package/dist/Molecular/CustomIcons/components/TrashRed.js +11 -22
  254. package/dist/Molecular/CustomIcons/components/Triggers.js +11 -22
  255. package/dist/Molecular/CustomIcons/components/User.js +16 -27
  256. package/dist/Molecular/CustomIcons/components/Visa.js +27 -38
  257. package/dist/Molecular/CustomIcons/components/X.js +11 -22
  258. package/dist/Molecular/CustomIcons/index.js +61 -183
  259. package/dist/Molecular/FormElement/FormElement.js +19 -28
  260. package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +91 -112
  261. package/dist/Molecular/FormWithDependOn/partials/_utils.js +35 -37
  262. package/dist/Molecular/InputAddress/InputAddress.js +176 -312
  263. package/dist/Molecular/InputPassword/InputPassword.js +15 -39
  264. package/dist/index.js +1 -3
  265. package/package.json +1 -1
  266. package/dist/Atomic/FormElements/UserContacts/partial/defaultIcons.js +0 -119
  267. package/dist/Atomic/UI/ModalBackup/Modal.js +0 -174
  268. package/dist/Atomic/UI/ModalBackup/Modal.scss +0 -333
  269. package/dist/Atomic/UI/ModalBackup/ModalHOC.js +0 -51
  270. package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +0 -24
  271. package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +0 -41
  272. package/dist/Functions/presets/inputMaskPreset.js +0 -176
@@ -1,292 +1,187 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof3 = require("@babel/runtime/helpers/typeof");
6
-
7
4
  Object.defineProperty(exports, "__esModule", {
8
5
  value: true
9
6
  });
10
7
  exports.default = void 0;
11
-
12
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
-
14
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
-
16
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
-
18
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
19
-
20
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
21
-
22
9
  var _react = _interopRequireWildcard(require("react"));
23
-
24
10
  var _classnames = _interopRequireDefault(require("classnames"));
25
-
26
11
  var _reactDom = require("react-dom");
27
-
28
12
  var _reactFeather = require("react-feather");
29
-
30
13
  var _Input = _interopRequireDefault(require("../../../Atomic/FormElements/Input/Input"));
31
-
32
14
  var _RadioInput = _interopRequireDefault(require("../../../Atomic/FormElements/RadioInput/RadioInput"));
33
-
34
15
  var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
35
-
36
- var _useIsMobile2 = _interopRequireDefault(require("../../../Functions/useIsMobile"));
37
-
16
+ var _useIsMobile = _interopRequireDefault(require("../../../Functions/useIsMobile"));
38
17
  var _utils = require("../../../Functions/utils");
39
-
40
18
  var _DropdownLoader = _interopRequireDefault(require("./components/DropdownLoader"));
41
-
42
19
  require("./Dropdown.scss");
43
-
44
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
45
-
46
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(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; }
47
-
48
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
49
-
50
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
51
-
52
- var RC = "dropdown";
53
- var MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH = 10;
54
-
55
- var Dropdown = function Dropdown(_ref) {
56
- var _options$find, _dropdownListWrapperR4, _dropdownListWrapperR5, _dropdownListRef$curr5, _dropdownListRef$curr6, _filteredOptions$find, _cn6, _cn7, _tabIndex$toString;
57
-
58
- var label = _ref.label,
59
- _ref$options = _ref.options,
60
- options = _ref$options === void 0 ? [] : _ref$options,
61
- value = _ref.value,
62
- error = _ref.error,
63
- disabled = _ref.disabled,
64
- onChange = _ref.onChange,
65
- placeholder = _ref.placeholder,
66
- className = _ref.className,
67
- isSearchable = _ref.isSearchable,
68
- entity = _ref.entity,
69
- scrollReactionObj = _ref.scrollReactionObj,
70
- isListTop = _ref.isListTop,
71
- _ref$isNotValidateASC = _ref.isNotValidateASCII,
72
- isNotValidateASCII = _ref$isNotValidateASC === void 0 ? false : _ref$isNotValidateASC,
73
- testId = _ref.testId,
74
- _ref$sortAlphabetical = _ref.sortAlphabetical,
75
- sortAlphabetical = _ref$sortAlphabetical === void 0 ? true : _ref$sortAlphabetical,
76
- fieldKey = _ref.fieldKey,
77
- id = _ref.id,
78
- _ref$noOptionsText = _ref.noOptionsText,
79
- noOptionsText = _ref$noOptionsText === void 0 ? "No options available" : _ref$noOptionsText,
80
- _ref$attributesOfNati = _ref.attributesOfNativeInput,
81
- attributesOfNativeInput = _ref$attributesOfNati === void 0 ? {} : _ref$attributesOfNati,
82
- isDoNotPullOutListOfMainContainer = _ref.isDoNotPullOutListOfMainContainer,
83
- withMobileLogic = _ref.withMobileLogic,
84
- withActions = _ref.withActions,
85
- _ref$minItemsForShowM = _ref.minItemsForShowMobileSearch,
86
- minItemsForShowMobileSearch = _ref$minItemsForShowM === void 0 ? MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH : _ref$minItemsForShowM,
87
- customTrigger = _ref.customTrigger,
88
- tabIndex = _ref.tabIndex,
89
- onActionConfirmClick = _ref.onActionConfirmClick,
90
- onActionCancelClick = _ref.onActionCancelClick,
91
- isDefaultOpened = _ref.isDefaultOpened;
92
-
93
- var _useIsMobile = (0, _useIsMobile2.default)(),
94
- isMobileProp = _useIsMobile.isMobile;
95
-
96
- var isMobile = isMobileProp && withMobileLogic && window.screen.width <= 768;
97
-
98
- var _useState = (0, _react.useState)(id || fieldKey || Math.random().toString(16).slice(2)),
99
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
100
- dropdownId = _useState2[0],
101
- setDropdownId = _useState2[1];
102
-
103
- var _useState3 = (0, _react.useState)(false),
104
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
105
- isOpen = _useState4[0],
106
- setIsOpen = _useState4[1];
107
-
108
- var _useState5 = (0, _react.useState)(),
109
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
110
- searchValue = _useState6[0],
111
- setSearchValue = _useState6[1];
112
-
113
- var dropdownRef = (0, _react.useRef)(null);
114
- var dropdownListRef = (0, _react.useRef)(null);
115
- var dropdownListWrapperRef = (0, _react.useRef)(null);
116
- var searchInputRef = (0, _react.useRef)(null);
117
- var wrapperRef = (0, _react.useRef)(null);
118
-
119
- var _useState7 = (0, _react.useState)(null),
120
- _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
121
- initListHeight = _useState8[0],
122
- setInitListHeight = _useState8[1];
123
-
124
- var _useState9 = (0, _react.useState)(false),
125
- _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
126
- isSearchChanged = _useState10[0],
127
- setIsSearchChanged = _useState10[1];
128
-
129
- var _useState11 = (0, _react.useState)(false),
130
- _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
131
- isSearchInputFocused = _useState12[0],
132
- setIsSearchInputFocused = _useState12[1];
133
-
134
- var _useState13 = (0, _react.useState)(null),
135
- _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
136
- isScrollableList = _useState14[0],
137
- setIsScrollableList = _useState14[1];
138
-
139
- var _useState15 = (0, _react.useState)(false),
140
- _useState16 = (0, _slicedToArray2.default)(_useState15, 2),
141
- isFixedMaxHeight = _useState16[0],
142
- setIsFixedMaxHeight = _useState16[1];
143
-
144
- var _useState17 = (0, _react.useState)(0),
145
- _useState18 = (0, _slicedToArray2.default)(_useState17, 2),
146
- scrollTop = _useState18[0],
147
- setScrollTop = _useState18[1];
148
-
149
- var _useState19 = (0, _react.useState)(1),
150
- _useState20 = (0, _slicedToArray2.default)(_useState19, 2),
151
- scrollHeight = _useState20[0],
152
- setScrollHeight = _useState20[1];
153
-
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; }
22
+ const RC = "dropdown";
23
+ const MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH = 10;
24
+ const Dropdown = _ref => {
25
+ var _options$find, _dropdownListWrapperR3, _dropdownListRef$curr5, _dropdownListRef$curr6, _filteredOptions$find, _tabIndex$toString;
26
+ let {
27
+ label,
28
+ options = [],
29
+ value,
30
+ error,
31
+ disabled,
32
+ onChange,
33
+ placeholder,
34
+ className,
35
+ isSearchable,
36
+ entity,
37
+ scrollReactionObj,
38
+ isListTop,
39
+ isNotValidateASCII = false,
40
+ testId,
41
+ sortAlphabetical = true,
42
+ fieldKey,
43
+ id,
44
+ noOptionsText = "No options available",
45
+ attributesOfNativeInput = {},
46
+ isDoNotPullOutListOfMainContainer,
47
+ withMobileLogic,
48
+ withActions,
49
+ minItemsForShowMobileSearch = MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH,
50
+ customTrigger,
51
+ tabIndex,
52
+ onActionConfirmClick,
53
+ onActionCancelClick,
54
+ isDefaultOpened
55
+ } = _ref;
56
+ const {
57
+ isMobile: isMobileProp
58
+ } = (0, _useIsMobile.default)();
59
+ const isMobile = isMobileProp && withMobileLogic && window.screen.width <= 768;
60
+ const [dropdownId, setDropdownId] = (0, _react.useState)(id || fieldKey || Math.random().toString(16).slice(2));
61
+ const [isOpen, setIsOpen] = (0, _react.useState)(false);
62
+ const [searchValue, setSearchValue] = (0, _react.useState)();
63
+ const dropdownRef = (0, _react.useRef)(null);
64
+ const dropdownListRef = (0, _react.useRef)(null);
65
+ const dropdownListWrapperRef = (0, _react.useRef)(null);
66
+ const searchInputRef = (0, _react.useRef)(null);
67
+ const wrapperRef = (0, _react.useRef)(null);
68
+ const [initListHeight, setInitListHeight] = (0, _react.useState)(null);
69
+ const [isSearchChanged, setIsSearchChanged] = (0, _react.useState)(false);
70
+ const [isSearchInputFocused, setIsSearchInputFocused] = (0, _react.useState)(false);
71
+ const [isScrollableList, setIsScrollableList] = (0, _react.useState)(null);
72
+ const [isFixedMaxHeight, setIsFixedMaxHeight] = (0, _react.useState)(false);
73
+ const [scrollTop, setScrollTop] = (0, _react.useState)(0);
74
+ const [scrollHeight, setScrollHeight] = (0, _react.useState)(1);
154
75
  if (!options) return null;
155
- var getTotalOptions = (0, _react.useCallback)(function () {
156
- return options === null || options === void 0 ? void 0 : options.reduce(function (result, item) {
76
+ const getTotalOptions = (0, _react.useCallback)(() => {
77
+ return options === null || options === void 0 ? void 0 : options.reduce((result, item) => {
157
78
  if (item !== null && item !== void 0 && item.list || item !== null && item !== void 0 && item.items) {
158
79
  var _item$list, _item$items;
159
-
160
- 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;
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;
161
81
  } else {
162
82
  ++result;
163
83
  }
164
-
165
84
  return result;
166
85
  }, 0);
167
86
  }, [options]);
168
-
169
87
  if (isMobile) {
170
88
  isSearchable = getTotalOptions() > (minItemsForShowMobileSearch || MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH);
171
89
  }
172
-
173
- var moveOtherToEnd = function moveOtherToEnd(options) {
174
- var otherIndex = options === null || options === void 0 ? void 0 : options.findIndex(function (option) {
175
- return (option === null || option === void 0 ? void 0 : option.value) === "other";
176
- });
177
-
90
+ const moveOtherToEnd = options => {
91
+ const otherIndex = options === null || options === void 0 ? void 0 : options.findIndex(option => (option === null || option === void 0 ? void 0 : option.value) === "other");
178
92
  if (otherIndex > -1) {
179
- var other = options === null || options === void 0 ? void 0 : options.splice(otherIndex, 1);
180
- options.push.apply(options, (0, _toConsumableArray2.default)(other));
93
+ const other = options === null || options === void 0 ? void 0 : options.splice(otherIndex, 1);
94
+ options.push(...other);
181
95
  }
182
-
183
96
  return options;
184
97
  };
185
-
186
- var optionsWithOtherAtTheEnd = moveOtherToEnd(options);
187
- options.map(function (option) {
98
+ const optionsWithOtherAtTheEnd = moveOtherToEnd(options);
99
+ options.map(option => {
188
100
  if (option.items) {
189
101
  return option.items = moveOtherToEnd(option.items);
190
102
  } else return option;
191
103
  });
192
- var filteredGroups = optionsWithOtherAtTheEnd.map(function (item) {
104
+ const filteredGroups = optionsWithOtherAtTheEnd.map(item => {
193
105
  var _item$items2;
194
-
195
- return _objectSpread(_objectSpread({}, item), {}, {
196
- 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(function (el) {
106
+ return {
107
+ ...item,
108
+ 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 => {
197
109
  var _el$label;
198
-
199
- 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) === "";
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) === "";
200
111
  })
201
- });
202
- }).filter(function (item) {
112
+ };
113
+ }).filter(item => {
203
114
  var _item$items3;
204
-
205
115
  return ((_item$items3 = item.items) === null || _item$items3 === void 0 ? void 0 : _item$items3.length) > 0;
206
116
  });
207
- var filteredItems = optionsWithOtherAtTheEnd.filter(function (item) {
117
+ const filteredItems = optionsWithOtherAtTheEnd.filter(item => {
208
118
  var _item$items4;
209
-
210
119
  return !((_item$items4 = item.items) !== null && _item$items4 !== void 0 && _item$items4.length);
211
- }).filter(function (item) {
120
+ }).filter(item => {
212
121
  var _item$label;
213
-
214
122
  if (!isSearchable || !isSearchChanged) return true;
215
- 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) === "";
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) === "";
216
124
  });
217
- var filteredOptions = [].concat((0, _toConsumableArray2.default)(filteredItems), (0, _toConsumableArray2.default)(filteredGroups));
218
- var modalBtnTrigger = entity && entity !== "" && typeof entity === "string";
219
-
220
- var onChangeHandler = function onChangeHandler(item) {
125
+ const filteredOptions = [...filteredItems, ...filteredGroups];
126
+ const modalBtnTrigger = entity && entity !== "" && typeof entity === "string";
127
+ const onChangeHandler = item => {
221
128
  setIsOpen(false);
222
129
  onChange(item.value);
223
130
  };
224
-
225
- var onKeyDown = function onKeyDown(e) {
131
+ const onKeyDown = e => {
226
132
  if (![9, 13].includes(e.keyCode)) return false;
227
133
  setIsOpen(false);
228
134
  };
229
-
230
- var onKeyUp = function onKeyUp(e) {
135
+ const onKeyUp = e => {
231
136
  if (![9, 13].includes(e.keyCode)) return false;
232
137
  setIsOpen(true);
233
- }; // decorator
234
-
235
-
236
- var getDepends = function getDepends(getDependsTrigger) {
237
- var newOnChange = function newOnChange(e) {
138
+ };
139
+ // decorator
140
+ const getDepends = getDependsTrigger => {
141
+ const newOnChange = e => {
238
142
  if (e.value === "open_modal") {
239
143
  onChange("open_modal");
240
144
  } else {
241
145
  onChangeHandler(e);
242
146
  }
243
- }; // add pseudo option
244
-
147
+ };
245
148
 
246
- var newOptions = [{
149
+ // add pseudo option
150
+ const newOptions = [{
247
151
  label: "New ".concat(entity),
248
152
  value: "open_modal",
249
153
  className: "dropdown__list-item--modal"
250
- }].concat((0, _toConsumableArray2.default)(filteredOptions));
154
+ }, ...filteredOptions];
251
155
  return {
252
- onChange: function onChange(changeItem) {
156
+ onChange: changeItem => {
253
157
  return getDependsTrigger ? newOnChange(changeItem) : onChangeHandler(changeItem);
254
158
  },
255
159
  options: getDependsTrigger ? newOptions : options
256
160
  };
257
161
  };
258
-
259
- var handleClickOutside = function handleClickOutside(event) {
162
+ const handleClickOutside = event => {
260
163
  var _getListContainer;
261
-
262
164
  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))) {
263
165
  setIsOpen(false);
264
166
  }
265
167
  };
266
-
267
- var onSearchHandler = function onSearchHandler(name) {
268
- var inputValue = name;
168
+ const onSearchHandler = name => {
169
+ let inputValue = name;
269
170
  if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
270
171
  setIsSearchChanged(true);
271
172
  setSearchValue(inputValue);
272
173
  };
273
-
274
- var onWrapperClick = function onWrapperClick(e) {
174
+ const onWrapperClick = e => {
275
175
  if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
276
176
  e.stopPropagation();
277
177
  e.preventDefault();
278
178
  setIsOpen(false);
279
179
  }
280
180
  };
281
-
282
- var hightlightedText = function hightlightedText(text, postfix, description) {
181
+ const hightlightedText = (text, postfix, description) => {
283
182
  var _text;
284
-
285
- var prepare = function prepare(text) {
286
- return text === null || text === void 0 ? void 0 : text.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
287
- };
288
-
289
- text = text.replace(/["&<>]/g, function (a) {
183
+ const prepare = text => text === null || text === void 0 ? void 0 : text.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
184
+ text = text.replace(/["&<>]/g, a => {
290
185
  return {
291
186
  '"': "&quot;",
292
187
  "&": "&amp;",
@@ -294,28 +189,26 @@ var Dropdown = function Dropdown(_ref) {
294
189
  ">": "&gt;"
295
190
  }[a];
296
191
  });
297
- var main = isSearchable && searchValue ? (_text = text) === null || _text === void 0 ? void 0 : _text.replace(new RegExp(prepare(searchValue), "i"), function (match) {
298
- return "<span class=\"bg--yellow\">".concat(match, "</span>");
299
- }) : text;
300
- var postfixPart = postfix ? "<span class=\"dropdown__list-item-postfix\">".concat(postfix, "</span>") : "";
301
- var descriptionPart = description ? "<span class=\"dropdown__list-item-description\">".concat(description, "</span>") : "";
192
+ const main = isSearchable && 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;
193
+ const postfixPart = postfix ? "<span class=\"dropdown__list-item-postfix\">".concat(postfix, "</span>") : "";
194
+ const descriptionPart = description ? "<span class=\"dropdown__list-item-description\">".concat(description, "</span>") : "";
302
195
  return main + postfixPart + descriptionPart;
303
196
  };
304
-
305
- var depend = getDepends(modalBtnTrigger);
306
-
307
- var getMarkupForElement = function getMarkupForElement(item, index, optTestId) {
308
- var _item$value, _item$value$toString, _item$value2, _item$value2$toString, _cn, _item$customMobileIco;
309
-
197
+ const depend = getDepends(modalBtnTrigger);
198
+ const getMarkupForElement = (item, index, optTestId) => {
199
+ var _item$value, _item$value2, _item$customMobileIco;
310
200
  return /*#__PURE__*/_react.default.createElement("button", {
311
- "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"),
312
- 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, "_"),
313
- onMouseDown: function onMouseDown() {
314
- return depend.onChange(item);
315
- },
316
- className: (0, _classnames.default)("".concat(RC, "__list-item"), (_cn = {}, (0, _defineProperty2.default)(_cn, "".concat(RC, "__list-item_active"), item.value === value), (0, _defineProperty2.default)(_cn, "".concat(RC, "__list-item_disabled"), item.disabled), _cn), item.className)
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, "_"),
203
+ onMouseDown: () => depend.onChange(item),
204
+ className: (0, _classnames.default)("".concat(RC, "__list-item"), {
205
+ ["".concat(RC, "__list-item_active")]: item.value === value,
206
+ ["".concat(RC, "__list-item_disabled")]: item.disabled
207
+ }, item.className)
317
208
  }, !isMobile && /*#__PURE__*/_react.default.createElement("span", {
318
- className: (0, _classnames.default)("".concat(RC, "__active-icon"), (0, _defineProperty2.default)({}, "".concat(RC, "__active-icon_active"), item.value === value))
209
+ className: (0, _classnames.default)("".concat(RC, "__active-icon"), {
210
+ ["".concat(RC, "__active-icon_active")]: item.value === value
211
+ })
319
212
  }, /*#__PURE__*/_react.default.createElement(_reactFeather.Check, null)), /*#__PURE__*/_react.default.createElement("div", {
320
213
  className: (0, _classnames.default)("".concat(RC, "__list-item-label"), item.labelClassName || ""),
321
214
  dangerouslySetInnerHTML: {
@@ -326,226 +219,196 @@ var Dropdown = function Dropdown(_ref) {
326
219
  checked: value
327
220
  }) : "");
328
221
  };
329
-
330
- var filteredOptionList = function filteredOptionList(filteredOption) {
331
- var _filteredOption$items, _filteredOption$label, _filteredOption$label2;
332
-
222
+ const filteredOptionList = filteredOption => {
223
+ var _filteredOption$items, _filteredOption$label;
333
224
  return ((_filteredOption$items = filteredOption.items) === null || _filteredOption$items === void 0 ? void 0 : _filteredOption$items.length) > 0 ? /*#__PURE__*/_react.default.createElement("div", {
334
- 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()),
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()),
335
226
  className: (0, _classnames.default)("".concat(RC, "-group"), filteredOption.className)
336
227
  }, /*#__PURE__*/_react.default.createElement("div", {
337
228
  className: "".concat(RC, "-group__name")
338
- }, filteredOption.label), filteredOption.items.map(function (el, index) {
339
- return getMarkupForElement(el, index, el === null || el === void 0 ? void 0 : el.testId);
340
- })) : null;
229
+ }, filteredOption.label), filteredOption.items.map((el, index) => getMarkupForElement(el, index, el === null || el === void 0 ? void 0 : el.testId))) : null;
341
230
  };
342
-
343
- var selectedLabel = ((_options$find = options.find(function (el) {
344
- return el.value === value;
345
- })) === null || _options$find === void 0 ? void 0 : _options$find.label) || options.reduce(function (acc, item) {
346
- var _item$items5, _item$items5$find;
347
-
348
- return acc || ((_item$items5 = item.items) === null || _item$items5 === void 0 ? void 0 : (_item$items5$find = _item$items5.find(function (el) {
349
- return el.value === value;
350
- })) === null || _item$items5$find === void 0 ? void 0 : _item$items5$find.label);
231
+ 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);
351
234
  }, null);
352
- var doScrollCallback = (0, _react.useCallback)(function (e) {
353
- var _ref2 = scrollReactionObj || {},
354
- callback = _ref2.callback,
355
- isWithAnyScrolling = _ref2.isWithAnyScrolling,
356
- _ref2$scrollingInaccu = _ref2.scrollingInaccuracy,
357
- scrollingInaccuracy = _ref2$scrollingInaccu === void 0 ? 0 : _ref2$scrollingInaccu;
358
-
235
+ const doScrollCallback = (0, _react.useCallback)(e => {
236
+ const {
237
+ callback,
238
+ isWithAnyScrolling,
239
+ scrollingInaccuracy = 0
240
+ } = scrollReactionObj || {};
359
241
  if (callback && typeof callback === "function") {
360
242
  if (isWithAnyScrolling) callback(e);else if (Math.round(e.target.clientHeight + e.target.scrollTop + scrollingInaccuracy) >= e.target.scrollHeight) {
361
243
  callback(e);
362
244
  }
363
245
  }
364
246
  }, [filteredOptions]);
365
-
366
- var getParentNode = function getParentNode() {
367
- var _ref3, _document$querySelect;
368
-
247
+ const getParentNode = () => {
248
+ var _ref2, _document$querySelect;
369
249
  if (isDoNotPullOutListOfMainContainer) return dropdownRef.current;
370
- return (_ref3 = (_document$querySelect = document.querySelector("div#root")) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("div#app")) !== null && _ref3 !== void 0 ? _ref3 : document.querySelector("div#storybook-root");
250
+ 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");
371
251
  };
372
-
373
- var initListContainer = function initListContainer() {
374
- var dropdownList = document.createElement("div");
252
+ const initListContainer = () => {
253
+ const dropdownList = document.createElement("div");
375
254
  dropdownList.setAttribute("id", dropdownId);
376
255
  dropdownList.classList.add("dropdown__container");
377
-
378
256
  if (isMobile) {
379
- dropdownList.addEventListener("click", function (e) {
257
+ dropdownList.addEventListener("click", e => {
380
258
  if (e.target.id === dropdownId) setIsOpen(false);
381
259
  });
382
260
  }
383
-
384
261
  try {
385
262
  var _getListContainer2;
386
-
387
- (_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 ? void 0 : _getListContainer2.remove();
263
+ (_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 || _getListContainer2.remove();
388
264
  } finally {
389
265
  if (isMobile) {
390
266
  var _getParentNode;
391
-
392
267
  try {
393
268
  var _document$getElementB;
394
-
395
- (_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove();
269
+ (_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
396
270
  } catch (e) {}
397
-
398
- var dropdownMobileListWrapper = document.createElement("div");
271
+ const dropdownMobileListWrapper = document.createElement("div");
399
272
  dropdownMobileListWrapper.classList.add("dropdown-mobile");
400
273
  dropdownMobileListWrapper.setAttribute("id", "mlw-".concat(dropdownId));
401
- dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 ? void 0 : dropdownMobileListWrapper.append(dropdownList);
402
- (_getParentNode = getParentNode()) === null || _getParentNode === void 0 ? void 0 : _getParentNode.append(dropdownMobileListWrapper);
274
+ dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 || dropdownMobileListWrapper.append(dropdownList);
275
+ (_getParentNode = getParentNode()) === null || _getParentNode === void 0 || _getParentNode.append(dropdownMobileListWrapper);
403
276
  } else {
404
277
  var _getParentNode2;
405
-
406
- (_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 ? void 0 : _getParentNode2.append(dropdownList);
278
+ (_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 || _getParentNode2.append(dropdownList);
407
279
  }
408
280
  }
409
281
  };
410
-
411
- var getListContainer = function getListContainer() {
282
+ const getListContainer = () => {
412
283
  return document.getElementById(dropdownId);
413
284
  };
414
-
415
- var getListContainerWrapper = function getListContainerWrapper() {
285
+ const getListContainerWrapper = () => {
416
286
  return document.getElementById("mlw-".concat(dropdownId));
417
287
  };
418
-
419
- var setListContainerStyles = function setListContainerStyles() {
420
- 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;
421
-
422
- var lc = getListContainer();
288
+ const setListContainerStyles = () => {
289
+ var _dropdownRef$current$, _dropdownListWrapperR, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$max, _getComputedStyle2, _sw$getBoundingClient, _dropdownListWrapperR2, _lh$getBoundingClient, _getComputedStyle$hei, _getComputedStyle3;
290
+ const lc = getListContainer();
423
291
  if (!lc || !isOpen) return false;
424
- var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
425
-
426
- var _ref4 = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0 ? void 0 : dropdownRef.current.getBoundingClientRect()) !== null && _dropdownRef$current$ !== void 0 ? _dropdownRef$current$ : {},
427
- width = _ref4.width,
428
- height = _ref4.height,
429
- left = _ref4.left,
430
- top = _ref4.top;
431
-
432
- var sw = lc.getElementsByClassName("dropdown__list")[0];
433
- var lh = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperR = dropdownListWrapperRef.current) === null || _dropdownListWrapperR === void 0 ? void 0 : _dropdownListWrapperR.getElementsByClassName("dropdown__list-header")[0];
434
- var 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);
435
- var 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);
292
+ const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
293
+ const {
294
+ width,
295
+ height,
296
+ left,
297
+ top
298
+ } = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0 ? void 0 : dropdownRef.current.getBoundingClientRect()) !== null && _dropdownRef$current$ !== void 0 ? _dropdownRef$current$ : {};
299
+ 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);
436
303
  if (initListHeight === null) setInitListHeight(maxHeight);
437
- var toTop = top - margin;
438
- var toBottom = windowHeight - top - height - margin * 2;
439
- var swHeight = sw === null || sw === void 0 ? void 0 : (_sw$getBoundingClient = sw.getBoundingClientRect()) === null || _sw$getBoundingClient === void 0 ? void 0 : _sw$getBoundingClient.height;
440
- var 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;
441
- var listPos = toTop < toBottom || toBottom >= swHeight ? "bottom" : "top";
304
+ const toTop = top - margin;
305
+ 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;
308
+ const listPos = toTop < toBottom || toBottom >= swHeight ? "bottom" : "top";
442
309
  lc.style.minWidth = "".concat(width, "px");
443
310
  lc.style.left = "".concat(left, "px");
444
- 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");
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");
445
312
  sw.style.maxHeight = "".concat(maxSwHeight, "px");
446
313
  };
447
-
448
- var renderListContainer = function renderListContainer() {
449
- var lc = getListContainer();
314
+ const renderListContainer = () => {
315
+ const lc = getListContainer();
450
316
  if (!lc) return null;
451
317
  return /*#__PURE__*/(0, _reactDom.createPortal)(getListMarkUp(), lc);
452
318
  };
453
-
454
- var getSortedOptions = function getSortedOptions(data) {
455
- var newData = (0, _toConsumableArray2.default)(data);
456
-
319
+ const getSortedOptions = data => {
320
+ let newData = [...data];
457
321
  if (sortAlphabetical) {
458
- var openModalOption = newData.filter(function (_ref5) {
459
- var value = _ref5.value;
322
+ const openModalOption = newData.filter(_ref3 => {
323
+ let {
324
+ value
325
+ } = _ref3;
460
326
  return value === "open_modal";
461
327
  });
462
- var emptyOption = newData.filter(function (_ref6) {
463
- var value = _ref6.value;
328
+ const emptyOption = newData.filter(_ref4 => {
329
+ let {
330
+ value
331
+ } = _ref4;
464
332
  return value === "";
465
333
  });
466
- var restOfOptions = newData.filter(function (_ref7) {
467
- var value = _ref7.value;
334
+ const restOfOptions = newData.filter(_ref5 => {
335
+ let {
336
+ value
337
+ } = _ref5;
468
338
  return value !== "open_modal" && value !== "";
469
339
  }).sort(_utils.compareAlphabetical);
470
- newData = [].concat((0, _toConsumableArray2.default)(openModalOption), (0, _toConsumableArray2.default)(emptyOption), (0, _toConsumableArray2.default)(restOfOptions)).map(function (item) {
340
+ newData = [...openModalOption, ...emptyOption, ...restOfOptions].map(item => {
471
341
  if (item !== null && item !== void 0 && item.items) {
472
- item.items = (0, _toConsumableArray2.default)(item.items).sort(_utils.compareAlphabetical);
342
+ item.items = [...item.items].sort(_utils.compareAlphabetical);
473
343
  }
474
-
475
344
  return item;
476
345
  });
477
346
  }
478
-
479
347
  return newData;
480
348
  };
481
-
482
- var getListMarkUp = function getListMarkUp() {
483
- var _cn3, _cn4, _getSortedOptions;
484
-
349
+ const getListMarkUp = () => {
350
+ var _getSortedOptions;
485
351
  return /*#__PURE__*/_react.default.createElement("div", {
486
352
  className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
487
353
  ref: wrapperRef,
488
- onClick: isMobile ? onWrapperClick : function () {}
354
+ onClick: isMobile ? onWrapperClick : () => {}
489
355
  }, /*#__PURE__*/_react.default.createElement("div", {
490
- className: (0, _classnames.default)("".concat(RC, "__list-wrapper"), (_cn3 = {}, (0, _defineProperty2.default)(_cn3, "".concat(RC, "__list-wrapper--fixed-height"), isFixedMaxHeight), (0, _defineProperty2.default)(_cn3, "".concat(RC, "__list-wrapper--with-bottom-shadow"), isScrollableList && isMobile), (0, _defineProperty2.default)(_cn3, "".concat(RC, "__list-wrapper--with-bottom-shadow-hidden"), scrollTop === scrollHeight), _cn3)),
356
+ className: (0, _classnames.default)("".concat(RC, "__list-wrapper"), {
357
+ ["".concat(RC, "__list-wrapper--fixed-height")]: isFixedMaxHeight,
358
+ ["".concat(RC, "__list-wrapper--with-bottom-shadow")]: isScrollableList && isMobile,
359
+ ["".concat(RC, "__list-wrapper--with-bottom-shadow-hidden")]: scrollTop === scrollHeight
360
+ }),
491
361
  ref: dropdownListWrapperRef
492
362
  }, isMobile && /*#__PURE__*/_react.default.createElement("div", {
493
- className: (0, _classnames.default)("".concat(RC, "__list-header"), (_cn4 = {}, (0, _defineProperty2.default)(_cn4, "".concat(RC, "__list-header-with-shadow"), isScrollableList && isMobile), (0, _defineProperty2.default)(_cn4, "".concat(RC, "__list-header-with-shadow-hidden"), scrollTop === 0), _cn4))
363
+ className: (0, _classnames.default)("".concat(RC, "__list-header"), {
364
+ ["".concat(RC, "__list-header-with-shadow")]: isScrollableList && isMobile,
365
+ ["".concat(RC, "__list-header-with-shadow-hidden")]: scrollTop === 0
366
+ })
494
367
  }, /*#__PURE__*/_react.default.createElement("div", {
495
368
  className: (0, _classnames.default)("".concat(RC, "__list-header-row"))
496
369
  }, /*#__PURE__*/_react.default.createElement("div", {
497
370
  className: (0, _classnames.default)("".concat(RC, "__list-label"))
498
371
  }, label), /*#__PURE__*/_react.default.createElement("div", {
499
372
  className: (0, _classnames.default)("".concat(RC, "__list-close-icon")),
500
- onClick: function onClick() {
501
- return setIsOpen(false);
502
- }
373
+ onClick: () => setIsOpen(false)
503
374
  }, /*#__PURE__*/_react.default.createElement(_reactFeather.X, {
504
- onClick: function onClick() {
505
- return setIsOpen(false);
506
- }
375
+ onClick: () => setIsOpen(false)
507
376
  }))), isSearchable && /*#__PURE__*/_react.default.createElement("div", {
508
377
  className: (0, _classnames.default)("".concat(RC, "__list-header-row"))
509
378
  }, /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({
510
379
  ref: searchInputRef,
511
380
  className: "".concat(RC, "__input"),
512
381
  value: searchValue !== null && searchValue !== void 0 ? searchValue : selectedLabel,
513
- onChange: function onChange(v) {
514
- return onSearchHandler(v);
515
- },
382
+ onChange: v => onSearchHandler(v),
516
383
  placeholder: placeholder || "Search",
517
384
  withDelete: true,
518
- onFocus: function onFocus() {
519
- return setIsSearchInputFocused(true);
520
- },
521
- onBlur: function onBlur() {
522
- return setIsSearchInputFocused(false);
523
- },
524
- onMouseDown: function onMouseDown() {
385
+ onFocus: () => setIsSearchInputFocused(true),
386
+ onBlur: () => setIsSearchInputFocused(false),
387
+ onMouseDown: () => {
525
388
  if (!isOpen) {
526
389
  setIsSearchInputFocused(true);
527
390
  }
528
391
  }
529
392
  }, attributesOfNativeInput)))), /*#__PURE__*/_react.default.createElement("div", {
530
- className: (0, _classnames.default)("".concat(RC, "__list"), (0, _defineProperty2.default)({}, "".concat(RC, "__list-top"), isListTop)),
393
+ className: (0, _classnames.default)("".concat(RC, "__list"), {
394
+ ["".concat(RC, "__list-top")]: isListTop
395
+ }),
531
396
  ref: dropdownListRef
532
- }, (_getSortedOptions = getSortedOptions(depend.options)) === null || _getSortedOptions === void 0 ? void 0 : _getSortedOptions.map(function (option) {
397
+ }, (_getSortedOptions = getSortedOptions(depend.options)) === null || _getSortedOptions === void 0 ? void 0 : _getSortedOptions.map(option => {
533
398
  var _option$items, _option$label;
534
-
535
399
  if (option !== null && option !== void 0 && (_option$items = option.items) !== null && _option$items !== void 0 && _option$items.length) {
536
400
  if (!isSearchable || !isSearchChanged) {
537
401
  return filteredOptionList(option);
538
402
  } else {
539
403
  var _option$items2;
540
-
541
- var items = (_option$items2 = option.items) === null || _option$items2 === void 0 ? void 0 : _option$items2.slice().filter(function (el) {
404
+ const items = (_option$items2 = option.items) === null || _option$items2 === void 0 ? void 0 : _option$items2.slice().filter(el => {
542
405
  var _el$label2;
543
-
544
- 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) === "";
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) === "";
407
+ });
408
+ if (items !== null && items !== void 0 && items.length) return filteredOptionList({
409
+ ...option,
410
+ items
545
411
  });
546
- if (items !== null && items !== void 0 && items.length) return filteredOptionList(_objectSpread(_objectSpread({}, option), {}, {
547
- items: items
548
- }));
549
412
  return null;
550
413
  }
551
414
  } else if (!isSearchable || !isSearchChanged || option !== null && option !== void 0 && (_option$label = option.label) !== null && _option$label !== void 0 && _option$label.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "") || !(option !== null && option !== void 0 && option.value) || (option === null || option === void 0 ? void 0 : option.value) === "") {
@@ -555,24 +418,21 @@ var Dropdown = function Dropdown(_ref) {
555
418
  className: "".concat(RC, "__list-item ").concat(RC, "__list-item--no-options")
556
419
  }, noOptionsText), disabled && isOpen && /*#__PURE__*/_react.default.createElement(_DropdownLoader.default, null))));
557
420
  };
558
-
559
- var toggleList = function toggleList(e) {
560
- e === null || e === void 0 ? void 0 : e.stopPropagation();
561
- setIsOpen(function (isOpen) {
421
+ const toggleList = e => {
422
+ e === null || e === void 0 || e.stopPropagation();
423
+ setIsOpen(isOpen => {
562
424
  return !isOpen;
563
425
  });
564
426
  };
565
-
566
- var closeList = isOpen ? handleClickOutside : function () {};
567
- (0, _react.useEffect)(function () {
427
+ const closeList = isOpen ? handleClickOutside : () => {};
428
+ (0, _react.useEffect)(() => {
568
429
  if (!isDoNotPullOutListOfMainContainer || dropdownRef.current) {
569
430
  initListContainer();
570
431
  if (isDefaultOpened && !isMobileProp) setIsOpen(true);
571
432
  }
572
433
  }, [isDoNotPullOutListOfMainContainer, dropdownRef.current]);
573
- (0, _react.useLayoutEffect)(function () {
434
+ (0, _react.useLayoutEffect)(() => {
574
435
  var _getListContainer3;
575
-
576
436
  if (!isMobile) {
577
437
  window.addEventListener("resize", setListContainerStyles);
578
438
  window.addEventListener("mousewheel", closeList);
@@ -584,146 +444,122 @@ var Dropdown = function Dropdown(_ref) {
584
444
  window.removeEventListener("scroll", closeList);
585
445
  window.removeEventListener("touchmove", closeList);
586
446
  }
587
-
588
- (_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.addEventListener("click", closeList);
589
- return function () {
447
+ (_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 || _getListContainer3.addEventListener("click", closeList);
448
+ return () => {
590
449
  var _getListContainer4;
591
-
592
450
  window.removeEventListener("resize", setListContainerStyles);
593
451
  window.removeEventListener("mousewheel", closeList);
594
452
  window.removeEventListener("scroll", closeList);
595
453
  window.removeEventListener("touchmove", closeList);
596
- (_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 ? void 0 : _getListContainer4.removeEventListener("click", closeList);
454
+ (_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 || _getListContainer4.removeEventListener("click", closeList);
597
455
  };
598
456
  }, [getListContainer]);
599
- (0, _react.useLayoutEffect)(function () {
457
+ (0, _react.useLayoutEffect)(() => {
600
458
  setListContainerStyles();
601
- }, [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]);
602
- (0, _react.useEffect)(function () {
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]);
460
+ (0, _react.useEffect)(() => {
603
461
  document.addEventListener("click", handleClickOutside, true);
604
- return function () {
605
- return document.removeEventListener("click", handleClickOutside, true);
606
- };
462
+ return () => document.removeEventListener("click", handleClickOutside, true);
607
463
  }, []);
608
- (0, _react.useEffect)(function () {
464
+ (0, _react.useEffect)(() => {
609
465
  if (!isOpen) {
610
466
  setIsSearchChanged(false);
611
467
  }
612
-
613
- if (scrollReactionObj && (0, _typeof2.default)(scrollReactionObj) === "object" && isOpen && dropdownListRef && dropdownListRef.current) {
468
+ if (scrollReactionObj && typeof scrollReactionObj === "object" && isOpen && dropdownListRef && dropdownListRef.current) {
614
469
  dropdownListRef.current.addEventListener("scroll", doScrollCallback);
615
470
  }
616
-
617
- return function () {
618
- if (scrollReactionObj && (0, _typeof2.default)(scrollReactionObj) === "object") removeEventListener("scroll", doScrollCallback);
471
+ return () => {
472
+ if (scrollReactionObj && typeof scrollReactionObj === "object") removeEventListener("scroll", doScrollCallback);
619
473
  };
620
474
  }, [isOpen, dropdownListRef]);
621
- (0, _react.useEffect)(function () {
475
+ (0, _react.useEffect)(() => {
622
476
  if (!searchValue && isSearchInputFocused) {
623
477
  setSearchValue(selectedLabel);
624
- setTimeout(function () {
625
- return searchInputRef.current.select();
626
- }, 1);
478
+ setTimeout(() => searchInputRef.current.select(), 1);
627
479
  }
628
-
629
480
  if (!isSearchInputFocused && !isOpen) {
630
481
  setSearchValue(null);
631
482
  }
632
483
  }, [isSearchInputFocused]);
633
- (0, _react.useEffect)(function () {
484
+ (0, _react.useEffect)(() => {
634
485
  var _searchInputRef$curre;
635
-
636
- 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();
637
-
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();
638
487
  if (isOpen) {
639
488
  var _getListContainer5;
640
-
641
- (_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 ? void 0 : _getListContainer5.classList.add("dropdown__container--opened");
489
+ (_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 || _getListContainer5.classList.add("dropdown__container--opened");
642
490
  } else {
643
491
  var _searchInputRef$curre2, _getListContainer6;
644
-
645
- searchInputRef === null || searchInputRef === void 0 ? void 0 : (_searchInputRef$curre2 = searchInputRef.current) === null || _searchInputRef$curre2 === void 0 ? void 0 : _searchInputRef$curre2.blur();
646
- (_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 ? void 0 : _getListContainer6.classList.remove("dropdown__container--opened");
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");
647
494
  }
648
-
649
495
  if (!isOpen && isMobile) {
650
496
  setSearchValue(null);
651
497
  }
652
498
  }, [isOpen]);
653
- (0, _react.useEffect)(function () {
499
+ (0, _react.useEffect)(() => {
654
500
  if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current && !searchValue) {
655
501
  var _dropdownListRef$curr, _dropdownListRef$curr2, _dropdownListRef$curr3, _dropdownListRef$curr4;
656
-
657
- 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));
658
- 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));
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));
659
504
  }
660
- }, [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]);
661
- (0, _react.useEffect)(function () {
662
- var setScrollTopValue = function setScrollTopValue(e) {
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]);
506
+ (0, _react.useEffect)(() => {
507
+ const setScrollTopValue = e => {
663
508
  setScrollTop(parseInt(e.target.scrollTop, 10));
664
509
  };
665
-
666
510
  if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
667
511
  var _dropdownListRef$curr7;
668
-
669
- dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
512
+ dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 || _dropdownListRef$curr7.addEventListener("scroll", setScrollTopValue);
670
513
  }
671
-
672
- return function () {
514
+ return () => {
673
515
  var _dropdownListRef$curr8;
674
-
675
- dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
516
+ dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 || _dropdownListRef$curr8.removeEventListener("scroll", setScrollTopValue);
676
517
  };
677
518
  }, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
678
- (0, _react.useEffect)(function () {
519
+ (0, _react.useEffect)(() => {
679
520
  if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
680
521
  var _dropdownListRef$curr9, _dropdownListRef$curr10;
681
-
682
- 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));
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));
683
523
  }
684
524
  }, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
685
- (0, _react.useEffect)(function () {
686
- return function () {
525
+ (0, _react.useEffect)(() => {
526
+ return () => {
687
527
  var _getListContainer7, _getListContainerWrap;
688
-
689
- (_getListContainer7 = getListContainer()) === null || _getListContainer7 === void 0 ? void 0 : _getListContainer7.remove();
690
- (_getListContainerWrap = getListContainerWrapper()) === null || _getListContainerWrap === void 0 ? void 0 : _getListContainerWrap.remove();
528
+ (_getListContainer7 = getListContainer()) === null || _getListContainer7 === void 0 || _getListContainer7.remove();
529
+ (_getListContainerWrap = getListContainerWrapper()) === null || _getListContainerWrap === void 0 || _getListContainerWrap.remove();
691
530
  };
692
531
  }, []);
693
- var postfixText = selectedLabel && ((_filteredOptions$find = filteredOptions.find(function (option) {
694
- return option.value === value;
695
- })) === null || _filteredOptions$find === void 0 ? void 0 : _filteredOptions$find.postfix) || null;
532
+ const postfixText = selectedLabel && ((_filteredOptions$find = filteredOptions.find(option => option.value === value)) === null || _filteredOptions$find === void 0 ? void 0 : _filteredOptions$find.postfix) || null;
696
533
  return /*#__PURE__*/_react.default.createElement("div", {
697
- className: (0, _classnames.default)(RC, className, (_cn6 = {
698
- disabled: disabled
699
- }, (0, _defineProperty2.default)(_cn6, "".concat(RC, "-mobile"), isMobile), (0, _defineProperty2.default)(_cn6, "".concat(RC, "--focused"), isOpen && !isMobile), (0, _defineProperty2.default)(_cn6, "".concat(RC, "--with-custom-trigger"), Boolean(customTrigger)), _cn6)),
534
+ className: (0, _classnames.default)(RC, className, {
535
+ disabled,
536
+ ["".concat(RC, "-mobile")]: isMobile,
537
+ ["".concat(RC, "--focused")]: isOpen && !isMobile,
538
+ ["".concat(RC, "--with-custom-trigger")]: Boolean(customTrigger)
539
+ }),
700
540
  ref: dropdownRef,
701
541
  onKeyDown: onKeyDown,
702
542
  onKeyUp: onKeyUp
703
543
  }, /*#__PURE__*/_react.default.createElement("button", {
704
544
  "data-testid": "dropdown--".concat(testId || "", "--container"),
705
- className: (0, _classnames.default)("".concat(RC, "__trigger"), "input__wrap", (_cn7 = {}, (0, _defineProperty2.default)(_cn7, "".concat(RC, "__trigger--with-actions"), withActions), (0, _defineProperty2.default)(_cn7, "placeholder", !value), (0, _defineProperty2.default)(_cn7, "error", error), _cn7)),
706
- onClick: function onClick() {
707
- return setIsOpen(true);
708
- },
545
+ className: (0, _classnames.default)("".concat(RC, "__trigger"), "input__wrap", {
546
+ ["".concat(RC, "__trigger--with-actions")]: withActions,
547
+ placeholder: !value,
548
+ error: error
549
+ }),
550
+ onClick: () => setIsOpen(true),
709
551
  onKeyDown: onKeyDown,
710
552
  onKeyUp: onKeyUp,
711
- tabIndex: tabIndex === null || tabIndex === void 0 ? void 0 : (_tabIndex$toString = tabIndex.toString) === null || _tabIndex$toString === void 0 ? void 0 : _tabIndex$toString.call(tabIndex)
553
+ tabIndex: tabIndex === null || tabIndex === void 0 || (_tabIndex$toString = tabIndex.toString) === null || _tabIndex$toString === void 0 ? void 0 : _tabIndex$toString.call(tabIndex)
712
554
  }, customTrigger || /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isSearchable && !isMobile ? /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({
713
555
  ref: searchInputRef,
714
556
  className: "".concat(RC, "__input"),
715
557
  value: isOpen ? searchValue !== null && searchValue !== void 0 ? searchValue : "" : selectedLabel || "",
716
- onChange: function onChange(e) {
717
- return onSearchHandler(e.target.value);
718
- },
558
+ onChange: e => onSearchHandler(e.target.value),
719
559
  placeholder: placeholder,
720
- onFocus: function onFocus() {
721
- return setIsSearchInputFocused(true);
722
- },
723
- onBlur: function onBlur() {
724
- return setIsSearchInputFocused(false);
725
- },
726
- onMouseDown: function onMouseDown() {
560
+ onFocus: () => setIsSearchInputFocused(true),
561
+ onBlur: () => setIsSearchInputFocused(false),
562
+ onMouseDown: () => {
727
563
  if (!isOpen) {
728
564
  setIsSearchInputFocused(true);
729
565
  }
@@ -735,7 +571,9 @@ var Dropdown = function Dropdown(_ref) {
735
571
  }, selectedLabel || placeholder), postfixText && /*#__PURE__*/_react.default.createElement("span", {
736
572
  className: "dropdown__list-item-postfix"
737
573
  }, postfixText)), /*#__PURE__*/_react.default.createElement("span", {
738
- className: (0, _classnames.default)("".concat(RC, "__arrow"), (0, _defineProperty2.default)({}, "".concat(RC, "__arrow_active"), isOpen)),
574
+ className: (0, _classnames.default)("".concat(RC, "__arrow"), {
575
+ ["".concat(RC, "__arrow_active")]: isOpen
576
+ }),
739
577
  onClick: toggleList
740
578
  }, isMobile ? /*#__PURE__*/_react.default.createElement(_reactFeather.Code, {
741
579
  className: "mobile-icon"
@@ -749,6 +587,4 @@ var Dropdown = function Dropdown(_ref) {
749
587
  onClick: onActionCancelClick
750
588
  }, /*#__PURE__*/_react.default.createElement(_reactFeather.X, null))), isOpen && renderListContainer());
751
589
  };
752
-
753
- var _default = Dropdown;
754
- exports.default = _default;
590
+ var _default = exports.default = Dropdown;