intelicoreact 1.4.36 → 1.4.37

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 (256) 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/FileLoaderLocal/FileLoaderLocal.js +26 -6
  15. package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +35 -19
  16. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +38 -9
  17. package/dist/Atomic/FormElements/Input/Input.js +60 -25
  18. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +31 -4
  19. package/dist/Atomic/FormElements/InputColor/InputColor.js +14 -4
  20. package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +29 -6
  21. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +43 -8
  22. package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +21 -3
  23. package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +81 -58
  24. package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +41 -6
  25. package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +8 -1
  26. package/dist/Atomic/FormElements/InputDateRange/dependencies.js +46 -16
  27. package/dist/Atomic/FormElements/InputLink/InputLink.js +23 -6
  28. package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +4 -0
  29. package/dist/Atomic/FormElements/InputMask/InputMask.js +208 -77
  30. package/dist/Atomic/FormElements/InputMask/functions.js +28 -2
  31. package/dist/Atomic/FormElements/InputMask2/InputMask2.js +119 -43
  32. package/dist/Atomic/FormElements/InputMask2/functions.js +28 -2
  33. package/dist/Atomic/FormElements/InputMask3/InputMask3.js +137 -44
  34. package/dist/Atomic/FormElements/InputMask3/functions.js +28 -2
  35. package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +17 -3
  36. package/dist/Atomic/FormElements/InputsRow/InputsRow.js +24 -5
  37. package/dist/Atomic/FormElements/Label/Label.js +9 -1
  38. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +73 -35
  39. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +15 -3
  40. package/dist/Atomic/FormElements/NumericInput/NumericInput.js +44 -23
  41. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +17 -7
  42. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +14 -3
  43. package/dist/Atomic/FormElements/RadioInput/RadioInput.js +10 -1
  44. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +14 -3
  45. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +23 -3
  46. package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +34 -17
  47. package/dist/Atomic/FormElements/RangeList/RangeList.js +25 -6
  48. package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +11 -1
  49. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +85 -14
  50. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +132 -43
  51. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +10 -1
  52. package/dist/Atomic/FormElements/Switcher/Switcher.js +10 -1
  53. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +13 -1
  54. package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +10 -1
  55. package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +17 -2
  56. package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +17 -3
  57. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +11 -1
  58. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +29 -6
  59. package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +3 -2
  60. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +12 -1
  61. package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +23 -6
  62. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +234 -123
  63. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.scss +21 -21
  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 -3
  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 +15 -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 +31 -5
  108. package/dist/Atomic/UI/Modal/Modal.js +28 -6
  109. package/dist/Atomic/UI/Modal/ModalHOC.js +9 -1
  110. package/dist/Atomic/UI/Modal/partials/ModalFooter.js +7 -1
  111. package/dist/Atomic/UI/Modal/partials/ModalTitle.js +8 -1
  112. package/dist/Atomic/UI/Modal/partials/useMobileModal.js +49 -32
  113. package/dist/Atomic/UI/ModalBackup/Modal.js +174 -0
  114. package/dist/Atomic/UI/ModalBackup/Modal.scss +333 -0
  115. package/dist/Atomic/UI/ModalBackup/ModalHOC.js +51 -0
  116. package/dist/Atomic/UI/ModalBackup/partials/ModalFooter.js +24 -0
  117. package/dist/Atomic/UI/ModalBackup/partials/ModalTitle.js +41 -0
  118. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +21 -6
  119. package/dist/Atomic/UI/NavLine/NavLine.js +55 -26
  120. package/dist/Atomic/UI/NavLine/Tabs.js +3 -2
  121. package/dist/Atomic/UI/PageTitle/PageTitle.js +10 -2
  122. package/dist/Atomic/UI/PieChart/PieChart.js +10 -1
  123. package/dist/Atomic/UI/Price/Price.js +8 -3
  124. package/dist/Atomic/UI/PriceRange/PriceRange.js +7 -1
  125. package/dist/Atomic/UI/ProgressLine/ProgressLine.js +16 -1
  126. package/dist/Atomic/UI/Status/Status.js +8 -1
  127. package/dist/Atomic/UI/Table/Partials/TdCell.js +29 -5
  128. package/dist/Atomic/UI/Table/Partials/TdHeader.js +11 -1
  129. package/dist/Atomic/UI/Table/Partials/TdRow.js +17 -5
  130. package/dist/Atomic/UI/Table/Partials/TdTitle.js +14 -3
  131. package/dist/Atomic/UI/Table/Table.js +12 -1
  132. package/dist/Atomic/UI/Table/TdTypes/TdActions.js +18 -2
  133. package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +9 -1
  134. package/dist/Atomic/UI/Table/TdTypes/TdRange.js +4 -1
  135. package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +13 -1
  136. package/dist/Atomic/UI/Tag/Tag.js +24 -9
  137. package/dist/Atomic/UI/TagList/TagList.js +39 -18
  138. package/dist/Atomic/UI/UserBox/UserBox.js +13 -1
  139. package/dist/Classes/AbortableFetch.js +93 -36
  140. package/dist/Classes/AnimatedHandler.js +7 -3
  141. package/dist/Classes/RESTAPI/index.js +42 -39
  142. package/dist/Classes/RESTAPI/partials/AbortableFetch.js +93 -35
  143. package/dist/Classes/RESTAPI/partials/ApiBase.js +9 -1
  144. package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +32 -24
  145. package/dist/Classes/RESTAPI/partials/ApiUtils.js +41 -34
  146. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +44 -21
  147. package/dist/Classes/RESTAPI/partials/Utils.js +19 -6
  148. package/dist/Classes/RESTAPI/partials/_outerDependencies.js +6 -2
  149. package/dist/Classes/RESTAPI/partials/_utils.js +36 -13
  150. package/dist/Constants/index.constants.js +15 -8
  151. package/dist/Functions/Portal.js +16 -5
  152. package/dist/Functions/customEventListener.js +17 -4
  153. package/dist/Functions/fieldValueFormatters.js +83 -43
  154. package/dist/Functions/hooks/useFormFieldsChangesManager.js +26 -23
  155. package/dist/Functions/locale/createTranslator.js +9 -4
  156. package/dist/Functions/operations.js +22 -12
  157. package/dist/Functions/presets/inputMaskPresets.js +11 -9
  158. package/dist/Functions/presets/inputPresets.js +11 -8
  159. package/dist/Functions/presets/mobileKeyboardTypesPresets.js +9 -7
  160. package/dist/Functions/schemas.js +13 -6
  161. package/dist/Functions/useBodyScrollLock.js +6 -1
  162. package/dist/Functions/useClickOutside.js +4 -0
  163. package/dist/Functions/useDebounce.js +7 -2
  164. package/dist/Functions/useFieldFocus.js +18 -6
  165. package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +9 -0
  166. package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +23 -12
  167. package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +15 -6
  168. package/dist/Functions/useFormTools/functions/General.js +28 -18
  169. package/dist/Functions/useFormTools/functions/RenderFields.js +11 -2
  170. package/dist/Functions/useFormTools/functions/usePrevious.js +5 -1
  171. package/dist/Functions/useFormTools/index.js +144 -85
  172. package/dist/Functions/useInputHighlightError.js +12 -3
  173. package/dist/Functions/useIsMobile.js +13 -7
  174. package/dist/Functions/useKeyPress/useHandleKeyPress.js +7 -1
  175. package/dist/Functions/useKeyPress/useKeyPress.js +9 -1
  176. package/dist/Functions/useLocalStorage.js +9 -1
  177. package/dist/Functions/useLocationParams.js +5 -4
  178. package/dist/Functions/useMediaQuery.js +9 -3
  179. package/dist/Functions/useMetaInfo.js +10 -3
  180. package/dist/Functions/useMouseUpOutside.js +3 -0
  181. package/dist/Functions/useOnlineStatus.js +9 -1
  182. package/dist/Functions/usePasswordChecker.js +20 -4
  183. package/dist/Functions/usePrevious.js +5 -1
  184. package/dist/Functions/useResize.js +10 -2
  185. package/dist/Functions/useScrollTo.js +7 -2
  186. package/dist/Functions/useToggle.js +5 -1
  187. package/dist/Functions/utils.js +131 -56
  188. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +9 -2
  189. package/dist/Molecular/CustomIcons/components/AlertCircle.js +9 -2
  190. package/dist/Molecular/CustomIcons/components/AppStore.js +9 -2
  191. package/dist/Molecular/CustomIcons/components/Arrow.js +9 -2
  192. package/dist/Molecular/CustomIcons/components/ArrowDown.js +9 -2
  193. package/dist/Molecular/CustomIcons/components/ArrowLeft.js +9 -2
  194. package/dist/Molecular/CustomIcons/components/ArrowRight.js +9 -2
  195. package/dist/Molecular/CustomIcons/components/ArrowUp.js +9 -2
  196. package/dist/Molecular/CustomIcons/components/Bell.js +9 -2
  197. package/dist/Molecular/CustomIcons/components/Button.js +9 -2
  198. package/dist/Molecular/CustomIcons/components/Campaigns.js +9 -2
  199. package/dist/Molecular/CustomIcons/components/Check.js +9 -2
  200. package/dist/Molecular/CustomIcons/components/Check2.js +9 -2
  201. package/dist/Molecular/CustomIcons/components/ChevronDown.js +9 -2
  202. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +9 -2
  203. package/dist/Molecular/CustomIcons/components/ChevronLeft.js +9 -2
  204. package/dist/Molecular/CustomIcons/components/ChevronRight.js +9 -2
  205. package/dist/Molecular/CustomIcons/components/ChevronUp.js +9 -2
  206. package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +9 -2
  207. package/dist/Molecular/CustomIcons/components/Close.js +9 -2
  208. package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +9 -2
  209. package/dist/Molecular/CustomIcons/components/Delete.js +9 -2
  210. package/dist/Molecular/CustomIcons/components/Edit.js +9 -2
  211. package/dist/Molecular/CustomIcons/components/Email.js +9 -2
  212. package/dist/Molecular/CustomIcons/components/FinturfLogo.js +9 -2
  213. package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +9 -2
  214. package/dist/Molecular/CustomIcons/components/Flows.js +9 -2
  215. package/dist/Molecular/CustomIcons/components/Gift.js +9 -2
  216. package/dist/Molecular/CustomIcons/components/GoogleAuth.js +9 -2
  217. package/dist/Molecular/CustomIcons/components/GooglePlay.js +9 -2
  218. package/dist/Molecular/CustomIcons/components/HelpCircle.js +9 -2
  219. package/dist/Molecular/CustomIcons/components/HelpCircle2.js +9 -2
  220. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +9 -2
  221. package/dist/Molecular/CustomIcons/components/Home.js +9 -2
  222. package/dist/Molecular/CustomIcons/components/Home2.js +9 -2
  223. package/dist/Molecular/CustomIcons/components/Key.js +9 -2
  224. package/dist/Molecular/CustomIcons/components/Landers.js +9 -2
  225. package/dist/Molecular/CustomIcons/components/Lock.js +9 -2
  226. package/dist/Molecular/CustomIcons/components/Mail.js +9 -2
  227. package/dist/Molecular/CustomIcons/components/Mastercard.js +9 -2
  228. package/dist/Molecular/CustomIcons/components/Minus.js +9 -2
  229. package/dist/Molecular/CustomIcons/components/Offers.js +9 -2
  230. package/dist/Molecular/CustomIcons/components/Pause.js +9 -2
  231. package/dist/Molecular/CustomIcons/components/PayPal.js +9 -2
  232. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +9 -2
  233. package/dist/Molecular/CustomIcons/components/Phone.js +9 -2
  234. package/dist/Molecular/CustomIcons/components/Play.js +9 -2
  235. package/dist/Molecular/CustomIcons/components/Plus.js +9 -2
  236. package/dist/Molecular/CustomIcons/components/Profile.js +9 -2
  237. package/dist/Molecular/CustomIcons/components/QRCode.js +9 -2
  238. package/dist/Molecular/CustomIcons/components/Rectangle.js +9 -2
  239. package/dist/Molecular/CustomIcons/components/Revert.js +9 -2
  240. package/dist/Molecular/CustomIcons/components/Star.js +9 -2
  241. package/dist/Molecular/CustomIcons/components/Star2.js +9 -2
  242. package/dist/Molecular/CustomIcons/components/TrafficSources.js +9 -2
  243. package/dist/Molecular/CustomIcons/components/Trash.js +9 -2
  244. package/dist/Molecular/CustomIcons/components/TrashRed.js +9 -2
  245. package/dist/Molecular/CustomIcons/components/Triggers.js +9 -2
  246. package/dist/Molecular/CustomIcons/components/User.js +9 -2
  247. package/dist/Molecular/CustomIcons/components/Visa.js +9 -2
  248. package/dist/Molecular/CustomIcons/components/X.js +9 -2
  249. package/dist/Molecular/CustomIcons/index.js +122 -0
  250. package/dist/Molecular/FormElement/FormElement.js +12 -1
  251. package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +31 -30
  252. package/dist/Molecular/FormWithDependOn/partials/_utils.js +12 -9
  253. package/dist/Molecular/InputAddress/InputAddress.js +114 -65
  254. package/dist/Molecular/InputPassword/InputPassword.js +19 -5
  255. package/dist/index.js +2 -0
  256. package/package.json +1 -1
