intelicoreact 1.5.33 → 1.5.35

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 (520) hide show
  1. package/dist/Atomic/FormElements/ActionAlert/ActionAlert.interface.js +4 -0
  2. package/dist/Atomic/FormElements/ActionAlert/ActionAlert.js +93 -44
  3. package/dist/Atomic/FormElements/ActionAlert/ActionAlert.scss +23 -13
  4. package/dist/Atomic/FormElements/ActionAlert/ActionAlert.stories.js +89 -0
  5. package/dist/Atomic/FormElements/ActionAlert/ActionAlert.test.js +130 -0
  6. package/dist/Atomic/FormElements/ActionAlert/index.js +17 -0
  7. package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.interface.js +4 -0
  8. package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.js +43 -38
  9. package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.scss +20 -10
  10. package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.stories.js +81 -0
  11. package/dist/Atomic/FormElements/AdvancedStatus/AdvancedStatus.test.js +104 -0
  12. package/dist/Atomic/FormElements/AdvancedStatus/index.js +17 -0
  13. package/dist/Atomic/FormElements/Calendar/Calendar.js +243 -164
  14. package/dist/Atomic/FormElements/Calendar/Calendar.props.js +4 -0
  15. package/dist/Atomic/FormElements/Calendar/Calendar.scss +1 -0
  16. package/dist/Atomic/FormElements/Calendar/Calendar.stories.js +108 -0
  17. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.interface.js +4 -0
  18. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.js +60 -51
  19. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.scss +25 -15
  20. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.stories.js +100 -0
  21. package/dist/Atomic/FormElements/CheckboxInput/CheckboxInput.test.js +143 -0
  22. package/dist/Atomic/FormElements/CheckboxInput/index.js +17 -0
  23. package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.interface.js +4 -0
  24. package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.js +46 -41
  25. package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.scss +5 -2
  26. package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.stories.js +94 -0
  27. package/dist/Atomic/FormElements/CheckboxesLine/CheckboxesLine.test.js +177 -0
  28. package/dist/Atomic/FormElements/CheckboxesLine/index.js +17 -0
  29. package/dist/Atomic/FormElements/Datepicker/Datepicker.js +410 -308
  30. package/dist/Atomic/FormElements/Datepicker/Datepicker.stories.js +51 -0
  31. package/dist/Atomic/FormElements/Datepicker/components/Calendar.js +169 -109
  32. package/dist/Atomic/FormElements/Dropdown/Dropdown.js +680 -571
  33. package/dist/Atomic/FormElements/Dropdown/Dropdown.scss +61 -59
  34. package/dist/Atomic/FormElements/Dropdown/Dropdown.stories.js +596 -0
  35. package/dist/Atomic/FormElements/Dropdown/components/DropdownLoader.js +28 -15
  36. package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.js +498 -397
  37. package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.scss +36 -32
  38. package/dist/Atomic/FormElements/DropdownLiveSearch/DropdownLiveSearch.stories.js +272 -0
  39. package/dist/Atomic/FormElements/FileLoader/FileLoader.js +103 -70
  40. package/dist/Atomic/FormElements/FileLoader/FileLoader.scss +0 -2
  41. package/dist/Atomic/FormElements/FileLoader/FileLoader.stories.js +182 -0
  42. package/dist/Atomic/FormElements/FileLoader/partial/LoadZone.js +138 -91
  43. package/dist/Atomic/FormElements/FileLoader/partial/LoadedContent.js +109 -55
  44. package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.js +254 -193
  45. package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.scss +19 -16
  46. package/dist/Atomic/FormElements/FileLoaderDescription/FileLoaderDescription.stories.js +327 -0
  47. package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.js +156 -143
  48. package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.scss +8 -4
  49. package/dist/Atomic/FormElements/FileLoaderLocal/FileLoaderLocal.stories.js +186 -0
  50. package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.js +222 -159
  51. package/dist/Atomic/FormElements/FileLoaderLocalGroup/FileLoaderLocalGroup.stories.js +84 -0
  52. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.js +158 -117
  53. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN.stories.js +107 -0
  54. package/dist/Atomic/FormElements/FormattedRawSSN/FormattedRawSSN_old.js +151 -98
  55. package/dist/Atomic/FormElements/Input/Input.js +340 -337
  56. package/dist/Atomic/FormElements/Input/Input.scss +1 -1
  57. package/dist/Atomic/FormElements/Input/Input.stories.js +251 -0
  58. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.js +156 -112
  59. package/dist/Atomic/FormElements/InputCalendar/InputCalendar.stories.js +115 -0
  60. package/dist/Atomic/FormElements/InputColor/InputColor.js +57 -58
  61. package/dist/Atomic/FormElements/InputColor/InputColor.stories.js +119 -0
  62. package/dist/Atomic/FormElements/InputCurrency/InputCurrency.interface.js +4 -0
  63. package/dist/Atomic/FormElements/InputCurrency/InputCurrency.js +189 -125
  64. package/dist/Atomic/FormElements/InputCurrency/InputCurrency.stories.js +178 -0
  65. package/dist/Atomic/FormElements/InputCurrency/InputCurrency.test.js +129 -0
  66. package/dist/Atomic/FormElements/InputCurrency/index.js +16 -0
  67. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.js +294 -233
  68. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.scss +1 -2
  69. package/dist/Atomic/FormElements/InputDateRange/InputDateRange.stories.js +123 -0
  70. package/dist/Atomic/FormElements/InputDateRange/components/DateInput.js +55 -56
  71. package/dist/Atomic/FormElements/InputDateRange/components/Datepicker.js +645 -545
  72. package/dist/Atomic/FormElements/InputDateRange/components/OpenedPart.js +220 -193
  73. package/dist/Atomic/FormElements/InputDateRange/components/SelectItem.js +33 -31
  74. package/dist/Atomic/FormElements/InputDateRange/dependencies.js +247 -172
  75. package/dist/Atomic/FormElements/InputLink/InputLink.js +118 -73
  76. package/dist/Atomic/FormElements/InputLink/InputLink.stories.js +140 -0
  77. package/dist/Atomic/FormElements/InputMask/InputCarretPosition.js +47 -38
  78. package/dist/Atomic/FormElements/InputMask/InputMask.js +947 -1061
  79. package/dist/Atomic/FormElements/InputMask/InputMask.stories.js +303 -0
  80. package/dist/Atomic/FormElements/InputMask/config.js +16 -15
  81. package/dist/Atomic/FormElements/InputMask/functions.js +77 -52
  82. package/dist/Atomic/FormElements/InputMask2/InputMask2.js +573 -600
  83. package/dist/Atomic/FormElements/InputMask2/InputMask2.stories.js +314 -0
  84. package/dist/Atomic/FormElements/InputMask2/config.js +16 -15
  85. package/dist/Atomic/FormElements/InputMask2/functions.js +77 -52
  86. package/dist/Atomic/FormElements/InputMask3/InputMask3.js +655 -691
  87. package/dist/Atomic/FormElements/InputMask3/InputMask3.stories.js +335 -0
  88. package/dist/Atomic/FormElements/InputMask3/config.js +16 -15
  89. package/dist/Atomic/FormElements/InputMask3/functions.js +77 -52
  90. package/dist/Atomic/FormElements/InputWithAction/InputWithAction.js +127 -88
  91. package/dist/Atomic/FormElements/InputWithAction/InputWithAction.scss +1 -1
  92. package/dist/Atomic/FormElements/InputWithAction/InputWithAction.stories.js +276 -0
  93. package/dist/Atomic/FormElements/InputsRow/InputsRow.js +182 -111
  94. package/dist/Atomic/FormElements/InputsRow/InputsRow.stories.js +56 -0
  95. package/dist/Atomic/FormElements/Label/Label.interface.js +4 -0
  96. package/dist/Atomic/FormElements/Label/Label.js +82 -55
  97. package/dist/Atomic/FormElements/Label/Label.scss +18 -8
  98. package/dist/Atomic/FormElements/Label/Label.stories.js +47 -0
  99. package/dist/Atomic/FormElements/Label/Label.test.js +167 -0
  100. package/dist/Atomic/FormElements/Label/index.js +17 -0
  101. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.js +437 -388
  102. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.scss +3 -3
  103. package/dist/Atomic/FormElements/MobileCalendar/MobileCalendar.stories.js +172 -0
  104. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.js +88 -50
  105. package/dist/Atomic/FormElements/MultiSelect/MultiSelect.stories.js +121 -0
  106. package/dist/Atomic/FormElements/NumericInput/NumericInput.js +314 -270
  107. package/dist/Atomic/FormElements/NumericInput/NumericInput.scss +1 -1
  108. package/dist/Atomic/FormElements/NumericInput/NumericInput.stories.js +184 -0
  109. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.js +93 -51
  110. package/dist/Atomic/FormElements/RadioGroup/RadioGroup.stories.js +79 -0
  111. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.js +69 -55
  112. package/dist/Atomic/FormElements/RadioGroupWithInput/RadioGroupWithInput.stories.js +151 -0
  113. package/dist/Atomic/FormElements/RadioInput/RadioInput.js +51 -45
  114. package/dist/Atomic/FormElements/RadioInput/RadioInput.scss +4 -4
  115. package/dist/Atomic/FormElements/RadioInput/RadioInput.stories.js +67 -0
  116. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.js +53 -40
  117. package/dist/Atomic/FormElements/RadioRowSwitcher/RadioRowSwitcher.stories.js +116 -0
  118. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.js +169 -120
  119. package/dist/Atomic/FormElements/RangeCalendar/RangeCalendar.stories.js +107 -0
  120. package/dist/Atomic/FormElements/RangeInputs/RangeInputs.js +195 -144
  121. package/dist/Atomic/FormElements/RangeInputs/RangeInputs.stories.js +92 -0
  122. package/dist/Atomic/FormElements/RangeList/RangeList.js +199 -141
  123. package/dist/Atomic/FormElements/RangeList/RangeList.scss +2 -2
  124. package/dist/Atomic/FormElements/RangeList/RangeList.stories.js +169 -0
  125. package/dist/Atomic/FormElements/RangeList/partial/AnyOuterClass.scss +1 -4
  126. package/dist/Atomic/FormElements/RangeList/partial/RangeListRow.js +57 -44
  127. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.js +463 -381
  128. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.scss +1 -1
  129. package/dist/Atomic/FormElements/RangeSlider/RangeSlider.stories.js +401 -0
  130. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.js +760 -770
  131. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.scss +9 -9
  132. package/dist/Atomic/FormElements/RangeSlider2/RangeSlider2.stories.js +314 -0
  133. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.js +36 -31
  134. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.scss +0 -2
  135. package/dist/Atomic/FormElements/SwitchableRow/SwitchableRow.stories.js +137 -0
  136. package/dist/Atomic/FormElements/SwitchableRow/partial/AnyOuterClass.scss +1 -1
  137. package/dist/Atomic/FormElements/Switcher/Switcher.js +52 -44
  138. package/dist/Atomic/FormElements/Switcher/Switcher.scss +3 -3
  139. package/dist/Atomic/FormElements/Switcher/Switcher.stories.js +91 -0
  140. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.js +43 -44
  141. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.scss +0 -2
  142. package/dist/Atomic/FormElements/SwitcherCheckbox/SwitcherCheckbox.stories.js +104 -0
  143. package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.js +37 -36
  144. package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.scss +0 -2
  145. package/dist/Atomic/FormElements/SwitcherHide/SwitcherHide.stories.js +96 -0
  146. package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.js +93 -57
  147. package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.scss +0 -2
  148. package/dist/Atomic/FormElements/SwitcherRadio/SwitcherRadio.stories.js +140 -0
  149. package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.js +86 -53
  150. package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.scss +0 -2
  151. package/dist/Atomic/FormElements/SwitcherRange/SwitcherRange.stories.js +112 -0
  152. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.js +46 -54
  153. package/dist/Atomic/FormElements/SwitcherRangeList/SwitcherRangeList.stories.js +145 -0
  154. package/dist/Atomic/FormElements/SwitcherRangeList/partial/AnyOuterClass.scss +1 -1
  155. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.js +172 -109
  156. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.scss +4 -6
  157. package/dist/Atomic/FormElements/SwitcherTagsDropdown/SwitcherTagsDropdown.stories.js +158 -0
  158. package/dist/Atomic/FormElements/SwitcherTagsDropdown/partial/States.js +209 -154
  159. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.js +59 -56
  160. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.scss +2 -2
  161. package/dist/Atomic/FormElements/SwitcherTextarea/SwitcherTextarea.stories.js +101 -0
  162. package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.js +140 -113
  163. package/dist/Atomic/FormElements/TagListToDropdown/TagListToDropdown.stories.js +131 -0
  164. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.js +1035 -962
  165. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.scss +155 -119
  166. package/dist/Atomic/FormElements/TagsDropdown/TagsDropdown.stories.js +357 -0
  167. package/dist/Atomic/FormElements/Text/Text.js +88 -97
  168. package/dist/Atomic/FormElements/Text/Text.stories.js +80 -0
  169. package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.js +44 -35
  170. package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.scss +8 -8
  171. package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.stories.js +106 -0
  172. package/dist/Atomic/FormElements/TextSwitcher/TextSwitcher.test.js +93 -0
  173. package/dist/Atomic/FormElements/Textarea/Textarea.js +102 -64
  174. package/dist/Atomic/FormElements/Textarea/Textarea.scss +4 -8
  175. package/dist/Atomic/FormElements/Textarea/Textarea.stories.js +103 -0
  176. package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.js +172 -136
  177. package/dist/Atomic/FormElements/TieredCheckboxes/TieredCheckboxes.stories.js +174 -0
  178. package/dist/Atomic/FormElements/TieredCheckboxes/partial/AccordionWithCheckbox.js +48 -50
  179. package/dist/Atomic/FormElements/TimeRange/TimeRange.interface.js +4 -0
  180. package/dist/Atomic/FormElements/TimeRange/TimeRange.js +114 -63
  181. package/dist/Atomic/FormElements/TimeRange/TimeRange.scss +9 -3
  182. package/dist/Atomic/FormElements/TimeRange/TimeRange.stories.js +40 -0
  183. package/dist/Atomic/FormElements/TimeRange/TimeRange.test.js +163 -0
  184. package/dist/Atomic/FormElements/TimeRange/index.js +17 -0
  185. package/dist/Atomic/FormElements/UserContacts/UserContact.test.js +381 -0
  186. package/dist/Atomic/FormElements/UserContacts/UserContacts.interface.js +4 -0
  187. package/dist/Atomic/FormElements/UserContacts/UserContacts.js +179 -123
  188. package/dist/Atomic/FormElements/UserContacts/UserContacts.scss +10 -5
  189. package/dist/Atomic/FormElements/UserContacts/UserContacts.stories.js +74 -0
  190. package/dist/Atomic/FormElements/UserContacts/index.js +17 -0
  191. package/dist/Atomic/FormElements/UserContacts/partial/AnyOuterClass.scss +1 -1
  192. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.js +101 -65
  193. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.scss +4 -12
  194. package/dist/Atomic/FormElements/VariantsListRadio/VariantsListRadio.stories.js +193 -0
  195. package/dist/Atomic/FormElements/VariantsListRadio/partials/VariantsListRadioItem.js +80 -71
  196. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.js +79 -64
  197. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.scss +1 -3
  198. package/dist/Atomic/FormElements/WidgetPseudoTable/WidgetPseudoTable.stories.js +147 -0
  199. package/dist/Atomic/FormElements/WidgetPseudoTable/partial/AnyOuterClass.scss +1 -1
  200. package/dist/Atomic/FormElements/WidgetPseudoTable/partial/constructor.js +42 -34
  201. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.js +102 -83
  202. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.scss +1 -3
  203. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/WidgetWithSwitchableRows.stories.js +151 -0
  204. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/AnyOuterClass.scss +1 -1
  205. package/dist/Atomic/FormElements/WidgetWithSwitchableRows/partial/constructor.js +42 -35
  206. package/dist/Atomic/Layout/Header/Header.js +148 -80
  207. package/dist/Atomic/Layout/Header/Header.scss +1 -1
  208. package/dist/Atomic/Layout/Header/Header.stories.js +71 -0
  209. package/dist/Atomic/Layout/MainMenu/MainMenu.js +213 -133
  210. package/dist/Atomic/Layout/MainMenu/MainMenu.scss +9 -9
  211. package/dist/Atomic/Layout/MainMenu/MainMenu.stories.js +115 -0
  212. package/dist/Atomic/Layout/Spinner/Spinner.interface.js +4 -0
  213. package/dist/Atomic/Layout/Spinner/Spinner.js +39 -22
  214. package/dist/Atomic/Layout/Spinner/Spinner.scss +32 -16
  215. package/dist/Atomic/Layout/Spinner/Spinner.stories.js +46 -0
  216. package/dist/Atomic/Layout/Spinner/Spinner.test.js +54 -0
  217. package/dist/Atomic/Layout/Spinner/index.js +17 -0
  218. package/dist/Atomic/UI/Accordion/Accordion.interface.js +4 -0
  219. package/dist/Atomic/UI/Accordion/Accordion.js +102 -52
  220. package/dist/Atomic/UI/Accordion/Accordion.scss +25 -14
  221. package/dist/Atomic/UI/Accordion/Accordion.stories.js +168 -0
  222. package/dist/Atomic/UI/Accordion/Accordion.test.js +54 -0
  223. package/dist/Atomic/UI/Accordion/AccordionItem.js +170 -104
  224. package/dist/Atomic/UI/Accordion/AccordionItem.test.js +50 -0
  225. package/dist/Atomic/UI/Accordion/index.js +17 -0
  226. package/dist/Atomic/UI/AccordionTable/AccordionTable.js +251 -173
  227. package/dist/Atomic/UI/AccordionTable/AccordionTable.stories.js +268 -0
  228. package/dist/Atomic/UI/AccordionText/AccordionText.js +105 -54
  229. package/dist/Atomic/UI/AccordionText/AccordionText.scss +22 -9
  230. package/dist/Atomic/UI/AccordionText/AccordionText.stories.js +125 -0
  231. package/dist/Atomic/UI/AdvancedTag/AdvTag.js +207 -136
  232. package/dist/Atomic/UI/AdvancedTag/AdvancedTags.js +100 -46
  233. package/dist/Atomic/UI/AdvancedTag/AdvancedTags.scss +2 -2
  234. package/dist/Atomic/UI/AdvancedTag/AdvancedTags.stories.js +115 -0
  235. package/dist/Atomic/UI/Alert/Alert.js +116 -63
  236. package/dist/Atomic/UI/Alert/Alert.scss +2 -2
  237. package/dist/Atomic/UI/Alert/Alert.stories.js +81 -0
  238. package/dist/Atomic/UI/Arrow/Arrow.js +163 -110
  239. package/dist/Atomic/UI/Arrow/Arrow.stories.js +62 -0
  240. package/dist/Atomic/UI/Box/Box.js +37 -37
  241. package/dist/Atomic/UI/Box/Box.scss +11 -11
  242. package/dist/Atomic/UI/Box/Box.stories.js +114 -0
  243. package/dist/Atomic/UI/Button/Button.js +43 -42
  244. package/dist/Atomic/UI/Button/Button.stories.js +105 -0
  245. package/dist/Atomic/UI/Button/Button.test.js +147 -0
  246. package/dist/Atomic/UI/ButtonsBar/ButtonsBar.js +61 -67
  247. package/dist/Atomic/UI/ButtonsBar/ButtonsBar.stories.js +129 -0
  248. package/dist/Atomic/UI/Chart/Chart.js +170 -98
  249. package/dist/Atomic/UI/Chart/Chart.stories.js +93 -0
  250. package/dist/Atomic/UI/Chart/partial/Chart.constants.js +142 -74
  251. package/dist/Atomic/UI/Chart/partial/ChartTypeSwitcherIcon/ChartTypeSwitcherIcon.js +91 -77
  252. package/dist/Atomic/UI/Chart/partial/datasetSetters.js +120 -120
  253. package/dist/Atomic/UI/Chart/partial/optionsConstructor.js +311 -293
  254. package/dist/Atomic/UI/Chart/partial/optionsSetters.js +54 -42
  255. package/dist/Atomic/UI/Chart/partial/utils.js +55 -35
  256. package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.js +145 -88
  257. package/dist/Atomic/UI/CircleProgressBar/CircleProgressBar.stories.js +85 -0
  258. package/dist/Atomic/UI/DateTime/DateTime.js +89 -37
  259. package/dist/Atomic/UI/DateTime/DateTime.scss +2 -2
  260. package/dist/Atomic/UI/DateTime/DateTime.stories.js +50 -0
  261. package/dist/Atomic/UI/DateTime/partial/AnyOuterClass.scss +1 -1
  262. package/dist/Atomic/UI/DebugContainer/DebugContainer.js +93 -33
  263. package/dist/Atomic/UI/DebugContainer/useDebugContainer.js +66 -18
  264. package/dist/Atomic/UI/DoubleString/DoubleString.js +134 -78
  265. package/dist/Atomic/UI/DoubleString/DoubleString.scss +6 -4
  266. package/dist/Atomic/UI/DoubleString/DoubleString.stories.js +79 -0
  267. package/dist/Atomic/UI/DoubleString/partial/AnyOuterClass.scss +1 -1
  268. package/dist/Atomic/UI/DynamicIcon/DynamicIcon.interface.js +4 -0
  269. package/dist/Atomic/UI/DynamicIcon/DynamicIcon.js +65 -22
  270. package/dist/Atomic/UI/DynamicIcon/DynamicIcon.stories.js +98 -0
  271. package/dist/Atomic/UI/DynamicIcon/DynamicIcon.test.js +51 -0
  272. package/dist/Atomic/UI/DynamicIcon/index.js +17 -0
  273. package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.js +250 -172
  274. package/dist/Atomic/UI/ExampleChartIntegration/ExampleChartIntegration.stories.js +98 -0
  275. package/dist/Atomic/UI/ExampleChartIntegration/partial/AnyOuterClass.scss +1 -1
  276. package/dist/Atomic/UI/ExampleChartIntegration/partial/utils.js +109 -84
  277. package/dist/Atomic/UI/Hint/Hint.js +243 -204
  278. package/dist/Atomic/UI/Hint/Hint.scss +5 -3
  279. package/dist/Atomic/UI/Hint/Hint.stories.js +101 -0
  280. package/dist/Atomic/UI/Hint/index.js +16 -0
  281. package/dist/Atomic/UI/Hint/partials/_utils.js +54 -44
  282. package/dist/Atomic/UI/Modal/Modal.interface.js +4 -0
  283. package/dist/Atomic/UI/Modal/Modal.js +171 -172
  284. package/dist/Atomic/UI/Modal/Modal.scss +91 -69
  285. package/dist/Atomic/UI/Modal/Modal.stories.js +370 -0
  286. package/dist/Atomic/UI/Modal/ModalHOC.js +92 -38
  287. package/dist/Atomic/UI/Modal/ModalHOC.stories.js +191 -0
  288. package/dist/Atomic/UI/Modal/ModalHOC.test.js +187 -0
  289. package/dist/Atomic/UI/Modal/ModalMobile.scss +24 -14
  290. package/dist/Atomic/UI/Modal/index.js +26 -0
  291. package/dist/Atomic/UI/Modal/partials/ModalFooter.js +68 -18
  292. package/dist/Atomic/UI/Modal/partials/ModalFooter.test.js +118 -0
  293. package/dist/Atomic/UI/Modal/partials/ModalTitle.js +107 -38
  294. package/dist/Atomic/UI/Modal/partials/ModalTitle.test.js +126 -0
  295. package/dist/Atomic/UI/Modal/partials/useMobileModal.js +128 -163
  296. package/dist/Atomic/UI/Modal/partials/useMobileModal.test.js +133 -0
  297. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.interface.js +4 -0
  298. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.js +117 -64
  299. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.scss +163 -25
  300. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.stories.js +513 -0
  301. package/dist/Atomic/UI/MonoAccordion/MonoAccordion.test.js +84 -0
  302. package/dist/Atomic/UI/MonoAccordion/index.js +17 -0
  303. package/dist/Atomic/UI/NavLine/NavLine.interface.js +4 -0
  304. package/dist/Atomic/UI/NavLine/NavLine.js +306 -279
  305. package/dist/Atomic/UI/NavLine/NavLine.scss +195 -155
  306. package/dist/Atomic/UI/NavLine/NavLine.stories.js +434 -0
  307. package/dist/Atomic/UI/NavLine/NavLine.test.js +311 -0
  308. package/dist/Atomic/UI/NavLine/index.js +17 -0
  309. package/dist/Atomic/UI/PageTitle/PageTitle.interface.js +4 -0
  310. package/dist/Atomic/UI/PageTitle/PageTitle.js +73 -52
  311. package/dist/Atomic/UI/PageTitle/PageTitle.scss +52 -14
  312. package/dist/Atomic/UI/PageTitle/PageTitle.stories.js +62 -0
  313. package/dist/Atomic/UI/PageTitle/PageTitle.test.js +181 -0
  314. package/dist/Atomic/UI/PageTitle/index.js +17 -0
  315. package/dist/Atomic/UI/PieChart/PieChar.interface.js +4 -0
  316. package/dist/Atomic/UI/PieChart/PieChart.js +105 -42
  317. package/dist/Atomic/UI/PieChart/PieChart.scss +86 -11
  318. package/dist/Atomic/UI/PieChart/PieChart.stories.js +82 -0
  319. package/dist/Atomic/UI/PieChart/PieChart.test.js +142 -0
  320. package/dist/Atomic/UI/PieChart/index.js +26 -0
  321. package/dist/Atomic/UI/Price/Price.interface.js +4 -0
  322. package/dist/Atomic/UI/Price/Price.js +27 -20
  323. package/dist/Atomic/UI/Price/Price.stories.js +52 -0
  324. package/dist/Atomic/UI/Price/Price.test.js +83 -0
  325. package/dist/Atomic/UI/Price/index.js +17 -0
  326. package/dist/Atomic/UI/PriceRange/PriceRange.interface.js +4 -0
  327. package/dist/Atomic/UI/PriceRange/PriceRange.js +40 -18
  328. package/dist/Atomic/UI/PriceRange/PriceRange.stories.js +51 -0
  329. package/dist/Atomic/UI/PriceRange/PriceRange.test.js +72 -0
  330. package/dist/Atomic/UI/PriceRange/index.js +17 -0
  331. package/dist/Atomic/UI/ProgressLine/ProgressLine.interface.js +4 -0
  332. package/dist/Atomic/UI/ProgressLine/ProgressLine.js +92 -73
  333. package/dist/Atomic/UI/ProgressLine/ProgressLine.scss +85 -71
  334. package/dist/Atomic/UI/ProgressLine/ProgressLine.stories.js +163 -0
  335. package/dist/Atomic/UI/ProgressLine/ProgressLine.test.js +60 -0
  336. package/dist/Atomic/UI/ProgressLine/index.js +17 -0
  337. package/dist/Atomic/UI/Status/Status.interface.js +4 -0
  338. package/dist/Atomic/UI/Status/Status.js +62 -51
  339. package/dist/Atomic/UI/Status/Status.scss +48 -29
  340. package/dist/Atomic/UI/Status/Status.stories.js +79 -0
  341. package/dist/Atomic/UI/Status/Status.test.js +103 -0
  342. package/dist/Atomic/UI/Status/index.js +17 -0
  343. package/dist/Atomic/UI/Table/Partials/TdCell.js +126 -88
  344. package/dist/Atomic/UI/Table/Partials/TdHeader.js +58 -39
  345. package/dist/Atomic/UI/Table/Partials/TdRow.js +124 -73
  346. package/dist/Atomic/UI/Table/Partials/TdTitle.js +113 -45
  347. package/dist/Atomic/UI/Table/Table.js +61 -43
  348. package/dist/Atomic/UI/Table/Table.scss +0 -3
  349. package/dist/Atomic/UI/Table/Table.stories.js +250 -0
  350. package/dist/Atomic/UI/Table/TdTypes/TdActions.js +108 -64
  351. package/dist/Atomic/UI/Table/TdTypes/TdPriority.js +44 -31
  352. package/dist/Atomic/UI/Table/TdTypes/TdRange.js +24 -10
  353. package/dist/Atomic/UI/Table/TdTypes/TdWeight.js +59 -48
  354. package/dist/Atomic/UI/Tag/Tag.interface.js +4 -0
  355. package/dist/Atomic/UI/Tag/Tag.js +157 -115
  356. package/dist/Atomic/UI/Tag/Tag.scss +102 -48
  357. package/dist/Atomic/UI/Tag/Tag.stories.js +108 -0
  358. package/dist/Atomic/UI/Tag/Tag.test.js +75 -0
  359. package/dist/Atomic/UI/Tag/index.js +17 -0
  360. package/dist/Atomic/UI/TagList/TagList.js +223 -184
  361. package/dist/Atomic/UI/TagList/TagList.scss +13 -9
  362. package/dist/Atomic/UI/TagList/TagList.stories.js +169 -0
  363. package/dist/Atomic/UI/UserBox/UserBox.interface.js +4 -0
  364. package/dist/Atomic/UI/UserBox/UserBox.js +80 -56
  365. package/dist/Atomic/UI/UserBox/UserBox.scss +45 -21
  366. package/dist/Atomic/UI/UserBox/UserBox.stories.js +57 -0
  367. package/dist/Atomic/UI/UserBox/UserBox.test.js +136 -0
  368. package/dist/Atomic/UI/UserBox/index.js +17 -0
  369. package/dist/Atomic/UI/WizardStepper/WizardStepper.stories.js +70 -0
  370. package/dist/Atomic/UI/WizardStepper/constructor.js +127 -89
  371. package/dist/Atomic/UI/WizardStepper/index.js +14 -6
  372. package/dist/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.js +53 -51
  373. package/dist/Atomic/UI/WizardStepper/ui/StateIcon/StateIcon.scss +11 -7
  374. package/dist/Atomic/UI/WizardStepper/ui/StateIcon/index.js +9 -5
  375. package/dist/Atomic/UI/WizardStepper/ui/StepRow/StepRow.js +84 -70
  376. package/dist/Atomic/UI/WizardStepper/ui/StepRow/StepRow.scss +13 -7
  377. package/dist/Atomic/UI/WizardStepper/ui/StepRow/index.js +14 -6
  378. package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.js +50 -45
  379. package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/StepWrapper.scss +24 -18
  380. package/dist/Atomic/UI/WizardStepper/ui/StepWrapper/index.js +14 -6
  381. package/dist/Atomic/UI/WizardStepper/ui/icons.js +138 -106
  382. package/dist/Atomic/UI/WizardStepper/ui/index.js +14 -6
  383. package/dist/Classes/AbortableFetch.js +394 -375
  384. package/dist/Classes/AnimatedHandler.js +31 -44
  385. package/dist/Classes/RESTAPI/index.js +131 -174
  386. package/dist/Classes/RESTAPI/partials/AbortableFetch.js +399 -382
  387. package/dist/Classes/RESTAPI/partials/ApiBase.js +30 -30
  388. package/dist/Classes/RESTAPI/partials/ApiRequestCreators.js +107 -94
  389. package/dist/Classes/RESTAPI/partials/ApiUtils.js +144 -166
  390. package/dist/Classes/RESTAPI/partials/CredentialsProcessing.js +180 -205
  391. package/dist/Classes/RESTAPI/partials/Utils.js +80 -83
  392. package/dist/Classes/RESTAPI/partials/_outerDependencies.js +16 -8
  393. package/dist/Classes/RESTAPI/partials/_utils.js +139 -134
  394. package/dist/Constants/index.constants.js +102 -22
  395. package/dist/Functions/Portal.js +67 -25
  396. package/dist/Functions/animatingFunctions/getAnimatedHandler.js +1 -1
  397. package/dist/Functions/customEventListener.js +48 -50
  398. package/dist/Functions/dateTime.js +130 -177
  399. package/dist/Functions/fieldValueFormatters.js +274 -350
  400. package/dist/Functions/hooks/useFormFieldsChangesManager.js +125 -100
  401. package/dist/Functions/locale/createTranslator.js +29 -29
  402. package/dist/Functions/operations.js +129 -102
  403. package/dist/Functions/presets/inputMaskPresets.js +88 -99
  404. package/dist/Functions/presets/inputPresets.js +41 -35
  405. package/dist/Functions/presets/mobileKeyboardTypesPresets.js +30 -49
  406. package/dist/Functions/schemas.js +78 -20
  407. package/dist/Functions/useBodyScrollLock.js +21 -15
  408. package/dist/Functions/useClickOutside.js +21 -16
  409. package/dist/Functions/useDebounce.js +62 -21
  410. package/dist/Functions/useFieldFocus.js +83 -84
  411. package/dist/Functions/useFormTools/form-drivers/ArrayWithObjects.js +39 -47
  412. package/dist/Functions/useFormTools/form-drivers/ObjectWithIterableObjects.js +132 -137
  413. package/dist/Functions/useFormTools/form-drivers/ObjectWithNamedKeyObjects.js +63 -74
  414. package/dist/Functions/useFormTools/functions/General.js +117 -129
  415. package/dist/Functions/useFormTools/functions/RenderFields.js +75 -85
  416. package/dist/Functions/useFormTools/functions/usePrevious.js +16 -10
  417. package/dist/Functions/useFormTools/index.js +647 -720
  418. package/dist/Functions/useInputHighlightError.js +104 -53
  419. package/dist/Functions/useIsMobile/index.js +17 -0
  420. package/dist/Functions/useIsMobile/useIsMobile.js +33 -0
  421. package/dist/Functions/useIsMobile/useIsMobile.test.js +104 -0
  422. package/dist/Functions/useKeyPress/useHandleKeyPress.js +40 -33
  423. package/dist/Functions/useKeyPress/useHandleKeyPress.test.js +96 -0
  424. package/dist/Functions/useKeyPress/useKeyPress.js +48 -39
  425. package/dist/Functions/useKeyPress/useKeyPress.test.js +87 -0
  426. package/dist/Functions/useLocalStorage.js +38 -31
  427. package/dist/Functions/useLocationParams.js +31 -25
  428. package/dist/Functions/useMediaQuery.js +14 -10
  429. package/dist/Functions/useMetaInfo.js +45 -35
  430. package/dist/Functions/useMouseUpOutside.js +21 -15
  431. package/dist/Functions/useOnlineStatus.js +25 -21
  432. package/dist/Functions/usePasswordChecker.js +183 -111
  433. package/dist/Functions/usePrevious.js +16 -10
  434. package/dist/Functions/useResize.js +32 -30
  435. package/dist/Functions/useScrollTo.js +26 -17
  436. package/dist/Functions/useToggle.js +20 -16
  437. package/dist/Functions/utils.js +493 -472
  438. package/dist/Molecular/CustomIcons/components/AffiliateNetworks.js +75 -28
  439. package/dist/Molecular/CustomIcons/components/AlertCircle.js +77 -28
  440. package/dist/Molecular/CustomIcons/components/AppStore.js +84 -32
  441. package/dist/Molecular/CustomIcons/components/Arrow.js +93 -38
  442. package/dist/Molecular/CustomIcons/components/ArrowDown.js +63 -20
  443. package/dist/Molecular/CustomIcons/components/ArrowLeft.js +71 -23
  444. package/dist/Molecular/CustomIcons/components/ArrowRight.js +71 -23
  445. package/dist/Molecular/CustomIcons/components/ArrowUp.js +63 -20
  446. package/dist/Molecular/CustomIcons/components/Bell.js +61 -18
  447. package/dist/Molecular/CustomIcons/components/Button.js +61 -18
  448. package/dist/Molecular/CustomIcons/components/Campaigns.js +62 -19
  449. package/dist/Molecular/CustomIcons/components/Check.js +62 -19
  450. package/dist/Molecular/CustomIcons/components/Check2.js +61 -18
  451. package/dist/Molecular/CustomIcons/components/ChevronDown.js +61 -18
  452. package/dist/Molecular/CustomIcons/components/ChevronDownDisabled.js +61 -18
  453. package/dist/Molecular/CustomIcons/components/ChevronLeft.js +61 -18
  454. package/dist/Molecular/CustomIcons/components/ChevronRight.js +61 -18
  455. package/dist/Molecular/CustomIcons/components/ChevronUp.js +61 -18
  456. package/dist/Molecular/CustomIcons/components/ChevronUpDown.js +81 -33
  457. package/dist/Molecular/CustomIcons/components/Close.js +64 -20
  458. package/dist/Molecular/CustomIcons/components/ColumnsOrder.js +95 -45
  459. package/dist/Molecular/CustomIcons/components/Delete.js +62 -19
  460. package/dist/Molecular/CustomIcons/components/Edit.js +61 -18
  461. package/dist/Molecular/CustomIcons/components/Email.js +87 -36
  462. package/dist/Molecular/CustomIcons/components/FinturfLogo.js +82 -26
  463. package/dist/Molecular/CustomIcons/components/FinturfLogo2.js +83 -34
  464. package/dist/Molecular/CustomIcons/components/Flows.js +61 -18
  465. package/dist/Molecular/CustomIcons/components/Gift.js +71 -23
  466. package/dist/Molecular/CustomIcons/components/GoogleAuth.js +84 -32
  467. package/dist/Molecular/CustomIcons/components/GooglePlay.js +84 -32
  468. package/dist/Molecular/CustomIcons/components/HelpCircle.js +67 -21
  469. package/dist/Molecular/CustomIcons/components/HelpCircle2.js +68 -22
  470. package/dist/Molecular/CustomIcons/components/HelpCircleFilled.js +67 -21
  471. package/dist/Molecular/CustomIcons/components/Home.js +67 -21
  472. package/dist/Molecular/CustomIcons/components/Home2.js +70 -24
  473. package/dist/Molecular/CustomIcons/components/Key.js +69 -26
  474. package/dist/Molecular/CustomIcons/components/Landers.js +68 -22
  475. package/dist/Molecular/CustomIcons/components/Lock.js +61 -18
  476. package/dist/Molecular/CustomIcons/components/Mail.js +75 -26
  477. package/dist/Molecular/CustomIcons/components/Mastercard.js +128 -68
  478. package/dist/Molecular/CustomIcons/components/Minus.js +79 -31
  479. package/dist/Molecular/CustomIcons/components/Offers.js +62 -19
  480. package/dist/Molecular/CustomIcons/components/Pause.js +79 -31
  481. package/dist/Molecular/CustomIcons/components/PayPal.js +96 -45
  482. package/dist/Molecular/CustomIcons/components/PayPalLightLarge.js +81 -32
  483. package/dist/Molecular/CustomIcons/components/Phone.js +81 -33
  484. package/dist/Molecular/CustomIcons/components/Play.js +79 -31
  485. package/dist/Molecular/CustomIcons/components/Plus.js +79 -31
  486. package/dist/Molecular/CustomIcons/components/Profile.js +69 -23
  487. package/dist/Molecular/CustomIcons/components/QRCode.js +85 -33
  488. package/dist/Molecular/CustomIcons/components/Rectangle.js +61 -18
  489. package/dist/Molecular/CustomIcons/components/Revert.js +67 -21
  490. package/dist/Molecular/CustomIcons/components/Star.js +60 -17
  491. package/dist/Molecular/CustomIcons/components/Star2.js +62 -19
  492. package/dist/Molecular/CustomIcons/components/TrafficSources.js +68 -21
  493. package/dist/Molecular/CustomIcons/components/Trash.js +61 -18
  494. package/dist/Molecular/CustomIcons/components/TrashRed.js +61 -18
  495. package/dist/Molecular/CustomIcons/components/Triggers.js +61 -18
  496. package/dist/Molecular/CustomIcons/components/User.js +71 -23
  497. package/dist/Molecular/CustomIcons/components/Visa.js +88 -34
  498. package/dist/Molecular/CustomIcons/components/X.js +61 -18
  499. package/dist/Molecular/CustomIcons/index.js +76 -674
  500. package/dist/Molecular/FormElement/FormElement.js +44 -41
  501. package/dist/Molecular/FormElement/FormElement.stories.js +92 -0
  502. package/dist/Molecular/FormWithDependOn/FormWithDependOn.js +179 -161
  503. package/dist/Molecular/FormWithDependOn/FormWithDependOn.stories.js +301 -0
  504. package/dist/Molecular/FormWithDependOn/partials/_utils.js +49 -60
  505. package/dist/Molecular/InputAddress/InputAddress.js +496 -439
  506. package/dist/Molecular/InputAddress/InputAddress.scss +14 -16
  507. package/dist/Molecular/InputAddress/InputAddress.stories.js +541 -0
  508. package/dist/Molecular/InputPassword/InputPassword.js +99 -48
  509. package/dist/Molecular/InputPassword/InputPassword.stories.js +86 -0
  510. package/dist/index.js +11 -8
  511. package/dist/scss/_fonts.scss +48 -60
  512. package/dist/scss/_mixins.scss +2 -2
  513. package/dist/scss/_vars.scss +4 -5
  514. package/dist/scss/main.scss +5 -4
  515. package/dist/types/base.interface.js +4 -0
  516. package/dist/types/base.types.js +4 -0
  517. package/package.json +17 -21
  518. package/dist/Atomic/UI/Hint/partial/_utils.js +0 -52
  519. package/dist/Atomic/UI/NavLine/Tabs.js +0 -115
  520. package/dist/Functions/useIsMobile.js +0 -26
