@true-engineering/true-react-common-ui-kit 3.45.2 → 3.45.3

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 (697) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +7 -1
  3. package/dist/components/AccountInfo/AccountInfo.d.ts +11 -11
  4. package/dist/components/AccountInfo/AccountInfo.stories.d.ts +6 -6
  5. package/dist/components/AccountInfo/AccountInfo.styles.d.ts +6 -6
  6. package/dist/components/AccountInfo/constants.d.ts +1 -1
  7. package/dist/components/AccountInfo/index.d.ts +2 -2
  8. package/dist/components/AddButton/AddButton.d.ts +14 -14
  9. package/dist/components/AddButton/AddButton.stories.d.ts +6 -6
  10. package/dist/components/AddButton/AddButton.styles.d.ts +3 -3
  11. package/dist/components/AddButton/index.d.ts +2 -2
  12. package/dist/components/Button/Button.d.ts +41 -41
  13. package/dist/components/Button/Button.stories.d.ts +6 -6
  14. package/dist/components/Button/Button.styles.d.ts +8 -8
  15. package/dist/components/Button/constants.d.ts +2 -2
  16. package/dist/components/Button/index.d.ts +3 -3
  17. package/dist/components/Button/types.d.ts +3 -3
  18. package/dist/components/Checkbox/Checkbox.d.ts +24 -24
  19. package/dist/components/Checkbox/Checkbox.stories.d.ts +8 -8
  20. package/dist/components/Checkbox/Checkbox.styles.d.ts +3 -3
  21. package/dist/components/Checkbox/index.d.ts +2 -2
  22. package/dist/components/CloseButton/CloseButton.d.ts +10 -10
  23. package/dist/components/CloseButton/CloseButton.stories.d.ts +5 -5
  24. package/dist/components/CloseButton/CloseButton.styles.d.ts +3 -3
  25. package/dist/components/CloseButton/index.d.ts +2 -2
  26. package/dist/components/Colors/Colors.d.ts +2 -2
  27. package/dist/components/Colors/Colors.stories.d.ts +5 -5
  28. package/dist/components/Colors/Colors.styles.d.ts +1 -1
  29. package/dist/components/Colors/index.d.ts +1 -1
  30. package/dist/components/CssBaseline/CssBaseline.d.ts +5 -5
  31. package/dist/components/CssBaseline/CssBaseline.styles.d.ts +3 -3
  32. package/dist/components/CssBaseline/index.d.ts +2 -2
  33. package/dist/components/DateInput/DateInput.d.ts +17 -17
  34. package/dist/components/DateInput/DateInput.stories.d.ts +7 -7
  35. package/dist/components/DateInput/DateInput.styles.d.ts +6 -6
  36. package/dist/components/DateInput/constants.d.ts +2 -2
  37. package/dist/components/DateInput/index.d.ts +3 -3
  38. package/dist/components/DatePicker/DatePicker.d.ts +26 -26
  39. package/dist/components/DatePicker/DatePicker.stories.d.ts +7 -7
  40. package/dist/components/DatePicker/DatePicker.styles.d.ts +6 -6
  41. package/dist/components/DatePicker/components/DatePickerHeader/DatePickerHeader.d.ts +8 -8
  42. package/dist/components/DatePicker/components/DatePickerHeader/DatePickerHeader.styles.d.ts +7 -7
  43. package/dist/components/DatePicker/components/DatePickerHeader/index.d.ts +2 -2
  44. package/dist/components/DatePicker/components/PopperContainer/PopperContainer.d.ts +4 -4
  45. package/dist/components/DatePicker/components/PopperContainer/index.d.ts +1 -1
  46. package/dist/components/DatePicker/components/index.d.ts +2 -2
  47. package/dist/components/DatePicker/constants.d.ts +3 -3
  48. package/dist/components/DatePicker/helpers.d.ts +3 -3
  49. package/dist/components/DatePicker/index.d.ts +4 -4
  50. package/dist/components/DatePicker/types.d.ts +4 -4
  51. package/dist/components/Description/Description.d.ts +13 -13
  52. package/dist/components/Description/Description.stories.d.ts +16 -16
  53. package/dist/components/Description/Description.styles.d.ts +3 -3
  54. package/dist/components/Description/constants.d.ts +1 -1
  55. package/dist/components/Description/index.d.ts +2 -2
  56. package/dist/components/FileInput/FileInput.d.ts +25 -25
  57. package/dist/components/FileInput/FileInput.stories.d.ts +7 -7
  58. package/dist/components/FileInput/FileInput.styles.d.ts +3 -3
  59. package/dist/components/FileInput/helpers.d.ts +2 -2
  60. package/dist/components/FileInput/index.d.ts +2 -2
  61. package/dist/components/FileItem/FileItem.d.ts +31 -31
  62. package/dist/components/FileItem/FileItem.stories.d.ts +8 -8
  63. package/dist/components/FileItem/FileItem.styles.d.ts +11 -11
  64. package/dist/components/FileItem/constants.d.ts +5 -5
  65. package/dist/components/FileItem/helpers.d.ts +4 -4
  66. package/dist/components/FileItem/index.d.ts +4 -4
  67. package/dist/components/FileItem/types.d.ts +8 -8
  68. package/dist/components/FiltersPane/FiltersPane.d.ts +22 -22
  69. package/dist/components/FiltersPane/FiltersPane.stories.d.ts +32 -32
  70. package/dist/components/FiltersPane/FiltersPane.styles.d.ts +11 -11
  71. package/dist/components/FiltersPane/components/Filter/Filter.d.ts +7 -7
  72. package/dist/components/FiltersPane/components/Filter/index.d.ts +1 -1
  73. package/dist/components/FiltersPane/components/FilterInterval/FilterInterval.d.ts +24 -24
  74. package/dist/components/FiltersPane/components/FilterInterval/FilterInterval.styles.d.ts +15 -15
  75. package/dist/components/FiltersPane/components/FilterInterval/index.d.ts +2 -2
  76. package/dist/components/FiltersPane/components/FilterMultiSelect/FilterMultiSelect.d.ts +5 -5
  77. package/dist/components/FiltersPane/components/FilterMultiSelect/index.d.ts +1 -1
  78. package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.d.ts +30 -30
  79. package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.styles.d.ts +15 -15
  80. package/dist/components/FiltersPane/components/FilterSelect/index.d.ts +2 -2
  81. package/dist/components/FiltersPane/components/FilterValueView/FilterValueView.d.ts +5 -5
  82. package/dist/components/FiltersPane/components/FilterValueView/FilterValueView.styles.d.ts +3 -3
  83. package/dist/components/FiltersPane/components/FilterValueView/index.d.ts +2 -2
  84. package/dist/components/FiltersPane/components/FilterWithDates/FilterWithDates.d.ts +16 -16
  85. package/dist/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.d.ts +26 -26
  86. package/dist/components/FiltersPane/components/FilterWithDates/index.d.ts +2 -2
  87. package/dist/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.d.ts +13 -13
  88. package/dist/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.styles.d.ts +7 -7
  89. package/dist/components/FiltersPane/components/FilterWithPeriod/index.d.ts +2 -2
  90. package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.d.ts +13 -13
  91. package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.d.ts +8 -8
  92. package/dist/components/FiltersPane/components/FilterWrapper/helpers.d.ts +1 -1
  93. package/dist/components/FiltersPane/components/FilterWrapper/index.d.ts +2 -2
  94. package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.d.ts +21 -21
  95. package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.d.ts +10 -10
  96. package/dist/components/FiltersPane/components/FiltersPaneSearch/index.d.ts +2 -2
  97. package/dist/components/FiltersPane/components/index.d.ts +9 -9
  98. package/dist/components/FiltersPane/constants.d.ts +9 -9
  99. package/dist/components/FiltersPane/helpers.d.ts +5 -5
  100. package/dist/components/FiltersPane/index.d.ts +4 -4
  101. package/dist/components/FiltersPane/types.d.ts +108 -108
  102. package/dist/components/Flag/Flag.d.ts +8 -8
  103. package/dist/components/Flag/Flag.stories.d.ts +12 -12
  104. package/dist/components/Flag/Flag.styles.d.ts +3 -3
  105. package/dist/components/Flag/customFlags/customFlags.d.ts +10 -0
  106. package/dist/components/Flag/customFlags/index.d.ts +1 -0
  107. package/dist/components/Flag/index.d.ts +2 -2
  108. package/dist/components/FlexibleTable/FlexibleTable.d.ts +31 -31
  109. package/dist/components/FlexibleTable/FlexibleTable.stories.d.ts +19 -19
  110. package/dist/components/FlexibleTable/FlexibleTable.styles.d.ts +7 -7
  111. package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.d.ts +14 -14
  112. package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.d.ts +3 -3
  113. package/dist/components/FlexibleTable/components/FlexibleTableCell/index.d.ts +2 -2
  114. package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.d.ts +31 -31
  115. package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.d.ts +6 -6
  116. package/dist/components/FlexibleTable/components/FlexibleTableRow/index.d.ts +2 -2
  117. package/dist/components/FlexibleTable/components/index.d.ts +2 -2
  118. package/dist/components/FlexibleTable/constants.d.ts +3 -3
  119. package/dist/components/FlexibleTable/helpers.d.ts +3 -3
  120. package/dist/components/FlexibleTable/index.d.ts +4 -4
  121. package/dist/components/FlexibleTable/types.d.ts +57 -57
  122. package/dist/components/Icon/Icon.d.ts +8 -8
  123. package/dist/components/Icon/Icon.stories.d.ts +6 -6
  124. package/dist/components/Icon/Icon.styles.d.ts +3 -3
  125. package/dist/components/Icon/complexIcons/icons.d.ts +10 -10
  126. package/dist/components/Icon/complexIcons/index.d.ts +1 -1
  127. package/dist/components/Icon/components/ComplexIconBoilerplate/ComplexIconBoilerplate.d.ts +6 -6
  128. package/dist/components/Icon/components/ComplexIconBoilerplate/index.d.ts +1 -1
  129. package/dist/components/Icon/components/IconBolerplate/IconBoilerplate.d.ts +6 -6
  130. package/dist/components/Icon/components/IconBolerplate/index.d.ts +1 -1
  131. package/dist/components/Icon/components/index.d.ts +2 -2
  132. package/dist/components/Icon/helpers.d.ts +6 -6
  133. package/dist/components/Icon/icons-list.d.ts +1 -1
  134. package/dist/components/Icon/index.d.ts +5 -5
  135. package/dist/components/Icon/snippet.d.ts +3 -3
  136. package/dist/components/Icon/types.d.ts +13 -13
  137. package/dist/components/IconButton/IconButton.d.ts +19 -19
  138. package/dist/components/IconButton/IconButton.stories.d.ts +6 -6
  139. package/dist/components/IconButton/IconButton.styles.d.ts +3 -3
  140. package/dist/components/IconButton/constants.d.ts +2 -2
  141. package/dist/components/IconButton/index.d.ts +3 -3
  142. package/dist/components/IconButton/types.d.ts +5 -5
  143. package/dist/components/IncrementInput/IncrementInput.d.ts +9 -9
  144. package/dist/components/IncrementInput/IncrementInput.stories.d.ts +6 -6
  145. package/dist/components/IncrementInput/IncrementInput.styles.d.ts +9 -9
  146. package/dist/components/IncrementInput/index.d.ts +2 -2
  147. package/dist/components/Input/Input.d.ts +52 -52
  148. package/dist/components/Input/Input.stories.d.ts +34 -34
  149. package/dist/components/Input/Input.styles.d.ts +7 -7
  150. package/dist/components/Input/constants.d.ts +1 -1
  151. package/dist/components/Input/index.d.ts +3 -3
  152. package/dist/components/Input/types.d.ts +4 -4
  153. package/dist/components/List/List.d.ts +9 -9
  154. package/dist/components/List/List.stories.d.ts +5 -5
  155. package/dist/components/List/List.styles.d.ts +5 -5
  156. package/dist/components/List/components/ListItem/ListItem.d.ts +17 -17
  157. package/dist/components/List/components/ListItem/ListItem.styles.d.ts +3 -3
  158. package/dist/components/List/components/ListItem/index.d.ts +2 -2
  159. package/dist/components/List/components/index.d.ts +1 -1
  160. package/dist/components/List/index.d.ts +3 -3
  161. package/dist/components/Modal/Modal.d.ts +34 -34
  162. package/dist/components/Modal/Modal.stories.d.ts +29 -29
  163. package/dist/components/Modal/Modal.styles.d.ts +7 -7
  164. package/dist/components/Modal/index.d.ts +3 -3
  165. package/dist/components/Modal/types.d.ts +3 -3
  166. package/dist/components/MoreMenu/MoreMenu.d.ts +15 -15
  167. package/dist/components/MoreMenu/MoreMenu.stories.d.ts +6 -6
  168. package/dist/components/MoreMenu/MoreMenu.styles.d.ts +6 -6
  169. package/dist/components/MoreMenu/index.d.ts +2 -2
  170. package/dist/components/MultiSelect/MultiSelect.d.ts +23 -23
  171. package/dist/components/MultiSelect/MultiSelect.stories.d.ts +13 -13
  172. package/dist/components/MultiSelect/MultiSelect.styles.d.ts +7 -7
  173. package/dist/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.d.ts +12 -12
  174. package/dist/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.styles.d.ts +3 -3
  175. package/dist/components/MultiSelect/components/MultiSelectInput/index.d.ts +2 -2
  176. package/dist/components/MultiSelect/components/index.d.ts +1 -1
  177. package/dist/components/MultiSelect/index.d.ts +4 -4
  178. package/dist/components/MultiSelect/types.d.ts +1 -1
  179. package/dist/components/MultiSelectList/MultiSelectList.d.ts +25 -25
  180. package/dist/components/MultiSelectList/MultiSelectList.styles.d.ts +13 -13
  181. package/dist/components/MultiSelectList/constants.d.ts +3 -3
  182. package/dist/components/MultiSelectList/helpers.d.ts +3 -3
  183. package/dist/components/MultiSelectList/index.d.ts +3 -3
  184. package/dist/components/MultiSelectList/types.d.ts +12 -12
  185. package/dist/components/NewMoreMenu/NewMoreMenu.d.ts +13 -13
  186. package/dist/components/NewMoreMenu/NewMoreMenu.stories.d.ts +12 -12
  187. package/dist/components/NewMoreMenu/NewMoreMenu.styles.d.ts +8 -8
  188. package/dist/components/NewMoreMenu/index.d.ts +2 -2
  189. package/dist/components/Notification/Notification.d.ts +17 -17
  190. package/dist/components/Notification/Notification.stories.d.ts +8 -8
  191. package/dist/components/Notification/Notification.styles.d.ts +3 -3
  192. package/dist/components/Notification/index.d.ts +3 -3
  193. package/dist/components/Notification/types.d.ts +1 -1
  194. package/dist/components/NumberInput/NumberInput.d.ts +18 -18
  195. package/dist/components/NumberInput/NumberInput.stories.d.ts +7 -7
  196. package/dist/components/NumberInput/helpers.d.ts +4 -4
  197. package/dist/components/NumberInput/index.d.ts +1 -1
  198. package/dist/components/PhoneInput/PhoneInput.d.ts +17 -17
  199. package/dist/components/PhoneInput/PhoneInput.stories.d.ts +28 -28
  200. package/dist/components/PhoneInput/PhoneInput.styles.d.ts +9 -9
  201. package/dist/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.d.ts +13 -13
  202. package/dist/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.stories.d.ts +5 -5
  203. package/dist/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.styles.d.ts +7 -7
  204. package/dist/components/PhoneInput/components/PhoneInputCountryList/index.d.ts +2 -2
  205. package/dist/components/PhoneInput/components/index.d.ts +1 -1
  206. package/dist/components/PhoneInput/constants.d.ts +2 -2
  207. package/dist/components/PhoneInput/index.d.ts +4 -4
  208. package/dist/components/PhoneInput/types.d.ts +15 -15
  209. package/dist/components/RadioButton/RadioButton.d.ts +15 -15
  210. package/dist/components/RadioButton/RadioButton.stories.d.ts +7 -7
  211. package/dist/components/RadioButton/RadioButton.styles.d.ts +3 -3
  212. package/dist/components/RadioButton/index.d.ts +2 -2
  213. package/dist/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.d.ts +386 -386
  214. package/dist/components/ScrollIntoViewIfNeeded/constants.d.ts +3 -3
  215. package/dist/components/ScrollIntoViewIfNeeded/index.d.ts +1 -1
  216. package/dist/components/SearchInput/SearchInput.d.ts +8 -8
  217. package/dist/components/SearchInput/SearchInput.stories.d.ts +6 -6
  218. package/dist/components/SearchInput/SearchInput.styles.d.ts +7 -7
  219. package/dist/components/SearchInput/index.d.ts +2 -2
  220. package/dist/components/Select/CustomSelect.stories.d.ts +11 -11
  221. package/dist/components/Select/MultiSelect.stories.d.ts +15 -15
  222. package/dist/components/Select/Select.d.ts +52 -52
  223. package/dist/components/Select/Select.stories.d.ts +15 -15
  224. package/dist/components/Select/Select.styles.d.ts +33 -33
  225. package/dist/components/Select/components/SelectList/SelectList.d.ts +23 -23
  226. package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +6 -6
  227. package/dist/components/Select/components/SelectList/index.d.ts +2 -2
  228. package/dist/components/Select/components/SelectListItem/SelectListItem.d.ts +15 -15
  229. package/dist/components/Select/components/SelectListItem/SelectListItem.styles.d.ts +2 -2
  230. package/dist/components/Select/components/SelectListItem/index.d.ts +1 -1
  231. package/dist/components/Select/components/index.d.ts +2 -2
  232. package/dist/components/Select/constants.d.ts +2 -2
  233. package/dist/components/Select/helpers.d.ts +4 -4
  234. package/dist/components/Select/index.d.ts +4 -4
  235. package/dist/components/Select/types.d.ts +1 -1
  236. package/dist/components/Selector/Selector.d.ts +22 -22
  237. package/dist/components/Selector/Selector.stories.d.ts +7 -7
  238. package/dist/components/Selector/Selector.styles.d.ts +9 -9
  239. package/dist/components/Selector/index.d.ts +2 -2
  240. package/dist/components/Selector/types.d.ts +10 -10
  241. package/dist/components/Skeleton/Skeleton.d.ts +7 -7
  242. package/dist/components/Skeleton/Skeleton.stories.d.ts +6 -6
  243. package/dist/components/Skeleton/Skeleton.styles.d.ts +3 -3
  244. package/dist/components/Skeleton/index.d.ts +2 -2
  245. package/dist/components/SmartInput/SmartInput.d.ts +14 -14
  246. package/dist/components/SmartInput/SmartInput.stories.d.ts +18 -18
  247. package/dist/components/SmartInput/constants.d.ts +16 -16
  248. package/dist/components/SmartInput/helpers.d.ts +2 -2
  249. package/dist/components/SmartInput/index.d.ts +2 -2
  250. package/dist/components/SmartInput/types.d.ts +6 -6
  251. package/dist/components/Status/Status.d.ts +16 -16
  252. package/dist/components/Status/Status.stories.d.ts +6 -6
  253. package/dist/components/Status/Status.styles.d.ts +3 -3
  254. package/dist/components/Status/constants.d.ts +2 -2
  255. package/dist/components/Status/index.d.ts +2 -2
  256. package/dist/components/Status/types.d.ts +3 -3
  257. package/dist/components/Switch/Switch.d.ts +20 -20
  258. package/dist/components/Switch/Switch.stories.d.ts +16 -16
  259. package/dist/components/Switch/Switch.styles.d.ts +3 -3
  260. package/dist/components/Switch/index.d.ts +3 -3
  261. package/dist/components/Switch/types.d.ts +4 -4
  262. package/dist/components/TextArea/TextArea.d.ts +38 -38
  263. package/dist/components/TextArea/TextArea.stories.d.ts +17 -17
  264. package/dist/components/TextArea/TextArea.styles.d.ts +3 -3
  265. package/dist/components/TextArea/index.d.ts +3 -3
  266. package/dist/components/TextArea/types.d.ts +2 -2
  267. package/dist/components/TextButton/TextButton.d.ts +31 -31
  268. package/dist/components/TextButton/TextButton.stories.d.ts +6 -6
  269. package/dist/components/TextButton/TextButton.styles.d.ts +7 -7
  270. package/dist/components/TextButton/constants.d.ts +2 -2
  271. package/dist/components/TextButton/index.d.ts +3 -3
  272. package/dist/components/TextButton/types.d.ts +5 -5
  273. package/dist/components/TextWithInfo/TextWithInfo.d.ts +15 -15
  274. package/dist/components/TextWithInfo/TextWithInfo.stories.d.ts +12 -12
  275. package/dist/components/TextWithInfo/TextWithInfo.styles.d.ts +3 -3
  276. package/dist/components/TextWithInfo/index.d.ts +2 -2
  277. package/dist/components/TextWithTooltip/TextWithTooltip.d.ts +27 -27
  278. package/dist/components/TextWithTooltip/TextWithTooltip.stories.d.ts +24 -24
  279. package/dist/components/TextWithTooltip/TextWithTooltip.styles.d.ts +6 -6
  280. package/dist/components/TextWithTooltip/index.d.ts +2 -2
  281. package/dist/components/ThemedPreloader/ThemedPreloader.d.ts +11 -11
  282. package/dist/components/ThemedPreloader/ThemedPreloader.stories.d.ts +17 -17
  283. package/dist/components/ThemedPreloader/ThemedPreloader.styles.d.ts +7 -7
  284. package/dist/components/ThemedPreloader/components/DefaultPreloader/DefaultPreloader.d.ts +2 -2
  285. package/dist/components/ThemedPreloader/components/DefaultPreloader/index.d.ts +1 -1
  286. package/dist/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.d.ts +5 -5
  287. package/dist/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.styles.d.ts +3 -3
  288. package/dist/components/ThemedPreloader/components/DotsPreloader/index.d.ts +2 -2
  289. package/dist/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.d.ts +8 -8
  290. package/dist/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.styles.d.ts +3 -3
  291. package/dist/components/ThemedPreloader/components/SvgPreloader/index.d.ts +2 -2
  292. package/dist/components/ThemedPreloader/components/index.d.ts +3 -3
  293. package/dist/components/ThemedPreloader/constants.d.ts +1 -1
  294. package/dist/components/ThemedPreloader/index.d.ts +4 -4
  295. package/dist/components/ThemedPreloader/types.d.ts +2 -2
  296. package/dist/components/Toaster/Toaster.d.ts +23 -23
  297. package/dist/components/Toaster/Toaster.stories.d.ts +5 -5
  298. package/dist/components/Toaster/Toaster.styles.d.ts +6 -6
  299. package/dist/components/Toaster/constants.d.ts +1 -1
  300. package/dist/components/Toaster/index.d.ts +3 -3
  301. package/dist/components/Toaster/types.d.ts +1 -1
  302. package/dist/components/Tooltip/Tooltip.d.ts +11 -11
  303. package/dist/components/Tooltip/Tooltip.stories.d.ts +5 -5
  304. package/dist/components/Tooltip/Tooltip.styles.d.ts +3 -3
  305. package/dist/components/Tooltip/index.d.ts +3 -3
  306. package/dist/components/Tooltip/types.d.ts +1 -1
  307. package/dist/components/WithPopup/WithPopup.d.ts +40 -40
  308. package/dist/components/WithPopup/WithPopup.stories.d.ts +16 -16
  309. package/dist/components/WithPopup/WithPopup.styles.d.ts +3 -3
  310. package/dist/components/WithPopup/constants.d.ts +2 -2
  311. package/dist/components/WithPopup/helpers.d.ts +2 -2
  312. package/dist/components/WithPopup/index.d.ts +2 -2
  313. package/dist/components/WithPopup/types.d.ts +22 -22
  314. package/dist/components/WithTooltip/WithTooltip.d.ts +18 -18
  315. package/dist/components/WithTooltip/WithTooltip.stories.d.ts +6 -6
  316. package/dist/components/WithTooltip/WithTooltip.styles.d.ts +7 -7
  317. package/dist/components/WithTooltip/index.d.ts +2 -2
  318. package/dist/components/index.d.ts +46 -46
  319. package/dist/constants/index.d.ts +2 -2
  320. package/dist/constants/mime-types.d.ts +76 -76
  321. package/dist/constants/phone-info.d.ts +2 -2
  322. package/dist/helpers/index.d.ts +3 -3
  323. package/dist/helpers/misc.d.ts +21 -21
  324. package/dist/helpers/phone.d.ts +14 -14
  325. package/dist/helpers/popper-helpers.d.ts +2 -2
  326. package/dist/hooks/index.d.ts +7 -7
  327. package/dist/hooks/use-did-mount-effect.d.ts +2 -2
  328. package/dist/hooks/use-dropdown.d.ts +11 -11
  329. package/dist/hooks/use-is-mounted.d.ts +1 -1
  330. package/dist/hooks/use-merged-refs.d.ts +2 -2
  331. package/dist/hooks/use-mixed-styles.d.ts +1 -1
  332. package/dist/hooks/use-on-click-outside.d.ts +5 -5
  333. package/dist/hooks/use-tweak-styles.d.ts +21 -21
  334. package/dist/index.d.ts +6 -6
  335. package/dist/theme/Provider.d.ts +11 -11
  336. package/dist/theme/common.d.ts +103 -103
  337. package/dist/theme/helpers.d.ts +10 -10
  338. package/dist/theme/index.d.ts +4 -4
  339. package/dist/theme/types.d.ts +82 -82
  340. package/dist/true-react-common-ui-kit.js +127 -73
  341. package/dist/true-react-common-ui-kit.js.map +1 -1
  342. package/dist/true-react-common-ui-kit.umd.cjs +127 -73
  343. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  344. package/dist/types.d.ts +44 -44
  345. package/package.json +99 -99
  346. package/src/components/AccountInfo/AccountInfo.stories.tsx +32 -32
  347. package/src/components/AccountInfo/AccountInfo.styles.ts +52 -52
  348. package/src/components/AccountInfo/AccountInfo.tsx +80 -80
  349. package/src/components/AccountInfo/constants.ts +1 -1
  350. package/src/components/AccountInfo/index.ts +2 -2
  351. package/src/components/AddButton/AddButton.stories.tsx +21 -21
  352. package/src/components/AddButton/AddButton.styles.ts +34 -34
  353. package/src/components/AddButton/AddButton.tsx +52 -52
  354. package/src/components/AddButton/index.ts +2 -2
  355. package/src/components/Button/Button.stories.tsx +54 -54
  356. package/src/components/Button/Button.styles.ts +200 -200
  357. package/src/components/Button/Button.tsx +129 -129
  358. package/src/components/Button/constants.ts +11 -11
  359. package/src/components/Button/index.ts +3 -3
  360. package/src/components/Button/types.ts +5 -5
  361. package/src/components/Checkbox/Checkbox.stories.tsx +54 -54
  362. package/src/components/Checkbox/Checkbox.styles.ts +49 -49
  363. package/src/components/Checkbox/Checkbox.tsx +84 -84
  364. package/src/components/Checkbox/index.ts +2 -2
  365. package/src/components/CloseButton/CloseButton.stories.tsx +11 -11
  366. package/src/components/CloseButton/CloseButton.styles.ts +34 -34
  367. package/src/components/CloseButton/CloseButton.tsx +35 -35
  368. package/src/components/CloseButton/index.ts +2 -2
  369. package/src/components/Colors/Colors.stories.tsx +7 -7
  370. package/src/components/Colors/Colors.styles.ts +36 -36
  371. package/src/components/Colors/Colors.tsx +26 -26
  372. package/src/components/Colors/index.ts +1 -1
  373. package/src/components/CssBaseline/CssBaseline.styles.ts +14 -14
  374. package/src/components/CssBaseline/CssBaseline.tsx +13 -13
  375. package/src/components/CssBaseline/index.ts +2 -2
  376. package/src/components/DateInput/DateInput.stories.tsx +61 -61
  377. package/src/components/DateInput/DateInput.styles.ts +18 -18
  378. package/src/components/DateInput/DateInput.tsx +90 -90
  379. package/src/components/DateInput/constants.ts +2 -2
  380. package/src/components/DateInput/index.ts +3 -3
  381. package/src/components/DatePicker/DatePicker.stories.tsx +88 -88
  382. package/src/components/DatePicker/DatePicker.styles.ts +38 -38
  383. package/src/components/DatePicker/DatePicker.tsx +314 -314
  384. package/src/components/DatePicker/components/DatePickerHeader/DatePickerHeader.styles.ts +88 -88
  385. package/src/components/DatePicker/components/DatePickerHeader/DatePickerHeader.tsx +89 -89
  386. package/src/components/DatePicker/components/DatePickerHeader/index.ts +2 -2
  387. package/src/components/DatePicker/components/PopperContainer/PopperContainer.tsx +6 -6
  388. package/src/components/DatePicker/components/PopperContainer/index.ts +1 -1
  389. package/src/components/DatePicker/components/index.ts +2 -2
  390. package/src/components/DatePicker/constants.ts +6 -6
  391. package/src/components/DatePicker/helpers.ts +23 -23
  392. package/src/components/DatePicker/index.ts +4 -4
  393. package/src/components/DatePicker/types.ts +48 -48
  394. package/src/components/Description/Description.stories.tsx +27 -27
  395. package/src/components/Description/Description.styles.ts +30 -30
  396. package/src/components/Description/Description.tsx +61 -61
  397. package/src/components/Description/constants.ts +1 -1
  398. package/src/components/Description/index.ts +2 -2
  399. package/src/components/FileInput/FileInput.stories.tsx +75 -75
  400. package/src/components/FileInput/FileInput.styles.ts +80 -80
  401. package/src/components/FileInput/FileInput.tsx +147 -147
  402. package/src/components/FileInput/helpers.ts +6 -6
  403. package/src/components/FileInput/index.ts +2 -2
  404. package/src/components/FileItem/FileItem.stories.tsx +63 -63
  405. package/src/components/FileItem/FileItem.styles.ts +122 -122
  406. package/src/components/FileItem/FileItem.tsx +157 -157
  407. package/src/components/FileItem/constants.ts +29 -29
  408. package/src/components/FileItem/helpers.ts +27 -27
  409. package/src/components/FileItem/index.ts +4 -4
  410. package/src/components/FileItem/types.ts +11 -11
  411. package/src/components/FiltersPane/FiltersPane.stories.tsx +299 -299
  412. package/src/components/FiltersPane/FiltersPane.styles.ts +92 -92
  413. package/src/components/FiltersPane/FiltersPane.tsx +162 -162
  414. package/src/components/FiltersPane/components/Filter/Filter.tsx +114 -114
  415. package/src/components/FiltersPane/components/Filter/index.ts +1 -1
  416. package/src/components/FiltersPane/components/FilterInterval/FilterInterval.styles.ts +61 -61
  417. package/src/components/FiltersPane/components/FilterInterval/FilterInterval.tsx +154 -154
  418. package/src/components/FiltersPane/components/FilterInterval/index.ts +2 -2
  419. package/src/components/FiltersPane/components/FilterMultiSelect/FilterMultiSelect.tsx +10 -10
  420. package/src/components/FiltersPane/components/FilterMultiSelect/index.ts +1 -1
  421. package/src/components/FiltersPane/components/FilterSelect/FilterSelect.styles.ts +141 -141
  422. package/src/components/FiltersPane/components/FilterSelect/FilterSelect.tsx +361 -361
  423. package/src/components/FiltersPane/components/FilterSelect/index.ts +2 -2
  424. package/src/components/FiltersPane/components/FilterValueView/FilterValueView.styles.tsx +15 -15
  425. package/src/components/FiltersPane/components/FilterValueView/FilterValueView.tsx +166 -166
  426. package/src/components/FiltersPane/components/FilterValueView/index.tsx +2 -2
  427. package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.ts +68 -68
  428. package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.tsx +210 -210
  429. package/src/components/FiltersPane/components/FilterWithDates/index.ts +2 -2
  430. package/src/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.styles.ts +21 -21
  431. package/src/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.tsx +177 -177
  432. package/src/components/FiltersPane/components/FilterWithPeriod/index.ts +2 -2
  433. package/src/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.ts +99 -99
  434. package/src/components/FiltersPane/components/FilterWrapper/FilterWrapper.tsx +149 -149
  435. package/src/components/FiltersPane/components/FilterWrapper/helpers.ts +14 -14
  436. package/src/components/FiltersPane/components/FilterWrapper/index.ts +2 -2
  437. package/src/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.ts +123 -123
  438. package/src/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.tsx +165 -165
  439. package/src/components/FiltersPane/components/FiltersPaneSearch/index.ts +2 -2
  440. package/src/components/FiltersPane/components/index.ts +9 -9
  441. package/src/components/FiltersPane/constants.ts +137 -137
  442. package/src/components/FiltersPane/helpers.ts +26 -26
  443. package/src/components/FiltersPane/index.ts +5 -5
  444. package/src/components/FiltersPane/types.ts +157 -157
  445. package/src/components/Flag/Flag.stories.tsx +30 -29
  446. package/src/components/Flag/Flag.styles.ts +21 -17
  447. package/src/components/Flag/Flag.tsx +40 -26
  448. package/src/components/Flag/augment.d.ts +1 -1
  449. package/src/components/Flag/customFlags/AB.svg +1 -0
  450. package/src/components/Flag/customFlags/OS.svg +1 -0
  451. package/src/components/Flag/customFlags/augment.d.ts +1 -0
  452. package/src/components/Flag/customFlags/customFlags.ts +13 -0
  453. package/src/components/Flag/customFlags/index.ts +1 -0
  454. package/src/components/Flag/index.ts +2 -2
  455. package/src/components/FlexibleTable/FlexibleTable.stories.tsx +300 -300
  456. package/src/components/FlexibleTable/FlexibleTable.styles.ts +111 -111
  457. package/src/components/FlexibleTable/FlexibleTable.tsx +308 -308
  458. package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.ts +43 -43
  459. package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.tsx +113 -113
  460. package/src/components/FlexibleTable/components/FlexibleTableCell/index.ts +2 -2
  461. package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.ts +25 -25
  462. package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.tsx +193 -193
  463. package/src/components/FlexibleTable/components/FlexibleTableRow/index.ts +2 -2
  464. package/src/components/FlexibleTable/components/index.ts +2 -2
  465. package/src/components/FlexibleTable/constants.ts +8 -8
  466. package/src/components/FlexibleTable/helpers.ts +16 -16
  467. package/src/components/FlexibleTable/index.ts +4 -4
  468. package/src/components/FlexibleTable/types.ts +82 -82
  469. package/src/components/Icon/Icon.stories.tsx +86 -86
  470. package/src/components/Icon/Icon.styles.ts +10 -10
  471. package/src/components/Icon/Icon.tsx +26 -26
  472. package/src/components/Icon/complexIcons/augment.d.ts +1 -1
  473. package/src/components/Icon/complexIcons/avatarGreen.svg +57 -57
  474. package/src/components/Icon/complexIcons/fileExcel.svg +10 -10
  475. package/src/components/Icon/complexIcons/fileImage.svg +12 -12
  476. package/src/components/Icon/complexIcons/fileOther.svg +9 -9
  477. package/src/components/Icon/complexIcons/filePdf.svg +10 -10
  478. package/src/components/Icon/complexIcons/fileWord.svg +10 -10
  479. package/src/components/Icon/complexIcons/fileXml.svg +12 -12
  480. package/src/components/Icon/complexIcons/fileZip.svg +15 -15
  481. package/src/components/Icon/complexIcons/icons.ts +19 -19
  482. package/src/components/Icon/complexIcons/index.ts +1 -1
  483. package/src/components/Icon/components/ComplexIconBoilerplate/ComplexIconBoilerplate.tsx +16 -16
  484. package/src/components/Icon/components/ComplexIconBoilerplate/index.ts +1 -1
  485. package/src/components/Icon/components/IconBolerplate/IconBoilerplate.tsx +43 -43
  486. package/src/components/Icon/components/IconBolerplate/index.ts +1 -1
  487. package/src/components/Icon/components/index.ts +2 -2
  488. package/src/components/Icon/helpers.tsx +9 -9
  489. package/src/components/Icon/icons-list.ts +855 -855
  490. package/src/components/Icon/index.ts +5 -5
  491. package/src/components/Icon/snippet.tsx +6 -6
  492. package/src/components/Icon/types.ts +18 -18
  493. package/src/components/IconButton/IconButton.stories.tsx +32 -32
  494. package/src/components/IconButton/IconButton.styles.ts +84 -84
  495. package/src/components/IconButton/IconButton.tsx +74 -74
  496. package/src/components/IconButton/constants.ts +3 -3
  497. package/src/components/IconButton/index.ts +3 -3
  498. package/src/components/IconButton/types.ts +11 -11
  499. package/src/components/IncrementInput/IncrementInput.stories.tsx +31 -31
  500. package/src/components/IncrementInput/IncrementInput.styles.ts +78 -78
  501. package/src/components/IncrementInput/IncrementInput.tsx +105 -105
  502. package/src/components/IncrementInput/index.ts +2 -2
  503. package/src/components/Input/Input.stories.tsx +91 -91
  504. package/src/components/Input/Input.styles.ts +308 -308
  505. package/src/components/Input/Input.tsx +296 -296
  506. package/src/components/Input/constants.ts +1 -1
  507. package/src/components/Input/index.ts +3 -3
  508. package/src/components/Input/types.ts +33 -33
  509. package/src/components/List/List.stories.tsx +90 -90
  510. package/src/components/List/List.styles.ts +25 -25
  511. package/src/components/List/List.tsx +68 -68
  512. package/src/components/List/components/ListItem/ListItem.styles.ts +52 -52
  513. package/src/components/List/components/ListItem/ListItem.tsx +68 -68
  514. package/src/components/List/components/ListItem/index.ts +2 -2
  515. package/src/components/List/components/index.ts +1 -1
  516. package/src/components/List/index.ts +3 -3
  517. package/src/components/Modal/Modal.stories.tsx +105 -105
  518. package/src/components/Modal/Modal.styles.ts +318 -318
  519. package/src/components/Modal/Modal.tsx +203 -203
  520. package/src/components/Modal/index.ts +3 -3
  521. package/src/components/Modal/types.ts +17 -17
  522. package/src/components/MoreMenu/MoreMenu.stories.tsx +46 -46
  523. package/src/components/MoreMenu/MoreMenu.styles.ts +69 -69
  524. package/src/components/MoreMenu/MoreMenu.tsx +93 -93
  525. package/src/components/MoreMenu/index.ts +2 -2
  526. package/src/components/MultiSelect/MultiSelect.stories.tsx +46 -46
  527. package/src/components/MultiSelect/MultiSelect.styles.ts +59 -59
  528. package/src/components/MultiSelect/MultiSelect.tsx +106 -106
  529. package/src/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.styles.ts +73 -73
  530. package/src/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.tsx +53 -53
  531. package/src/components/MultiSelect/components/MultiSelectInput/index.ts +2 -2
  532. package/src/components/MultiSelect/components/index.ts +1 -1
  533. package/src/components/MultiSelect/index.ts +4 -4
  534. package/src/components/MultiSelect/types.ts +1 -1
  535. package/src/components/MultiSelectList/MultiSelectList.styles.ts +136 -136
  536. package/src/components/MultiSelectList/MultiSelectList.tsx +461 -461
  537. package/src/components/MultiSelectList/constants.ts +21 -21
  538. package/src/components/MultiSelectList/helpers.ts +11 -11
  539. package/src/components/MultiSelectList/index.ts +3 -3
  540. package/src/components/MultiSelectList/types.ts +15 -15
  541. package/src/components/NewMoreMenu/NewMoreMenu.stories.tsx +74 -74
  542. package/src/components/NewMoreMenu/NewMoreMenu.styles.ts +39 -39
  543. package/src/components/NewMoreMenu/NewMoreMenu.tsx +79 -79
  544. package/src/components/NewMoreMenu/index.ts +2 -2
  545. package/src/components/Notification/Notification.stories.tsx +55 -55
  546. package/src/components/Notification/Notification.styles.ts +57 -57
  547. package/src/components/Notification/Notification.tsx +77 -77
  548. package/src/components/Notification/index.ts +3 -3
  549. package/src/components/Notification/types.ts +1 -1
  550. package/src/components/NumberInput/NumberInput.stories.tsx +35 -35
  551. package/src/components/NumberInput/NumberInput.tsx +137 -137
  552. package/src/components/NumberInput/helpers.ts +84 -84
  553. package/src/components/NumberInput/index.ts +1 -1
  554. package/src/components/PhoneInput/PhoneInput.stories.tsx +71 -70
  555. package/src/components/PhoneInput/PhoneInput.styles.ts +89 -89
  556. package/src/components/PhoneInput/PhoneInput.tsx +214 -214
  557. package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.stories.tsx +21 -21
  558. package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.styles.ts +103 -103
  559. package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx +155 -155
  560. package/src/components/PhoneInput/components/PhoneInputCountryList/index.ts +2 -2
  561. package/src/components/PhoneInput/components/index.ts +1 -1
  562. package/src/components/PhoneInput/constants.ts +3 -3
  563. package/src/components/PhoneInput/index.ts +4 -4
  564. package/src/components/PhoneInput/types.ts +16 -16
  565. package/src/components/RadioButton/RadioButton.stories.tsx +46 -46
  566. package/src/components/RadioButton/RadioButton.styles.ts +37 -37
  567. package/src/components/RadioButton/RadioButton.tsx +57 -57
  568. package/src/components/RadioButton/index.ts +2 -2
  569. package/src/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.ts +54 -54
  570. package/src/components/ScrollIntoViewIfNeeded/constants.ts +12 -12
  571. package/src/components/ScrollIntoViewIfNeeded/index.ts +1 -1
  572. package/src/components/SearchInput/SearchInput.stories.tsx +23 -23
  573. package/src/components/SearchInput/SearchInput.styles.ts +54 -54
  574. package/src/components/SearchInput/SearchInput.tsx +70 -70
  575. package/src/components/SearchInput/index.ts +2 -2
  576. package/src/components/Select/CustomSelect.stories.tsx +253 -253
  577. package/src/components/Select/MultiSelect.stories.tsx +240 -240
  578. package/src/components/Select/Select.stories.tsx +236 -236
  579. package/src/components/Select/Select.styles.ts +147 -147
  580. package/src/components/Select/Select.tsx +658 -658
  581. package/src/components/Select/components/SelectList/SelectList.styles.ts +73 -73
  582. package/src/components/Select/components/SelectList/SelectList.tsx +152 -152
  583. package/src/components/Select/components/SelectList/index.ts +2 -2
  584. package/src/components/Select/components/SelectListItem/SelectListItem.styles.ts +14 -14
  585. package/src/components/Select/components/SelectListItem/SelectListItem.tsx +76 -76
  586. package/src/components/Select/components/SelectListItem/index.ts +1 -1
  587. package/src/components/Select/components/index.ts +2 -2
  588. package/src/components/Select/constants.ts +2 -2
  589. package/src/components/Select/helpers.ts +20 -20
  590. package/src/components/Select/index.ts +4 -4
  591. package/src/components/Select/types.ts +1 -1
  592. package/src/components/Selector/Selector.stories.tsx +62 -62
  593. package/src/components/Selector/Selector.styles.ts +165 -165
  594. package/src/components/Selector/Selector.tsx +115 -115
  595. package/src/components/Selector/index.ts +2 -2
  596. package/src/components/Selector/types.ts +12 -12
  597. package/src/components/Skeleton/Skeleton.stories.tsx +19 -19
  598. package/src/components/Skeleton/Skeleton.styles.ts +46 -46
  599. package/src/components/Skeleton/Skeleton.tsx +12 -12
  600. package/src/components/Skeleton/index.ts +2 -2
  601. package/src/components/SmartInput/SmartInput.stories.tsx +52 -52
  602. package/src/components/SmartInput/SmartInput.tsx +116 -116
  603. package/src/components/SmartInput/constants.ts +91 -91
  604. package/src/components/SmartInput/helpers.ts +26 -26
  605. package/src/components/SmartInput/index.ts +2 -2
  606. package/src/components/SmartInput/types.ts +18 -18
  607. package/src/components/Status/Status.stories.tsx +73 -73
  608. package/src/components/Status/Status.styles.ts +143 -143
  609. package/src/components/Status/Status.tsx +49 -49
  610. package/src/components/Status/constants.ts +11 -11
  611. package/src/components/Status/index.ts +3 -3
  612. package/src/components/Status/types.ts +5 -5
  613. package/src/components/Switch/Switch.stories.tsx +40 -40
  614. package/src/components/Switch/Switch.styles.ts +75 -75
  615. package/src/components/Switch/Switch.tsx +75 -75
  616. package/src/components/Switch/index.ts +3 -3
  617. package/src/components/Switch/types.ts +4 -4
  618. package/src/components/TextArea/TextArea.stories.tsx +37 -37
  619. package/src/components/TextArea/TextArea.styles.ts +177 -177
  620. package/src/components/TextArea/TextArea.tsx +183 -183
  621. package/src/components/TextArea/index.ts +3 -3
  622. package/src/components/TextArea/types.ts +6 -6
  623. package/src/components/TextButton/TextButton.stories.tsx +47 -47
  624. package/src/components/TextButton/TextButton.styles.ts +130 -130
  625. package/src/components/TextButton/TextButton.tsx +110 -110
  626. package/src/components/TextButton/constants.ts +3 -3
  627. package/src/components/TextButton/index.ts +3 -3
  628. package/src/components/TextButton/types.ts +11 -11
  629. package/src/components/TextWithInfo/TextWithInfo.stories.tsx +53 -53
  630. package/src/components/TextWithInfo/TextWithInfo.styles.ts +59 -59
  631. package/src/components/TextWithInfo/TextWithInfo.tsx +62 -62
  632. package/src/components/TextWithInfo/index.ts +2 -2
  633. package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +58 -58
  634. package/src/components/TextWithTooltip/TextWithTooltip.styles.ts +21 -21
  635. package/src/components/TextWithTooltip/TextWithTooltip.tsx +156 -156
  636. package/src/components/TextWithTooltip/index.ts +2 -2
  637. package/src/components/ThemedPreloader/ThemedPreloader.stories.tsx +41 -41
  638. package/src/components/ThemedPreloader/ThemedPreloader.styles.ts +26 -26
  639. package/src/components/ThemedPreloader/ThemedPreloader.tsx +54 -54
  640. package/src/components/ThemedPreloader/components/DefaultPreloader/DefaultPreloader.tsx +29 -29
  641. package/src/components/ThemedPreloader/components/DefaultPreloader/index.ts +1 -1
  642. package/src/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.styles.ts +55 -55
  643. package/src/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.tsx +15 -15
  644. package/src/components/ThemedPreloader/components/DotsPreloader/index.ts +2 -2
  645. package/src/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.styles.ts +11 -11
  646. package/src/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.tsx +24 -24
  647. package/src/components/ThemedPreloader/components/SvgPreloader/index.ts +2 -2
  648. package/src/components/ThemedPreloader/components/index.ts +3 -3
  649. package/src/components/ThemedPreloader/constants.ts +1 -1
  650. package/src/components/ThemedPreloader/index.ts +4 -4
  651. package/src/components/ThemedPreloader/types.ts +3 -3
  652. package/src/components/Toaster/Toaster.stories.tsx +30 -30
  653. package/src/components/Toaster/Toaster.styles.ts +60 -60
  654. package/src/components/Toaster/Toaster.tsx +96 -96
  655. package/src/components/Toaster/constants.ts +1 -1
  656. package/src/components/Toaster/index.ts +3 -3
  657. package/src/components/Toaster/types.ts +1 -1
  658. package/src/components/Tooltip/Tooltip.stories.tsx +19 -19
  659. package/src/components/Tooltip/Tooltip.styles.ts +49 -49
  660. package/src/components/Tooltip/Tooltip.tsx +35 -35
  661. package/src/components/Tooltip/index.ts +3 -3
  662. package/src/components/Tooltip/types.ts +1 -1
  663. package/src/components/WithPopup/WithPopup.stories.tsx +101 -101
  664. package/src/components/WithPopup/WithPopup.styles.ts +47 -47
  665. package/src/components/WithPopup/WithPopup.tsx +210 -210
  666. package/src/components/WithPopup/constants.ts +3 -3
  667. package/src/components/WithPopup/helpers.ts +9 -9
  668. package/src/components/WithPopup/index.ts +2 -2
  669. package/src/components/WithPopup/types.ts +32 -32
  670. package/src/components/WithTooltip/WithTooltip.stories.tsx +56 -56
  671. package/src/components/WithTooltip/WithTooltip.styles.ts +13 -13
  672. package/src/components/WithTooltip/WithTooltip.tsx +72 -72
  673. package/src/components/WithTooltip/index.ts +2 -2
  674. package/src/components/index.ts +46 -46
  675. package/src/constants/index.ts +2 -2
  676. package/src/constants/mime-types.ts +77 -77
  677. package/src/constants/phone-info.ts +2164 -2147
  678. package/src/helpers/index.ts +3 -3
  679. package/src/helpers/misc.ts +160 -160
  680. package/src/helpers/phone.ts +91 -91
  681. package/src/helpers/popper-helpers.ts +17 -17
  682. package/src/hooks/index.ts +7 -7
  683. package/src/hooks/use-did-mount-effect.ts +18 -18
  684. package/src/hooks/use-dropdown.ts +84 -84
  685. package/src/hooks/use-is-mounted.ts +15 -15
  686. package/src/hooks/use-merged-refs.ts +4 -4
  687. package/src/hooks/use-mixed-styles.ts +14 -14
  688. package/src/hooks/use-on-click-outside.ts +77 -77
  689. package/src/hooks/use-tweak-styles.ts +57 -57
  690. package/src/index.ts +6 -6
  691. package/src/theme/Provider.tsx +21 -21
  692. package/src/theme/common.ts +166 -166
  693. package/src/theme/helpers.ts +76 -76
  694. package/src/theme/index.ts +4 -4
  695. package/src/theme/types.ts +158 -158
  696. package/src/types.ts +62 -62
  697. package/src/vite-env.d.ts +1 -1