@@ -1,31 +1,51 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
9
+
8
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+
9
12
  var _react = _interopRequireWildcard(require("react"));
13
+
10
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
+
11
16
  var _reactDom = require("react-dom");
17
+
12
18
  var _reactFeather = require("react-feather");
19
+
13
20
  var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
21
+
14
22
  var _useDebounce = require("../../../Functions/useDebounce");
23
+
15
24
  var _useIsMobile = _interopRequireDefault(require("../../../Functions/useIsMobile"));
25
+
16
26
  var _CheckboxInput = _interopRequireDefault(require("../../FormElements/CheckboxInput/CheckboxInput"));
27
+
17
28
  var _Input = _interopRequireDefault(require("../../FormElements/Input/Input"));
29
+
18
30
  var _Button = _interopRequireDefault(require("../../UI/Button/Button"));
31
+
19
32
  var _Tag = _interopRequireDefault(require("../../UI/Tag/Tag"));
33
+
20
34
  var _TagList = _interopRequireDefault(require("../../UI/TagList/TagList"));
35
+
21
36
  require("./TagsDropdown.scss");
22
- 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); }
23
- 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; }
37
+
38
+ 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); }
39
+
40
+ 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; }
41
+
24
42
  const RC = "tags-dropdown";
25
43
  const MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH = 10;
26
44
  const COLORS = ["#F1F0F0", "#E3E2E0", "#EEDFDA", "#F9DEC9", "#FDECC8", "#DBECDB", "#D3E4EF", "#E8DEEE", "#F4E0E9", "#FFE2DD", "#D3EFED", "#ECEEDE"];