@@ -1,990 +1,1063 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
2
  Object.defineProperty(exports, "__esModule", {
5
- value: true
3
+ value: true
6
4
  });
7
- exports.default = void 0;
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _classnames = _interopRequireDefault(require("classnames"));
11
- var _reactDom = require("react-dom");
12
- var _reactFeather = require("react-feather");
13
- var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
14
- var _useDebounce = require("../../../Functions/useDebounce");
15
- var _useIsMobile = _interopRequireDefault(require("../../../Functions/useIsMobile"));
16
- var _CheckboxInput = _interopRequireDefault(require("../../FormElements/CheckboxInput/CheckboxInput"));
17
- var _Input = _interopRequireDefault(require("../../FormElements/Input/Input"));
18
- var _Button = _interopRequireDefault(require("../../UI/Button/Button"));
19
- var _Tag = _interopRequireDefault(require("../../UI/Tag/Tag"));
20
- var _TagList = _interopRequireDefault(require("../../UI/TagList/TagList"));
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _default;
9
+ }
10
+ });
11
+ const _jsxruntime = require("react/jsx-runtime");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
13
+ const _classnames = /*#__PURE__*/ _interop_require_default(require("classnames"));
14
+ const _reactdom = require("react-dom");
15
+ const _reactfeather = require("react-feather");
16
+ const _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
17
+ const _useDebounce = require("../../../Functions/useDebounce");
18
+ const _useIsMobile = /*#__PURE__*/ _interop_require_default(require("../../../Functions/useIsMobile/useIsMobile"));
19
+ const _CheckboxInput = /*#__PURE__*/ _interop_require_default(require("../../FormElements/CheckboxInput/CheckboxInput"));
20
+ const _Input = /*#__PURE__*/ _interop_require_default(require("../../FormElements/Input/Input"));
21
+ const _Button = /*#__PURE__*/ _interop_require_default(require("../../UI/Button/Button"));
22
+ const _Tag = /*#__PURE__*/ _interop_require_default(require("../../UI/Tag/Tag"));
23
+ const _TagList = /*#__PURE__*/ _interop_require_default(require("../../UI/TagList/TagList"));
21
24
  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; }