@@ -1,658 +1,658 @@
1
- import {
2
- useCallback,
3
- useEffect,
4
- useMemo,
5
- useRef,
6
- useState,
7
- ChangeEvent,
8
- CSSProperties,
9
- FocusEvent,
10
- FormEvent,
11
- KeyboardEvent,
12
- MouseEvent,
13
- ReactNode,
14
- SyntheticEvent,
15
- } from 'react';
16
- import { Portal } from 'react-overlays';
17
- import clsx from 'clsx';
18
- import { debounce } from 'ts-debounce';
19
- import {
20
- createFilter,
21
- getTestId,
22
- isEmpty,
23
- isNotEmpty,
24
- isReactNodeNotEmpty,
25
- isStringNotEmpty,
26
- } from '@true-engineering/true-react-platform-helpers';
27
- import { hasExactParent } from '../../helpers';
28
- import { useDropdown, useIsMounted, useOnClickOutsideWithRef, useTweakStyles } from '../../hooks';
29
- import { IDropdownWithPopperOptions, ICommonProps } from '../../types';
30
- import { renderIcon, IIcon } from '../Icon';
31
- import { Input, IInputProps } from '../Input';
32
- import { SearchInput, ISearchInputProps } from '../SearchInput';
33
- import { SelectList } from './components';
34
- import { ALL_OPTION_INDEX, DEFAULT_OPTION_INDEX } from './constants';
35
- import {
36
- defaultCompareFunction,
37
- defaultConvertFunction,
38
- defaultIsOptionDisabled,
39
- getDefaultConvertToIdFunction,
40
- } from './helpers';
41
- import { IMultipleSelectValue } from './types';
42
- import { getInputStyles, searchInputStyles, useStyles, ISelectStyles } from './Select.styles';
43
-
44
- export interface ISelectProps<Value>
45
- extends Omit<IInputProps, 'value' | 'onChange' | 'onBlur' | 'type' | 'tweakStyles'>,
46
- ICommonProps<ISelectStyles> {
47
- header?: ReactNode;
48
- footer?: ReactNode;
49
- defaultOptionLabel?: ReactNode;
50
- allOptionsLabel?: string;
51
- noMatchesLabel?: string;
52
- loadingLabel?: ReactNode;
53
- /** @default 'normal' */
54
- optionsMode?: 'search' | 'dynamic' | 'normal';
55
- /** @default 400 */
56
- debounceTime?: number;
57
- /** @default 0 */
58
- minSymbolsCountToOpenList?: number;
59
- dropdownOptions?: IDropdownWithPopperOptions;
60
- /** @default 'chevron-down' */
61
- dropdownIcon?: IIcon;
62
- options: Value[] | Readonly<Value[]>;
63
- value: Value | undefined;
64
- /** @default true */
65
- shouldScrollToList?: boolean;
66
- isMultiSelect?: false;
67
- searchInput?: { shouldRenderInList: true } & Pick<ISearchInputProps, 'placeholder'>;
68
- isOptionDisabled?: (option: Value) => boolean;
69
- onChange: (
70
- value: Value | undefined,
71
- event:
72
- | MouseEvent<HTMLElement>
73
- | KeyboardEvent
74
- | ChangeEvent<HTMLElement>
75
- | FormEvent<HTMLElement>,
76
- ) => void; // подумать как возвращать индекс
77
- onBlur?: (event: Event | SyntheticEvent) => void;
78
- onType?: (value: string) => Promise<void>;
79
- optionsFilter?: (options: Value[], query: string) => Value[];
80
- onOpen?: () => void;
81
- compareValuesOnChange?: (v1?: Value, v2?: Value) => boolean;
82
- /** @description Функция должна быть мемоизирована с целью избежания ререндера */
83
- convertValueToString?: (value: Value) => string | undefined;
84
- /** @description Функция должна быть мемоизирована с целью избежания ререндера */
85
- convertValueToReactNode?: (value: Value, isDisabled: boolean) => ReactNode;
86
- /** @description Функция должна быть мемоизирована с целью избежания ререндера */
87
- convertValueToId?: (value: Value) => string | undefined;
88
- }
89
-
90
- export interface IMultipleSelectProps<Value>
91
- extends Omit<
92
- ISelectProps<Value>,
93
- 'value' | 'onChange' | 'compareValuesOnChange' | 'isMultiSelect'
94
- > {
95
- isMultiSelect: true;
96
- value: IMultipleSelectValue<Value> | undefined;
97
- onChange: (
98
- value: IMultipleSelectValue<Value> | undefined,
99
- event:
100
- | MouseEvent<HTMLElement>
101
- | KeyboardEvent
102
- | ChangeEvent<HTMLElement>
103
- | FormEvent<HTMLElement>,
104
- ) => void;
105
- compareValuesOnChange?: (
106
- v1?: IMultipleSelectValue<Value>,
107
- v2?: IMultipleSelectValue<Value>,
108
- ) => boolean;
109
- }
110
-
111
- export function Select<Value>(
112
- props: ISelectProps<Value> | IMultipleSelectProps<Value>,
113
- ): JSX.Element {
114
- const {
115
- options,
116
- isMultiSelect,
117
- value,
118
- header,
119
- footer,
120
- defaultOptionLabel,
121
- allOptionsLabel,
122
- debounceTime = 400,
123
- optionsMode = 'normal',
124
- noMatchesLabel,
125
- loadingLabel,
126
- tweakStyles,
127
- testId,
128
- isActive,
129
- isReadonly,
130
- isDisabled,
131
- dropdownOptions,
132
- minSymbolsCountToOpenList = 0,
133
- dropdownIcon = 'chevron-down',
134
- shouldScrollToList = true,
135
- searchInput,
136
- iconType,
137
- onChange,
138
- onFocus,
139
- onBlur,
140
- onType,
141
- onOpen,
142
- isOptionDisabled = defaultIsOptionDisabled,
143
- compareValuesOnChange = defaultCompareFunction,
144
- convertValueToString = defaultConvertFunction,
145
- convertValueToId,
146
- convertValueToReactNode,
147
- optionsFilter,
148
- ...inputProps
149
- } = props;
150
- const classes = useStyles({ theme: tweakStyles });
151
-
152
- const { shouldRenderInList: shouldRenderSearchInputInList = false, ...searchInputProps } =
153
- searchInput ?? {};
154
- const hasSearchInputInList = optionsMode !== 'normal' && shouldRenderSearchInputInList;
155
- const hasReadonlyInput = isReadonly || optionsMode === 'normal' || shouldRenderSearchInputInList;
156
-
157
- const tweakInputStyles = useTweakStyles({
158
- innerStyles: getInputStyles({ hasReadonlyInput, isMultiSelect }),
159
- tweakStyles,
160
- className: 'tweakInput',
161
- currentComponentName: 'Select',
162
- });
163
-
164
- const tweakSearchInputStyles = useTweakStyles({
165
- innerStyles: searchInputStyles,
166
- tweakStyles,
167
- className: 'tweakSearchInput',
168
- currentComponentName: 'Select',
169
- });
170
-
171
- const tweakSelectListStyles = useTweakStyles({
172
- tweakStyles,
173
- className: 'tweakSelectList',
174
- currentComponentName: 'Select',
175
- });
176
-
177
- const isMounted = useIsMounted();
178
- const [isListOpen, setIsListOpen] = useState(false);
179
- const [areOptionsLoading, setAreOptionsLoading] = useState(false);
180
- const hasDefaultOption = isReactNodeNotEmpty(defaultOptionLabel);
181
-
182
- const [focusedListCellIndex, setFocusedListCellIndex] = useState(DEFAULT_OPTION_INDEX);
183
- const [searchValue, setSearchValue] = useState('');
184
- // если мы ввели что то в строку поиска - то этот булеан будет отключаться
185
- // вынесен отдельно, из-за проблем с дебаунсом при динамич. опциях
186
- const [shouldShowDefaultOption, setShouldShowDefaultOption] = useState(true);
187
-
188
- const root = useRef<HTMLDivElement>(null);
189
- const inputWrapper = useRef<HTMLDivElement>(null);
190
- const list = useRef<HTMLDivElement>(null);
191
- const input = useRef<HTMLInputElement>(null); // TODO ref снаружи?
192
-
193
- const strValue = isMultiSelect ? value?.[0] : value;
194
- const shouldShowAllOption =
195
- isMultiSelect && isStringNotEmpty(allOptionsLabel) && searchValue === '';
196
-
197
- const filteredOptions = useMemo(() => {
198
- if (optionsMode !== 'search') {
199
- return options;
200
- }
201
-
202
- const filter =
203
- optionsFilter ?? createFilter<Value>((option) => [convertValueToString(option) ?? '']);
204
-
205
- return filter(options as Value[], searchValue);
206
- }, [optionsFilter, options, convertValueToString, searchValue, optionsMode]);
207
-
208
- const availableOptions = useMemo(
209
- () => options.filter((option) => !isOptionDisabled(option)),
210
- [options, isOptionDisabled],
211
- );
212
-
213
- const areAllOptionsSelected = isMultiSelect && value?.length === availableOptions.length;
214
- const shouldShowMultiSelectCounter =
215
- isMultiSelect && isNotEmpty(value) && value.length > 1 && !areAllOptionsSelected;
216
-
217
- const optionsIndexesForNavigation = useMemo(() => {
218
- const result: number[] = [];
219
- if (shouldShowDefaultOption && hasDefaultOption) {
220
- result.push(DEFAULT_OPTION_INDEX);
221
- }
222
- if (shouldShowAllOption) {
223
- result.push(ALL_OPTION_INDEX);
224
- }
225
- return result.concat(
226
- filteredOptions.reduce((acc, cur, i) => {
227
- if (!isOptionDisabled(cur)) {
228
- acc.push(i);
229
- }
230
- return acc;
231
- }, [] as number[]),
232
- );
233
- }, [
234
- filteredOptions,
235
- hasDefaultOption,
236
- isOptionDisabled,
237
- shouldShowAllOption,
238
- shouldShowDefaultOption,
239
- ]);
240
-
241
- const stringValue = isNotEmpty(strValue) ? convertValueToString(strValue) : undefined;
242
- // Для мультиселекта пытаемся показать "Все опции" если выбраны все опции
243
- const showedStringValue =
244
- areAllOptionsSelected && isNotEmpty(allOptionsLabel) ? allOptionsLabel : stringValue;
245
-
246
- const convertToId = useCallback(
247
- (v: Value) => (convertValueToId ?? getDefaultConvertToIdFunction(convertValueToString))(v),
248
- [convertValueToId, convertValueToString],
249
- );
250
-
251
- const getDropdownOffset = () => {
252
- if (isEmpty(input.current) || inputProps.errorPosition === 'top') {
253
- return 0;
254
- }
255
-
256
- // Высота элемента inputWrapper у компонента Input
257
- return input.current.parentElement?.offsetHeight ?? 0;
258
- };
259
-
260
- const closeList = useCallback(() => {
261
- setIsListOpen(false);
262
- setSearchValue('');
263
- setShouldShowDefaultOption(true);
264
-
265
- if (!dropdownOptions?.shouldUsePopper) {
266
- root.current?.style.removeProperty('--dropdown-offset');
267
- }
268
- }, [dropdownOptions?.shouldUsePopper]);
269
-
270
- const handleListClose = useCallback(
271
- (event: Event | SyntheticEvent) => {
272
- closeList();
273
- onBlur?.(event);
274
- },
275
- [closeList, onBlur],
276
- );
277
-
278
- const handleListOpen = () => {
279
- if (isReadonly) {
280
- return;
281
- }
282
-
283
- if (!isListOpen) {
284
- setIsListOpen(true);
285
-
286
- if (!dropdownOptions?.shouldUsePopper) {
287
- root.current?.style.setProperty('--dropdown-offset', `${getDropdownOffset()}px`);
288
- }
289
- }
290
- };
291
-
292
- const handleFocus = (event: FocusEvent<HTMLInputElement>) => {
293
- onFocus?.(event);
294
- handleListOpen();
295
- };
296
-
297
- const handleOnClick = () => {
298
- handleListOpen();
299
- };
300
-
301
- const handleBlur = (event: FocusEvent<HTMLInputElement>) => {
302
- // Когда что-то блокирует открытие листа, но блур все равно должен сработать
303
- // например minSymbolsCount
304
- if (isListOpen && !isOpen) {
305
- handleListClose(event);
306
- return;
307
- }
308
-
309
- if (
310
- !isNotEmpty(event.relatedTarget) ||
311
- !isNotEmpty(list.current) ||
312
- !isNotEmpty(inputWrapper.current)
313
- ) {
314
- return;
315
- }
316
-
317
- const isActionInsideSelect =
318
- hasExactParent(event.relatedTarget, list.current) ||
319
- hasExactParent(event.relatedTarget, inputWrapper.current);
320
-
321
- // Ничего не делаем, если клик был внутри селекта
322
- if (!isActionInsideSelect) {
323
- handleListClose(event);
324
- }
325
- };
326
-
327
- const handleChange = useCallback(
328
- (
329
- newValue: Value | IMultipleSelectValue<Value> | undefined,
330
- event:
331
- | MouseEvent<HTMLElement>
332
- | KeyboardEvent
333
- | ChangeEvent<HTMLElement>
334
- | FormEvent<HTMLElement>,
335
- ) => {
336
- // Тут беда с типами, сорри
337
- if (!compareValuesOnChange(value as never, newValue as never)) {
338
- onChange(newValue as (Value & IMultipleSelectValue<Value>) | undefined, event);
339
- }
340
- },
341
- [value, compareValuesOnChange, onChange],
342
- );
343
-
344
- const handleOptionSelect = useCallback(
345
- (index: number, event: MouseEvent<HTMLElement> | KeyboardEvent) => {
346
- handleChange(index === DEFAULT_OPTION_INDEX ? undefined : filteredOptions[index], event);
347
- handleListClose(event);
348
- input.current?.blur();
349
- },
350
- [handleChange, handleListClose, filteredOptions],
351
- );
352
-
353
- // MultiSelect
354
- const handleToggleOptionCheckbox = useCallback(
355
- (index: number, isSelected: boolean, event: ChangeEvent<HTMLElement> | KeyboardEvent) => {
356
- if (!isMultiSelect) {
357
- return;
358
- }
359
-
360
- // Если выбрана не дефолтная опция, которая сетит андеф
361
- if (index === DEFAULT_OPTION_INDEX || (index === ALL_OPTION_INDEX && !isSelected)) {
362
- handleChange(undefined, event);
363
- return;
364
- }
365
- if (index === ALL_OPTION_INDEX && isSelected) {
366
- handleChange(availableOptions as IMultipleSelectValue<Value>, event);
367
- return;
368
- }
369
- const option = filteredOptions[index];
370
- handleChange(
371
- isSelected
372
- ? // Добавляем
373
- ([...(value ?? []), option] as IMultipleSelectValue<Value>)
374
- : // Убираем
375
- value?.filter((o) => convertToId(o) !== convertToId(option)),
376
- event,
377
- );
378
- },
379
- [isMultiSelect, filteredOptions, handleChange, value, availableOptions, convertToId],
380
- );
381
-
382
- const handleOnType = useCallback(
383
- async (v: string) => {
384
- if (onType === undefined) {
385
- return;
386
- }
387
- if (isMounted()) {
388
- setAreOptionsLoading(true);
389
- }
390
- await onType(v);
391
- if (isMounted()) {
392
- setAreOptionsLoading(false);
393
- }
394
- if (optionsMode === 'dynamic') {
395
- setShouldShowDefaultOption(v === '');
396
- }
397
- },
398
- [isMounted, onType, optionsMode],
399
- );
400
-
401
- const debounceHandleOnType = useMemo(
402
- () => debounce(handleOnType, debounceTime, { isImmediate: debounceTime === 0 }),
403
- [handleOnType, debounceTime],
404
- );
405
-
406
- const handleInputChange = (v: string, event: FormEvent<HTMLElement>) => {
407
- if (onType !== undefined) {
408
- debounceHandleOnType(v);
409
- }
410
-
411
- if (optionsMode !== 'dynamic') {
412
- setShouldShowDefaultOption(v === '');
413
- }
414
-
415
- if (v === '' && !hasSearchInputInList) {
416
- handleChange(undefined, event);
417
- }
418
-
419
- setSearchValue(v);
420
- };
421
-
422
- const handleKeyDown = (event: KeyboardEvent) => {
423
- if (!isListOpen) {
424
- return;
425
- }
426
-
427
- event.stopPropagation();
428
- const curIndexInNavigation = optionsIndexesForNavigation.findIndex(
429
- (index) => index === focusedListCellIndex,
430
- );
431
-
432
- switch (event.code) {
433
- case 'Enter':
434
- case 'NumpadEnter': {
435
- let indexToSelect = focusedListCellIndex;
436
-
437
- // если осталась одна опция в списке,
438
- // то выбираем ее нажатием на enter
439
- if (indexToSelect === DEFAULT_OPTION_INDEX && filteredOptions.length === 1) {
440
- indexToSelect = 0;
441
- }
442
-
443
- if (isMultiSelect) {
444
- let isThisValueAlreadySelected: boolean | undefined;
445
- if (indexToSelect === ALL_OPTION_INDEX) {
446
- isThisValueAlreadySelected = areAllOptionsSelected;
447
- } else {
448
- // подумать над концептом реального фокуса на опциях, а не вот эти вот focusedCell
449
- const option = filteredOptions[indexToSelect];
450
- const valueIdToSelect = convertToId(option);
451
- isThisValueAlreadySelected =
452
- value?.some((opt) => convertToId(opt) === valueIdToSelect) ?? false;
453
- }
454
- handleToggleOptionCheckbox(indexToSelect, !isThisValueAlreadySelected, event);
455
- } else {
456
- handleOptionSelect(indexToSelect, event);
457
- }
458
- break;
459
- }
460
-
461
- case 'ArrowDown': {
462
- // чтобы убрать перемещение курсора в инпуте
463
- event.preventDefault();
464
- const targetIndexInNavigation =
465
- (curIndexInNavigation + 1) % optionsIndexesForNavigation.length;
466
- setFocusedListCellIndex(optionsIndexesForNavigation[targetIndexInNavigation]);
467
- break;
468
- }
469
-
470
- case 'ArrowUp': {
471
- // чтобы убрать перемещение курсора в инпуте
472
- event.preventDefault();
473
- const targetIndexInNavigation =
474
- (curIndexInNavigation - 1 + optionsIndexesForNavigation.length) %
475
- optionsIndexesForNavigation.length;
476
- setFocusedListCellIndex(optionsIndexesForNavigation[targetIndexInNavigation]);
477
- break;
478
- }
479
- }
480
- };
481
-
482
- const onArrowClick = () => {
483
- if (isListOpen) {
484
- input.current?.blur();
485
- closeList();
486
- } else {
487
- input.current?.focus();
488
- }
489
- };
490
-
491
- useOnClickOutsideWithRef(list, handleListClose, inputWrapper);
492
-
493
- const hasEnoughSymbolsToSearch = searchValue.trim().length >= minSymbolsCountToOpenList;
494
-
495
- const isOpen =
496
- // Пользователь пытается открыть лист
497
- isListOpen &&
498
- // Нам есть что показать:
499
- // Есть опции
500
- (filteredOptions.length > 0 ||
501
- // Дефолтная опция
502
- (defaultOptionLabel !== undefined && !hasEnoughSymbolsToSearch) ||
503
- // Текст "Загрузка..."
504
- inputProps.isLoading ||
505
- // Текст "Совпадений не найдено"
506
- noMatchesLabel !== undefined ||
507
- // У нас есть инпут с поиском внутри листа
508
- hasSearchInputInList) &&
509
- // Последняя проверка на случай, если мы че то ищем в опциях
510
- (optionsMode === 'normal' || hasEnoughSymbolsToSearch);
511
-
512
- // Эти значения ставятся в false по дефолту также в useDropdown
513
- const {
514
- shouldUsePopper = false,
515
- shouldRenderInBody = false,
516
- shouldHideOnScroll = false,
517
- } = dropdownOptions ?? {};
518
-
519
- const popperData = useDropdown({
520
- isOpen,
521
- onDropdownClose: handleListClose,
522
- referenceElement: input.current?.parentElement ?? inputWrapper.current,
523
- dropdownElement: list.current,
524
- options: dropdownOptions,
525
- dependenciesForPositionUpdating: [inputProps.isLoading, filteredOptions.length],
526
- });
527
-
528
- useEffect(() => {
529
- const focusedCellIndex = isNotEmpty(strValue)
530
- ? optionsIndexesForNavigation.find((index) => {
531
- const option = filteredOptions[index];
532
- return isNotEmpty(option) && convertToId(option) === convertToId(strValue);
533
- })
534
- : undefined;
535
-
536
- setFocusedListCellIndex(focusedCellIndex ?? optionsIndexesForNavigation[0]);
537
- }, [strValue, filteredOptions, optionsIndexesForNavigation, convertToId]);
538
-
539
- useEffect(() => {
540
- if (isOpen) {
541
- onOpen?.();
542
- }
543
- }, [isOpen]);
544
-
545
- const searchInputEl = hasSearchInputInList && (
546
- <SearchInput
547
- value={searchValue}
548
- onChange={handleInputChange}
549
- tweakStyles={tweakSearchInputStyles}
550
- placeholder="Поиск"
551
- {...searchInputProps}
552
- />
553
- );
554
-
555
- // Т.к. используется для проверки на пустой элемент `isReactNodeNotEmpty` внутри `SelectList`, то
556
- // он пропускает React.Fragment
557
- const customHeader = (isReactNodeNotEmpty(searchInputEl) || isReactNodeNotEmpty(header)) && (
558
- <>
559
- {searchInputEl}
560
- {header}
561
- </>
562
- );
563
-
564
- const listEl = (
565
- <div
566
- className={clsx(classes.listWrapper, {
567
- [classes.withoutPopper]: !shouldUsePopper,
568
- [classes.listWrapperInBody]: shouldRenderInBody,
569
- })}
570
- ref={list}
571
- style={popperData?.styles.popper as CSSProperties}
572
- tabIndex={0}
573
- onBlur={handleBlur} // обработка для Tab из списка
574
- {...popperData?.attributes.popper}
575
- >
576
- {isOpen && (
577
- <SelectList
578
- options={filteredOptions}
579
- defaultOptionLabel={hasDefaultOption && shouldShowDefaultOption && defaultOptionLabel}
580
- allOptionsLabel={shouldShowAllOption && allOptionsLabel}
581
- areAllOptionsSelected={areAllOptionsSelected}
582
- customListHeader={customHeader}
583
- customListFooter={footer}
584
- noMatchesLabel={noMatchesLabel}
585
- focusedIndex={focusedListCellIndex}
586
- activeValue={value}
587
- isLoading={inputProps.isLoading}
588
- loadingLabel={loadingLabel}
589
- tweakStyles={tweakSelectListStyles}
590
- testId={getTestId(testId, 'list')}
591
- isMultiSelect={isMultiSelect}
592
- // скролл не работает с включеным поппером
593
- shouldScrollToList={shouldScrollToList && !shouldUsePopper && !shouldHideOnScroll}
594
- isOptionDisabled={isOptionDisabled}
595
- convertValueToString={convertValueToString}
596
- convertValueToReactNode={convertValueToReactNode}
597
- convertValueToId={convertToId}
598
- onOptionSelect={handleOptionSelect}
599
- onToggleCheckbox={handleToggleOptionCheckbox}
600
- />
601
- )}
602
- </div>
603
- );
604
-
605
- const multiSelectCounterWithIcon =
606
- shouldShowMultiSelectCounter || isNotEmpty(iconType) ? (
607
- <>
608
- {shouldShowMultiSelectCounter && (
609
- <div className={classes.counter}>(+{value.length - 1})</div>
610
- )}
611
- {isNotEmpty(iconType) && <div className={classes.icon}>{renderIcon(iconType)}</div>}
612
- </>
613
- ) : undefined;
614
-
615
- return (
616
- <div className={classes.root} onKeyDown={handleKeyDown} ref={root}>
617
- <div
618
- className={clsx(classes.inputWrapper, isDisabled && classes.disabled)}
619
- onClick={isDisabled || isReadonly ? undefined : handleOnClick}
620
- ref={inputWrapper}
621
- >
622
- <Input
623
- value={
624
- searchValue !== '' && !shouldRenderSearchInputInList ? searchValue : showedStringValue
625
- }
626
- onChange={handleInputChange}
627
- isActive={isListOpen || isActive}
628
- isReadonly={hasReadonlyInput}
629
- onFocus={handleFocus}
630
- onBlur={handleBlur}
631
- isDisabled={isDisabled}
632
- ref={input}
633
- isLoading={areOptionsLoading}
634
- tweakStyles={tweakInputStyles}
635
- testId={testId}
636
- iconType={isMultiSelect ? multiSelectCounterWithIcon : iconType}
637
- {...inputProps}
638
- />
639
- <div
640
- onMouseDown={(event: MouseEvent) => {
641
- event.preventDefault();
642
- }}
643
- onClick={onArrowClick}
644
- className={clsx(classes.arrow, isOpen && classes.activeArrow)}
645
- >
646
- {renderIcon(dropdownIcon)}
647
- </div>
648
- </div>
649
- {shouldUsePopper ? (
650
- <Portal container={shouldRenderInBody ? document.body : inputWrapper.current}>
651
- <>{listEl}</>
652
- </Portal>
653
- ) : (
654
- <>{isOpen && listEl}</>
655
- )}
656
- </div>
657
- );
658
- }
1
+ import {
2
+ useCallback,
3
+ useEffect,
4
+ useMemo,
5
+ useRef,
6
+ useState,
7
+ ChangeEvent,
8
+ CSSProperties,
9
+ FocusEvent,
10
+ FormEvent,
11
+ KeyboardEvent,
12
+ MouseEvent,
13
+ ReactNode,
14
+ SyntheticEvent,
15
+ } from 'react';
16
+ import { Portal } from 'react-overlays';
17
+ import clsx from 'clsx';
18
+ import { debounce } from 'ts-debounce';
19
+ import {
20
+ createFilter,
21
+ getTestId,
22
+ isEmpty,
23
+ isNotEmpty,
24
+ isReactNodeNotEmpty,
25
+ isStringNotEmpty,
26
+ } from '@true-engineering/true-react-platform-helpers';
27
+ import { hasExactParent } from '../../helpers';
28
+ import { useDropdown, useIsMounted, useOnClickOutsideWithRef, useTweakStyles } from '../../hooks';
29
+ import { IDropdownWithPopperOptions, ICommonProps } from '../../types';
30
+ import { renderIcon, IIcon } from '../Icon';
31
+ import { Input, IInputProps } from '../Input';
32
+ import { SearchInput, ISearchInputProps } from '../SearchInput';
33
+ import { SelectList } from './components';
34
+ import { ALL_OPTION_INDEX, DEFAULT_OPTION_INDEX } from './constants';
35
+ import {
36
+ defaultCompareFunction,
37
+ defaultConvertFunction,
38
+ defaultIsOptionDisabled,
39
+ getDefaultConvertToIdFunction,
40
+ } from './helpers';
41
+ import { IMultipleSelectValue } from './types';
42
+ import { getInputStyles, searchInputStyles, useStyles, ISelectStyles } from './Select.styles';
43
+
44
+ export interface ISelectProps<Value>
45
+ extends Omit<IInputProps, 'value' | 'onChange' | 'onBlur' | 'type' | 'tweakStyles'>,
46
+ ICommonProps<ISelectStyles> {
47
+ header?: ReactNode;
48
+ footer?: ReactNode;
49
+ defaultOptionLabel?: ReactNode;
50
+ allOptionsLabel?: string;
51
+ noMatchesLabel?: string;
52
+ loadingLabel?: ReactNode;
53
+ /** @default 'normal' */
54
+ optionsMode?: 'search' | 'dynamic' | 'normal';
55
+ /** @default 400 */
56
+ debounceTime?: number;
57
+ /** @default 0 */
58
+ minSymbolsCountToOpenList?: number;
59
+ dropdownOptions?: IDropdownWithPopperOptions;
60
+ /** @default 'chevron-down' */
61
+ dropdownIcon?: IIcon;
62
+ options: Value[] | Readonly<Value[]>;
63
+ value: Value | undefined;
64
+ /** @default true */
65
+ shouldScrollToList?: boolean;
66
+ isMultiSelect?: false;
67
+ searchInput?: { shouldRenderInList: true } & Pick<ISearchInputProps, 'placeholder'>;
68
+ isOptionDisabled?: (option: Value) => boolean;
69
+ onChange: (
70
+ value: Value | undefined,
71
+ event:
72
+ | MouseEvent<HTMLElement>
73
+ | KeyboardEvent
74
+ | ChangeEvent<HTMLElement>
75
+ | FormEvent<HTMLElement>,
76
+ ) => void; // подумать как возвращать индекс
77
+ onBlur?: (event: Event | SyntheticEvent) => void;
78
+ onType?: (value: string) => Promise<void>;
79
+ optionsFilter?: (options: Value[], query: string) => Value[];
80
+ onOpen?: () => void;
81
+ compareValuesOnChange?: (v1?: Value, v2?: Value) => boolean;
82
+ /** @description Функция должна быть мемоизирована с целью избежания ререндера */
83
+ convertValueToString?: (value: Value) => string | undefined;
84
+ /** @description Функция должна быть мемоизирована с целью избежания ререндера */
85
+ convertValueToReactNode?: (value: Value, isDisabled: boolean) => ReactNode;
86
+ /** @description Функция должна быть мемоизирована с целью избежания ререндера */
87
+ convertValueToId?: (value: Value) => string | undefined;
88
+ }
89
+
90
+ export interface IMultipleSelectProps<Value>
91
+ extends Omit<
92
+ ISelectProps<Value>,
93
+ 'value' | 'onChange' | 'compareValuesOnChange' | 'isMultiSelect'
94
+ > {
95
+ isMultiSelect: true;
96
+ value: IMultipleSelectValue<Value> | undefined;
97
+ onChange: (
98
+ value: IMultipleSelectValue<Value> | undefined,
99
+ event:
100
+ | MouseEvent<HTMLElement>
101
+ | KeyboardEvent
102
+ | ChangeEvent<HTMLElement>
103
+ | FormEvent<HTMLElement>,
104
+ ) => void;
105
+ compareValuesOnChange?: (
106
+ v1?: IMultipleSelectValue<Value>,
107
+ v2?: IMultipleSelectValue<Value>,
108
+ ) => boolean;
109
+ }
110
+
111
+ export function Select<Value>(
112
+ props: ISelectProps<Value> | IMultipleSelectProps<Value>,
113
+ ): JSX.Element {
114
+ const {
115
+ options,
116
+ isMultiSelect,
117
+ value,
118
+ header,
119
+ footer,
120
+ defaultOptionLabel,
121
+ allOptionsLabel,
122
+ debounceTime = 400,
123
+ optionsMode = 'normal',
124
+ noMatchesLabel,
125
+ loadingLabel,
126
+ tweakStyles,
127
+ testId,
128
+ isActive,
129
+ isReadonly,
130
+ isDisabled,
131
+ dropdownOptions,
132
+ minSymbolsCountToOpenList = 0,
133
+ dropdownIcon = 'chevron-down',
134
+ shouldScrollToList = true,
135
+ searchInput,
136
+ iconType,
137
+ onChange,
138
+ onFocus,
139
+ onBlur,
140
+ onType,
141
+ onOpen,
142
+ isOptionDisabled = defaultIsOptionDisabled,
143
+ compareValuesOnChange = defaultCompareFunction,
144
+ convertValueToString = defaultConvertFunction,
145
+ convertValueToId,
146
+ convertValueToReactNode,
147
+ optionsFilter,
148
+ ...inputProps
149
+ } = props;
150
+ const classes = useStyles({ theme: tweakStyles });
151
+
152
+ const { shouldRenderInList: shouldRenderSearchInputInList = false, ...searchInputProps } =
153
+ searchInput ?? {};
154
+ const hasSearchInputInList = optionsMode !== 'normal' && shouldRenderSearchInputInList;
155
+ const hasReadonlyInput = isReadonly || optionsMode === 'normal' || shouldRenderSearchInputInList;
156
+
157
+ const tweakInputStyles = useTweakStyles({
158
+ innerStyles: getInputStyles({ hasReadonlyInput, isMultiSelect }),
159
+ tweakStyles,
160
+ className: 'tweakInput',
161
+ currentComponentName: 'Select',
162
+ });
163
+
164
+ const tweakSearchInputStyles = useTweakStyles({
165
+ innerStyles: searchInputStyles,
166
+ tweakStyles,
167
+ className: 'tweakSearchInput',
168
+ currentComponentName: 'Select',
169
+ });
170
+
171
+ const tweakSelectListStyles = useTweakStyles({
172
+ tweakStyles,
173
+ className: 'tweakSelectList',
174
+ currentComponentName: 'Select',
175
+ });
176
+
177
+ const isMounted = useIsMounted();
178
+ const [isListOpen, setIsListOpen] = useState(false);
179
+ const [areOptionsLoading, setAreOptionsLoading] = useState(false);
180
+ const hasDefaultOption = isReactNodeNotEmpty(defaultOptionLabel);
181
+
182
+ const [focusedListCellIndex, setFocusedListCellIndex] = useState(DEFAULT_OPTION_INDEX);
183
+ const [searchValue, setSearchValue] = useState('');
184
+ // если мы ввели что то в строку поиска - то этот булеан будет отключаться
185
+ // вынесен отдельно, из-за проблем с дебаунсом при динамич. опциях
186
+ const [shouldShowDefaultOption, setShouldShowDefaultOption] = useState(true);
187
+
188
+ const root = useRef<HTMLDivElement>(null);
189
+ const inputWrapper = useRef<HTMLDivElement>(null);
190
+ const list = useRef<HTMLDivElement>(null);
191
+ const input = useRef<HTMLInputElement>(null); // TODO ref снаружи?
192
+
193
+ const strValue = isMultiSelect ? value?.[0] : value;
194
+ const shouldShowAllOption =
195
+ isMultiSelect && isStringNotEmpty(allOptionsLabel) && searchValue === '';
196
+
197
+ const filteredOptions = useMemo(() => {
198
+ if (optionsMode !== 'search') {
199
+ return options;
200
+ }
201
+
202
+ const filter =
203
+ optionsFilter ?? createFilter<Value>((option) => [convertValueToString(option) ?? '']);
204
+
205
+ return filter(options as Value[], searchValue);
206
+ }, [optionsFilter, options, convertValueToString, searchValue, optionsMode]);
207
+
208
+ const availableOptions = useMemo(
209
+ () => options.filter((option) => !isOptionDisabled(option)),
210
+ [options, isOptionDisabled],
211
+ );
212
+
213
+ const areAllOptionsSelected = isMultiSelect && value?.length === availableOptions.length;
214
+ const shouldShowMultiSelectCounter =
215
+ isMultiSelect && isNotEmpty(value) && value.length > 1 && !areAllOptionsSelected;
216
+
217
+ const optionsIndexesForNavigation = useMemo(() => {
218
+ const result: number[] = [];
219
+ if (shouldShowDefaultOption && hasDefaultOption) {
220
+ result.push(DEFAULT_OPTION_INDEX);
221
+ }
222
+ if (shouldShowAllOption) {
223
+ result.push(ALL_OPTION_INDEX);
224
+ }
225
+ return result.concat(
226
+ filteredOptions.reduce((acc, cur, i) => {
227
+ if (!isOptionDisabled(cur)) {
228
+ acc.push(i);
229
+ }
230
+ return acc;
231
+ }, [] as number[]),
232
+ );
233
+ }, [
234
+ filteredOptions,
235
+ hasDefaultOption,
236
+ isOptionDisabled,
237
+ shouldShowAllOption,
238
+ shouldShowDefaultOption,
239
+ ]);
240
+
241
+ const stringValue = isNotEmpty(strValue) ? convertValueToString(strValue) : undefined;
242
+ // Для мультиселекта пытаемся показать "Все опции" если выбраны все опции
243
+ const showedStringValue =
244
+ areAllOptionsSelected && isNotEmpty(allOptionsLabel) ? allOptionsLabel : stringValue;
245
+
246
+ const convertToId = useCallback(
247
+ (v: Value) => (convertValueToId ?? getDefaultConvertToIdFunction(convertValueToString))(v),
248
+ [convertValueToId, convertValueToString],
249
+ );
250
+
251
+ const getDropdownOffset = () => {
252
+ if (isEmpty(input.current) || inputProps.errorPosition === 'top') {
253
+ return 0;
254
+ }
255
+
256
+ // Высота элемента inputWrapper у компонента Input
257
+ return input.current.parentElement?.offsetHeight ?? 0;
258
+ };
259
+
260
+ const closeList = useCallback(() => {
261
+ setIsListOpen(false);
262
+ setSearchValue('');
263
+ setShouldShowDefaultOption(true);
264
+
265
+ if (!dropdownOptions?.shouldUsePopper) {
266
+ root.current?.style.removeProperty('--dropdown-offset');
267
+ }
268
+ }, [dropdownOptions?.shouldUsePopper]);
269
+
270
+ const handleListClose = useCallback(
271
+ (event: Event | SyntheticEvent) => {
272
+ closeList();
273
+ onBlur?.(event);
274
+ },
275
+ [closeList, onBlur],
276
+ );
277
+
278
+ const handleListOpen = () => {
279
+ if (isReadonly) {
280
+ return;
281
+ }
282
+
283
+ if (!isListOpen) {
284
+ setIsListOpen(true);
285
+
286
+ if (!dropdownOptions?.shouldUsePopper) {
287
+ root.current?.style.setProperty('--dropdown-offset', `${getDropdownOffset()}px`);
288
+ }
289
+ }
290
+ };
291
+
292
+ const handleFocus = (event: FocusEvent<HTMLInputElement>) => {
293
+ onFocus?.(event);
294
+ handleListOpen();
295
+ };
296
+
297
+ const handleOnClick = () => {
298
+ handleListOpen();
299
+ };
300
+
301
+ const handleBlur = (event: FocusEvent<HTMLInputElement>) => {
302
+ // Когда что-то блокирует открытие листа, но блур все равно должен сработать
303
+ // например minSymbolsCount
304
+ if (isListOpen && !isOpen) {
305
+ handleListClose(event);
306
+ return;
307
+ }
308
+
309
+ if (
310
+ !isNotEmpty(event.relatedTarget) ||
311
+ !isNotEmpty(list.current) ||
312
+ !isNotEmpty(inputWrapper.current)
313
+ ) {
314
+ return;
315
+ }
316
+
317
+ const isActionInsideSelect =
318
+ hasExactParent(event.relatedTarget, list.current) ||
319
+ hasExactParent(event.relatedTarget, inputWrapper.current);
320
+
321
+ // Ничего не делаем, если клик был внутри селекта
322
+ if (!isActionInsideSelect) {
323
+ handleListClose(event);
324
+ }
325
+ };
326
+
327
+ const handleChange = useCallback(
328
+ (
329
+ newValue: Value | IMultipleSelectValue<Value> | undefined,
330
+ event:
331
+ | MouseEvent<HTMLElement>
332
+ | KeyboardEvent
333
+ | ChangeEvent<HTMLElement>
334
+ | FormEvent<HTMLElement>,
335
+ ) => {
336
+ // Тут беда с типами, сорри
337
+ if (!compareValuesOnChange(value as never, newValue as never)) {
338
+ onChange(newValue as (Value & IMultipleSelectValue<Value>) | undefined, event);
339
+ }
340
+ },
341
+ [value, compareValuesOnChange, onChange],
342
+ );
343
+
344
+ const handleOptionSelect = useCallback(
345
+ (index: number, event: MouseEvent<HTMLElement> | KeyboardEvent) => {
346
+ handleChange(index === DEFAULT_OPTION_INDEX ? undefined : filteredOptions[index], event);
347
+ handleListClose(event);
348
+ input.current?.blur();
349
+ },
350
+ [handleChange, handleListClose, filteredOptions],
351
+ );
352
+
353
+ // MultiSelect
354
+ const handleToggleOptionCheckbox = useCallback(
355
+ (index: number, isSelected: boolean, event: ChangeEvent<HTMLElement> | KeyboardEvent) => {
356
+ if (!isMultiSelect) {
357
+ return;
358
+ }
359
+
360
+ // Если выбрана не дефолтная опция, которая сетит андеф
361
+ if (index === DEFAULT_OPTION_INDEX || (index === ALL_OPTION_INDEX && !isSelected)) {
362
+ handleChange(undefined, event);
363
+ return;
364
+ }
365
+ if (index === ALL_OPTION_INDEX && isSelected) {
366
+ handleChange(availableOptions as IMultipleSelectValue<Value>, event);
367
+ return;
368
+ }
369
+ const option = filteredOptions[index];
370
+ handleChange(
371
+ isSelected
372
+ ? // Добавляем
373
+ ([...(value ?? []), option] as IMultipleSelectValue<Value>)
374
+ : // Убираем
375
+ value?.filter((o) => convertToId(o) !== convertToId(option)),
376
+ event,
377
+ );
378
+ },
379
+ [isMultiSelect, filteredOptions, handleChange, value, availableOptions, convertToId],
380
+ );
381
+
382
+ const handleOnType = useCallback(
383
+ async (v: string) => {
384
+ if (onType === undefined) {
385
+ return;
386
+ }
387
+ if (isMounted()) {
388
+ setAreOptionsLoading(true);
389
+ }
390
+ await onType(v);
391
+ if (isMounted()) {
392
+ setAreOptionsLoading(false);
393
+ }
394
+ if (optionsMode === 'dynamic') {
395
+ setShouldShowDefaultOption(v === '');
396
+ }
397
+ },
398
+ [isMounted, onType, optionsMode],
399
+ );
400
+
401
+ const debounceHandleOnType = useMemo(
402
+ () => debounce(handleOnType, debounceTime, { isImmediate: debounceTime === 0 }),
403
+ [handleOnType, debounceTime],
404
+ );
405
+
406
+ const handleInputChange = (v: string, event: FormEvent<HTMLElement>) => {
407
+ if (onType !== undefined) {
408
+ debounceHandleOnType(v);
409
+ }
410
+
411
+ if (optionsMode !== 'dynamic') {
412
+ setShouldShowDefaultOption(v === '');
413
+ }
414
+
415
+ if (v === '' && !hasSearchInputInList) {
416
+ handleChange(undefined, event);
417
+ }
418
+
419
+ setSearchValue(v);
420
+ };
421
+
422
+ const handleKeyDown = (event: KeyboardEvent) => {
423
+ if (!isListOpen) {
424
+ return;
425
+ }
426
+
427
+ event.stopPropagation();
428
+ const curIndexInNavigation = optionsIndexesForNavigation.findIndex(
429
+ (index) => index === focusedListCellIndex,
430
+ );
431
+
432
+ switch (event.code) {
433
+ case 'Enter':
434
+ case 'NumpadEnter': {
435
+ let indexToSelect = focusedListCellIndex;
436
+
437
+ // если осталась одна опция в списке,
438
+ // то выбираем ее нажатием на enter
439
+ if (indexToSelect === DEFAULT_OPTION_INDEX && filteredOptions.length === 1) {
440
+ indexToSelect = 0;
441
+ }
442
+
443
+ if (isMultiSelect) {
444
+ let isThisValueAlreadySelected: boolean | undefined;
445
+ if (indexToSelect === ALL_OPTION_INDEX) {
446
+ isThisValueAlreadySelected = areAllOptionsSelected;
447
+ } else {
448
+ // подумать над концептом реального фокуса на опциях, а не вот эти вот focusedCell
449
+ const option = filteredOptions[indexToSelect];
450
+ const valueIdToSelect = convertToId(option);
451
+ isThisValueAlreadySelected =
452
+ value?.some((opt) => convertToId(opt) === valueIdToSelect) ?? false;
453
+ }
454
+ handleToggleOptionCheckbox(indexToSelect, !isThisValueAlreadySelected, event);
455
+ } else {
456
+ handleOptionSelect(indexToSelect, event);
457
+ }
458
+ break;
459
+ }
460
+
461
+ case 'ArrowDown': {
462
+ // чтобы убрать перемещение курсора в инпуте
463
+ event.preventDefault();
464
+ const targetIndexInNavigation =
465
+ (curIndexInNavigation + 1) % optionsIndexesForNavigation.length;
466
+ setFocusedListCellIndex(optionsIndexesForNavigation[targetIndexInNavigation]);
467
+ break;
468
+ }
469
+
470
+ case 'ArrowUp': {
471
+ // чтобы убрать перемещение курсора в инпуте
472
+ event.preventDefault();
473
+ const targetIndexInNavigation =
474
+ (curIndexInNavigation - 1 + optionsIndexesForNavigation.length) %
475
+ optionsIndexesForNavigation.length;
476
+ setFocusedListCellIndex(optionsIndexesForNavigation[targetIndexInNavigation]);
477
+ break;
478
+ }
479
+ }
480
+ };
481
+
482
+ const onArrowClick = () => {
483
+ if (isListOpen) {
484
+ input.current?.blur();
485
+ closeList();
486
+ } else {
487
+ input.current?.focus();
488
+ }
489
+ };
490
+
491
+ useOnClickOutsideWithRef(list, handleListClose, inputWrapper);
492
+
493
+ const hasEnoughSymbolsToSearch = searchValue.trim().length >= minSymbolsCountToOpenList;
494
+
495
+ const isOpen =
496
+ // Пользователь пытается открыть лист
497
+ isListOpen &&
498
+ // Нам есть что показать:
499
+ // Есть опции
500
+ (filteredOptions.length > 0 ||
501
+ // Дефолтная опция
502
+ (defaultOptionLabel !== undefined && !hasEnoughSymbolsToSearch) ||
503
+ // Текст "Загрузка..."
504
+ inputProps.isLoading ||
505
+ // Текст "Совпадений не найдено"
506
+ noMatchesLabel !== undefined ||
507
+ // У нас есть инпут с поиском внутри листа
508
+ hasSearchInputInList) &&
509
+ // Последняя проверка на случай, если мы че то ищем в опциях
510
+ (optionsMode === 'normal' || hasEnoughSymbolsToSearch);
511
+
512
+ // Эти значения ставятся в false по дефолту также в useDropdown
513
+ const {
514
+ shouldUsePopper = false,
515
+ shouldRenderInBody = false,
516
+ shouldHideOnScroll = false,
517
+ } = dropdownOptions ?? {};
518
+
519
+ const popperData = useDropdown({
520
+ isOpen,
521
+ onDropdownClose: handleListClose,
522
+ referenceElement: input.current?.parentElement ?? inputWrapper.current,
523
+ dropdownElement: list.current,
524
+ options: dropdownOptions,
525
+ dependenciesForPositionUpdating: [inputProps.isLoading, filteredOptions.length],
526
+ });
527
+
528
+ useEffect(() => {
529
+ const focusedCellIndex = isNotEmpty(strValue)
530
+ ? optionsIndexesForNavigation.find((index) => {
531
+ const option = filteredOptions[index];
532
+ return isNotEmpty(option) && convertToId(option) === convertToId(strValue);
533
+ })
534
+ : undefined;
535
+
536
+ setFocusedListCellIndex(focusedCellIndex ?? optionsIndexesForNavigation[0]);
537
+ }, [strValue, filteredOptions, optionsIndexesForNavigation, convertToId]);
538
+
539
+ useEffect(() => {
540
+ if (isOpen) {
541
+ onOpen?.();
542
+ }
543
+ }, [isOpen]);
544
+
545
+ const searchInputEl = hasSearchInputInList && (
546
+ <SearchInput
547
+ value={searchValue}
548
+ onChange={handleInputChange}
549
+ tweakStyles={tweakSearchInputStyles}
550
+ placeholder="Поиск"
551
+ {...searchInputProps}
552
+ />
553
+ );
554
+
555
+ // Т.к. используется для проверки на пустой элемент `isReactNodeNotEmpty` внутри `SelectList`, то
556
+ // он пропускает React.Fragment
557
+ const customHeader = (isReactNodeNotEmpty(searchInputEl) || isReactNodeNotEmpty(header)) && (
558
+ <>
559
+ {searchInputEl}
560
+ {header}
561
+ </>
562
+ );
563
+
564
+ const listEl = (
565
+ <div
566
+ className={clsx(classes.listWrapper, {
567
+ [classes.withoutPopper]: !shouldUsePopper,
568
+ [classes.listWrapperInBody]: shouldRenderInBody,
569
+ })}
570
+ ref={list}
571
+ style={popperData?.styles.popper as CSSProperties}
572
+ tabIndex={0}
573
+ onBlur={handleBlur} // обработка для Tab из списка
574
+ {...popperData?.attributes.popper}
575
+ >
576
+ {isOpen && (
577
+ <SelectList
578
+ options={filteredOptions}
579
+ defaultOptionLabel={hasDefaultOption && shouldShowDefaultOption && defaultOptionLabel}
580
+ allOptionsLabel={shouldShowAllOption && allOptionsLabel}
581
+ areAllOptionsSelected={areAllOptionsSelected}
582
+ customListHeader={customHeader}
583
+ customListFooter={footer}
584
+ noMatchesLabel={noMatchesLabel}
585
+ focusedIndex={focusedListCellIndex}
586
+ activeValue={value}
587
+ isLoading={inputProps.isLoading}
588
+ loadingLabel={loadingLabel}
589
+ tweakStyles={tweakSelectListStyles}
590
+ testId={getTestId(testId, 'list')}
591
+ isMultiSelect={isMultiSelect}
592
+ // скролл не работает с включеным поппером
593
+ shouldScrollToList={shouldScrollToList && !shouldUsePopper && !shouldHideOnScroll}
594
+ isOptionDisabled={isOptionDisabled}
595
+ convertValueToString={convertValueToString}
596
+ convertValueToReactNode={convertValueToReactNode}
597
+ convertValueToId={convertToId}
598
+ onOptionSelect={handleOptionSelect}
599
+ onToggleCheckbox={handleToggleOptionCheckbox}
600
+ />
601
+ )}
602
+ </div>
603
+ );
604
+
605
+ const multiSelectCounterWithIcon =
606
+ shouldShowMultiSelectCounter || isNotEmpty(iconType) ? (
607
+ <>
608
+ {shouldShowMultiSelectCounter && (
609
+ <div className={classes.counter}>(+{value.length - 1})</div>
610
+ )}
611
+ {isNotEmpty(iconType) && <div className={classes.icon}>{renderIcon(iconType)}</div>}
612
+ </>
613
+ ) : undefined;
614
+
615
+ return (
616
+ <div className={classes.root} onKeyDown={handleKeyDown} ref={root}>
617
+ <div
618
+ className={clsx(classes.inputWrapper, isDisabled && classes.disabled)}
619
+ onClick={isDisabled || isReadonly ? undefined : handleOnClick}
620
+ ref={inputWrapper}
621
+ >
622
+ <Input
623
+ value={
624
+ searchValue !== '' && !shouldRenderSearchInputInList ? searchValue : showedStringValue
625
+ }
626
+ onChange={handleInputChange}
627
+ isActive={isListOpen || isActive}
628
+ isReadonly={hasReadonlyInput}
629
+ onFocus={handleFocus}
630
+ onBlur={handleBlur}
631
+ isDisabled={isDisabled}
632
+ ref={input}
633
+ isLoading={areOptionsLoading}
634
+ tweakStyles={tweakInputStyles}
635
+ testId={testId}
636
+ iconType={isMultiSelect ? multiSelectCounterWithIcon : iconType}
637
+ {...inputProps}
638
+ />
639
+ <div
640
+ onMouseDown={(event: MouseEvent) => {
641
+ event.preventDefault();
642
+ }}
643
+ onClick={onArrowClick}
644
+ className={clsx(classes.arrow, isOpen && classes.activeArrow)}
645
+ >
646
+ {renderIcon(dropdownIcon)}
647
+ </div>
648
+ </div>
649
+ {shouldUsePopper ? (
650
+ <Portal container={shouldRenderInBody ? document.body : inputWrapper.current}>
651
+ <>{listEl}</>
652
+ </Portal>
653
+ ) : (
654
+ <>{isOpen && listEl}</>
655
+ )}
656
+ </div>
657
+ );
658
+ }