45
+
27
46
  const TagsDropdown = _ref => {
28
- var _Object$keys, _dropdownListWrapperR2, _dropdownListRef$curr7, _dropdownListRef$curr8;
47
+ var _Object$keys, _dropdownListWrapperR2, _dropdownListWrapperR3, _dropdownListRef$curr7, _dropdownListRef$curr8;
48
+
29
49
  let {
30
50
  options: optionsProp,
31
51
  chosenOptions = [],
@@ -102,21 +122,24 @@ const TagsDropdown = _ref => {
102
122
  delay: 600
103
123
  });
104
124
  const [isValueDeleted, setIsValueDeleted] = (0, _react.useState)(false);
125
+
105
126
  const setSearchValueInterceptor = value => {
106
127
  setSearchValue(value);
107
128
  setIsValueDeleted(searchValue !== value && value === "");
108
129
  searchValueRef.current = value;
109
130
  };
131
+
110
132
  const editingOptionInputRef = (0, _react.useRef)(null);
111
133
  const [options, setOptions] = (0, _react.useState)([]);
112
134
  const [editingOption, setEditingOptionState] = (0, _react.useState)(null);
135
+
113
136
  const setEditingOption = data => {
114
- setEditingOptionState(editingOption => !data ? data : {
115
- ...(editingOption !== null && editingOption !== void 0 ? editingOption : {}),
137
+ setEditingOptionState(editingOption => !data ? data : { ...(editingOption !== null && editingOption !== void 0 ? editingOption : {}),
116
138
  ...(typeof data === "function" ? data === null || data === void 0 ? void 0 : data(editingOption) : data),
117
139
  isChanged: Boolean(editingOption)
118
140
  });
119
141
  };
142
+
120
143
  const isEditingOptionError = (0, _react.useMemo)(() => {
121
144
  if (!editingOption) return false;
122
145
  return options.filter(_ref2 => {
@@ -136,9 +159,9 @@ const TagsDropdown = _ref => {
136
159
  const getRandomIndex = (min, max) => {
137
160
  return Math.floor(Math.random() * (max - min + 1)) + min;
138
161
  };
162
+
139
163
  const randomIndex = getRandomIndex(0, COLORS.length - 1);
140
- return COLORS[randomIndex];
141
- // eslint-disable-next-line react-hooks/exhaustive-deps
164
+ return COLORS[randomIndex]; // eslint-disable-next-line react-hooks/exhaustive-deps
142
165
  }, [options.length]);
143
166
  const singleLevelOptions = options === null || options === void 0 ? void 0 : options.reduce((acc, item) => {
144
167
  const checkUniqAndPush = (acc, item) => {
@@ -148,115 +171,138 @@ const TagsDropdown = _ref => {
148
171
  } = _ref4;
149
172
  return value === (item === null || item === void 0 ? void 0 : item.value);
150
173
  });
174
+
151
175
  if (isExist !== -1) {
152
176
  acc[isExist] = item;
153
177
  } else {
154
178
  acc.push(item);
155
179
  }
156
180
  };
181
+
157
182
  if (item.groupName) {
158
183
  var _item$list;
159
- (_item$list = item.list) === null || _item$list === void 0 || _item$list.map(item => checkUniqAndPush(acc, item));
184
+
185
+ (_item$list = item.list) === null || _item$list === void 0 ? void 0 : _item$list.map(item => checkUniqAndPush(acc, item));
160
186
  } else {
161
187
  checkUniqAndPush(acc, item);
162
188
  }
189
+
163
190
  return acc;
164
191
  }, isUseLocalOptionsStore ? (_Object$keys = Object.keys(localOptionsStore)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.map(value => ({
165
192
  value,
166
193
  label: localOptionsStore === null || localOptionsStore === void 0 ? void 0 : localOptionsStore[value]
167
194
  })) : []);
195
+
168
196
  const deleteChosen = value => {
169
197
  if (isMobile ? closeOnRemoveMobile : closeOnRemove) setIsOpen(false);
198
+
170
199
  if (isUseLocalOptionsStore) {
171
- setLocalOptionsStore(options => ({
172
- ...options,
200
+ setLocalOptionsStore(options => ({ ...options,
173
201
  [value]: undefined
174
202
  }));
175
203
  }
204
+
176
205
  onChange(chosenOptions.filter(item => item !== value), "chosenOptions");
177
- };
206
+ }; // --- LIST CONTAINER FUNCTIONS BEGIN --- //
207
+
178
208
 
179
- // --- LIST CONTAINER FUNCTIONS BEGIN --- //
180
209
  const getParentNode = () => {
181
210
  var _ref5, _document$querySelect;
211
+
182
212
  return (_ref5 = (_document$querySelect = document.querySelector("div#root")) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("div#app")) !== null && _ref5 !== void 0 ? _ref5 : document.querySelector("div#storybook-root");
183
213
  };
214
+
184
215
  const initListContainer = () => {
185
216
  const dropdownList = document.createElement("div");
186
217
  dropdownList.setAttribute("id", dropdownId);
187
218
  dropdownList.classList.add("tags-dropdown__container");
219
+
188
220
  if (isMobile) {
189
221
  dropdownList.addEventListener("click", e => {
190
222
  if (e.target.id === dropdownId) setIsOpen(false);
191
223
  });
192
224
  }
225
+
193
226
  if (isMobile) {
194
227
  var _getParentNode;
228
+
195
229
  try {
196
230
  var _document$getElementB;
197
- (_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
198
- // eslint-disable-next-line no-empty
231
+
232
+ (_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.remove(); // eslint-disable-next-line no-empty
199
233
  } catch (e) {}
234
+
200
235
  const dropdownMobileListWrapper = document.createElement("div");
201
236
  dropdownMobileListWrapper.classList.add("tags-dropdown-mobile");
202
237
  dropdownMobileListWrapper.setAttribute("id", "mlw-".concat(dropdownId));
203
- dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 || dropdownMobileListWrapper.append(dropdownList);
204
- (_getParentNode = getParentNode()) === null || _getParentNode === void 0 || _getParentNode.append(dropdownMobileListWrapper);
238
+ dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 ? void 0 : dropdownMobileListWrapper.append(dropdownList);
239
+ (_getParentNode = getParentNode()) === null || _getParentNode === void 0 ? void 0 : _getParentNode.append(dropdownMobileListWrapper);
205
240
  } else {
206
241
  var _getParentNode2;
207
- (_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 || _getParentNode2.append(dropdownList);
242
+
243
+ (_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 ? void 0 : _getParentNode2.append(dropdownList);
208
244
  }
209
245
  };
246
+
210
247
  const getListContainer = () => {
211
248
  return document.getElementById(dropdownId);
212
249
  };
250
+
213
251
  const getListContainerWrapper = () => {
214
252
  return document.getElementById("mlw-".concat(dropdownId));
215
253
  };
254
+
216
255
  const setListContainerStyles = () => {
217
- var _dropdownRef$current$, _dropdownRef$current, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$max, _getComputedStyle2, _sw$getBoundingClient, _sw$getBoundingClient2, _lh$getBoundingClient, _lf$getBoundingClient;
218
- const lc = getListContainer();
219
- if (!lc || !isOpen) return false;
256
+ var _dropdownRef$current$, _dropdownRef$current, _getComputedStyle$mar, _getComputedStyle, _getComputedStyle$mar2, _selectorWrapper$getB, _listHeader$getBoundi, _listHeader$getBoundi2, _listFooter$getBoundi, _listFooter$getBoundi2;
257
+
258
+ const listContainer = getListContainer();
259
+ if (!listContainer || !isOpen) return false;
220
260
  const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
221
261
  const {
222
262
  width,
223
263
  height,
224
264
  left,
225
265
  top
226
- } = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0 || (_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : _dropdownRef$current.getBoundingClientRect()) !== null && _dropdownRef$current$ !== void 0 ? _dropdownRef$current$ : {};
227
- const sw = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current;
228
- const dl = lc.getElementsByClassName("tags-dropdown__list")[0];
229
- const lh = sw === null || sw === void 0 ? void 0 : sw.getElementsByClassName("tags-dropdown__header")[0];
230
- const lf = sw === null || sw === void 0 ? void 0 : sw.getElementsByClassName("tags-dropdown__footer")[0];
231
- const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(sw)) === 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);
232
- const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_getComputedStyle$max = (_getComputedStyle2 = getComputedStyle(dl)) === 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);
233
- if (initListHeight === null) setInitListHeight(maxHeight);
234
- const toTop = top - margin;
235
- const toBottom = windowHeight - top - height - margin * 2;
236
- let swHeight = sw === null || sw === void 0 || (_sw$getBoundingClient = sw.getBoundingClientRect()) === null || _sw$getBoundingClient === void 0 ? void 0 : _sw$getBoundingClient.height;
237
- if (swHeight > maxHeight) swHeight = maxHeight - 2 * margin;
238
- const maxSwHeight = (sw === null || sw === void 0 || (_sw$getBoundingClient2 = sw.getBoundingClientRect()) === null || _sw$getBoundingClient2 === void 0 ? void 0 : _sw$getBoundingClient2.height) - (lh === null || lh === void 0 || (_lh$getBoundingClient = lh.getBoundingClientRect()) === null || _lh$getBoundingClient === void 0 ? void 0 : _lh$getBoundingClient.height) - (lf === null || lf === void 0 || (_lf$getBoundingClient = lf.getBoundingClientRect()) === null || _lf$getBoundingClient === void 0 ? void 0 : _lf$getBoundingClient.height);
239
- const listPos = toTop < toBottom || toBottom >= swHeight ? "bottom" : "top";
240
- if (swHeight > (listPos === "top" ? toTop : toBottom)) swHeight = (listPos === "top" ? toTop : toBottom) - 3 * margin;
241
- lc.style.minWidth = "".concat(width, "px");
242
- lc.style.left = "".concat(left, "px");
243
- lc.style.top = "".concat(listPos === "bottom" ? top + height : top - swHeight - 2 * margin, "px");
244
- if (isMobile) {
245
- dl.style.maxHeight = "".concat(maxSwHeight, "px");
266
+ } = (_dropdownRef$current$ = dropdownRef === null || dropdownRef === void 0 ? void 0 : (_dropdownRef$current = dropdownRef.current) === null || _dropdownRef$current === void 0 ? void 0 : _dropdownRef$current.getBoundingClientRect()) !== null && _dropdownRef$current$ !== void 0 ? _dropdownRef$current$ : {};
267
+ const selectorWrapper = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current;
268
+ const dropdownList = listContainer.getElementsByClassName("tags-dropdown__list")[0];
269
+ const listHeader = selectorWrapper === null || selectorWrapper === void 0 ? void 0 : selectorWrapper.getElementsByClassName("tags-dropdown__header")[0];
270
+ const listFooter = selectorWrapper === null || selectorWrapper === void 0 ? void 0 : selectorWrapper.getElementsByClassName("tags-dropdown__footer")[0];
271
+ const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(selectorWrapper)) === 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);
272
+ let selectorWrapperHeight = selectorWrapper === null || selectorWrapper === void 0 ? void 0 : (_selectorWrapper$getB = selectorWrapper.getBoundingClientRect()) === null || _selectorWrapper$getB === void 0 ? void 0 : _selectorWrapper$getB.height;
273
+ const maxSelectorWrapperHeight = 500 - ((_listHeader$getBoundi = listHeader === null || listHeader === void 0 ? void 0 : (_listHeader$getBoundi2 = listHeader.getBoundingClientRect()) === null || _listHeader$getBoundi2 === void 0 ? void 0 : _listHeader$getBoundi2.height) !== null && _listHeader$getBoundi !== void 0 ? _listHeader$getBoundi : 0) - ((_listFooter$getBoundi = listFooter === null || listFooter === void 0 ? void 0 : (_listFooter$getBoundi2 = listFooter.getBoundingClientRect()) === null || _listFooter$getBoundi2 === void 0 ? void 0 : _listFooter$getBoundi2.height) !== null && _listFooter$getBoundi !== void 0 ? _listFooter$getBoundi : 0);
274
+
275
+ if (!isMobile || !withMobileLogic) {
276
+ var _getComputedStyle2, _dropdownListMaxHeigh;
277
+
278
+ const dropdownListMaxHeightInPx = (_getComputedStyle2 = getComputedStyle(dropdownList)) === null || _getComputedStyle2 === void 0 ? void 0 : _getComputedStyle2.maxHeight;
279
+ const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_dropdownListMaxHeigh = dropdownListMaxHeightInPx === null || dropdownListMaxHeightInPx === void 0 ? void 0 : dropdownListMaxHeightInPx.replace("px", "")) !== null && _dropdownListMaxHeigh !== void 0 ? _dropdownListMaxHeigh : 0, 10);
280
+ if (initListHeight === null && !isNaN(maxHeight)) setInitListHeight(maxHeight);
281
+ if (selectorWrapperHeight > maxHeight && !isNaN(maxHeight)) selectorWrapperHeight = maxHeight - 2 * margin;
282
+ const toTop = top - margin;
283
+ const toBottom = windowHeight - top - height - margin * 2;
284
+ const listPos = toTop < toBottom || toBottom >= selectorWrapperHeight ? "bottom" : "top";
285
+ if (selectorWrapperHeight > (listPos === "top" ? toTop : toBottom)) selectorWrapperHeight = (listPos === "top" ? toTop : toBottom) - 3 * margin;
286
+ listContainer.style.minWidth = "".concat(width, "px");
287
+ listContainer.style.left = "".concat(left, "px");
288
+ listContainer.style.top = "".concat(listPos === "bottom" ? top + height : top - selectorWrapperHeight - 2 * margin, "px");
289
+ } else {
290
+ dropdownList.style.maxHeight = "".concat(maxSelectorWrapperHeight, "px");
246
291
  }
247
292
  };
293
+
248
294
  const renderListContainer = () => {
249
295
  const lc = getListContainer();
250
- if (!lc) return null;
296
+ if (!lc) return null; // eslint-disable-next-line no-use-before-define
251
297
 
252
- // eslint-disable-next-line no-use-before-define
253
298
  return /*#__PURE__*/(0, _reactDom.createPortal)(getListMarkUp(), lc);
254
- };
255
- // --- LIST CONTAINER FUNCTIONS END --- //
256
-
299
+ }; // --- LIST CONTAINER FUNCTIONS END --- //
257
300
  // --- CREATABLE LOGIC BEGIN --- //
301
+
302
+
258
303
  const onOptionCreateClick = () => {
259
304
  var _onOptionCreate;
305
+
260
306
  const newOption = {
261
307
  label: searchValue,
262
308
  style: {
@@ -264,11 +310,11 @@ const TagsDropdown = _ref => {
264
310
  },
265
311
  isEditable: true,
266
312
  ref: /*#__PURE__*/(0, _react.createRef)()
267
- };
313
+ }; // eslint-disable-next-line no-promise-executor-return
268
314
 
269
- // eslint-disable-next-line no-promise-executor-return
270
315
  ((_onOptionCreate = onOptionCreate === null || onOptionCreate === void 0 ? void 0 : onOptionCreate(newOption)) !== null && _onOptionCreate !== void 0 ? _onOptionCreate : new Promise(r => r())).then(result => {
271
316
  var _result$id;
317
+
272
318
  const tempId = Math.random().toString(16).slice(2);
273
319
  newOption.value = (_result$id = result === null || result === void 0 ? void 0 : result.id) !== null && _result$id !== void 0 ? _result$id : tempId;
274
320
  setOptions(state => [...state, newOption]);
@@ -276,13 +322,16 @@ const TagsDropdown = _ref => {
276
322
  onChangeHandler(newOption);
277
323
  });
278
324
  };
325
+
279
326
  const onOptionEditClick = (e, item) => {
280
- e === null || e === void 0 || e.preventDefault();
281
- e === null || e === void 0 || e.stopPropagation();
327
+ e === null || e === void 0 ? void 0 : e.preventDefault();
328
+ e === null || e === void 0 ? void 0 : e.stopPropagation();
282
329
  setEditingOption((editingOption === null || editingOption === void 0 ? void 0 : editingOption.value) === (item === null || item === void 0 ? void 0 : item.value) ? null : item);
283
330
  };
331
+
284
332
  const onOptionDeleteClick = () => {
285
333
  var _onOptionDelete;
334
+
286
335
  // eslint-disable-next-line no-promise-executor-return
287
336
  ((_onOptionDelete = onOptionDelete === null || onOptionDelete === void 0 ? void 0 : onOptionDelete(editingOption)) !== null && _onOptionDelete !== void 0 ? _onOptionDelete : new Promise(r => r())).then(() => {
288
337
  deleteChosen(editingOption === null || editingOption === void 0 ? void 0 : editingOption.value);
@@ -295,25 +344,29 @@ const TagsDropdown = _ref => {
295
344
  setEditingOption(null);
296
345
  });
297
346
  };
347
+
298
348
  const saveEditingOption = () => {
299
349
  if (!(editingOption !== null && editingOption !== void 0 && editingOption.isChanged) || isEditingOptionError) {
300
350
  setEditingOption(null);
301
351
  return false;
302
352
  }
303
- onOptionEdit === null || onOptionEdit === void 0 || onOptionEdit(editingOption);
353
+
354
+ onOptionEdit === null || onOptionEdit === void 0 ? void 0 : onOptionEdit(editingOption);
304
355
  setOptions(options => options.map(option => {
305
356
  if (editingOption && option.value === (editingOption === null || editingOption === void 0 ? void 0 : editingOption.value)) {
306
- const tmp = {
307
- ...editingOption
357
+ const tmp = { ...editingOption
308
358
  };
309
359
  setEditingOption(null);
310
360
  return tmp;
311
361
  }
362
+
312
363
  return option;
313
364
  }));
314
365
  };
366
+
315
367
  const setEditOptionModalStyles = () => {
316
368
  var _editingOption$ref, _el$getBoundingClient, _dropdownListWrapperR, _positionClasses, _positionClasses2;
369
+
317
370
  if (!editingOption || !(editOptionModalRef !== null && editOptionModalRef !== void 0 && editOptionModalRef.current)) return null;
318
371
  const modalSize = 200;
319
372
  const {
@@ -328,14 +381,14 @@ const TagsDropdown = _ref => {
328
381
  };
329
382
  const windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
330
383
  const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
331
- const el = editingOption === null || editingOption === void 0 || (_editingOption$ref = editingOption.ref) === null || _editingOption$ref === void 0 ? void 0 : _editingOption$ref.current;
384
+ const el = editingOption === null || editingOption === void 0 ? void 0 : (_editingOption$ref = editingOption.ref) === null || _editingOption$ref === void 0 ? void 0 : _editingOption$ref.current;
332
385
  const {
333
386
  x,
334
387
  y,
335
388
  width,
336
389
  height
337
390
  } = (_el$getBoundingClient = el === null || el === void 0 ? void 0 : el.getBoundingClientRect()) !== null && _el$getBoundingClient !== void 0 ? _el$getBoundingClient : {};
338
- const containerPosition = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 || (_dropdownListWrapperR = dropdownListWrapperRef.current) === null || _dropdownListWrapperR === void 0 ? void 0 : _dropdownListWrapperR.getBoundingClientRect();
391
+ const containerPosition = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperR = dropdownListWrapperRef.current) === null || _dropdownListWrapperR === void 0 ? void 0 : _dropdownListWrapperR.getBoundingClientRect();
339
392
  const distanceToRight = windowWidth - (containerPosition === null || containerPosition === void 0 ? void 0 : containerPosition.x) - (containerPosition === null || containerPosition === void 0 ? void 0 : containerPosition.width);
340
393
  const distanceToBottom = windowHeight - y - scrollY - height;
341
394
  Object.values(positionClasses).map(className => editOptionModalRef.current.classList.remove(className));
@@ -347,6 +400,7 @@ const TagsDropdown = _ref => {
347
400
  editOptionModalRef.current.style.top = "".concat(y + scrollY + height, "px");
348
401
  editOptionModalRef.current.style.transform = "translate(".concat(xTranslate, ", ").concat(yTranslate, ")");
349
402
  };
403
+
350
404
  const renderEditOptionModal = () => {
351
405
  return /*#__PURE__*/_react.default.createElement("div", {
352
406
  key: "editOptionModal".concat(editingOption === null || editingOption === void 0 ? void 0 : editingOption.value),
@@ -356,8 +410,7 @@ const TagsDropdown = _ref => {
356
410
  className: (0, _classnames.default)("".concat(RC, "__edit-option-modal-section"))
357
411
  }, /*#__PURE__*/_react.default.createElement(_Input.default, {
358
412
  value: editingOption.label,
359
- onChange: v => setEditingOption(state => ({
360
- ...state,
413
+ onChange: v => setEditingOption(state => ({ ...state,
361
414
  label: v
362
415
  })),
363
416
  error: isEditingOptionError,
@@ -379,113 +432,132 @@ const TagsDropdown = _ref => {
379
432
  className: (0, _classnames.default)("".concat(RC, "__edit-option-modal-section-colors"))
380
433
  }, COLORS.map(color => {
381
434
  var _editingOption$style;
435
+
382
436
  return /*#__PURE__*/_react.default.createElement("div", {
383
437
  key: color,
384
438
  className: "color-block",
385
439
  style: {
386
440
  backgroundColor: color
387
441
  },
388
- onClick: () => setEditingOption(state => ({
389
- ...state,
390
- style: {
391
- ...state.style,
442
+ onClick: () => setEditingOption(state => ({ ...state,
443
+ style: { ...state.style,
392
444
  backgroundColor: color
393
445
  }
394
446
  }))
395
- }, (editingOption === null || editingOption === void 0 || (_editingOption$style = editingOption.style) === null || _editingOption$style === void 0 ? void 0 : _editingOption$style.backgroundColor) === color ? /*#__PURE__*/_react.default.createElement(_reactFeather.Check, null) : null);
447
+ }, (editingOption === null || editingOption === void 0 ? void 0 : (_editingOption$style = editingOption.style) === null || _editingOption$style === void 0 ? void 0 : _editingOption$style.backgroundColor) === color ? /*#__PURE__*/_react.default.createElement(_reactFeather.Check, null) : null);
396
448
  }))));
397
- };
398
- // --- CREATABLE LOGIC END --- //
399
-
449
+ }; // --- CREATABLE LOGIC END --- //
400
450
  // --- GENERAL FUNCTIONS BEGIN --- //
451
+
452
+
401
453
  const handleClickOutside = e => {
402
454
  var _getListContainer, _editOptionModalRef$c;
455
+
403
456
  const {
404
457
  target
405
458
  } = e;
406
- if (isOpen && !((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(target)) && !editOptionModalRef.current
407
- // &&
459
+
460
+ if (isOpen && !((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(target)) && !editOptionModalRef.current // &&
408
461
  // (
409
462
  // customTriggerRef?.current ? customTriggerRef?.current?.contains(target) : true
410
463
  // )
411
464
  ) {
412
465
  setIsOpen(false);
413
- onDropdownListClose === null || onDropdownListClose === void 0 || onDropdownListClose(e);
466
+ onDropdownListClose === null || onDropdownListClose === void 0 ? void 0 : onDropdownListClose(e);
414
467
  } else if (editOptionModalRef.current && !((_editOptionModalRef$c = editOptionModalRef.current) !== null && _editOptionModalRef$c !== void 0 && _editOptionModalRef$c.contains(target))) {
415
- var _document, _document$getElementB2, _document$getElementB3;
416
- if (!((_document = document) !== null && _document !== void 0 && (_document$getElementB2 = _document.getElementById) !== null && _document$getElementB2 !== void 0 && (_document$getElementB2 = _document$getElementB2.call(_document, "editTrigger".concat(editingOption === null || editingOption === void 0 ? void 0 : editingOption.value))) !== null && _document$getElementB2 !== void 0 && (_document$getElementB3 = _document$getElementB2.contains) !== null && _document$getElementB3 !== void 0 && _document$getElementB3.call(_document$getElementB2, target))) saveEditingOption();
468
+ var _document, _document$getElementB2, _document$getElementB3, _document$getElementB4;
469
+
470
+ if (!((_document = document) !== null && _document !== void 0 && (_document$getElementB2 = _document.getElementById) !== null && _document$getElementB2 !== void 0 && (_document$getElementB3 = _document$getElementB2.call(_document, "editTrigger".concat(editingOption === null || editingOption === void 0 ? void 0 : editingOption.value))) !== null && _document$getElementB3 !== void 0 && (_document$getElementB4 = _document$getElementB3.contains) !== null && _document$getElementB4 !== void 0 && _document$getElementB4.call(_document$getElementB3, target))) saveEditingOption();
417
471
  }
418
472
  };
473
+
419
474
  const closeList = e => {
420
475
  var _inputRef$current;
476
+
421
477
  handleClickOutside(e);
422
- if (!e.target.isEqualNode(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current)) inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.blur();
478
+ if (!e.target.isEqualNode(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current)) inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.blur();
423
479
  };
480
+
424
481
  const isTargetInParent = target => {
425
482
  var _target$className, _target$className$ind, _target$className2, _target$className2$in;
483
+
426
484
  if ((target === null || target === void 0 ? void 0 : target.tagName) === "svg" && (target === null || target === void 0 ? void 0 : target.parentNodclassName) === "tag__button" || (target === null || target === void 0 ? void 0 : target.tagName) === "line") return false;
427
- if ((target === null || target === void 0 ? void 0 : target.tagName) === "svg" && (target === null || target === void 0 ? void 0 : target.parentNodclassName) !== "tag__button" || (target === null || target === void 0 || (_target$className = target.className) === null || _target$className === void 0 || (_target$className$ind = _target$className.indexOf) === null || _target$className$ind === void 0 ? void 0 : _target$className$ind.call(_target$className, "tag__label")) !== -1 || (target === null || target === void 0 || (_target$className2 = target.className) === null || _target$className2 === void 0 || (_target$className2$in = _target$className2.indexOf) === null || _target$className2$in === void 0 ? void 0 : _target$className2$in.call(_target$className2, "tag-list_wrapper")) !== -1 || (target === null || target === void 0 ? void 0 : target.className.indexOf("".concat(RC, "__trigger"))) !== -1 || (target === null || target === void 0 ? void 0 : target.className) === "tags-dropdown__arrow") return true;
485
+ if ((target === null || target === void 0 ? void 0 : target.tagName) === "svg" && (target === null || target === void 0 ? void 0 : target.parentNodclassName) !== "tag__button" || (target === null || target === void 0 ? void 0 : (_target$className = target.className) === null || _target$className === void 0 ? void 0 : (_target$className$ind = _target$className.indexOf) === null || _target$className$ind === void 0 ? void 0 : _target$className$ind.call(_target$className, "tag__label")) !== -1 || (target === null || target === void 0 ? void 0 : (_target$className2 = target.className) === null || _target$className2 === void 0 ? void 0 : (_target$className2$in = _target$className2.indexOf) === null || _target$className2$in === void 0 ? void 0 : _target$className2$in.call(_target$className2, "tag-list_wrapper")) !== -1 || (target === null || target === void 0 ? void 0 : target.className.indexOf("".concat(RC, "__trigger"))) !== -1 || (target === null || target === void 0 ? void 0 : target.className) === "tags-dropdown__arrow") return true;
428
486
  return false;
429
487
  };
488
+
430
489
  const isItemMatchesSearch = item => {
431
490
  const title = item.title || item.label;
432
491
  return searchValue.length ? title === null || title === void 0 ? void 0 : title.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "") : true;
433
- };
434
- // --- GENERAL FUNCTIONS END --- //
492
+ }; // --- GENERAL FUNCTIONS END --- //
493
+
435
494
 
436
495
  const prepareOptions = options => {
437
496
  return options === null || options === void 0 ? void 0 : options.map(option => option !== null && option !== void 0 && option.groupName ? option === null || option === void 0 ? void 0 : option.list : option).flat();
438
497
  };
498
+
439
499
  const getFilteredOptions = options => options === null || options === void 0 ? void 0 : options.reduce((result, option) => {
440
500
  if (option.groupName) {
441
501
  var _option$list;
442
- const filteredGroupItems = option === null || option === void 0 || (_option$list = option.list) === null || _option$list === void 0 ? void 0 : _option$list.filter(item => isItemMatchesSearch(item));
502
+
503
+ const filteredGroupItems = option === null || option === void 0 ? void 0 : (_option$list = option.list) === null || _option$list === void 0 ? void 0 : _option$list.filter(item => isItemMatchesSearch(item));
504
+
443
505
  if (filteredGroupItems !== null && filteredGroupItems !== void 0 && filteredGroupItems.length) {
444
- result.push({
445
- ...option,
506
+ result.push({ ...option,
446
507
  list: filteredGroupItems
447
508
  });
448
509
  }
449
510
  } else if (isItemMatchesSearch(option)) {
450
511
  result.push(option);
451
512
  }
513
+
452
514
  return result;
453
515
  }, []);
516
+
454
517
  const getTotalOptions = (0, _react.useCallback)(() => {
455
518
  return options === null || options === void 0 ? void 0 : options.reduce((result, item) => {
456
519
  if (item !== null && item !== void 0 && item.list) {
457
520
  var _item$list2;
458
- result += (item === null || item === void 0 || (_item$list2 = item.list) === null || _item$list2 === void 0 ? void 0 : _item$list2.length) || 0;
521
+
522
+ result += (item === null || item === void 0 ? void 0 : (_item$list2 = item.list) === null || _item$list2 === void 0 ? void 0 : _item$list2.length) || 0;
459
523
  } else {
460
524
  ++result;
461
525
  }
526
+
462
527
  return result;
463
528
  }, 0);
464
529
  }, [options]);
530
+
465
531
  const onChangeHandler = item => {
466
532
  if (item !== null && item !== void 0 && item.isFreezed) return false;
533
+
467
534
  if ((item === null || item === void 0 ? void 0 : item.closeOnOptionSelect) !== undefined) {
468
535
  if (item.closeOnOptionSelect) setIsOpen(false);
469
536
  } else if (isMobile ? closeOnSelectMobile : closeOnSelect) setIsOpen(false);
537
+
470
538
  setSearchValueInterceptor("");
539
+
471
540
  if (chosenOptions.some(el => el === item.value)) {
472
541
  deleteChosen(item.value);
473
542
  return null;
474
543
  }
544
+
475
545
  if (isUseLocalOptionsStore) {
476
- setLocalOptionsStore(options => ({
477
- ...options,
546
+ setLocalOptionsStore(options => ({ ...options,
478
547
  [item === null || item === void 0 ? void 0 : item.value]: item === null || item === void 0 ? void 0 : item.label
479
548
  }));
480
549
  }
550
+
481
551
  onChange([...chosenOptions, item.value], "chosenOptions");
482
552
  return null;
483
553
  };
554
+
484
555
  const onSearchHandler = name => {
485
556
  let inputValue = name;
486
557
  if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
487
558
  setSearchValueInterceptor(inputValue);
488
559
  };
560
+
489
561
  const onWrapperClick = e => {
490
562
  if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
491
563
  e.stopPropagation();
@@ -493,8 +565,10 @@ const TagsDropdown = _ref => {
493
565
  setIsOpen(false);
494
566
  }
495
567
  };
568
+
496
569
  const selectAllItems = () => {
497
570
  var _prepareOptions;
571
+
498
572
  const preparedOptions = (_prepareOptions = prepareOptions(options)) === null || _prepareOptions === void 0 ? void 0 : _prepareOptions.filter(_ref7 => {
499
573
  let {
500
574
  isFreezed,
@@ -502,6 +576,7 @@ const TagsDropdown = _ref => {
502
576
  } = _ref7;
503
577
  return !isFreezed && !(chosenOptions !== null && chosenOptions !== void 0 && chosenOptions.includes(value)) && value !== "open_modal";
504
578
  });
579
+
505
580
  if (isUseLocalOptionsStore) {
506
581
  setLocalOptionsStore(options => preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.reduce((result, _ref8) => {
507
582
  let {
@@ -512,6 +587,7 @@ const TagsDropdown = _ref => {
512
587
  return result;
513
588
  }, options));
514
589
  }
590
+
515
591
  onChange([...chosenOptions, ...((preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.map(_ref9 => {
516
592
  let {
517
593
  value
@@ -520,37 +596,42 @@ const TagsDropdown = _ref => {
520
596
  })) || [])], "chosenOptions");
521
597
  if (isMobile ? closeOnSelectAllMobile : closeOnSelectAll) setIsOpen(false);
522
598
  };
599
+
523
600
  const unselectAllItems = () => {
524
601
  if (isUseLocalOptionsStore) setLocalOptionsStore({});
525
602
  onChange(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.filter(item => {
526
- var _prepareOptions2;
527
- return (_prepareOptions2 = prepareOptions(options)) === null || _prepareOptions2 === void 0 || (_prepareOptions2 = _prepareOptions2.find(_ref10 => {
603
+ var _prepareOptions2, _prepareOptions2$find;
604
+
605
+ return (_prepareOptions2 = prepareOptions(options)) === null || _prepareOptions2 === void 0 ? void 0 : (_prepareOptions2$find = _prepareOptions2.find(_ref10 => {
528
606
  let {
529
607
  value
530
608
  } = _ref10;
531
609
  return value === item;
532
- })) === null || _prepareOptions2 === void 0 ? void 0 : _prepareOptions2.isFreezed;
610
+ })) === null || _prepareOptions2$find === void 0 ? void 0 : _prepareOptions2$find.isFreezed;
533
611
  }), "chosenOptions");
534
612
  if (isMobile ? closeOnRemoveAllMobile : closeOnRemoveAll) setIsOpen(false);
535
613
  };
614
+
536
615
  const doScrollCallback = (0, _react.useCallback)(e => {
537
616
  if (doLiveSearchRequest && typeof doLiveSearchRequest === "function") {
538
617
  if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight) {
539
618
  doLiveSearchRequest(searchValueRef.current, true);
540
619
  }
541
620
  }
542
- }, [options]);
621
+ }, [options]); // --- RENDER FUNCTIONS BEGIN --- //
543
622
 
544
- // --- RENDER FUNCTIONS BEGIN --- //
545
623
  const getMarkupForElement = item => {
546
624
  var _title$toString, _item$customMobileIco;
625
+
547
626
  const {
548
627
  description
549
628
  } = item;
550
629
  const title = item.title || item.label;
630
+
551
631
  const hightlightSearchValue = title => {
552
632
  var _title$toLowerCase;
553
- const index = title === null || title === void 0 || (_title$toLowerCase = title.toLowerCase()) === null || _title$toLowerCase === void 0 ? void 0 : _title$toLowerCase.indexOf(searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase());
633
+
634
+ const index = title === null || title === void 0 ? void 0 : (_title$toLowerCase = title.toLowerCase()) === null || _title$toLowerCase === void 0 ? void 0 : _title$toLowerCase.indexOf(searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase());
554
635
  if (index === -1) return title;
555
636
  return /*#__PURE__*/_react.default.createElement("pre", {
556
637
  className: "inherit-styles"
@@ -558,9 +639,10 @@ const TagsDropdown = _ref => {
558
639
  className: "search-match bg--yellow"
559
640
  }, title.substring(index, index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length))), /*#__PURE__*/_react.default.createElement("span", null, title.substring(index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length))));
560
641
  };
642
+
561
643
  return /*#__PURE__*/_react.default.createElement("button", {
562
644
  ref: item === null || item === void 0 ? void 0 : item.ref,
563
- key: title === null || title === void 0 || (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.replace(/ /g, "_"),
645
+ key: title === null || title === void 0 ? void 0 : (_title$toString = title.toString()) === null || _title$toString === void 0 ? void 0 : _title$toString.replace(/ /g, "_"),
564
646
  onClick: e => {
565
647
  e.preventDefault();
566
648
  e.stopPropagation();
@@ -608,8 +690,10 @@ const TagsDropdown = _ref => {
608
690
  }
609
691
  }) : "");
610
692
  };
693
+
611
694
  const getListMarkUp = () => {
612
- var _filteredOptions$filt, _filteredOptions$filt2, _document$getElementB4;
695
+ var _filteredOptions$filt, _filteredOptions$filt2, _document$getElementB5;
696
+
613
697
  const filteredOptions = getFilteredOptions(options);
614
698
  return /*#__PURE__*/_react.default.createElement("div", {
615
699
  className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
@@ -668,9 +752,10 @@ const TagsDropdown = _ref => {
668
752
  ref: dropdownListRef,
669
753
  className: "".concat(RC, "__list ").concat(headerContent || isMobile ? "".concat(RC, "__list--with-header") : "", " ").concat(footerContent ? "".concat(RC, "__list--with-footer") : "")
670
754
  }, filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.map(option => {
671
- var _option$groupName, _option$list2;
755
+ var _option$groupName, _option$groupName$toS, _option$list2;
756
+
672
757
  return option.groupName ? /*#__PURE__*/_react.default.createElement("div", {
673
- key: (_option$groupName = option.groupName) === null || _option$groupName === void 0 || (_option$groupName = _option$groupName.toString()) === null || _option$groupName === void 0 ? void 0 : _option$groupName.replace(/ /g, "_").concat(Date.now()),
758
+ key: (_option$groupName = option.groupName) === null || _option$groupName === void 0 ? void 0 : (_option$groupName$toS = _option$groupName.toString()) === null || _option$groupName$toS === void 0 ? void 0 : _option$groupName$toS.replace(/ /g, "_").concat(Date.now()),
674
759
  className: (0, _classnames.default)("".concat(RC, "-group"), option.className)
675
760
  }, /*#__PURE__*/_react.default.createElement("span", {
676
761
  className: "".concat(RC, "-group__name")
@@ -694,7 +779,7 @@ const TagsDropdown = _ref => {
694
779
  })
695
780
  }, footerContent, isMobile && /*#__PURE__*/_react.default.createElement("button", {
696
781
  onClick: () => setIsOpen(false)
697
- }, "Apply", chosenOptions !== null && chosenOptions !== void 0 && chosenOptions.length ? "(".concat(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.length, ")") : "")) : null, editingOption && /*#__PURE__*/(0, _reactDom.createPortal)(renderEditOptionModal(), (_document$getElementB4 = document.getElementById("app")) !== null && _document$getElementB4 !== void 0 ? _document$getElementB4 : document.body), withCreateLogic && onOptionCreate && searchValue && singleLevelOptions.every(_ref14 => {
782
+ }, "Apply", chosenOptions !== null && chosenOptions !== void 0 && chosenOptions.length ? "(".concat(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.length, ")") : "")) : null, editingOption && /*#__PURE__*/(0, _reactDom.createPortal)(renderEditOptionModal(), (_document$getElementB5 = document.getElementById("app")) !== null && _document$getElementB5 !== void 0 ? _document$getElementB5 : document.body), withCreateLogic && onOptionCreate && searchValue && singleLevelOptions.every(_ref14 => {
698
783
  let {
699
784
  label
700
785
  } = _ref14;
@@ -710,6 +795,7 @@ const TagsDropdown = _ref => {
710
795
  isNoDismiss: true
711
796
  }))));
712
797
  };
798
+
713
799
  const renderSearchInput = () => {
714
800
  return /*#__PURE__*/_react.default.createElement(_Input.default, {
715
801
  ref: inputRef,
@@ -719,8 +805,7 @@ const TagsDropdown = _ref => {
719
805
  value: searchValue,
720
806
  onChange: onSearchHandler,
721
807
  placeholder: placeholder || "Select from list",
722
- attributesOfNativeInput: {
723
- ...attributesOfNativeInput,
808
+ attributesOfNativeInput: { ...attributesOfNativeInput,
724
809
  onKeyDown: e => {
725
810
  if (e.keyCode === 13 && withCreateLogic && onOptionCreate && singleLevelOptions.every(_ref15 => {
726
811
  let {
@@ -730,17 +815,19 @@ const TagsDropdown = _ref => {
730
815
  })) {
731
816
  onOptionCreateClick();
732
817
  }
818
+
733
819
  onKeyPress(e, searchValue);
734
- },
735
- onFocus: e => {
736
- var _e$target;
737
- if (isMobile) e === null || e === void 0 || (_e$target = e.target) === null || _e$target === void 0 || _e$target.blur();
738
- }
820
+ } // onFocus: (e) => {
821
+ // if (isMobile) e?.target?.blur();
822
+ // },
823
+
739
824
  }
740
825
  });
741
826
  };
827
+
742
828
  const renderDropdownTrigger = (0, _react.useCallback)(() => {
743
829
  var _renderCustomTrigger;
830
+
744
831
  const renderDefaultDropdownTrigger = () => {
745
832
  return /*#__PURE__*/_react.default.createElement("div", {
746
833
  className: (0, _classnames.default)("".concat(RC, "__trigger"), {
@@ -751,6 +838,7 @@ const TagsDropdown = _ref => {
751
838
  let {
752
839
  target
753
840
  } = _ref16;
841
+
754
842
  if ((target === null || target === void 0 ? void 0 : target.tagName) === "INPUT") {
755
843
  setIsOpen(true);
756
844
  } else if (isTargetInParent(target)) {
@@ -795,6 +883,7 @@ const TagsDropdown = _ref => {
795
883
  className: "color--text"
796
884
  })));
797
885
  };
886
+
798
887
  return (_renderCustomTrigger = renderCustomTrigger === null || renderCustomTrigger === void 0 ? void 0 : renderCustomTrigger({
799
888
  chosenOptions,
800
889
  singleLevelOptions,
@@ -804,24 +893,26 @@ const TagsDropdown = _ref => {
804
893
  isOpen,
805
894
  setIsOpen
806
895
  })) !== null && _renderCustomTrigger !== void 0 ? _renderCustomTrigger : renderDefaultDropdownTrigger();
807
- }, [chosenOptions, singleLevelOptions, inputRef, isOpen]);
808
- // --- RENDER FUNCTIONS END --- //
896
+ }, [chosenOptions, singleLevelOptions, inputRef, isOpen]); // --- RENDER FUNCTIONS END --- //
809
897
 
810
898
  (0, _react.useLayoutEffect)(() => {
811
899
  initListContainer();
812
900
  if (isDefaultOpened) setIsOpen(true);
813
901
  return () => {
814
902
  var _getListContainer2, _getListContainerWrap;
815
- (_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 || _getListContainer2.remove();
816
- (_getListContainerWrap = getListContainerWrapper()) === null || _getListContainerWrap === void 0 || _getListContainerWrap.remove();
903
+
904
+ (_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 ? void 0 : _getListContainer2.remove();
905
+ (_getListContainerWrap = getListContainerWrapper()) === null || _getListContainerWrap === void 0 ? void 0 : _getListContainerWrap.remove();
817
906
  };
818
907
  }, []);
819
908
  (0, _react.useLayoutEffect)(() => {
820
909
  var _getListContainer3;
910
+
821
911
  const onResize = () => {
822
912
  setListContainerStyles();
823
913
  setEditOptionModalStyles();
824
914
  };
915
+
825
916
  if (!isMobile) {
826
917
  window.addEventListener("resize", onResize);
827
918
  window.addEventListener("mousewheel", closeList);
@@ -835,27 +926,28 @@ const TagsDropdown = _ref => {
835
926
  window.removeEventListener("touchmove", closeList);
836
927
  window.removeEventListener("mouseup", handleClickOutside);
837
928
  }
838
- (_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 || _getListContainer3.addEventListener("click", closeList);
929
+
930
+ (_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 ? void 0 : _getListContainer3.addEventListener("click", closeList);
839
931
  return () => {
840
932
  var _getListContainer4;
933
+
841
934
  window.removeEventListener("resize", onResize);
842
935
  window.removeEventListener("mousewheel", closeList);
843
936
  window.removeEventListener("mouseup", handleClickOutside);
844
937
  window.removeEventListener("scroll", closeList);
845
938
  window.removeEventListener("touchmove", closeList);
846
- (_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 || _getListContainer4.removeEventListener("click", closeList);
939
+ (_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 ? void 0 : _getListContainer4.removeEventListener("click", closeList);
847
940
  };
848
941
  }, [getListContainer, isMobile]);
849
942
  (0, _react.useLayoutEffect)(() => {
850
943
  setListContainerStyles();
851
944
  setEditOptionModalStyles();
852
- }, [isOpen, chosenOptions, isMobile, dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 || (_dropdownListWrapperR2 = dropdownListWrapperRef.current) === null || _dropdownListWrapperR2 === void 0 || (_dropdownListWrapperR2 = _dropdownListWrapperR2.getBoundingClientRect()) === null || _dropdownListWrapperR2 === void 0 ? void 0 : _dropdownListWrapperR2.height, recalculateListContainerStylesTrigger]);
945
+ }, [isOpen, optionsProp, chosenOptions, 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, recalculateListContainerStylesTrigger]);
853
946
  (0, _react.useEffect)(() => {
854
947
  if (isUseLocalOptionsStore && chosenOptions.length !== Object.keys(localOptionsStore).length) {
855
948
  options.map(option => {
856
949
  if (!(localOptionsStore !== null && localOptionsStore !== void 0 && localOptionsStore[option === null || option === void 0 ? void 0 : option.value])) {
857
- setLocalOptionsStore(options => ({
858
- ...options,
950
+ setLocalOptionsStore(options => ({ ...options,
859
951
  [option === null || option === void 0 ? void 0 : option.value]: option === null || option === void 0 ? void 0 : option.label
860
952
  }));
861
953
  }
@@ -864,28 +956,37 @@ const TagsDropdown = _ref => {
864
956
  }, [chosenOptions, isUseLocalOptionsStore]);
865
957
  (0, _react.useEffect)(() => {
866
958
  var _selectAllButtonRef$c, _unselectAllButtonRef;
959
+
867
960
  const fn = isOpen ? "addEventListener" : "removeEventListener";
868
- selectAllButtonRef === null || selectAllButtonRef === void 0 || (_selectAllButtonRef$c = selectAllButtonRef.current) === null || _selectAllButtonRef$c === void 0 || _selectAllButtonRef$c[fn]("click", selectAllItems, true);
869
- unselectAllButtonRef === null || unselectAllButtonRef === void 0 || (_unselectAllButtonRef = unselectAllButtonRef.current) === null || _unselectAllButtonRef === void 0 || _unselectAllButtonRef[fn]("click", unselectAllItems, true);
961
+ selectAllButtonRef === null || selectAllButtonRef === void 0 ? void 0 : (_selectAllButtonRef$c = selectAllButtonRef.current) === null || _selectAllButtonRef$c === void 0 ? void 0 : _selectAllButtonRef$c[fn]("click", selectAllItems, true);
962
+ unselectAllButtonRef === null || unselectAllButtonRef === void 0 ? void 0 : (_unselectAllButtonRef = unselectAllButtonRef.current) === null || _unselectAllButtonRef === void 0 ? void 0 : _unselectAllButtonRef[fn]("click", unselectAllItems, true);
963
+
870
964
  if (isOpen) {
871
965
  var _getListContainer5;
966
+
872
967
  if (customTriggerRef !== null && customTriggerRef !== void 0 && customTriggerRef.current) {
873
968
  customTriggerRef.current.style.pointerEvents = "none";
874
969
  }
875
- (_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 || _getListContainer5.classList.add("tags-dropdown__container--opened");
970
+
971
+ (_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 ? void 0 : _getListContainer5.classList.add("tags-dropdown__container--opened");
972
+
876
973
  if (!isMobile) {
877
974
  var _inputRef$current2, _inputRef$current2$fo;
878
- inputRef === null || inputRef === void 0 || (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 || (_inputRef$current2$fo = _inputRef$current2.focus) === null || _inputRef$current2$fo === void 0 || _inputRef$current2$fo.call(_inputRef$current2);
975
+
976
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : (_inputRef$current2$fo = _inputRef$current2.focus) === null || _inputRef$current2$fo === void 0 ? void 0 : _inputRef$current2$fo.call(_inputRef$current2);
879
977
  } else {
880
978
  var _inputRef$current3, _inputRef$current3$bl;
881
- inputRef === null || inputRef === void 0 || (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 || (_inputRef$current3$bl = _inputRef$current3.blur) === null || _inputRef$current3$bl === void 0 || _inputRef$current3$bl.call(_inputRef$current3);
979
+
980
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : (_inputRef$current3$bl = _inputRef$current3.blur) === null || _inputRef$current3$bl === void 0 ? void 0 : _inputRef$current3$bl.call(_inputRef$current3);
882
981
  }
883
982
  } else {
884
983
  var _getListContainer6;
984
+
885
985
  if (customTriggerRef !== null && customTriggerRef !== void 0 && customTriggerRef.current) {
886
986
  customTriggerRef.current.style.pointerEvents = "auto";
887
987
  }
888
- (_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 || _getListContainer6.classList.remove("tags-dropdown__container--opened");
988
+
989
+ (_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 ? void 0 : _getListContainer6.classList.remove("tags-dropdown__container--opened");
889
990
  if (withSearchInputInList) setSearchValueInterceptor("");
890
991
  }
891
992
  }, [isOpen]);
@@ -893,46 +994,54 @@ const TagsDropdown = _ref => {
893
994
  const setScrollTopValue = e => {
894
995
  setScrollTop(parseInt(e.target.scrollTop, 10));
895
996
  };
997
+
896
998
  if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
897
999
  var _dropdownListRef$curr, _dropdownListRef$curr2, _dropdownListRef$curr3;
898
- dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr = dropdownListRef.current) === null || _dropdownListRef$curr === void 0 || _dropdownListRef$curr.addEventListener("scroll", setScrollTopValue);
899
- setIsScrollableList((dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr2 = dropdownListRef.current) === null || _dropdownListRef$curr2 === void 0 ? void 0 : _dropdownListRef$curr2.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr3 = dropdownListRef.current) === null || _dropdownListRef$curr3 === void 0 ? void 0 : _dropdownListRef$curr3.clientHeight));
1000
+
1001
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr = dropdownListRef.current) === null || _dropdownListRef$curr === void 0 ? void 0 : _dropdownListRef$curr.addEventListener("scroll", setScrollTopValue);
1002
+ setIsScrollableList((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr2 = dropdownListRef.current) === null || _dropdownListRef$curr2 === void 0 ? void 0 : _dropdownListRef$curr2.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr3 = dropdownListRef.current) === null || _dropdownListRef$curr3 === void 0 ? void 0 : _dropdownListRef$curr3.clientHeight));
1003
+
900
1004
  if (isScrollableList === null) {
901
1005
  var _dropdownListRef$curr4, _dropdownListRef$curr5;
902
- setIsFixedMaxHeight((dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr4 = dropdownListRef.current) === null || _dropdownListRef$curr4 === void 0 ? void 0 : _dropdownListRef$curr4.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr5 = dropdownListRef.current) === null || _dropdownListRef$curr5 === void 0 ? void 0 : _dropdownListRef$curr5.clientHeight));
1006
+
1007
+ setIsFixedMaxHeight((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr4 = dropdownListRef.current) === null || _dropdownListRef$curr4 === void 0 ? void 0 : _dropdownListRef$curr4.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr5 = dropdownListRef.current) === null || _dropdownListRef$curr5 === void 0 ? void 0 : _dropdownListRef$curr5.clientHeight));
903
1008
  }
904
1009
  }
1010
+
905
1011
  if (isOpen && dropdownListRef && dropdownListRef.current) {
906
1012
  dropdownListRef.current.addEventListener("scroll", doScrollCallback);
907
1013
  }
1014
+
908
1015
  return () => {
909
1016
  var _dropdownListRef$curr6;
1017
+
910
1018
  removeEventListener("scroll", doScrollCallback);
911
- dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr6 = dropdownListRef.current) === null || _dropdownListRef$curr6 === void 0 || _dropdownListRef$curr6.removeEventListener("scroll", setScrollTopValue);
1019
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr6 = dropdownListRef.current) === null || _dropdownListRef$curr6 === void 0 ? void 0 : _dropdownListRef$curr6.removeEventListener("scroll", setScrollTopValue);
912
1020
  };
913
- }, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.scrollHeight, dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.clientHeight]);
1021
+ }, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 ? void 0 : _dropdownListRef$curr7.scrollHeight, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.clientHeight]);
914
1022
  (0, _react.useEffect)(() => {
915
1023
  if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
916
1024
  var _dropdownListRef$curr9, _dropdownListRef$curr10;
917
- 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));
1025
+
1026
+ 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));
918
1027
  }
919
1028
  }, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
920
1029
  (0, _react.useEffect)(() => {
921
1030
  if (isSearchable && useLiveSearch && (debouncedSearchTerm || isValueDeleted || isOpen)) {
922
- doLiveSearchRequest === null || doLiveSearchRequest === void 0 || doLiveSearchRequest(debouncedSearchTerm);
1031
+ doLiveSearchRequest === null || doLiveSearchRequest === void 0 ? void 0 : doLiveSearchRequest(debouncedSearchTerm);
923
1032
  }
924
1033
  }, [isOpen, debouncedSearchTerm, isValueDeleted]);
925
1034
  (0, _react.useEffect)(() => {
926
- setOptions(optionsProp.map(option => ({
927
- ...option,
1035
+ setOptions(optionsProp.map(option => ({ ...option,
928
1036
  ref: /*#__PURE__*/(0, _react.createRef)()
929
1037
  })));
930
1038
  }, [optionsProp]);
931
1039
  (0, _react.useEffect)(() => {
932
1040
  if (editingOption) {
933
1041
  var _editingOptionInputRe, _editingOptionInputRe2;
1042
+
934
1043
  setEditOptionModalStyles();
935
- editingOptionInputRef === null || editingOptionInputRef === void 0 || (_editingOptionInputRe = editingOptionInputRef.current) === null || _editingOptionInputRe === void 0 || (_editingOptionInputRe2 = _editingOptionInputRe.focus) === null || _editingOptionInputRe2 === void 0 || _editingOptionInputRe2.call(_editingOptionInputRe);
1044
+ editingOptionInputRef === null || editingOptionInputRef === void 0 ? void 0 : (_editingOptionInputRe = editingOptionInputRef.current) === null || _editingOptionInputRe === void 0 ? void 0 : (_editingOptionInputRe2 = _editingOptionInputRe.focus) === null || _editingOptionInputRe2 === void 0 ? void 0 : _editingOptionInputRe2.call(_editingOptionInputRe);
936
1045
  }
937
1046
  }, [editingOption === null || editingOption === void 0 ? void 0 : editingOption.value]);
938
1047
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -953,4 +1062,6 @@ const TagsDropdown = _ref => {
953
1062
  onClick: onActionCancelClick
954
1063
  }, /*#__PURE__*/_react.default.createElement(_reactFeather.X, null))), isOpen && renderListContainer());
955
1064
  };
956
- var _default = exports.default = TagsDropdown;
1065
+
1066
+ var _default = TagsDropdown;
1067
+ exports.default = _default;