25
+ function _interop_require_default(obj) {
26
+ return obj && obj.__esModule ? obj : {
27
+ default: obj
28
+ };
29
+ }
30
+ function _getRequireWildcardCache(nodeInterop) {
31
+ if (typeof WeakMap !== "function") return null;
32
+ var cacheBabelInterop = new WeakMap();
33
+ var cacheNodeInterop = new WeakMap();
34
+ return (_getRequireWildcardCache = function(nodeInterop) {
35
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
36
+ })(nodeInterop);
37
+ }
38
+ function _interop_require_wildcard(obj, nodeInterop) {
39
+ if (!nodeInterop && obj && obj.__esModule) {
40
+ return obj;
41
+ }
42
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
43
+ return {
44
+ default: obj
45
+ };
46
+ }
47
+ var cache = _getRequireWildcardCache(nodeInterop);
48
+ if (cache && cache.has(obj)) {
49
+ return cache.get(obj);
50
+ }
51
+ var newObj = {
52
+ __proto__: null
53
+ };
54
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
55
+ for(var key in obj){
56
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
57
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
58
+ if (desc && (desc.get || desc.set)) {
59
+ Object.defineProperty(newObj, key, desc);
60
+ } else {
61
+ newObj[key] = obj[key];
62
+ }
63
+ }
64
+ }
65
+ newObj.default = obj;
66
+ if (cache) {
67
+ cache.set(obj, newObj);
68
+ }
69
+ return newObj;
70
+ }
24
71
  const RC = "tags-dropdown";
25
72
  const MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH = 10;
26
- const COLORS = ["#F1F0F0", "#E3E2E0", "#EEDFDA", "#F9DEC9", "#FDECC8", "#DBECDB", "#D3E4EF", "#E8DEEE", "#F4E0E9", "#FFE2DD", "#D3EFED", "#ECEEDE"];
27
- const TagsDropdown = _ref => {
28
- var _Object$keys, _dropdownListWrapperR2, _dropdownListRef$curr8, _dropdownListRef$curr9;
29
- let {
30
- options: optionsProp,
31
- chosenOptions = [],
32
- onChange,
33
- className,
34
- tagClassname,
35
- listClassName,
36
- onKeyPress = () => {},
37
- placeholder,
38
- label,
39
- disabled,
40
- isValuesInTags,
41
- error,
42
- isNotValidateASCII = false,
43
- noTagsWrap = false,
44
- headerContent = null,
45
- footerContent = null,
46
- selectAllButtonRef = null,
47
- unselectAllButtonRef = null,
48
- closeOnSelect = false,
49
- closeOnRemove = false,
50
- closeOnRemoveAll = false,
51
- closeOnSelectAll = false,
52
- closeOnSelectMobile = false,
53
- closeOnRemoveMobile = false,
54
- closeOnRemoveAllMobile = false,
55
- closeOnSelectAllMobile = false,
56
- fieldKey,
57
- id,
58
- noOptionsText = "No options available",
59
- mobileSearchPlaceholder,
60
- isSearchable = true,
61
- useLiveSearch,
62
- doRequest: doLiveSearchRequest,
63
- attributesOfNativeInput = {},
64
- isUseLocalOptionsStore = true,
65
- isDefaultOpened = false,
66
- withMobileLogic,
67
- withCreateLogic,
68
- withActions,
69
- withSearchInputInList,
70
- renderOptionsAsTags,
71
- minItemsForShowMobileSearch = MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH,
72
- onOptionCreate,
73
- onOptionEdit,
74
- onOptionDelete,
75
- onActionConfirmClick,
76
- onActionCancelClick,
77
- onDropdownListClose,
78
- customTriggerRef,
79
- renderCustomTrigger,
80
- recalculateListContainerStylesTrigger
81
- } = _ref;
82
- const inputRef = (0, _react.useRef)(null);
83
- const wrapperRef = (0, _react.useRef)(null);
84
- const dropdownRef = (0, _react.useRef)(null);
85
- const dropdownListRef = (0, _react.useRef)(null);
86
- const editOptionModalRef = (0, _react.useRef)(null);
87
- const dropdownListWrapperRef = (0, _react.useRef)(null);
88
- const {
89
- isMobile: isMobileProp
90
- } = (0, _useIsMobile.default)();
91
- const isMobile = isMobileProp && withMobileLogic && window.screen.width <= 768;
92
- const [dropdownId] = (0, _react.useState)(id || fieldKey || Math.random().toString(16).slice(2));
93
- const [isOpen, setIsOpen] = (0, _react.useState)(false);
94
- const [windowScrollTop, setWindowScrollTop] = (0, _react.useState)(0);
95
- const [listPos, setListPos] = (0, _react.useState)(null);
96
- const [initListHeight, setInitListHeight] = (0, _react.useState)(null);
97
- const [isScrollableList, setIsScrollableList] = (0, _react.useState)(null);
98
- const [isFixedMaxHeight, setIsFixedMaxHeight] = (0, _react.useState)(false);
99
- const [scrollTop, setScrollTop] = (0, _react.useState)(0);
100
- const [scrollHeight, setScrollHeight] = (0, _react.useState)(1);
101
- const searchValueRef = (0, _react.useRef)(null);
102
- const [searchValue, setSearchValue] = (0, _react.useState)("");
103
- const debouncedSearchTerm = (0, _useDebounce.useDebounce)({
104
- searchValue,
105
- delay: 600
106
- });
107
- const [isValueDeleted, setIsValueDeleted] = (0, _react.useState)(false);
108
- const setSearchValueInterceptor = value => {
109
- setSearchValue(value);
110
- setIsValueDeleted(searchValue !== value && value === "");
111
- searchValueRef.current = value;
112
- };
113
- const editingOptionInputRef = (0, _react.useRef)(null);
114
- const [options, setOptions] = (0, _react.useState)([]);
115
- const [editingOption, setEditingOptionState] = (0, _react.useState)(null);
116
- const setEditingOption = data => {
117
- setEditingOptionState(editingOption => !data ? data : {
118
- ...(editingOption !== null && editingOption !== void 0 ? editingOption : {}),
119
- ...(typeof data === "function" ? data === null || data === void 0 ? void 0 : data(editingOption) : data),
120
- isChanged: Boolean(editingOption)
73
+ const COLORS = [
74
+ "#F1F0F0",
75
+ "#E3E2E0",
76
+ "#EEDFDA",
77
+ "#F9DEC9",
78
+ "#FDECC8",
79
+ "#DBECDB",
80
+ "#D3E4EF",
81
+ "#E8DEEE",
82
+ "#F4E0E9",
83
+ "#FFE2DD",
84
+ "#D3EFED",
85
+ "#ECEEDE"
86
+ ];
87
+ const TagsDropdown = ({ options: optionsProp, chosenOptions = [], onChange, className, tagClassname, listClassName, onKeyPress = ()=>{}, placeholder, label, disabled, isValuesInTags, error, isNotValidateASCII = false, noTagsWrap = false, headerContent = null, footerContent = null, selectAllButtonRef = null, unselectAllButtonRef = null, closeOnSelect = false, closeOnRemove = false, closeOnRemoveAll = false, closeOnSelectAll = false, closeOnSelectMobile = false, closeOnRemoveMobile = false, closeOnRemoveAllMobile = false, closeOnSelectAllMobile = false, fieldKey, id, noOptionsText = "No options available", mobileSearchPlaceholder, isSearchable = true, useLiveSearch, doRequest: doLiveSearchRequest, attributesOfNativeInput = {}, isUseLocalOptionsStore = true, isDefaultOpened = false, withMobileLogic, withCreateLogic, withActions, withSearchInputInList, renderOptionsAsTags, minItemsForShowMobileSearch = MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH, onOptionCreate, onOptionEdit, onOptionDelete, onActionConfirmClick, onActionCancelClick, onDropdownListClose, customTriggerRef, renderCustomTrigger, recalculateListContainerStylesTrigger })=>{
88
+ var _Object_keys, _dropdownListWrapperRef_current_getBoundingClientRect, _dropdownListWrapperRef_current, _dropdownListRef_current, _dropdownListRef_current1;
89
+ const inputRef = (0, _react.useRef)(null);
90
+ const wrapperRef = (0, _react.useRef)(null);
91
+ const dropdownRef = (0, _react.useRef)(null);
92
+ const dropdownListRef = (0, _react.useRef)(null);
93
+ const editOptionModalRef = (0, _react.useRef)(null);
94
+ const dropdownListWrapperRef = (0, _react.useRef)(null);
95
+ const { isMobile: isMobileProp } = (0, _useIsMobile.default)();
96
+ const isMobile = isMobileProp && withMobileLogic && window.screen.width <= 768;
97
+ const [dropdownId] = (0, _react.useState)(id || fieldKey || Math.random().toString(16).slice(2));
98
+ const [isOpen, setIsOpen] = (0, _react.useState)(false);
99
+ const [windowScrollTop, setWindowScrollTop] = (0, _react.useState)(0);
100
+ const [listPos, setListPos] = (0, _react.useState)(null);
101
+ const [initListHeight, setInitListHeight] = (0, _react.useState)(null);
102
+ const [isScrollableList, setIsScrollableList] = (0, _react.useState)(null);
103
+ const [isFixedMaxHeight, setIsFixedMaxHeight] = (0, _react.useState)(false);
104
+ const [scrollTop, setScrollTop] = (0, _react.useState)(0);
105
+ const [scrollHeight, setScrollHeight] = (0, _react.useState)(1);
106
+ const searchValueRef = (0, _react.useRef)(null);
107
+ const [searchValue, setSearchValue] = (0, _react.useState)("");
108
+ const debouncedSearchTerm = (0, _useDebounce.useDebounce)({
109
+ searchValue,
110
+ delay: 600
121
111
  });
122
- };
123
- const isEditingOptionError = (0, _react.useMemo)(() => {
124
- if (!editingOption) return false;
125
- return options.filter(_ref2 => {
126
- let {
127
- value
128
- } = _ref2;
129
- return value !== editingOption.value;
130
- }).some(_ref3 => {
131
- let {
132
- label
133
- } = _ref3;
134
- return label === editingOption.label;
135
- }) ? true : null;
136
- }, [options, editingOption]);
137
- const [localOptionsStore, setLocalOptionsStore] = (0, _react.useState)({});
138
- const randomColorForNewOption = (0, _react.useMemo)(() => {
139
- const getRandomIndex = (min, max) => {
140
- return Math.floor(Math.random() * (max - min + 1)) + min;
112
+ const [isValueDeleted, setIsValueDeleted] = (0, _react.useState)(false);
113
+ const setSearchValueInterceptor = (value)=>{
114
+ setSearchValue(value);
115
+ setIsValueDeleted(searchValue !== value && value === "");
116
+ searchValueRef.current = value;
117
+ };
118
+ const editingOptionInputRef = (0, _react.useRef)(null);
119
+ const [options, setOptions] = (0, _react.useState)([]);
120
+ const [editingOption, setEditingOptionState] = (0, _react.useState)(null);
121
+ const setEditingOption = (data)=>{
122
+ setEditingOptionState((editingOption)=>!data ? data : {
123
+ ...editingOption !== null && editingOption !== void 0 ? editingOption : {},
124
+ ...typeof data === "function" ? data === null || data === void 0 ? void 0 : data(editingOption) : data,
125
+ isChanged: Boolean(editingOption)
126
+ });
141
127
  };
142
- const randomIndex = getRandomIndex(0, COLORS.length - 1);
143
- return COLORS[randomIndex];
128
+ const isEditingOptionError = (0, _react.useMemo)(()=>{
129
+ if (!editingOption) return false;
130
+ return options.filter(({ value })=>value !== editingOption.value).some(({ label })=>label === editingOption.label) ? true : null;
131
+ }, [
132
+ options,
133
+ editingOption
134
+ ]);
135
+ const [localOptionsStore, setLocalOptionsStore] = (0, _react.useState)({});
136
+ const randomColorForNewOption = (0, _react.useMemo)(()=>{
137
+ const getRandomIndex = (min, max)=>{
138
+ return Math.floor(Math.random() * (max - min + 1)) + min;
139
+ };
140
+ const randomIndex = getRandomIndex(0, COLORS.length - 1);
141
+ return COLORS[randomIndex];
144
142
  // eslint-disable-next-line react-hooks/exhaustive-deps
145
- }, [options.length]);
146
- const singleLevelOptions = options === null || options === void 0 ? void 0 : options.reduce((acc, item) => {
147
- const checkUniqAndPush = (acc, item) => {
148
- const isExist = acc === null || acc === void 0 ? void 0 : acc.findIndex(_ref4 => {
149
- let {
150
- value
151
- } = _ref4;
152
- return value === (item === null || item === void 0 ? void 0 : item.value);
153
- });
154
- if (isExist !== -1) {
155
- acc[isExist] = item;
156
- } else {
157
- acc.push(item);
158
- }
143
+ }, [
144
+ options.length
145
+ ]);
146
+ const singleLevelOptions = options === null || options === void 0 ? void 0 : options.reduce((acc, item)=>{
147
+ const checkUniqAndPush = (acc, item)=>{
148
+ const isExist = acc === null || acc === void 0 ? void 0 : acc.findIndex(({ value })=>value === (item === null || item === void 0 ? void 0 : item.value));
149
+ if (isExist !== -1) {
150
+ acc[isExist] = item;
151
+ } else {
152
+ acc.push(item);
153
+ }
154
+ };
155
+ if (item.groupName) {
156
+ var _item_list;
157
+ (_item_list = item.list) === null || _item_list === void 0 ? void 0 : _item_list.map((item)=>checkUniqAndPush(acc, item));
158
+ } else {
159
+ checkUniqAndPush(acc, item);
160
+ }
161
+ return acc;
162
+ }, isUseLocalOptionsStore ? (_Object_keys = Object.keys(localOptionsStore)) === null || _Object_keys === void 0 ? void 0 : _Object_keys.map((value)=>({
163
+ value,
164
+ label: localOptionsStore === null || localOptionsStore === void 0 ? void 0 : localOptionsStore[value]
165
+ })) : []);
166
+ const deleteChosen = (value)=>{
167
+ if (isMobile ? closeOnRemoveMobile : closeOnRemove) setIsOpen(false);
168
+ if (isUseLocalOptionsStore) {
169
+ setLocalOptionsStore((options)=>({
170
+ ...options,
171
+ [value]: undefined
172
+ }));
173
+ }
174
+ onChange(chosenOptions.filter((item)=>item !== value), "chosenOptions");
159
175
  };
160
- if (item.groupName) {
161
- var _item$list;
162
- (_item$list = item.list) === null || _item$list === void 0 || _item$list.map(item => checkUniqAndPush(acc, item));
163
- } else {
164
- checkUniqAndPush(acc, item);
165
- }
166
- return acc;
167
- }, isUseLocalOptionsStore ? (_Object$keys = Object.keys(localOptionsStore)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.map(value => ({
168
- value,
169
- label: localOptionsStore === null || localOptionsStore === void 0 ? void 0 : localOptionsStore[value]
170
- })) : []);
171
- const deleteChosen = value => {
172
- if (isMobile ? closeOnRemoveMobile : closeOnRemove) setIsOpen(false);
173
- if (isUseLocalOptionsStore) {
174
- setLocalOptionsStore(options => ({
175
- ...options,
176
- [value]: undefined
177
- }));
178
- }
179
- onChange(chosenOptions.filter(item => item !== value), "chosenOptions");
180
- };
181
-
182
- // --- LIST CONTAINER FUNCTIONS BEGIN --- //
183
- const getParentNode = () => {
184
- var _ref5, _document$querySelect;
185
- 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");
186
- };
187
- const initListContainer = () => {
188
- const dropdownList = document.createElement("div");
189
- dropdownList.setAttribute("id", dropdownId);
190
- dropdownList.classList.add("tags-dropdown__container");
191
- listClassName && dropdownList.classList.add(listClassName);
192
- if (isMobile) {
193
- dropdownList.addEventListener("click", e => {
194
- if (e.target.id === dropdownId) setIsOpen(false);
195
- });
196
- }
197
- if (isMobile) {
198
- var _getParentNode;
199
- try {
200
- var _document$getElementB;
201
- (_document$getElementB = document.getElementById("mlw-".concat(dropdownId))) === null || _document$getElementB === void 0 || _document$getElementB.remove();
202
- // eslint-disable-next-line no-empty
203
- } catch (e) {}
204
- const dropdownMobileListWrapper = document.createElement("div");
205
- dropdownMobileListWrapper.classList.add("tags-dropdown-mobile");
206
- dropdownMobileListWrapper.setAttribute("id", "mlw-".concat(dropdownId));
207
- dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 || dropdownMobileListWrapper.append(dropdownList);
208
- (_getParentNode = getParentNode()) === null || _getParentNode === void 0 || _getParentNode.append(dropdownMobileListWrapper);
209
- } else {
210
- var _getParentNode2;
211
- (_getParentNode2 = getParentNode()) === null || _getParentNode2 === void 0 || _getParentNode2.append(dropdownList);
212
- }
213
- };
214
- const getListContainer = () => {
215
- return document.getElementById(dropdownId);
216
- };
217
- const getListContainerWrapper = () => {
218
- return document.getElementById("mlw-".concat(dropdownId));
219
- };
220
- const setListContainerStyles = () => {
221
- var _dropdownRef$current$, _dropdownRef$current, _getComputedStyle$mar, _getComputedStyle, _selectorWrapper$getB, _listHeader$getBoundi, _listHeader$getBoundi2, _listFooter$getBoundi, _listFooter$getBoundi2;
222
- const listContainer = getListContainer();
223
- if (!listContainer || !isOpen) return false;
224
- const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
225
- const {
226
- width,
227
- height,
228
- left,
229
- top
230
- } = (_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$ : {};
231
- const selectorWrapper = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current;
232
- const dropdownList = listContainer.getElementsByClassName("tags-dropdown__list")[0];
233
- const listHeader = selectorWrapper === null || selectorWrapper === void 0 ? void 0 : selectorWrapper.getElementsByClassName("tags-dropdown__header")[0];
234
- const listFooter = selectorWrapper === null || selectorWrapper === void 0 ? void 0 : selectorWrapper.getElementsByClassName("tags-dropdown__footer")[0];
235
- const margin = parseInt((_getComputedStyle$mar = (_getComputedStyle = getComputedStyle(selectorWrapper)) === 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);
236
- let selectorWrapperHeight = selectorWrapper === null || selectorWrapper === void 0 || (_selectorWrapper$getB = selectorWrapper.getBoundingClientRect()) === null || _selectorWrapper$getB === void 0 ? void 0 : _selectorWrapper$getB.height;
237
- const maxSelectorWrapperHeight = 500 - ((_listHeader$getBoundi = listHeader === null || listHeader === 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 || (_listFooter$getBoundi2 = listFooter.getBoundingClientRect()) === null || _listFooter$getBoundi2 === void 0 ? void 0 : _listFooter$getBoundi2.height) !== null && _listFooter$getBoundi !== void 0 ? _listFooter$getBoundi : 0);
238
- if (!isMobile || !withMobileLogic) {
239
- var _getComputedStyle2, _dropdownListMaxHeigh, _customTriggerRef$cur, _customTriggerRef$cur2;
240
- const dropdownListMaxHeightInPx = (_getComputedStyle2 = getComputedStyle(dropdownList)) === null || _getComputedStyle2 === void 0 ? void 0 : _getComputedStyle2.maxHeight;
241
- 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);
242
- if (initListHeight === null && !isNaN(maxHeight)) setInitListHeight(maxHeight);
243
- if (selectorWrapperHeight > maxHeight && !isNaN(maxHeight)) selectorWrapperHeight = maxHeight - 2 * margin;
244
- const toTop = renderCustomTrigger ? top - margin - ((_customTriggerRef$cur = customTriggerRef === null || customTriggerRef === void 0 || (_customTriggerRef$cur2 = customTriggerRef.current) === null || _customTriggerRef$cur2 === void 0 || (_customTriggerRef$cur2 = _customTriggerRef$cur2.getBoundingClientRect()) === null || _customTriggerRef$cur2 === void 0 ? void 0 : _customTriggerRef$cur2.height) !== null && _customTriggerRef$cur !== void 0 ? _customTriggerRef$cur : 0) : top - margin;
245
- const toBottom = windowHeight - top - height - margin * 2;
246
- let listPosition = listPos;
247
- if (!listPos && options.length) {
248
- listPosition = toTop < toBottom || toBottom >= selectorWrapperHeight ? "bottom" : "top";
249
- setListPos(listPosition);
250
- }
251
- if (selectorWrapperHeight > (listPosition === "top" ? toTop : toBottom)) {
252
- selectorWrapperHeight = (listPosition === "top" ? toTop : toBottom) - 3 * margin;
253
- if (selectorWrapperHeight < 200) {
254
- selectorWrapperHeight = 200;
176
+ // --- LIST CONTAINER FUNCTIONS BEGIN --- //
177
+ const getParentNode = ()=>{
178
+ var _document_querySelector, _ref;
179
+ return (_ref = (_document_querySelector = document.querySelector("div#root")) !== null && _document_querySelector !== void 0 ? _document_querySelector : document.querySelector("div#app")) !== null && _ref !== void 0 ? _ref : document.querySelector("div#storybook-root");
180
+ };
181
+ const initListContainer = ()=>{
182
+ const dropdownList = document.createElement("div");
183
+ dropdownList.setAttribute("id", dropdownId);
184
+ dropdownList.classList.add("tags-dropdown__container");
185
+ listClassName && dropdownList.classList.add(listClassName);
186
+ if (isMobile) {
187
+ dropdownList.addEventListener("click", (e)=>{
188
+ if (e.target.id === dropdownId) setIsOpen(false);
189
+ });
190
+ }
191
+ if (isMobile) {
192
+ var _getParentNode;
193
+ try {
194
+ var _document_getElementById;
195
+ (_document_getElementById = document.getElementById(`mlw-${dropdownId}`)) === null || _document_getElementById === void 0 ? void 0 : _document_getElementById.remove();
196
+ // eslint-disable-next-line no-empty
197
+ } catch (e) {}
198
+ const dropdownMobileListWrapper = document.createElement("div");
199
+ dropdownMobileListWrapper.classList.add("tags-dropdown-mobile");
200
+ dropdownMobileListWrapper.setAttribute("id", `mlw-${dropdownId}`);
201
+ dropdownMobileListWrapper === null || dropdownMobileListWrapper === void 0 ? void 0 : dropdownMobileListWrapper.append(dropdownList);
202
+ (_getParentNode = getParentNode()) === null || _getParentNode === void 0 ? void 0 : _getParentNode.append(dropdownMobileListWrapper);
203
+ } else {
204
+ var _getParentNode1;
205
+ (_getParentNode1 = getParentNode()) === null || _getParentNode1 === void 0 ? void 0 : _getParentNode1.append(dropdownList);
255
206
  }
256
- selectorWrapper.style.maxHeight = "".concat(selectorWrapperHeight, "px");
257
- }
258
- listContainer.style.minWidth = "".concat(width, "px");
259
- listContainer.style.left = "".concat(left, "px");
260
- listContainer.style.top = "".concat(listPosition === "bottom" ? top + height : top - selectorWrapperHeight - 2 * margin, "px");
261
- } else {
262
- dropdownList.style.maxHeight = "".concat(maxSelectorWrapperHeight, "px");
263
- }
264
- };
265
- const renderListContainer = () => {
266
- const lc = getListContainer();
267
- if (!lc) return null;
268
-
269
- // eslint-disable-next-line no-use-before-define
270
- return /*#__PURE__*/(0, _reactDom.createPortal)(getListMarkUp(), lc);
271
- };
272
- // --- LIST CONTAINER FUNCTIONS END --- //
273
-
274
- // --- CREATABLE LOGIC BEGIN --- //
275
- const onOptionCreateClick = () => {
276
- var _onOptionCreate;
277
- const newOption = {
278
- label: searchValue,
279
- style: {
280
- backgroundColor: randomColorForNewOption
281
- },
282
- isEditable: true,
283
- ref: /*#__PURE__*/(0, _react.createRef)()
284
207
  };
285
-
286
- // eslint-disable-next-line no-promise-executor-return
287
- ((_onOptionCreate = onOptionCreate === null || onOptionCreate === void 0 ? void 0 : onOptionCreate(newOption)) !== null && _onOptionCreate !== void 0 ? _onOptionCreate : new Promise(r => r())).then(result => {
288
- var _result$id;
289
- const tempId = Math.random().toString(16).slice(2);
290
- newOption.value = (_result$id = result === null || result === void 0 ? void 0 : result.id) !== null && _result$id !== void 0 ? _result$id : tempId;
291
- setOptions(state => [...state, newOption]);
292
- setSearchValue("");
293
- onChangeHandler(newOption);
294
- });
295
- };
296
- const onOptionEditClick = (e, item) => {
297
- e === null || e === void 0 || e.preventDefault();
298
- e === null || e === void 0 || e.stopPropagation();
299
- setEditingOption((editingOption === null || editingOption === void 0 ? void 0 : editingOption.value) === (item === null || item === void 0 ? void 0 : item.value) ? null : item);
300
- };
301
- const onOptionDeleteClick = () => {
302
- var _onOptionDelete;
303
- // eslint-disable-next-line no-promise-executor-return
304
- ((_onOptionDelete = onOptionDelete === null || onOptionDelete === void 0 ? void 0 : onOptionDelete(editingOption)) !== null && _onOptionDelete !== void 0 ? _onOptionDelete : new Promise(r => r())).then(() => {
305
- deleteChosen(editingOption === null || editingOption === void 0 ? void 0 : editingOption.value);
306
- setOptions(options => options.filter(_ref6 => {
307
- let {
308
- value
309
- } = _ref6;
310
- return value !== (editingOption === null || editingOption === void 0 ? void 0 : editingOption.value);
311
- }));
312
- setEditingOption(null);
313
- });
314
- };
315
- const saveEditingOption = () => {
316
- if (!(editingOption !== null && editingOption !== void 0 && editingOption.isChanged) || isEditingOptionError) {
317
- setEditingOption(null);
318
- return false;
319
- }
320
- onOptionEdit === null || onOptionEdit === void 0 || onOptionEdit(editingOption);
321
- setOptions(options => options.map(option => {
322
- if (editingOption && option.value === (editingOption === null || editingOption === void 0 ? void 0 : editingOption.value)) {
323
- const tmp = {
324
- ...editingOption
208
+ const getListContainer = ()=>{
209
+ return document.getElementById(dropdownId);
210
+ };
211
+ const getListContainerWrapper = ()=>{
212
+ return document.getElementById(`mlw-${dropdownId}`);
213
+ };
214
+ const setListContainerStyles = ()=>{
215
+ var _dropdownRef_current, _getComputedStyle_marginTop, _getComputedStyle, _selectorWrapper_getBoundingClientRect, _listHeader_getBoundingClientRect, _listFooter_getBoundingClientRect;
216
+ const listContainer = getListContainer();
217
+ if (!listContainer || !isOpen) return false;
218
+ const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
219
+ var _dropdownRef_current_getBoundingClientRect;
220
+ const { width, height, left, top } = (_dropdownRef_current_getBoundingClientRect = dropdownRef === null || dropdownRef === void 0 ? void 0 : (_dropdownRef_current = dropdownRef.current) === null || _dropdownRef_current === void 0 ? void 0 : _dropdownRef_current.getBoundingClientRect()) !== null && _dropdownRef_current_getBoundingClientRect !== void 0 ? _dropdownRef_current_getBoundingClientRect : {};
221
+ const selectorWrapper = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : dropdownListWrapperRef.current;
222
+ const dropdownList = listContainer.getElementsByClassName("tags-dropdown__list")[0];
223
+ const listHeader = selectorWrapper === null || selectorWrapper === void 0 ? void 0 : selectorWrapper.getElementsByClassName("tags-dropdown__header")[0];
224
+ const listFooter = selectorWrapper === null || selectorWrapper === void 0 ? void 0 : selectorWrapper.getElementsByClassName("tags-dropdown__footer")[0];
225
+ var _getComputedStyle_marginTop_replace;
226
+ const margin = parseInt((_getComputedStyle_marginTop_replace = (_getComputedStyle = getComputedStyle(selectorWrapper)) === null || _getComputedStyle === void 0 ? void 0 : (_getComputedStyle_marginTop = _getComputedStyle.marginTop) === null || _getComputedStyle_marginTop === void 0 ? void 0 : _getComputedStyle_marginTop.replace("px", "")) !== null && _getComputedStyle_marginTop_replace !== void 0 ? _getComputedStyle_marginTop_replace : 0, 10);
227
+ let selectorWrapperHeight = selectorWrapper === null || selectorWrapper === void 0 ? void 0 : (_selectorWrapper_getBoundingClientRect = selectorWrapper.getBoundingClientRect()) === null || _selectorWrapper_getBoundingClientRect === void 0 ? void 0 : _selectorWrapper_getBoundingClientRect.height;
228
+ var _listHeader_getBoundingClientRect_height, _listFooter_getBoundingClientRect_height;
229
+ const maxSelectorWrapperHeight = 500 - ((_listHeader_getBoundingClientRect_height = listHeader === null || listHeader === void 0 ? void 0 : (_listHeader_getBoundingClientRect = listHeader.getBoundingClientRect()) === null || _listHeader_getBoundingClientRect === void 0 ? void 0 : _listHeader_getBoundingClientRect.height) !== null && _listHeader_getBoundingClientRect_height !== void 0 ? _listHeader_getBoundingClientRect_height : 0) - ((_listFooter_getBoundingClientRect_height = listFooter === null || listFooter === void 0 ? void 0 : (_listFooter_getBoundingClientRect = listFooter.getBoundingClientRect()) === null || _listFooter_getBoundingClientRect === void 0 ? void 0 : _listFooter_getBoundingClientRect.height) !== null && _listFooter_getBoundingClientRect_height !== void 0 ? _listFooter_getBoundingClientRect_height : 0);
230
+ if (!isMobile || !withMobileLogic) {
231
+ var _getComputedStyle1, _customTriggerRef_current_getBoundingClientRect, _customTriggerRef_current;
232
+ const dropdownListMaxHeightInPx = (_getComputedStyle1 = getComputedStyle(dropdownList)) === null || _getComputedStyle1 === void 0 ? void 0 : _getComputedStyle1.maxHeight;
233
+ var _dropdownListMaxHeightInPx_replace;
234
+ const maxHeight = initListHeight !== null && initListHeight !== void 0 ? initListHeight : parseInt((_dropdownListMaxHeightInPx_replace = dropdownListMaxHeightInPx === null || dropdownListMaxHeightInPx === void 0 ? void 0 : dropdownListMaxHeightInPx.replace("px", "")) !== null && _dropdownListMaxHeightInPx_replace !== void 0 ? _dropdownListMaxHeightInPx_replace : 0, 10);
235
+ if (initListHeight === null && !isNaN(maxHeight)) setInitListHeight(maxHeight);
236
+ if (selectorWrapperHeight > maxHeight && !isNaN(maxHeight)) selectorWrapperHeight = maxHeight - 2 * margin;
237
+ var _customTriggerRef_current_getBoundingClientRect_height;
238
+ const toTop = renderCustomTrigger ? top - margin - ((_customTriggerRef_current_getBoundingClientRect_height = customTriggerRef === null || customTriggerRef === void 0 ? void 0 : (_customTriggerRef_current = customTriggerRef.current) === null || _customTriggerRef_current === void 0 ? void 0 : (_customTriggerRef_current_getBoundingClientRect = _customTriggerRef_current.getBoundingClientRect()) === null || _customTriggerRef_current_getBoundingClientRect === void 0 ? void 0 : _customTriggerRef_current_getBoundingClientRect.height) !== null && _customTriggerRef_current_getBoundingClientRect_height !== void 0 ? _customTriggerRef_current_getBoundingClientRect_height : 0) : top - margin;
239
+ const toBottom = windowHeight - top - height - margin * 2;
240
+ let listPosition = listPos;
241
+ if (!listPos && options.length) {
242
+ listPosition = toTop < toBottom || toBottom >= selectorWrapperHeight ? "bottom" : "top";
243
+ setListPos(listPosition);
244
+ }
245
+ if (selectorWrapperHeight > (listPosition === "top" ? toTop : toBottom)) {
246
+ selectorWrapperHeight = (listPosition === "top" ? toTop : toBottom) - 3 * margin;
247
+ if (selectorWrapperHeight < 200) {
248
+ selectorWrapperHeight = 200;
249
+ }
250
+ selectorWrapper.style.maxHeight = `${selectorWrapperHeight}px`;
251
+ }
252
+ listContainer.style.minWidth = `${width}px`;
253
+ listContainer.style.left = `${left}px`;
254
+ listContainer.style.top = `${listPosition === "bottom" ? top + height : top - selectorWrapperHeight - 2 * margin}px`;
255
+ } else {
256
+ dropdownList.style.maxHeight = `${maxSelectorWrapperHeight}px`;
257
+ }
258
+ };
259
+ const renderListContainer = ()=>{
260
+ const lc = getListContainer();
261
+ if (!lc) return null;
262
+ // eslint-disable-next-line no-use-before-define
263
+ return /*#__PURE__*/ (0, _reactdom.createPortal)(getListMarkUp(), lc);
264
+ };
265
+ // --- LIST CONTAINER FUNCTIONS END --- //
266
+ // --- CREATABLE LOGIC BEGIN --- //
267
+ const onOptionCreateClick = ()=>{
268
+ const newOption = {
269
+ label: searchValue,
270
+ style: {
271
+ backgroundColor: randomColorForNewOption
272
+ },
273
+ isEditable: true,
274
+ ref: /*#__PURE__*/ (0, _react.createRef)()
325
275
  };
326
- setEditingOption(null);
327
- return tmp;
328
- }
329
- return option;
330
- }));
331
- };
332
- const setEditOptionModalStyles = () => {
333
- var _editingOption$ref, _el$getBoundingClient, _dropdownListWrapperR, _positionClasses, _positionClasses2;
334
- if (!editingOption || !(editOptionModalRef !== null && editOptionModalRef !== void 0 && editOptionModalRef.current)) return null;
335
- const modalSize = 200;
336
- const {
337
- scrollX,
338
- scrollY
339
- } = window;
340
- const positionClasses = {
341
- left: "modal-left",
342
- right: "modal-right",
343
- top: "modal-top",
344
- bottom: "modal-bottom"
276
+ var // eslint-disable-next-line no-promise-executor-return
277
+ _onOptionCreate;
278
+ ((_onOptionCreate = onOptionCreate === null || onOptionCreate === void 0 ? void 0 : onOptionCreate(newOption)) !== null && _onOptionCreate !== void 0 ? _onOptionCreate : new Promise((r)=>r())).then((result)=>{
279
+ const tempId = Math.random().toString(16).slice(2);
280
+ var _result_id;
281
+ newOption.value = (_result_id = result === null || result === void 0 ? void 0 : result.id) !== null && _result_id !== void 0 ? _result_id : tempId;
282
+ setOptions((state)=>[
283
+ ...state,
284
+ newOption
285
+ ]);
286
+ setSearchValue("");
287
+ onChangeHandler(newOption);
288
+ });
345
289
  };
346
- const windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
347
- const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
348
- const el = editingOption === null || editingOption === void 0 || (_editingOption$ref = editingOption.ref) === null || _editingOption$ref === void 0 ? void 0 : _editingOption$ref.current;
349
- const {
350
- x,
351
- y,
352
- width,
353
- height
354
- } = (_el$getBoundingClient = el === null || el === void 0 ? void 0 : el.getBoundingClientRect()) !== null && _el$getBoundingClient !== void 0 ? _el$getBoundingClient : {};
355
- const containerPosition = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 || (_dropdownListWrapperR = dropdownListWrapperRef.current) === null || _dropdownListWrapperR === void 0 ? void 0 : _dropdownListWrapperR.getBoundingClientRect();
356
- const distanceToRight = windowWidth - (containerPosition === null || containerPosition === void 0 ? void 0 : containerPosition.x) - (containerPosition === null || containerPosition === void 0 ? void 0 : containerPosition.width);
357
- const distanceToBottom = windowHeight - y - scrollY - height;
358
- Object.values(positionClasses).map(className => editOptionModalRef.current.classList.remove(className));
359
- editOptionModalRef.current.classList.add((_positionClasses = positionClasses === null || positionClasses === void 0 ? void 0 : positionClasses[distanceToRight < modalSize ? "left" : "right"]) !== null && _positionClasses !== void 0 ? _positionClasses : "");
360
- editOptionModalRef.current.classList.add((_positionClasses2 = positionClasses === null || positionClasses === void 0 ? void 0 : positionClasses[distanceToBottom < modalSize ? "top" : "bottom"]) !== null && _positionClasses2 !== void 0 ? _positionClasses2 : "");
361
- const xTranslate = distanceToRight < modalSize ? "calc(-100% + 7px)" : "-35px";
362
- const yTranslate = distanceToBottom < modalSize ? "calc(-100% - ".concat(height + 10, "px)") : "10px";
363
- editOptionModalRef.current.style.left = "".concat(x + scrollX + width, "px");
364
- editOptionModalRef.current.style.top = "".concat(y + scrollY + height, "px");
365
- editOptionModalRef.current.style.transform = "translate(".concat(xTranslate, ", ").concat(yTranslate, ")");
366
- };
367
- const renderEditOptionModal = () => {
368
- return /*#__PURE__*/_react.default.createElement("div", {
369
- key: "editOptionModal".concat(editingOption === null || editingOption === void 0 ? void 0 : editingOption.value),
370
- ref: editOptionModalRef,
371
- className: (0, _classnames.default)("".concat(RC, "__edit-option-modal"))
372
- }, /*#__PURE__*/_react.default.createElement("div", {
373
- className: (0, _classnames.default)("".concat(RC, "__edit-option-modal-section"))
374
- }, /*#__PURE__*/_react.default.createElement(_Input.default, {
375
- value: editingOption.label,
376
- onChange: v => setEditingOption(state => ({
377
- ...state,
378
- label: v
379
- })),
380
- error: isEditingOptionError,
381
- onKeyDown: keyCode => {
382
- if (keyCode === 13) saveEditingOption();
383
- },
384
- symbolsLimit: "50",
385
- ref: editingOptionInputRef
386
- }), /*#__PURE__*/_react.default.createElement(_Button.default, {
387
- variant: "link",
388
- icon: /*#__PURE__*/_react.default.createElement(_reactFeather.Trash2, null),
389
- label: "Delete",
390
- onClick: onOptionDeleteClick
391
- })), /*#__PURE__*/_react.default.createElement("div", {
392
- className: (0, _classnames.default)("".concat(RC, "__edit-option-modal-section-divider"))
393
- }), /*#__PURE__*/_react.default.createElement("div", {
394
- className: (0, _classnames.default)("".concat(RC, "__edit-option-modal-section"))
395
- }, /*#__PURE__*/_react.default.createElement("h3", null, "Colors"), /*#__PURE__*/_react.default.createElement("div", {
396
- className: (0, _classnames.default)("".concat(RC, "__edit-option-modal-section-colors"))
397
- }, COLORS.map(color => {
398
- var _editingOption$style;
399
- return /*#__PURE__*/_react.default.createElement("div", {
400
- key: color,
401
- className: "color-block",
402
- style: {
403
- backgroundColor: color
404
- },
405
- onClick: () => setEditingOption(state => ({
406
- ...state,
407
- style: {
408
- ...state.style,
409
- backgroundColor: color
410
- }
411
- }))
412
- }, (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);
413
- }))));
414
- };
415
- // --- CREATABLE LOGIC END --- //
416
-
417
- // --- GENERAL FUNCTIONS BEGIN --- //
418
- const handleClickOutside = e => {
419
- var _getListContainer, _editOptionModalRef$c;
420
- const {
421
- target
422
- } = e;
423
- if (isOpen && !((_getListContainer = getListContainer()) !== null && _getListContainer !== void 0 && _getListContainer.contains(target)) && !editOptionModalRef.current
424
- // &&
425
- // (
426
- // customTriggerRef?.current ? customTriggerRef?.current?.contains(target) : true
427
- // )
428
- ) {
429
- setIsOpen(false);
430
- onDropdownListClose === null || onDropdownListClose === void 0 || onDropdownListClose(e);
431
- } else if (editOptionModalRef.current && !((_editOptionModalRef$c = editOptionModalRef.current) !== null && _editOptionModalRef$c !== void 0 && _editOptionModalRef$c.contains(target))) {
432
- var _document, _document$getElementB2, _document$getElementB3;
433
- 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();
434
- }
435
- };
436
- const closeList = e => {
437
- var _inputRef$current;
438
- handleClickOutside(e);
439
- 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();
440
- };
441
- const isTargetInParent = target => {
442
- var _target$className, _target$className$ind, _target$className2, _target$className2$in;
443
- 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;
444
- 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;
445
- return false;
446
- };
447
- const isItemMatchesSearch = item => {
448
- if (item.isHiddenInList) return false;
449
- const title = item.title || item.label;
450
- return searchValue.length ? title === null || title === void 0 ? void 0 : title.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "") : true;
451
- };
452
- // --- GENERAL FUNCTIONS END --- //
453
-
454
- const prepareOptions = options => {
455
- 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();
456
- };
457
- const getFilteredOptions = options => options === null || options === void 0 ? void 0 : options.reduce((result, option) => {
458
- if (option.groupName) {
459
- var _option$list;
460
- const filteredGroupItems = option === null || option === void 0 || (_option$list = option.list) === null || _option$list === void 0 ? void 0 : _option$list.filter(item => isItemMatchesSearch(item));
461
- if (filteredGroupItems !== null && filteredGroupItems !== void 0 && filteredGroupItems.length) {
462
- result.push({
463
- ...option,
464
- list: filteredGroupItems
290
+ const onOptionEditClick = (e, item)=>{
291
+ e === null || e === void 0 ? void 0 : e.preventDefault();
292
+ e === null || e === void 0 ? void 0 : e.stopPropagation();
293
+ setEditingOption((editingOption === null || editingOption === void 0 ? void 0 : editingOption.value) === (item === null || item === void 0 ? void 0 : item.value) ? null : item);
294
+ };
295
+ const onOptionDeleteClick = ()=>{
296
+ var // eslint-disable-next-line no-promise-executor-return
297
+ _onOptionDelete;
298
+ ((_onOptionDelete = onOptionDelete === null || onOptionDelete === void 0 ? void 0 : onOptionDelete(editingOption)) !== null && _onOptionDelete !== void 0 ? _onOptionDelete : new Promise((r)=>r())).then(()=>{
299
+ deleteChosen(editingOption === null || editingOption === void 0 ? void 0 : editingOption.value);
300
+ setOptions((options)=>options.filter(({ value })=>value !== (editingOption === null || editingOption === void 0 ? void 0 : editingOption.value)));
301
+ setEditingOption(null);
465
302
  });
466
- }
467
- } else if (isItemMatchesSearch(option)) {
468
- result.push(option);
469
- }
470
- return result;
471
- }, []);
472
- const getTotalOptions = (0, _react.useCallback)(() => {
473
- return options === null || options === void 0 ? void 0 : options.reduce((result, item) => {
474
- if (item !== null && item !== void 0 && item.list) {
475
- var _item$list2;
476
- result += (item === null || item === void 0 || (_item$list2 = item.list) === null || _item$list2 === void 0 ? void 0 : _item$list2.length) || 0;
477
- } else {
478
- ++result;
479
- }
480
- return result;
481
- }, 0);
482
- }, [options]);
483
- const onChangeHandler = item => {
484
- if (item !== null && item !== void 0 && item.isFreezed) return false;
485
- if ((item === null || item === void 0 ? void 0 : item.closeOnOptionSelect) !== undefined) {
486
- if (item.closeOnOptionSelect) setIsOpen(false);
487
- } else if (isMobile ? closeOnSelectMobile : closeOnSelect) setIsOpen(false);
488
- setSearchValueInterceptor("");
489
- if (chosenOptions.some(el => el === item.value)) {
490
- deleteChosen(item.value);
491
- return null;
492
- }
493
- if (isUseLocalOptionsStore) {
494
- setLocalOptionsStore(options => ({
495
- ...options,
496
- [item === null || item === void 0 ? void 0 : item.value]: item === null || item === void 0 ? void 0 : item.label
497
- }));
498
- }
499
- onChange([...chosenOptions, item.value], "chosenOptions");
500
- return null;
501
- };
502
- const onSearchHandler = name => {
503
- let inputValue = name;
504
- if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
505
- setSearchValueInterceptor(inputValue);
506
- };
507
- const onWrapperClick = e => {
508
- if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
509
- e.stopPropagation();
510
- e.preventDefault();
511
- setIsOpen(false);
512
- }
513
- };
514
- const selectAllItems = () => {
515
- var _prepareOptions;
516
- const preparedOptions = (_prepareOptions = prepareOptions(options)) === null || _prepareOptions === void 0 ? void 0 : _prepareOptions.filter(_ref7 => {
517
- let {
518
- isFreezed,
519
- value
520
- } = _ref7;
521
- return !isFreezed && !(chosenOptions !== null && chosenOptions !== void 0 && chosenOptions.includes(value)) && value !== "open_modal";
522
- });
523
- if (isUseLocalOptionsStore) {
524
- setLocalOptionsStore(options => preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.reduce((result, _ref8) => {
525
- let {
526
- value,
527
- label
528
- } = _ref8;
529
- result[value] = label;
530
- return result;
531
- }, options));
532
- }
533
- onChange([...chosenOptions, ...((preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.map(_ref9 => {
534
- let {
535
- value
536
- } = _ref9;
537
- return value;
538
- })) || [])], "chosenOptions");
539
- if (isMobile ? closeOnSelectAllMobile : closeOnSelectAll) setIsOpen(false);
540
- };
541
- const unselectAllItems = () => {
542
- if (isUseLocalOptionsStore) setLocalOptionsStore({});
543
- onChange(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.filter(item => {
544
- var _prepareOptions2;
545
- return (_prepareOptions2 = prepareOptions(options)) === null || _prepareOptions2 === void 0 || (_prepareOptions2 = _prepareOptions2.find(_ref10 => {
546
- let {
547
- value
548
- } = _ref10;
549
- return value === item;
550
- })) === null || _prepareOptions2 === void 0 ? void 0 : _prepareOptions2.isFreezed;
551
- }), "chosenOptions");
552
- if (isMobile ? closeOnRemoveAllMobile : closeOnRemoveAll) setIsOpen(false);
553
- };
554
- const doScrollCallback = (0, _react.useCallback)(e => {
555
- if (doLiveSearchRequest && typeof doLiveSearchRequest === "function") {
556
- if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight) {
557
- doLiveSearchRequest(searchValueRef.current, true);
558
- }
559
- }
560
- }, [options]);
561
-
562
- // --- RENDER FUNCTIONS BEGIN --- //
563
-
564
- const getMarkupForElement = item => {
565
- var _item$customMobileIco;
566
- const {
567
- description
568
- } = item;
569
- const title = item.title || item.label;
570
- const hightlightSearchValue = title => {
571
- var _title$toLowerCase;
572
- 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());
573
- if (index === -1) return title;
574
- return /*#__PURE__*/_react.default.createElement("pre", {
575
- className: "inherit-styles"
576
- }, /*#__PURE__*/_react.default.createElement("span", null, title.substring(0, index)), /*#__PURE__*/_react.default.createElement("span", {
577
- className: "search-match bg--yellow"
578
- }, 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))));
579
303
  };
580
- return /*#__PURE__*/_react.default.createElement("button", {
581
- ref: item === null || item === void 0 ? void 0 : item.ref,
582
- key: "".concat(RC, "__list-item-").concat(item.id || item.value),
583
- onClick: e => {
584
- e.preventDefault();
585
- e.stopPropagation();
586
- onChangeHandler(item);
587
- },
588
- className: (0, _classnames.default)("".concat(RC, "__list-item"), {
589
- ["".concat(RC, "__list-item_active")]: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some(value => value === item.value)
590
- }, {
591
- ["".concat(RC, "__list-item_disabled")]: item.disabled
592
- }, {
593
- ["".concat(RC, "__list-item_freezed")]: item === null || item === void 0 ? void 0 : item.isFreezed
594
- }, {
595
- ["".concat(RC, "__list-item--editing")]: (item === null || item === void 0 ? void 0 : item.value) === (editingOption === null || editingOption === void 0 ? void 0 : editingOption.value)
596
- }, item.className)
597
- }, !isMobile && /*#__PURE__*/_react.default.createElement("span", {
598
- className: (0, _classnames.default)("".concat(RC, "__active-icon"), {
599
- ["".concat(RC, "__active-icon_active")]: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some(value => value === item.value)
600
- })
601
- }, /*#__PURE__*/_react.default.createElement(_reactFeather.Check, {
602
- width: 16,
603
- height: 16,
604
- className: "color--text"
605
- })), /*#__PURE__*/_react.default.createElement("div", {
606
- className: (0, _classnames.default)("".concat(RC, "__list-item-body"))
607
- }, renderOptionsAsTags ? /*#__PURE__*/_react.default.createElement(_Tag.default, {
608
- key: item === null || item === void 0 ? void 0 : item.value,
609
- className: (0, _classnames.default)("".concat(RC, "__list-item-title"), item === null || item === void 0 ? void 0 : item.labelClassName, {
610
- "tag_with-btn": !(item !== null && item !== void 0 && item.isFreezed)
611
- }),
612
- label: hightlightSearchValue(title),
613
- style: item === null || item === void 0 ? void 0 : item.style,
614
- isNoDismiss: true
615
- }) : /*#__PURE__*/_react.default.createElement("span", {
616
- className: (0, _classnames.default)("".concat(RC, "__list-item-title"), item.labelClassName)
617
- }, hightlightSearchValue(title)), description && /*#__PURE__*/_react.default.createElement("span", {
618
- className: (0, _classnames.default)("".concat(RC, "__list-item-description"))
619
- }, description)), !isMobile && (item === null || item === void 0 ? void 0 : item.isEditable) && onOptionEdit && onOptionDelete && /*#__PURE__*/_react.default.createElement("div", {
620
- id: "editTrigger".concat(item === null || item === void 0 ? void 0 : item.value),
621
- className: (0, _classnames.default)("".concat(RC, "__list-item-edit-trigger")),
622
- onClick: e => onOptionEditClick(e, item)
623
- }, /*#__PURE__*/_react.default.createElement(_reactFeather.MoreHorizontal, null)), isMobile ? (_item$customMobileIco = item === null || item === void 0 ? void 0 : item.customMobileIcon) !== null && _item$customMobileIco !== void 0 ? _item$customMobileIco : /*#__PURE__*/_react.default.createElement(_CheckboxInput.default, {
624
- value: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some(value => value === item.value),
625
- onChange: () => {
626
- onChangeHandler(item);
627
- }
628
- }) : "");
629
- };
630
- const getListMarkUp = () => {
631
- var _filteredOptions$filt, _filteredOptions$filt2, _document$getElementB4;
632
- const filteredOptions = getFilteredOptions(options);
633
- const arrToPrint = [];
634
- for (const option of filteredOptions) {
635
- if (option.groupName) {
636
- var _option$groupName, _option$list2;
637
- arrToPrint.push( /*#__PURE__*/_react.default.createElement("div", {
638
- 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()),
639
- className: (0, _classnames.default)("".concat(RC, "-group"), option.className)
640
- }, /*#__PURE__*/_react.default.createElement("span", {
641
- className: "".concat(RC, "-group__name")
642
- }, option.groupName), (_option$list2 = option.list) === null || _option$list2 === void 0 ? void 0 : _option$list2.map(item => getMarkupForElement(item))));
643
- } else arrToPrint.push(getMarkupForElement(option));
644
- }
645
- return /*#__PURE__*/_react.default.createElement("div", {
646
- className: (0, _classnames.default)("".concat(RC, "__container-wrapper")),
647
- ref: wrapperRef,
648
- onClick: isMobile ? onWrapperClick : () => {}
649
- }, /*#__PURE__*/_react.default.createElement("div", {
650
- ref: dropdownListWrapperRef,
651
- className: (0, _classnames.default)("".concat(RC, "__selector-wrapper"), {
652
- ["".concat(RC, "__selector-wrapper--fixed-height")]: isFixedMaxHeight && isMobile
653
- })
654
- }, headerContent || isMobile ? /*#__PURE__*/_react.default.createElement("div", {
655
- className: (0, _classnames.default)("".concat(RC, "__header"), {
656
- ["".concat(RC, "__header-with-shadow")]: isScrollableList && isMobile,
657
- ["".concat(RC, "__header-with-shadow-hidden")]: scrollTop === 0
658
- })
659
- }, isMobile && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
660
- className: (0, _classnames.default)("".concat(RC, "__header-row"))
661
- }, /*#__PURE__*/_react.default.createElement("div", {
662
- className: (0, _classnames.default)("".concat(RC, "__label"))
663
- }, label), /*#__PURE__*/_react.default.createElement("div", {
664
- className: (0, _classnames.default)("".concat(RC, "__close-icon")),
665
- onClick: e => {
666
- e.stopPropagation();
667
- setIsOpen(false);
668
- }
669
- }, /*#__PURE__*/_react.default.createElement(_reactFeather.X, {
670
- onClick: e => {
671
- e.stopPropagation();
672
- setIsOpen(false);
673
- }
674
- }))), getTotalOptions() > (minItemsForShowMobileSearch || MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH) && /*#__PURE__*/_react.default.createElement("div", {
675
- className: (0, _classnames.default)("".concat(RC, "__header-row"))
676
- }, /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({
677
- className: "".concat(RC, "__input"),
678
- value: searchValue,
679
- onChange: v => setSearchValueInterceptor(v),
680
- placeholder: mobileSearchPlaceholder || "Search",
681
- withDelete: true,
682
- onMouseDown: () => {
683
- if (!isOpen) {
684
- setIsOpen(true);
304
+ const saveEditingOption = ()=>{
305
+ if (!(editingOption === null || editingOption === void 0 ? void 0 : editingOption.isChanged) || isEditingOptionError) {
306
+ setEditingOption(null);
307
+ return false;
685
308
  }
686
- }
687
- }, attributesOfNativeInput)))), headerContent && /*#__PURE__*/_react.default.createElement("div", {
688
- className: (0, _classnames.default)("".concat(RC, "__header-row"))
689
- }, headerContent)) : null, withSearchInputInList && /*#__PURE__*/_react.default.createElement("div", {
690
- className: (0, _classnames.default)("".concat(RC, "__input-list-wrapper"))
691
- }, renderSearchInput()), withCreateLogic && onOptionCreate && searchValue && filteredOptions.length && singleLevelOptions.every(_ref11 => {
692
- let {
693
- label
694
- } = _ref11;
695
- return (label === null || label === void 0 ? void 0 : label.toLowerCase()) !== (searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase());
696
- }) ? /*#__PURE__*/_react.default.createElement("div", {
697
- className: (0, _classnames.default)("".concat(RC, "__creatable-helper"))
698
- }, "Select an option or create one") : null, /*#__PURE__*/_react.default.createElement("div", {
699
- ref: dropdownListRef,
700
- className: "".concat(RC, "__list ").concat(headerContent || isMobile ? "".concat(RC, "__list--with-header") : "", " ").concat(footerContent ? "".concat(RC, "__list--with-footer") : "")
701
- }, arrToPrint, ((_filteredOptions$filt = filteredOptions.filter(_ref12 => {
702
- let {
703
- value
704
- } = _ref12;
705
- return value !== "open_modal";
706
- })) === null || _filteredOptions$filt === void 0 ? void 0 : _filteredOptions$filt.length) === 0 && (!withCreateLogic || !searchValue) ? /*#__PURE__*/_react.default.createElement("div", {
707
- className: "".concat(RC, "__no-options")
708
- }, noOptionsText) : null), (footerContent || isMobile) && ((_filteredOptions$filt2 = filteredOptions.filter(_ref13 => {
709
- let {
710
- value
711
- } = _ref13;
712
- return value !== "open_modal";
713
- })) === null || _filteredOptions$filt2 === void 0 ? void 0 : _filteredOptions$filt2.length) > 0 ? /*#__PURE__*/_react.default.createElement("div", {
714
- className: (0, _classnames.default)("".concat(RC, "__footer"), {
715
- ["".concat(RC, "__footer-with-shadow")]: isMobile && isScrollableList,
716
- ["".concat(RC, "__footer-with-shadow-hidden")]: scrollTop === scrollHeight
717
- })
718
- }, footerContent, isMobile && /*#__PURE__*/_react.default.createElement("button", {
719
- onClick: () => setIsOpen(false)
720
- }, "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 => {
721
- let {
722
- label
723
- } = _ref14;
724
- return (label === null || label === void 0 ? void 0 : label.toLowerCase()) !== (searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase());
725
- }) && /*#__PURE__*/_react.default.createElement("div", {
726
- className: (0, _classnames.default)("".concat(RC, "__create-option")),
727
- onClick: onOptionCreateClick
728
- }, "Create", /*#__PURE__*/_react.default.createElement(_Tag.default, {
729
- label: searchValue,
730
- style: {
731
- backgroundColor: randomColorForNewOption
732
- },
733
- isNoDismiss: true
734
- }))));
735
- };
736
- const renderSearchInput = () => {
737
- return /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({
738
- ref: inputRef,
739
- className: (0, _classnames.default)("".concat(RC, "__input"), {
740
- ["".concat(RC, "__input--in-list")]: withSearchInputInList
741
- }),
742
- value: searchValue,
743
- onChange: onSearchHandler,
744
- placeholder: placeholder || "Select from list",
745
- attributesOfNativeInput: {
746
- ...attributesOfNativeInput,
747
- onKeyDown: e => {
748
- if (e.keyCode === 13 && withCreateLogic && onOptionCreate && singleLevelOptions.every(_ref15 => {
749
- let {
750
- label
751
- } = _ref15;
752
- return (label === null || label === void 0 ? void 0 : label.toLowerCase()) !== (searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase());
753
- })) {
754
- onOptionCreateClick();
755
- }
756
- onKeyPress(e, searchValue);
309
+ onOptionEdit === null || onOptionEdit === void 0 ? void 0 : onOptionEdit(editingOption);
310
+ setOptions((options)=>options.map((option)=>{
311
+ if (editingOption && option.value === (editingOption === null || editingOption === void 0 ? void 0 : editingOption.value)) {
312
+ const tmp = {
313
+ ...editingOption
314
+ };
315
+ setEditingOption(null);
316
+ return tmp;
317
+ }
318
+ return option;
319
+ }));
320
+ };
321
+ const setEditOptionModalStyles = ()=>{
322
+ var _editingOption_ref, _dropdownListWrapperRef_current;
323
+ if (!editingOption || !(editOptionModalRef === null || editOptionModalRef === void 0 ? void 0 : editOptionModalRef.current)) return null;
324
+ const modalSize = 200;
325
+ const { scrollX, scrollY } = window;
326
+ const positionClasses = {
327
+ left: "modal-left",
328
+ right: "modal-right",
329
+ top: "modal-top",
330
+ bottom: "modal-bottom"
331
+ };
332
+ const windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
333
+ const windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
334
+ const el = editingOption === null || editingOption === void 0 ? void 0 : (_editingOption_ref = editingOption.ref) === null || _editingOption_ref === void 0 ? void 0 : _editingOption_ref.current;
335
+ var _el_getBoundingClientRect;
336
+ const { x, y, width, height } = (_el_getBoundingClientRect = el === null || el === void 0 ? void 0 : el.getBoundingClientRect()) !== null && _el_getBoundingClientRect !== void 0 ? _el_getBoundingClientRect : {};
337
+ const containerPosition = dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperRef_current = dropdownListWrapperRef.current) === null || _dropdownListWrapperRef_current === void 0 ? void 0 : _dropdownListWrapperRef_current.getBoundingClientRect();
338
+ const distanceToRight = windowWidth - (containerPosition === null || containerPosition === void 0 ? void 0 : containerPosition.x) - (containerPosition === null || containerPosition === void 0 ? void 0 : containerPosition.width);
339
+ const distanceToBottom = windowHeight - y - scrollY - height;
340
+ Object.values(positionClasses).map((className)=>editOptionModalRef.current.classList.remove(className));
341
+ var _positionClasses_;
342
+ editOptionModalRef.current.classList.add((_positionClasses_ = positionClasses === null || positionClasses === void 0 ? void 0 : positionClasses[distanceToRight < modalSize ? "left" : "right"]) !== null && _positionClasses_ !== void 0 ? _positionClasses_ : "");
343
+ var _positionClasses_1;
344
+ editOptionModalRef.current.classList.add((_positionClasses_1 = positionClasses === null || positionClasses === void 0 ? void 0 : positionClasses[distanceToBottom < modalSize ? "top" : "bottom"]) !== null && _positionClasses_1 !== void 0 ? _positionClasses_1 : "");
345
+ const xTranslate = distanceToRight < modalSize ? "calc(-100% + 7px)" : "-35px";
346
+ const yTranslate = distanceToBottom < modalSize ? `calc(-100% - ${height + 10}px)` : "10px";
347
+ editOptionModalRef.current.style.left = `${x + scrollX + width}px`;
348
+ editOptionModalRef.current.style.top = `${y + scrollY + height}px`;
349
+ editOptionModalRef.current.style.transform = `translate(${xTranslate}, ${yTranslate})`;
350
+ };
351
+ const renderEditOptionModal = ()=>{
352
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
353
+ ref: editOptionModalRef,
354
+ className: (0, _classnames.default)(`${RC}__edit-option-modal`),
355
+ children: [
356
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
357
+ className: (0, _classnames.default)(`${RC}__edit-option-modal-section`),
358
+ children: [
359
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Input.default, {
360
+ value: editingOption.label,
361
+ onChange: (v)=>setEditingOption((state)=>({
362
+ ...state,
363
+ label: v
364
+ })),
365
+ error: isEditingOptionError,
366
+ onKeyDown: (keyCode)=>{
367
+ if (keyCode === 13) saveEditingOption();
368
+ },
369
+ symbolsLimit: "50",
370
+ ref: editingOptionInputRef
371
+ }),
372
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Button.default, {
373
+ variant: "link",
374
+ icon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactfeather.Trash2, {}),
375
+ label: "Delete",
376
+ onClick: onOptionDeleteClick
377
+ })
378
+ ]
379
+ }),
380
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
381
+ className: (0, _classnames.default)(`${RC}__edit-option-modal-section-divider`)
382
+ }),
383
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
384
+ className: (0, _classnames.default)(`${RC}__edit-option-modal-section`),
385
+ children: [
386
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("h3", {
387
+ children: "Colors"
388
+ }),
389
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
390
+ className: (0, _classnames.default)(`${RC}__edit-option-modal-section-colors`),
391
+ children: COLORS.map((color)=>{
392
+ var _editingOption_style;
393
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
394
+ className: "color-block",
395
+ style: {
396
+ backgroundColor: color
397
+ },
398
+ onClick: ()=>setEditingOption((state)=>({
399
+ ...state,
400
+ style: {
401
+ ...state.style,
402
+ backgroundColor: color
403
+ }
404
+ })),
405
+ children: (editingOption === null || editingOption === void 0 ? void 0 : (_editingOption_style = editingOption.style) === null || _editingOption_style === void 0 ? void 0 : _editingOption_style.backgroundColor) === color ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactfeather.Check, {}) : null
406
+ }, color);
407
+ })
408
+ })
409
+ ]
410
+ })
411
+ ]
412
+ }, `editOptionModal${editingOption === null || editingOption === void 0 ? void 0 : editingOption.value}`);
413
+ };
414
+ // --- CREATABLE LOGIC END --- //
415
+ // --- GENERAL FUNCTIONS BEGIN --- //
416
+ const handleClickOutside = (e)=>{
417
+ var _getListContainer, _editOptionModalRef_current;
418
+ const { target } = e;
419
+ if (isOpen && !((_getListContainer = getListContainer()) === null || _getListContainer === void 0 ? void 0 : _getListContainer.contains(target)) && !editOptionModalRef.current) {
420
+ setIsOpen(false);
421
+ onDropdownListClose === null || onDropdownListClose === void 0 ? void 0 : onDropdownListClose(e);
422
+ } else if (editOptionModalRef.current && !((_editOptionModalRef_current = editOptionModalRef.current) === null || _editOptionModalRef_current === void 0 ? void 0 : _editOptionModalRef_current.contains(target))) {
423
+ var _document_getElementById_contains, _document_getElementById, _document_getElementById1, _document;
424
+ if (!((_document = document) === null || _document === void 0 ? void 0 : (_document_getElementById1 = _document.getElementById) === null || _document_getElementById1 === void 0 ? void 0 : (_document_getElementById = _document_getElementById1.call(_document, `editTrigger${editingOption === null || editingOption === void 0 ? void 0 : editingOption.value}`)) === null || _document_getElementById === void 0 ? void 0 : (_document_getElementById_contains = _document_getElementById.contains) === null || _document_getElementById_contains === void 0 ? void 0 : _document_getElementById_contains.call(_document_getElementById, target))) saveEditingOption();
757
425
  }
758
- // onFocus: (e) => {
759
- // if (isMobile) e?.target?.blur();
760
- // },
761
- }
762
- }, withCreateLogic ? {
763
- symbolsLimit: 50
764
- } : {}));
765
- };
766
- const renderDropdownTrigger = (0, _react.useCallback)(() => {
767
- var _renderCustomTrigger;
768
- const renderDefaultDropdownTrigger = () => {
769
- return /*#__PURE__*/_react.default.createElement("div", {
770
- className: (0, _classnames.default)("".concat(RC, "__trigger"), {
771
- "tags-dropdown__error": error,
772
- ["".concat(RC, "__trigger--with-actions")]: withActions
773
- }),
774
- onClick: _ref16 => {
775
- let {
776
- target
777
- } = _ref16;
778
- if ((target === null || target === void 0 ? void 0 : target.tagName) === "INPUT") {
779
- setIsOpen(true);
780
- } else if (isTargetInParent(target)) {
781
- setIsOpen(isOpen => !isOpen);
782
- }
426
+ };
427
+ const closeList = (e)=>{
428
+ var _inputRef_current;
429
+ handleClickOutside(e);
430
+ 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();
431
+ };
432
+ const isTargetInParent = (target)=>{
433
+ var _target_className_indexOf, _target_className, _target_className_indexOf1, _target_className1;
434
+ 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;
435
+ 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_indexOf = _target_className.indexOf) === null || _target_className_indexOf === void 0 ? void 0 : _target_className_indexOf.call(_target_className, "tag__label")) !== -1 || (target === null || target === void 0 ? void 0 : (_target_className1 = target.className) === null || _target_className1 === void 0 ? void 0 : (_target_className_indexOf1 = _target_className1.indexOf) === null || _target_className_indexOf1 === void 0 ? void 0 : _target_className_indexOf1.call(_target_className1, "tag-list_wrapper")) !== -1 || (target === null || target === void 0 ? void 0 : target.className.indexOf(`${RC}__trigger`)) !== -1 || (target === null || target === void 0 ? void 0 : target.className) === "tags-dropdown__arrow") return true;
436
+ return false;
437
+ };
438
+ const isItemMatchesSearch = (item)=>{
439
+ if (item.isHiddenInList) return false;
440
+ const title = item.title || item.label;
441
+ return searchValue.length ? title === null || title === void 0 ? void 0 : title.toLowerCase().includes((searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()) || "") : true;
442
+ };
443
+ // --- GENERAL FUNCTIONS END --- //
444
+ const prepareOptions = (options)=>{
445
+ return options === null || options === void 0 ? void 0 : options.map((option)=>(option === null || option === void 0 ? void 0 : option.groupName) ? option === null || option === void 0 ? void 0 : option.list : option).flat();
446
+ };
447
+ const getFilteredOptions = (options)=>options === null || options === void 0 ? void 0 : options.reduce((result, option)=>{
448
+ if (option.groupName) {
449
+ var _option_list;
450
+ 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));
451
+ if (filteredGroupItems === null || filteredGroupItems === void 0 ? void 0 : filteredGroupItems.length) {
452
+ result.push({
453
+ ...option,
454
+ list: filteredGroupItems
455
+ });
456
+ }
457
+ } else if (isItemMatchesSearch(option)) {
458
+ result.push(option);
459
+ }
460
+ return result;
461
+ }, []);
462
+ const getTotalOptions = (0, _react.useCallback)(()=>{
463
+ return options === null || options === void 0 ? void 0 : options.reduce((result, item)=>{
464
+ if (item === null || item === void 0 ? void 0 : item.list) {
465
+ var _item_list;
466
+ result += (item === null || item === void 0 ? void 0 : (_item_list = item.list) === null || _item_list === void 0 ? void 0 : _item_list.length) || 0;
467
+ } else {
468
+ ++result;
469
+ }
470
+ return result;
471
+ }, 0);
472
+ }, [
473
+ options
474
+ ]);
475
+ const onChangeHandler = (item)=>{
476
+ if (item === null || item === void 0 ? void 0 : item.isFreezed) return false;
477
+ if ((item === null || item === void 0 ? void 0 : item.closeOnOptionSelect) !== undefined) {
478
+ if (item.closeOnOptionSelect) setIsOpen(false);
479
+ } else if (isMobile ? closeOnSelectMobile : closeOnSelect) setIsOpen(false);
480
+ setSearchValueInterceptor("");
481
+ if (chosenOptions.some((el)=>el === item.value)) {
482
+ deleteChosen(item.value);
483
+ return null;
783
484
  }
784
- }, noTagsWrap ? /*#__PURE__*/_react.default.createElement(_TagList.default, {
785
- items: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.map((value, i) => {
786
- const tag = singleLevelOptions === null || singleLevelOptions === void 0 ? void 0 : singleLevelOptions.find(el => el.value == value);
787
- const label = isValuesInTags ? tag === null || tag === void 0 ? void 0 : tag.value : (tag === null || tag === void 0 ? void 0 : tag.label) || (tag === null || tag === void 0 ? void 0 : tag.name) || (tag === null || tag === void 0 ? void 0 : tag.title);
788
- return {
789
- value,
790
- label,
791
- id: i,
792
- className: tag === null || tag === void 0 ? void 0 : tag.labelClassName,
793
- style: tag === null || tag === void 0 ? void 0 : tag.style
794
- };
795
- }),
796
- disableShowMore: true
797
- }) : chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.map(value => {
798
- const tag = singleLevelOptions === null || singleLevelOptions === void 0 ? void 0 : singleLevelOptions.find(el => el.value == value);
799
- const label = isValuesInTags ? tag === null || tag === void 0 ? void 0 : tag.value : (tag === null || tag === void 0 ? void 0 : tag.label) || (tag === null || tag === void 0 ? void 0 : tag.name) || (tag === null || tag === void 0 ? void 0 : tag.title);
800
- return /*#__PURE__*/_react.default.createElement(_Tag.default, {
801
- key: value,
802
- className: (0, _classnames.default)(tagClassname, tag === null || tag === void 0 ? void 0 : tag.labelClassName, {
803
- "tag_with-btn": !(tag !== null && tag !== void 0 && tag.isFreezed)
804
- }),
805
- label: label,
806
- style: tag === null || tag === void 0 ? void 0 : tag.style,
807
- removeItem: tag !== null && tag !== void 0 && tag.isFreezed ? null : () => deleteChosen(value),
808
- isNoDismiss: false
809
- });
810
- }), chosenOptions.length === 0 || !noTagsWrap ? renderSearchInput() : "", /*#__PURE__*/_react.default.createElement("span", {
811
- className: (0, _classnames.default)("".concat(RC, "__arrow"), {
812
- ["".concat(RC, "__arrow_active")]: isOpen
813
- })
814
- }, isMobile ? /*#__PURE__*/_react.default.createElement(_reactFeather.Code, {
815
- className: "mobile-icon"
816
- }) : isOpen ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronUp, {
817
- className: "color--text"
818
- }) : /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, {
819
- className: "color--text"
820
- })));
485
+ if (isUseLocalOptionsStore) {
486
+ setLocalOptionsStore((options)=>({
487
+ ...options,
488
+ [item === null || item === void 0 ? void 0 : item.value]: item === null || item === void 0 ? void 0 : item.label
489
+ }));
490
+ }
491
+ onChange([
492
+ ...chosenOptions,
493
+ item.value
494
+ ], "chosenOptions");
495
+ return null;
821
496
  };
822
- return (_renderCustomTrigger = renderCustomTrigger === null || renderCustomTrigger === void 0 ? void 0 : renderCustomTrigger({
823
- chosenOptions,
824
- singleLevelOptions,
825
- deleteChosen,
826
- inputRef,
827
- onSearchHandler,
828
- isOpen,
829
- setIsOpen
830
- })) !== null && _renderCustomTrigger !== void 0 ? _renderCustomTrigger : renderDefaultDropdownTrigger();
831
- }, [chosenOptions, singleLevelOptions, inputRef, isOpen]);
832
- // --- RENDER FUNCTIONS END --- //
833
-
834
- (0, _react.useLayoutEffect)(() => {
835
- initListContainer();
836
- if (isDefaultOpened && !isMobileProp) setIsOpen(true);
837
- return () => {
838
- var _getListContainer2, _getListContainerWrap;
839
- (_getListContainer2 = getListContainer()) === null || _getListContainer2 === void 0 || _getListContainer2.remove();
840
- (_getListContainerWrap = getListContainerWrapper()) === null || _getListContainerWrap === void 0 || _getListContainerWrap.remove();
497
+ const onSearchHandler = (name)=>{
498
+ let inputValue = name;
499
+ if (!isNotValidateASCII) inputValue = (0, _fieldValueFormatters.formatToOnlyASCIICodeText)(inputValue);
500
+ setSearchValueInterceptor(inputValue);
841
501
  };
842
- }, []);
843
- (0, _react.useLayoutEffect)(() => {
844
- var _getListContainer3;
845
- if (!isMobile) {
846
- window.addEventListener("mousewheel", closeList);
847
- window.addEventListener("wheel", closeList);
848
- window.addEventListener("touchmove", closeList);
849
- window.addEventListener("mouseup", handleClickOutside);
850
- } else {
851
- window.removeEventListener("mousewheel", closeList);
852
- window.removeEventListener("wheel", closeList);
853
- window.removeEventListener("touchmove", closeList);
854
- window.removeEventListener("mouseup", handleClickOutside);
855
- }
856
- (_getListContainer3 = getListContainer()) === null || _getListContainer3 === void 0 || _getListContainer3.addEventListener("click", closeList);
857
- return () => {
858
- var _getListContainer4;
859
- window.removeEventListener("mousewheel", closeList);
860
- window.removeEventListener("mouseup", handleClickOutside);
861
- window.removeEventListener("wheel", closeList);
862
- window.removeEventListener("touchmove", closeList);
863
- (_getListContainer4 = getListContainer()) === null || _getListContainer4 === void 0 || _getListContainer4.removeEventListener("click", closeList);
502
+ const onWrapperClick = (e)=>{
503
+ if (e.target === (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current)) {
504
+ e.stopPropagation();
505
+ e.preventDefault();
506
+ setIsOpen(false);
507
+ }
864
508
  };
865
- }, [getListContainer, isMobile]);
866
- (0, _react.useLayoutEffect)(() => {
867
- if (isOpen) {
868
- setListContainerStyles();
869
- setEditOptionModalStyles();
870
- }
871
- }, [isOpen, optionsProp, chosenOptions, searchValue, 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]);
872
- (0, _react.useEffect)(() => {
873
- if (isUseLocalOptionsStore && chosenOptions.length !== Object.keys(localOptionsStore).length) {
874
- options.map(option => {
875
- if (!(localOptionsStore !== null && localOptionsStore !== void 0 && localOptionsStore[option === null || option === void 0 ? void 0 : option.value])) {
876
- setLocalOptionsStore(options => ({
877
- ...options,
878
- [option === null || option === void 0 ? void 0 : option.value]: option === null || option === void 0 ? void 0 : option.label
879
- }));
509
+ const selectAllItems = ()=>{
510
+ var _prepareOptions;
511
+ const preparedOptions = (_prepareOptions = prepareOptions(options)) === null || _prepareOptions === void 0 ? void 0 : _prepareOptions.filter(({ isFreezed, value })=>!isFreezed && !(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.includes(value)) && value !== "open_modal");
512
+ if (isUseLocalOptionsStore) {
513
+ setLocalOptionsStore((options)=>preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.reduce((result, { value, label })=>{
514
+ result[value] = label;
515
+ return result;
516
+ }, options));
880
517
  }
881
- });
882
- }
883
- }, [chosenOptions, isUseLocalOptionsStore]);
884
- (0, _react.useEffect)(() => {
885
- var _selectAllButtonRef$c, _unselectAllButtonRef;
886
- const windowScrollEventHandler = e => {
887
- setWindowScrollTop(window.scrollY);
518
+ onChange([
519
+ ...chosenOptions,
520
+ ...(preparedOptions === null || preparedOptions === void 0 ? void 0 : preparedOptions.map(({ value })=>value)) || []
521
+ ], "chosenOptions");
522
+ if (isMobile ? closeOnSelectAllMobile : closeOnSelectAll) setIsOpen(false);
888
523
  };
889
- const fn = isOpen ? "addEventListener" : "removeEventListener";
890
- selectAllButtonRef === null || selectAllButtonRef === void 0 || (_selectAllButtonRef$c = selectAllButtonRef.current) === null || _selectAllButtonRef$c === void 0 || _selectAllButtonRef$c[fn]("click", selectAllItems, true);
891
- unselectAllButtonRef === null || unselectAllButtonRef === void 0 || (_unselectAllButtonRef = unselectAllButtonRef.current) === null || _unselectAllButtonRef === void 0 || _unselectAllButtonRef[fn]("click", unselectAllItems, true);
892
- if (isOpen) {
893
- var _getListContainer5;
894
- if (!isMobile || !withMobileLogic) window.removeEventListener("scroll", windowScrollEventHandler);
895
- if (customTriggerRef !== null && customTriggerRef !== void 0 && customTriggerRef.current) {
896
- customTriggerRef.current.style.pointerEvents = "none";
897
- }
898
- (_getListContainer5 = getListContainer()) === null || _getListContainer5 === void 0 || _getListContainer5.classList.add("tags-dropdown__container--opened");
899
- if (!isMobile) {
900
- var _inputRef$current2, _inputRef$current2$fo;
901
- 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);
902
- } else {
903
- var _inputRef$current3, _inputRef$current3$bl;
904
- 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);
905
- }
906
- } else {
907
- var _getListContainer6;
908
- if (!isMobile || !withMobileLogic) window.addEventListener("scroll", windowScrollEventHandler);
909
- if (customTriggerRef !== null && customTriggerRef !== void 0 && customTriggerRef.current) {
910
- customTriggerRef.current.style.pointerEvents = "auto";
911
- }
912
- (_getListContainer6 = getListContainer()) === null || _getListContainer6 === void 0 || _getListContainer6.classList.remove("tags-dropdown__container--opened");
913
- if (withSearchInputInList) setSearchValueInterceptor("");
914
- setListPos(null);
915
- setSearchValue("");
916
- }
917
- }, [isOpen]);
918
- (0, _react.useEffect)(() => {
919
- const setScrollTopValue = e => {
920
- setScrollTop(parseInt(e.target.scrollTop, 10));
524
+ const unselectAllItems = ()=>{
525
+ if (isUseLocalOptionsStore) setLocalOptionsStore({});
526
+ onChange(chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.filter((item)=>{
527
+ var _prepareOptions_find, _prepareOptions;
528
+ return (_prepareOptions = prepareOptions(options)) === null || _prepareOptions === void 0 ? void 0 : (_prepareOptions_find = _prepareOptions.find(({ value })=>value === item)) === null || _prepareOptions_find === void 0 ? void 0 : _prepareOptions_find.isFreezed;
529
+ }), "chosenOptions");
530
+ if (isMobile ? closeOnRemoveAllMobile : closeOnRemoveAll) setIsOpen(false);
921
531
  };
922
- const preventWindowScrolling = e => {
923
- e.preventDefault();
924
- window.scrollTo({
925
- top: windowScrollTop
926
- });
532
+ const doScrollCallback = (0, _react.useCallback)((e)=>{
533
+ if (doLiveSearchRequest && typeof doLiveSearchRequest === "function") {
534
+ if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight) {
535
+ doLiveSearchRequest(searchValueRef.current, true);
536
+ }
537
+ }
538
+ }, [
539
+ options
540
+ ]);
541
+ // --- RENDER FUNCTIONS BEGIN --- //
542
+ const getMarkupForElement = (item)=>{
543
+ const { description } = item;
544
+ const title = item.title || item.label;
545
+ const hightlightSearchValue = (title)=>{
546
+ var _title_toLowerCase;
547
+ 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());
548
+ if (index === -1) return title;
549
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("pre", {
550
+ className: "inherit-styles",
551
+ children: [
552
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
553
+ children: title.substring(0, index)
554
+ }),
555
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
556
+ className: "search-match bg--yellow",
557
+ children: title.substring(index, index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length))
558
+ }),
559
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
560
+ children: title.substring(index + (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length))
561
+ })
562
+ ]
563
+ });
564
+ };
565
+ var _item_customMobileIcon;
566
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("button", {
567
+ ref: item === null || item === void 0 ? void 0 : item.ref,
568
+ onClick: (e)=>{
569
+ e.preventDefault();
570
+ e.stopPropagation();
571
+ onChangeHandler(item);
572
+ },
573
+ className: (0, _classnames.default)(`${RC}__list-item`, {
574
+ [`${RC}__list-item_active`]: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some((value)=>value === item.value)
575
+ }, {
576
+ [`${RC}__list-item_disabled`]: item.disabled
577
+ }, {
578
+ [`${RC}__list-item_freezed`]: item === null || item === void 0 ? void 0 : item.isFreezed
579
+ }, {
580
+ [`${RC}__list-item--editing`]: (item === null || item === void 0 ? void 0 : item.value) === (editingOption === null || editingOption === void 0 ? void 0 : editingOption.value)
581
+ }, item.className),
582
+ children: [
583
+ !isMobile && /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
584
+ className: (0, _classnames.default)(`${RC}__active-icon`, {
585
+ [`${RC}__active-icon_active`]: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some((value)=>value === item.value)
586
+ }),
587
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactfeather.Check, {
588
+ width: 16,
589
+ height: 16,
590
+ className: "color--text"
591
+ })
592
+ }),
593
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
594
+ className: (0, _classnames.default)(`${RC}__list-item-body`),
595
+ children: [
596
+ renderOptionsAsTags ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_Tag.default, {
597
+ className: (0, _classnames.default)(`${RC}__list-item-title`, item === null || item === void 0 ? void 0 : item.labelClassName, {
598
+ "tag_with-btn": !(item === null || item === void 0 ? void 0 : item.isFreezed)
599
+ }),
600
+ label: hightlightSearchValue(title),
601
+ style: item === null || item === void 0 ? void 0 : item.style,
602
+ isNoDismiss: true
603
+ }, item === null || item === void 0 ? void 0 : item.value) : /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
604
+ className: (0, _classnames.default)(`${RC}__list-item-title`, item.labelClassName),
605
+ children: hightlightSearchValue(title)
606
+ }),
607
+ description && /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
608
+ className: (0, _classnames.default)(`${RC}__list-item-description`),
609
+ children: description
610
+ })
611
+ ]
612
+ }),
613
+ !isMobile && (item === null || item === void 0 ? void 0 : item.isEditable) && onOptionEdit && onOptionDelete && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
614
+ id: `editTrigger${item === null || item === void 0 ? void 0 : item.value}`,
615
+ className: (0, _classnames.default)(`${RC}__list-item-edit-trigger`),
616
+ onClick: (e)=>onOptionEditClick(e, item),
617
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactfeather.MoreHorizontal, {})
618
+ }),
619
+ isMobile ? (_item_customMobileIcon = item === null || item === void 0 ? void 0 : item.customMobileIcon) !== null && _item_customMobileIcon !== void 0 ? _item_customMobileIcon : /*#__PURE__*/ (0, _jsxruntime.jsx)(_CheckboxInput.default, {
620
+ value: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.some((value)=>value === item.value),
621
+ onChange: ()=>{
622
+ onChangeHandler(item);
623
+ }
624
+ }) : ""
625
+ ]
626
+ }, `${RC}__list-item-${item.id || item.value}`);
927
627
  };
928
- if (isOpen && isMobile && dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
929
- var _dropdownListRef$curr, _dropdownListRef$curr2, _dropdownListRef$curr3;
930
- dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr = dropdownListRef.current) === null || _dropdownListRef$curr === void 0 || _dropdownListRef$curr.addEventListener("scroll", setScrollTopValue);
931
- 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));
932
- if (isScrollableList === null) {
933
- var _dropdownListRef$curr4, _dropdownListRef$curr5;
934
- 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));
935
- }
936
- }
937
- if (isOpen && dropdownListRef && dropdownListRef.current) {
938
- dropdownListRef.current.addEventListener("scroll", doScrollCallback);
939
- if (!isMobile || !withMobileLogic) window.addEventListener("scroll", preventWindowScrolling);
940
- }
941
- return () => {
942
- var _dropdownListRef$curr6, _dropdownListRef$curr7;
943
- if (!isMobile || !withMobileLogic) window.removeEventListener("scroll", preventWindowScrolling);
944
- dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr6 = dropdownListRef.current) === null || _dropdownListRef$curr6 === void 0 || _dropdownListRef$curr6.removeEventListener("scroll", doScrollCallback);
945
- dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr7 = dropdownListRef.current) === null || _dropdownListRef$curr7 === void 0 || _dropdownListRef$curr7.removeEventListener("scroll", setScrollTopValue);
628
+ const getListMarkUp = ()=>{
629
+ var _filteredOptions_filter, _filteredOptions_filter1;
630
+ const filteredOptions = getFilteredOptions(options);
631
+ const arrToPrint = [];
632
+ for (const option of filteredOptions){
633
+ if (option.groupName) {
634
+ var _option_list, _option_groupName_toString, _option_groupName;
635
+ arrToPrint.push(/*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
636
+ className: (0, _classnames.default)(`${RC}-group`, option.className),
637
+ children: [
638
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
639
+ className: `${RC}-group__name`,
640
+ children: option.groupName
641
+ }),
642
+ (_option_list = option.list) === null || _option_list === void 0 ? void 0 : _option_list.map((item)=>getMarkupForElement(item))
643
+ ]
644
+ }, (_option_groupName = option.groupName) === null || _option_groupName === void 0 ? void 0 : (_option_groupName_toString = _option_groupName.toString()) === null || _option_groupName_toString === void 0 ? void 0 : _option_groupName_toString.replace(/ /g, "_").concat(Date.now())));
645
+ } else arrToPrint.push(getMarkupForElement(option));
646
+ }
647
+ var _document_getElementById;
648
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
649
+ className: (0, _classnames.default)(`${RC}__container-wrapper`),
650
+ ref: wrapperRef,
651
+ onClick: isMobile ? onWrapperClick : ()=>{},
652
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
653
+ ref: dropdownListWrapperRef,
654
+ className: (0, _classnames.default)(`${RC}__selector-wrapper`, {
655
+ [`${RC}__selector-wrapper--fixed-height`]: isFixedMaxHeight && isMobile
656
+ }),
657
+ children: [
658
+ headerContent || isMobile ? /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
659
+ className: (0, _classnames.default)(`${RC}__header`, {
660
+ [`${RC}__header-with-shadow`]: isScrollableList && isMobile,
661
+ [`${RC}__header-with-shadow-hidden`]: scrollTop === 0
662
+ }),
663
+ children: [
664
+ isMobile && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
665
+ children: [
666
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
667
+ className: (0, _classnames.default)(`${RC}__header-row`),
668
+ children: [
669
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
670
+ className: (0, _classnames.default)(`${RC}__label`),
671
+ children: label
672
+ }),
673
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
674
+ className: (0, _classnames.default)(`${RC}__close-icon`),
675
+ onClick: (e)=>{
676
+ e.stopPropagation();
677
+ setIsOpen(false);
678
+ },
679
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactfeather.X, {
680
+ onClick: (e)=>{
681
+ e.stopPropagation();
682
+ setIsOpen(false);
683
+ }
684
+ })
685
+ })
686
+ ]
687
+ }),
688
+ getTotalOptions() > (minItemsForShowMobileSearch || MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH) && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
689
+ className: (0, _classnames.default)(`${RC}__header-row`),
690
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Input.default, {
691
+ className: `${RC}__input`,
692
+ value: searchValue,
693
+ onChange: (v)=>setSearchValueInterceptor(v),
694
+ placeholder: mobileSearchPlaceholder || "Search",
695
+ withDelete: true,
696
+ onMouseDown: ()=>{
697
+ if (!isOpen) {
698
+ setIsOpen(true);
699
+ }
700
+ },
701
+ ...attributesOfNativeInput
702
+ })
703
+ })
704
+ ]
705
+ }),
706
+ headerContent && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
707
+ className: (0, _classnames.default)(`${RC}__header-row`),
708
+ children: headerContent
709
+ })
710
+ ]
711
+ }) : null,
712
+ withSearchInputInList && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
713
+ className: (0, _classnames.default)(`${RC}__input-list-wrapper`),
714
+ children: renderSearchInput()
715
+ }),
716
+ withCreateLogic && onOptionCreate && searchValue && filteredOptions.length && singleLevelOptions.every(({ label })=>(label === null || label === void 0 ? void 0 : label.toLowerCase()) !== (searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase())) ? /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
717
+ className: (0, _classnames.default)(`${RC}__creatable-helper`),
718
+ children: "Select an option or create one"
719
+ }) : null,
720
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
721
+ ref: dropdownListRef,
722
+ className: `${RC}__list ${headerContent || isMobile ? `${RC}__list--with-header` : ""} ${footerContent ? `${RC}__list--with-footer` : ""}`,
723
+ children: [
724
+ arrToPrint,
725
+ ((_filteredOptions_filter = filteredOptions.filter(({ value })=>value !== "open_modal")) === null || _filteredOptions_filter === void 0 ? void 0 : _filteredOptions_filter.length) === 0 && (!withCreateLogic || !searchValue) ? /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
726
+ className: `${RC}__no-options`,
727
+ children: noOptionsText
728
+ }) : null
729
+ ]
730
+ }),
731
+ (footerContent || isMobile) && ((_filteredOptions_filter1 = filteredOptions.filter(({ value })=>value !== "open_modal")) === null || _filteredOptions_filter1 === void 0 ? void 0 : _filteredOptions_filter1.length) > 0 ? /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
732
+ className: (0, _classnames.default)(`${RC}__footer`, {
733
+ [`${RC}__footer-with-shadow`]: isMobile && isScrollableList,
734
+ [`${RC}__footer-with-shadow-hidden`]: scrollTop === scrollHeight
735
+ }),
736
+ children: [
737
+ footerContent,
738
+ isMobile && /*#__PURE__*/ (0, _jsxruntime.jsxs)("button", {
739
+ onClick: ()=>setIsOpen(false),
740
+ children: [
741
+ "Apply",
742
+ (chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.length) ? `(${chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.length})` : ""
743
+ ]
744
+ })
745
+ ]
746
+ }) : null,
747
+ editingOption && /*#__PURE__*/ (0, _reactdom.createPortal)(renderEditOptionModal(), (_document_getElementById = document.getElementById("app")) !== null && _document_getElementById !== void 0 ? _document_getElementById : document.body),
748
+ withCreateLogic && onOptionCreate && searchValue && singleLevelOptions.every(({ label })=>(label === null || label === void 0 ? void 0 : label.toLowerCase()) !== (searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase())) && /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
749
+ className: (0, _classnames.default)(`${RC}__create-option`),
750
+ onClick: onOptionCreateClick,
751
+ children: [
752
+ "Create",
753
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_Tag.default, {
754
+ label: searchValue,
755
+ style: {
756
+ backgroundColor: randomColorForNewOption
757
+ },
758
+ isNoDismiss: true
759
+ })
760
+ ]
761
+ })
762
+ ]
763
+ })
764
+ });
946
765
  };
947
- }, [isOpen, isMobile, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current, dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr8 = dropdownListRef.current) === null || _dropdownListRef$curr8 === void 0 ? void 0 : _dropdownListRef$curr8.scrollHeight, dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr9 = dropdownListRef.current) === null || _dropdownListRef$curr9 === void 0 ? void 0 : _dropdownListRef$curr9.clientHeight]);
948
- (0, _react.useEffect)(() => {
949
- if (dropdownListRef !== null && dropdownListRef !== void 0 && dropdownListRef.current) {
950
- var _dropdownListRef$curr10, _dropdownListRef$curr11;
951
- setScrollHeight(parseInt((dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr10 = dropdownListRef.current) === null || _dropdownListRef$curr10 === void 0 ? void 0 : _dropdownListRef$curr10.scrollHeight) - (dropdownListRef === null || dropdownListRef === void 0 || (_dropdownListRef$curr11 = dropdownListRef.current) === null || _dropdownListRef$curr11 === void 0 ? void 0 : _dropdownListRef$curr11.clientHeight), 10));
952
- }
953
- }, [scrollTop, dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current]);
954
- (0, _react.useEffect)(() => {
955
- if (isSearchable && useLiveSearch && (debouncedSearchTerm || isValueDeleted || isOpen)) {
956
- doLiveSearchRequest === null || doLiveSearchRequest === void 0 || doLiveSearchRequest(debouncedSearchTerm);
957
- }
958
- }, [isOpen, debouncedSearchTerm, isValueDeleted]);
959
- (0, _react.useEffect)(() => {
960
- setOptions(optionsProp.map(option => ({
961
- ...option,
962
- ref: /*#__PURE__*/(0, _react.createRef)()
963
- })));
964
- }, [optionsProp]);
965
- (0, _react.useEffect)(() => {
966
- if (editingOption) {
967
- var _editingOptionInputRe, _editingOptionInputRe2;
968
- setEditOptionModalStyles();
969
- editingOptionInputRef === null || editingOptionInputRef === void 0 || (_editingOptionInputRe = editingOptionInputRef.current) === null || _editingOptionInputRe === void 0 || (_editingOptionInputRe2 = _editingOptionInputRe.focus) === null || _editingOptionInputRe2 === void 0 || _editingOptionInputRe2.call(_editingOptionInputRe);
970
- }
971
- }, [editingOption === null || editingOption === void 0 ? void 0 : editingOption.value]);
972
- return /*#__PURE__*/_react.default.createElement("div", {
973
- className: (0, _classnames.default)(RC, className, {
974
- ["".concat(RC, "_disabled")]: disabled,
975
- ["".concat(RC, "-mobile")]: isMobile,
976
- ["".concat(RC, "--focused")]: isOpen && !(customTriggerRef !== null && customTriggerRef !== void 0 && customTriggerRef.current) && !isMobile,
977
- ["".concat(RC, "--custom-trigger")]: Boolean(customTriggerRef === null || customTriggerRef === void 0 ? void 0 : customTriggerRef.current)
978
- }),
979
- ref: dropdownRef
980
- }, renderDropdownTrigger(), withActions && /*#__PURE__*/_react.default.createElement("div", {
981
- className: (0, _classnames.default)("".concat(RC, "__actions"))
982
- }, /*#__PURE__*/_react.default.createElement("div", {
983
- className: (0, _classnames.default)("".concat(RC, "__actions-item")),
984
- onClick: onActionConfirmClick
985
- }, /*#__PURE__*/_react.default.createElement(_reactFeather.Check, null)), /*#__PURE__*/_react.default.createElement("div", {
986
- className: (0, _classnames.default)("".concat(RC, "__actions-item")),
987
- onClick: onActionCancelClick
988
- }, /*#__PURE__*/_react.default.createElement(_reactFeather.X, null))), isOpen && renderListContainer());
766
+ const renderSearchInput = ()=>{
767
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_Input.default, {
768
+ ref: inputRef,
769
+ className: (0, _classnames.default)(`${RC}__input`, {
770
+ [`${RC}__input--in-list`]: withSearchInputInList
771
+ }),
772
+ value: searchValue,
773
+ onChange: onSearchHandler,
774
+ placeholder: placeholder || "Select from list",
775
+ attributesOfNativeInput: {
776
+ ...attributesOfNativeInput,
777
+ onKeyDown: (e)=>{
778
+ if (e.keyCode === 13 && withCreateLogic && onOptionCreate && singleLevelOptions.every(({ label })=>(label === null || label === void 0 ? void 0 : label.toLowerCase()) !== (searchValue === null || searchValue === void 0 ? void 0 : searchValue.toLowerCase()))) {
779
+ onOptionCreateClick();
780
+ }
781
+ onKeyPress(e, searchValue);
782
+ }
783
+ },
784
+ ...withCreateLogic ? {
785
+ symbolsLimit: 50
786
+ } : {}
787
+ });
788
+ };
789
+ const renderDropdownTrigger = (0, _react.useCallback)(()=>{
790
+ const renderDefaultDropdownTrigger = ()=>{
791
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
792
+ className: (0, _classnames.default)(`${RC}__trigger`, {
793
+ "tags-dropdown__error": error,
794
+ [`${RC}__trigger--with-actions`]: withActions
795
+ }),
796
+ onClick: ({ target })=>{
797
+ if ((target === null || target === void 0 ? void 0 : target.tagName) === "INPUT") {
798
+ setIsOpen(true);
799
+ } else if (isTargetInParent(target)) {
800
+ setIsOpen((isOpen)=>!isOpen);
801
+ }
802
+ },
803
+ children: [
804
+ noTagsWrap ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_TagList.default, {
805
+ items: chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.map((value, i)=>{
806
+ const tag = singleLevelOptions === null || singleLevelOptions === void 0 ? void 0 : singleLevelOptions.find((el)=>el.value == value);
807
+ const label = isValuesInTags ? tag === null || tag === void 0 ? void 0 : tag.value : (tag === null || tag === void 0 ? void 0 : tag.label) || (tag === null || tag === void 0 ? void 0 : tag.name) || (tag === null || tag === void 0 ? void 0 : tag.title);
808
+ return {
809
+ value,
810
+ label,
811
+ id: i,
812
+ className: tag === null || tag === void 0 ? void 0 : tag.labelClassName,
813
+ style: tag === null || tag === void 0 ? void 0 : tag.style
814
+ };
815
+ }),
816
+ disableShowMore: true
817
+ }) : chosenOptions === null || chosenOptions === void 0 ? void 0 : chosenOptions.map((value)=>{
818
+ const tag = singleLevelOptions === null || singleLevelOptions === void 0 ? void 0 : singleLevelOptions.find((el)=>el.value == value);
819
+ const label = isValuesInTags ? tag === null || tag === void 0 ? void 0 : tag.value : (tag === null || tag === void 0 ? void 0 : tag.label) || (tag === null || tag === void 0 ? void 0 : tag.name) || (tag === null || tag === void 0 ? void 0 : tag.title);
820
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_Tag.default, {
821
+ className: (0, _classnames.default)(tagClassname, tag === null || tag === void 0 ? void 0 : tag.labelClassName, {
822
+ "tag_with-btn": !(tag === null || tag === void 0 ? void 0 : tag.isFreezed)
823
+ }),
824
+ label: label,
825
+ style: tag === null || tag === void 0 ? void 0 : tag.style,
826
+ removeItem: (tag === null || tag === void 0 ? void 0 : tag.isFreezed) ? null : ()=>deleteChosen(value),
827
+ isNoDismiss: false
828
+ }, value);
829
+ }),
830
+ chosenOptions.length === 0 || !noTagsWrap ? renderSearchInput() : "",
831
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("span", {
832
+ className: (0, _classnames.default)(`${RC}__arrow`, {
833
+ [`${RC}__arrow_active`]: isOpen
834
+ }),
835
+ children: isMobile ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactfeather.Code, {
836
+ className: "mobile-icon"
837
+ }) : isOpen ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactfeather.ChevronUp, {
838
+ className: "color--text"
839
+ }) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactfeather.ChevronDown, {
840
+ className: "color--text"
841
+ })
842
+ })
843
+ ]
844
+ });
845
+ };
846
+ var _renderCustomTrigger;
847
+ return (_renderCustomTrigger = renderCustomTrigger === null || renderCustomTrigger === void 0 ? void 0 : renderCustomTrigger({
848
+ chosenOptions,
849
+ singleLevelOptions,
850
+ deleteChosen,
851
+ inputRef,
852
+ onSearchHandler,
853
+ isOpen,
854
+ setIsOpen
855
+ })) !== null && _renderCustomTrigger !== void 0 ? _renderCustomTrigger : renderDefaultDropdownTrigger();
856
+ }, [
857
+ chosenOptions,
858
+ singleLevelOptions,
859
+ inputRef,
860
+ isOpen
861
+ ]);
862
+ // --- RENDER FUNCTIONS END --- //
863
+ (0, _react.useLayoutEffect)(()=>{
864
+ initListContainer();
865
+ if (isDefaultOpened && !isMobileProp) setIsOpen(true);
866
+ return ()=>{
867
+ var _getListContainer, _getListContainerWrapper;
868
+ (_getListContainer = getListContainer()) === null || _getListContainer === void 0 ? void 0 : _getListContainer.remove();
869
+ (_getListContainerWrapper = getListContainerWrapper()) === null || _getListContainerWrapper === void 0 ? void 0 : _getListContainerWrapper.remove();
870
+ };
871
+ }, []);
872
+ (0, _react.useLayoutEffect)(()=>{
873
+ var _getListContainer;
874
+ if (!isMobile) {
875
+ window.addEventListener("mousewheel", closeList);
876
+ window.addEventListener("wheel", closeList);
877
+ window.addEventListener("touchmove", closeList);
878
+ window.addEventListener("mouseup", handleClickOutside);
879
+ } else {
880
+ window.removeEventListener("mousewheel", closeList);
881
+ window.removeEventListener("wheel", closeList);
882
+ window.removeEventListener("touchmove", closeList);
883
+ window.removeEventListener("mouseup", handleClickOutside);
884
+ }
885
+ (_getListContainer = getListContainer()) === null || _getListContainer === void 0 ? void 0 : _getListContainer.addEventListener("click", closeList);
886
+ return ()=>{
887
+ var _getListContainer;
888
+ window.removeEventListener("mousewheel", closeList);
889
+ window.removeEventListener("mouseup", handleClickOutside);
890
+ window.removeEventListener("wheel", closeList);
891
+ window.removeEventListener("touchmove", closeList);
892
+ (_getListContainer = getListContainer()) === null || _getListContainer === void 0 ? void 0 : _getListContainer.removeEventListener("click", closeList);
893
+ };
894
+ }, [
895
+ getListContainer,
896
+ isMobile
897
+ ]);
898
+ (0, _react.useLayoutEffect)(()=>{
899
+ if (isOpen) {
900
+ setListContainerStyles();
901
+ setEditOptionModalStyles();
902
+ }
903
+ }, [
904
+ isOpen,
905
+ optionsProp,
906
+ chosenOptions,
907
+ searchValue,
908
+ isMobile,
909
+ dropdownListWrapperRef === null || dropdownListWrapperRef === void 0 ? void 0 : (_dropdownListWrapperRef_current = dropdownListWrapperRef.current) === null || _dropdownListWrapperRef_current === void 0 ? void 0 : (_dropdownListWrapperRef_current_getBoundingClientRect = _dropdownListWrapperRef_current.getBoundingClientRect()) === null || _dropdownListWrapperRef_current_getBoundingClientRect === void 0 ? void 0 : _dropdownListWrapperRef_current_getBoundingClientRect.height,
910
+ recalculateListContainerStylesTrigger
911
+ ]);
912
+ (0, _react.useEffect)(()=>{
913
+ if (isUseLocalOptionsStore && chosenOptions.length !== Object.keys(localOptionsStore).length) {
914
+ options.map((option)=>{
915
+ if (!(localOptionsStore === null || localOptionsStore === void 0 ? void 0 : localOptionsStore[option === null || option === void 0 ? void 0 : option.value])) {
916
+ setLocalOptionsStore((options)=>({
917
+ ...options,
918
+ [option === null || option === void 0 ? void 0 : option.value]: option === null || option === void 0 ? void 0 : option.label
919
+ }));
920
+ }
921
+ });
922
+ }
923
+ }, [
924
+ chosenOptions,
925
+ isUseLocalOptionsStore
926
+ ]);
927
+ (0, _react.useEffect)(()=>{
928
+ var _selectAllButtonRef_current, _unselectAllButtonRef_current;
929
+ const windowScrollEventHandler = (e)=>{
930
+ setWindowScrollTop(window.scrollY);
931
+ };
932
+ const fn = isOpen ? "addEventListener" : "removeEventListener";
933
+ selectAllButtonRef === null || selectAllButtonRef === void 0 ? void 0 : (_selectAllButtonRef_current = selectAllButtonRef.current) === null || _selectAllButtonRef_current === void 0 ? void 0 : _selectAllButtonRef_current[fn]("click", selectAllItems, true);
934
+ unselectAllButtonRef === null || unselectAllButtonRef === void 0 ? void 0 : (_unselectAllButtonRef_current = unselectAllButtonRef.current) === null || _unselectAllButtonRef_current === void 0 ? void 0 : _unselectAllButtonRef_current[fn]("click", unselectAllItems, true);
935
+ if (isOpen) {
936
+ var _getListContainer;
937
+ if (!isMobile || !withMobileLogic) window.removeEventListener("scroll", windowScrollEventHandler);
938
+ if (customTriggerRef === null || customTriggerRef === void 0 ? void 0 : customTriggerRef.current) {
939
+ customTriggerRef.current.style.pointerEvents = "none";
940
+ }
941
+ (_getListContainer = getListContainer()) === null || _getListContainer === void 0 ? void 0 : _getListContainer.classList.add("tags-dropdown__container--opened");
942
+ if (!isMobile) {
943
+ var _inputRef_current_focus, _inputRef_current;
944
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : (_inputRef_current_focus = _inputRef_current.focus) === null || _inputRef_current_focus === void 0 ? void 0 : _inputRef_current_focus.call(_inputRef_current);
945
+ } else {
946
+ var _inputRef_current_blur, _inputRef_current1;
947
+ inputRef === null || inputRef === void 0 ? void 0 : (_inputRef_current1 = inputRef.current) === null || _inputRef_current1 === void 0 ? void 0 : (_inputRef_current_blur = _inputRef_current1.blur) === null || _inputRef_current_blur === void 0 ? void 0 : _inputRef_current_blur.call(_inputRef_current1);
948
+ }
949
+ } else {
950
+ var _getListContainer1;
951
+ if (!isMobile || !withMobileLogic) window.addEventListener("scroll", windowScrollEventHandler);
952
+ if (customTriggerRef === null || customTriggerRef === void 0 ? void 0 : customTriggerRef.current) {
953
+ customTriggerRef.current.style.pointerEvents = "auto";
954
+ }
955
+ (_getListContainer1 = getListContainer()) === null || _getListContainer1 === void 0 ? void 0 : _getListContainer1.classList.remove("tags-dropdown__container--opened");
956
+ if (withSearchInputInList) setSearchValueInterceptor("");
957
+ setListPos(null);
958
+ setSearchValue("");
959
+ }
960
+ }, [
961
+ isOpen
962
+ ]);
963
+ (0, _react.useEffect)(()=>{
964
+ const setScrollTopValue = (e)=>{
965
+ setScrollTop(parseInt(e.target.scrollTop, 10));
966
+ };
967
+ const preventWindowScrolling = (e)=>{
968
+ e.preventDefault();
969
+ window.scrollTo({
970
+ top: windowScrollTop
971
+ });
972
+ };
973
+ if (isOpen && isMobile && (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current)) {
974
+ var _dropdownListRef_current, _dropdownListRef_current1, _dropdownListRef_current2;
975
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef_current = dropdownListRef.current) === null || _dropdownListRef_current === void 0 ? void 0 : _dropdownListRef_current.addEventListener("scroll", setScrollTopValue);
976
+ setIsScrollableList((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef_current1 = dropdownListRef.current) === null || _dropdownListRef_current1 === void 0 ? void 0 : _dropdownListRef_current1.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef_current2 = dropdownListRef.current) === null || _dropdownListRef_current2 === void 0 ? void 0 : _dropdownListRef_current2.clientHeight));
977
+ if (isScrollableList === null) {
978
+ var _dropdownListRef_current3, _dropdownListRef_current4;
979
+ setIsFixedMaxHeight((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef_current3 = dropdownListRef.current) === null || _dropdownListRef_current3 === void 0 ? void 0 : _dropdownListRef_current3.scrollHeight) > (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef_current4 = dropdownListRef.current) === null || _dropdownListRef_current4 === void 0 ? void 0 : _dropdownListRef_current4.clientHeight));
980
+ }
981
+ }
982
+ if (isOpen && dropdownListRef && dropdownListRef.current) {
983
+ dropdownListRef.current.addEventListener("scroll", doScrollCallback);
984
+ if (!isMobile || !withMobileLogic) window.addEventListener("scroll", preventWindowScrolling);
985
+ }
986
+ return ()=>{
987
+ var _dropdownListRef_current, _dropdownListRef_current1;
988
+ if (!isMobile || !withMobileLogic) window.removeEventListener("scroll", preventWindowScrolling);
989
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef_current = dropdownListRef.current) === null || _dropdownListRef_current === void 0 ? void 0 : _dropdownListRef_current.removeEventListener("scroll", doScrollCallback);
990
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef_current1 = dropdownListRef.current) === null || _dropdownListRef_current1 === void 0 ? void 0 : _dropdownListRef_current1.removeEventListener("scroll", setScrollTopValue);
991
+ };
992
+ }, [
993
+ isOpen,
994
+ isMobile,
995
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current,
996
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef_current = dropdownListRef.current) === null || _dropdownListRef_current === void 0 ? void 0 : _dropdownListRef_current.scrollHeight,
997
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef_current1 = dropdownListRef.current) === null || _dropdownListRef_current1 === void 0 ? void 0 : _dropdownListRef_current1.clientHeight
998
+ ]);
999
+ (0, _react.useEffect)(()=>{
1000
+ if (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current) {
1001
+ var _dropdownListRef_current, _dropdownListRef_current1;
1002
+ setScrollHeight(parseInt((dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef_current = dropdownListRef.current) === null || _dropdownListRef_current === void 0 ? void 0 : _dropdownListRef_current.scrollHeight) - (dropdownListRef === null || dropdownListRef === void 0 ? void 0 : (_dropdownListRef_current1 = dropdownListRef.current) === null || _dropdownListRef_current1 === void 0 ? void 0 : _dropdownListRef_current1.clientHeight), 10));
1003
+ }
1004
+ }, [
1005
+ scrollTop,
1006
+ dropdownListRef === null || dropdownListRef === void 0 ? void 0 : dropdownListRef.current
1007
+ ]);
1008
+ (0, _react.useEffect)(()=>{
1009
+ if (isSearchable && useLiveSearch && (debouncedSearchTerm || isValueDeleted || isOpen)) {
1010
+ doLiveSearchRequest === null || doLiveSearchRequest === void 0 ? void 0 : doLiveSearchRequest(debouncedSearchTerm);
1011
+ }
1012
+ }, [
1013
+ isOpen,
1014
+ debouncedSearchTerm,
1015
+ isValueDeleted
1016
+ ]);
1017
+ (0, _react.useEffect)(()=>{
1018
+ setOptions(optionsProp.map((option)=>({
1019
+ ...option,
1020
+ ref: /*#__PURE__*/ (0, _react.createRef)()
1021
+ })));
1022
+ }, [
1023
+ optionsProp
1024
+ ]);
1025
+ (0, _react.useEffect)(()=>{
1026
+ if (editingOption) {
1027
+ var _editingOptionInputRef_current_focus, _editingOptionInputRef_current;
1028
+ setEditOptionModalStyles();
1029
+ editingOptionInputRef === null || editingOptionInputRef === void 0 ? void 0 : (_editingOptionInputRef_current = editingOptionInputRef.current) === null || _editingOptionInputRef_current === void 0 ? void 0 : (_editingOptionInputRef_current_focus = _editingOptionInputRef_current.focus) === null || _editingOptionInputRef_current_focus === void 0 ? void 0 : _editingOptionInputRef_current_focus.call(_editingOptionInputRef_current);
1030
+ }
1031
+ }, [
1032
+ editingOption === null || editingOption === void 0 ? void 0 : editingOption.value
1033
+ ]);
1034
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
1035
+ className: (0, _classnames.default)(RC, className, {
1036
+ [`${RC}_disabled`]: disabled,
1037
+ [`${RC}-mobile`]: isMobile,
1038
+ [`${RC}--focused`]: isOpen && !(customTriggerRef === null || customTriggerRef === void 0 ? void 0 : customTriggerRef.current) && !isMobile,
1039
+ [`${RC}--custom-trigger`]: Boolean(customTriggerRef === null || customTriggerRef === void 0 ? void 0 : customTriggerRef.current)
1040
+ }),
1041
+ ref: dropdownRef,
1042
+ children: [
1043
+ renderDropdownTrigger(),
1044
+ withActions && /*#__PURE__*/ (0, _jsxruntime.jsxs)("div", {
1045
+ className: (0, _classnames.default)(`${RC}__actions`),
1046
+ children: [
1047
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
1048
+ className: (0, _classnames.default)(`${RC}__actions-item`),
1049
+ onClick: onActionConfirmClick,
1050
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactfeather.Check, {})
1051
+ }),
1052
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
1053
+ className: (0, _classnames.default)(`${RC}__actions-item`),
1054
+ onClick: onActionCancelClick,
1055
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactfeather.X, {})
1056
+ })
1057
+ ]
1058
+ }),
1059
+ isOpen && renderListContainer()
1060
+ ]
1061
+ });
989
1062
  };
990
- var _default = exports.default = TagsDropdown;
1063
+ const _default = TagsDropdown;