@skbkontur/react-ui 4.2.2 → 4.3.0

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 (337) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/cjs/components/Autocomplete/Autocomplete.d.ts +9 -17
  3. package/cjs/components/Autocomplete/Autocomplete.js +10 -6
  4. package/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
  5. package/cjs/components/Button/Button.d.ts +4 -5
  6. package/cjs/components/Button/Button.js +8 -3
  7. package/cjs/components/Button/Button.js.map +1 -1
  8. package/cjs/components/Button/Button.mixins.js +1 -1
  9. package/cjs/components/Button/Button.mixins.js.map +1 -1
  10. package/cjs/components/Button/Button.styles.js +18 -18
  11. package/cjs/components/Button/Button.styles.js.map +1 -1
  12. package/cjs/components/Center/Center.d.ts +4 -3
  13. package/cjs/components/Center/Center.js +9 -3
  14. package/cjs/components/Center/Center.js.map +1 -1
  15. package/cjs/components/ComboBox/ComboBox.d.ts +8 -13
  16. package/cjs/components/ComboBox/ComboBox.js +12 -2
  17. package/cjs/components/ComboBox/ComboBox.js.map +1 -1
  18. package/cjs/components/CurrencyInput/CurrencyInput.d.ts +6 -9
  19. package/cjs/components/CurrencyInput/CurrencyInput.js +15 -6
  20. package/cjs/components/CurrencyInput/CurrencyInput.js.map +1 -1
  21. package/cjs/components/CurrencyLabel/CurrencyLabel.d.ts +3 -9
  22. package/cjs/components/CurrencyLabel/CurrencyLabel.js +15 -15
  23. package/cjs/components/CurrencyLabel/CurrencyLabel.js.map +1 -1
  24. package/cjs/components/DateInput/DateInput.d.ts +8 -11
  25. package/cjs/components/DateInput/DateInput.js +11 -3
  26. package/cjs/components/DateInput/DateInput.js.map +1 -1
  27. package/cjs/components/DatePicker/DatePicker.d.ts +6 -8
  28. package/cjs/components/DatePicker/DatePicker.js +12 -6
  29. package/cjs/components/DatePicker/DatePicker.js.map +1 -1
  30. package/cjs/components/DropdownMenu/DropdownMenu.d.ts +5 -5
  31. package/cjs/components/DropdownMenu/DropdownMenu.js +9 -3
  32. package/cjs/components/DropdownMenu/DropdownMenu.js.map +1 -1
  33. package/cjs/components/FxInput/FxInput.d.ts +6 -6
  34. package/cjs/components/FxInput/FxInput.js +13 -10
  35. package/cjs/components/FxInput/FxInput.js.map +1 -1
  36. package/cjs/components/Gapped/Gapped.d.ts +7 -8
  37. package/cjs/components/Gapped/Gapped.js +12 -6
  38. package/cjs/components/Gapped/Gapped.js.map +1 -1
  39. package/cjs/components/GlobalLoader/GlobalLoader.d.ts +7 -14
  40. package/cjs/components/GlobalLoader/GlobalLoader.js +13 -9
  41. package/cjs/components/GlobalLoader/GlobalLoader.js.map +1 -1
  42. package/cjs/components/Hint/Hint.d.ts +7 -11
  43. package/cjs/components/Hint/Hint.js +15 -5
  44. package/cjs/components/Hint/Hint.js.map +1 -1
  45. package/cjs/components/Input/Input.d.ts +4 -3
  46. package/cjs/components/Input/Input.js +7 -4
  47. package/cjs/components/Input/Input.js.map +1 -1
  48. package/cjs/components/Kebab/Kebab.d.ts +7 -11
  49. package/cjs/components/Kebab/Kebab.js +14 -5
  50. package/cjs/components/Kebab/Kebab.js.map +1 -1
  51. package/cjs/components/Link/Link.d.ts +4 -4
  52. package/cjs/components/Link/Link.js +11 -4
  53. package/cjs/components/Link/Link.js.map +1 -1
  54. package/cjs/components/Loader/Loader.d.ts +7 -4
  55. package/cjs/components/Loader/Loader.js +14 -4
  56. package/cjs/components/Loader/Loader.js.map +1 -1
  57. package/cjs/components/Modal/Modal.d.ts +4 -3
  58. package/cjs/components/Modal/Modal.js +8 -3
  59. package/cjs/components/Modal/Modal.js.map +1 -1
  60. package/cjs/components/Paging/Paging.d.ts +6 -9
  61. package/cjs/components/Paging/Paging.js +15 -5
  62. package/cjs/components/Paging/Paging.js.map +1 -1
  63. package/cjs/components/Paging/PagingDefaultComponent.d.ts +1 -1
  64. package/cjs/components/Paging/PagingDefaultComponent.js.map +1 -1
  65. package/cjs/components/PasswordInput/PasswordInput.d.ts +4 -3
  66. package/cjs/components/PasswordInput/PasswordInput.js +8 -3
  67. package/cjs/components/PasswordInput/PasswordInput.js.map +1 -1
  68. package/cjs/components/Radio/Radio.d.ts +4 -3
  69. package/cjs/components/Radio/Radio.js +8 -3
  70. package/cjs/components/Radio/Radio.js.map +1 -1
  71. package/cjs/components/RadioGroup/RadioGroup.d.ts +2 -4
  72. package/cjs/components/RadioGroup/RadioGroup.js +4 -2
  73. package/cjs/components/RadioGroup/RadioGroup.js.map +1 -1
  74. package/cjs/components/ScrollContainer/ScrollContainer.d.ts +6 -7
  75. package/cjs/components/ScrollContainer/ScrollContainer.js +11 -5
  76. package/cjs/components/ScrollContainer/ScrollContainer.js.map +1 -1
  77. package/cjs/components/Select/Select.d.ts +3 -12
  78. package/cjs/components/Select/Select.js +6 -1
  79. package/cjs/components/Select/Select.js.map +1 -1
  80. package/cjs/components/Select/Select.styles.js +4 -4
  81. package/cjs/components/Select/Select.styles.js.map +1 -1
  82. package/cjs/components/SidePage/SidePage.d.ts +5 -6
  83. package/cjs/components/SidePage/SidePage.js +8 -1
  84. package/cjs/components/SidePage/SidePage.js.map +1 -1
  85. package/cjs/components/Spinner/Spinner.d.ts +4 -2
  86. package/cjs/components/Spinner/Spinner.js +9 -3
  87. package/cjs/components/Spinner/Spinner.js.map +1 -1
  88. package/cjs/components/Sticky/Sticky.d.ts +5 -4
  89. package/cjs/components/Sticky/Sticky.js +9 -2
  90. package/cjs/components/Sticky/Sticky.js.map +1 -1
  91. package/cjs/components/Tabs/Tab.d.ts +4 -4
  92. package/cjs/components/Tabs/Tab.js +11 -13
  93. package/cjs/components/Tabs/Tab.js.map +1 -1
  94. package/cjs/components/Tabs/Tabs.d.ts +4 -4
  95. package/cjs/components/Tabs/Tabs.js +12 -3
  96. package/cjs/components/Tabs/Tabs.js.map +1 -1
  97. package/cjs/components/Textarea/Textarea.d.ts +8 -10
  98. package/cjs/components/Textarea/Textarea.js +10 -6
  99. package/cjs/components/Textarea/Textarea.js.map +1 -1
  100. package/cjs/components/Toggle/Toggle.d.ts +5 -6
  101. package/cjs/components/Toggle/Toggle.js +10 -4
  102. package/cjs/components/Toggle/Toggle.js.map +1 -1
  103. package/cjs/components/TokenInput/TokenInput.d.ts +19 -16
  104. package/cjs/components/TokenInput/TokenInput.js +75 -57
  105. package/cjs/components/TokenInput/TokenInput.js.map +1 -1
  106. package/cjs/components/Tooltip/Tooltip.d.ts +10 -14
  107. package/cjs/components/Tooltip/Tooltip.js +23 -12
  108. package/cjs/components/Tooltip/Tooltip.js.map +1 -1
  109. package/cjs/components/TooltipMenu/TooltipMenu.d.ts +5 -4
  110. package/cjs/components/TooltipMenu/TooltipMenu.js +11 -5
  111. package/cjs/components/TooltipMenu/TooltipMenu.js.map +1 -1
  112. package/cjs/internal/BGRuler.d.ts +13 -15
  113. package/cjs/internal/BGRuler.js +16 -8
  114. package/cjs/internal/BGRuler.js.map +1 -1
  115. package/cjs/internal/Calendar/Calendar.d.ts +4 -13
  116. package/cjs/internal/Calendar/Calendar.js +10 -5
  117. package/cjs/internal/Calendar/Calendar.js.map +1 -1
  118. package/cjs/internal/Calendar/DayCellView.styles.js +1 -1
  119. package/cjs/internal/Calendar/DayCellView.styles.js.map +1 -1
  120. package/cjs/internal/Calendar/Month.js +16 -11
  121. package/cjs/internal/Calendar/Month.js.map +1 -1
  122. package/cjs/internal/ComponentCombinator.d.ts +6 -8
  123. package/cjs/internal/ComponentCombinator.js +6 -2
  124. package/cjs/internal/ComponentCombinator.js.map +1 -1
  125. package/cjs/internal/ComponentTable.d.ts +5 -6
  126. package/cjs/internal/ComponentTable.js +11 -2
  127. package/cjs/internal/ComponentTable.js.map +1 -1
  128. package/cjs/internal/CustomComboBox/ComboBoxMenu.d.ts +4 -4
  129. package/cjs/internal/CustomComboBox/ComboBoxMenu.js +7 -1
  130. package/cjs/internal/CustomComboBox/ComboBoxMenu.js.map +1 -1
  131. package/cjs/internal/CustomComboBox/ComboBoxView.d.ts +4 -12
  132. package/cjs/internal/CustomComboBox/ComboBoxView.js +18 -10
  133. package/cjs/internal/CustomComboBox/ComboBoxView.js.map +1 -1
  134. package/cjs/internal/DateSelect/DateSelect.d.ts +4 -6
  135. package/cjs/internal/DateSelect/DateSelect.js +15 -9
  136. package/cjs/internal/DateSelect/DateSelect.js.map +1 -1
  137. package/cjs/internal/DropdownContainer/DropdownContainer.d.ts +3 -6
  138. package/cjs/internal/DropdownContainer/DropdownContainer.js +8 -5
  139. package/cjs/internal/DropdownContainer/DropdownContainer.js.map +1 -1
  140. package/cjs/internal/InputLikeText/InputLikeText.d.ts +4 -3
  141. package/cjs/internal/InputLikeText/InputLikeText.js +7 -2
  142. package/cjs/internal/InputLikeText/InputLikeText.js.map +1 -1
  143. package/cjs/internal/InternalMenu/InternalMenu.d.ts +3 -9
  144. package/cjs/internal/InternalMenu/InternalMenu.js +16 -6
  145. package/cjs/internal/InternalMenu/InternalMenu.js.map +1 -1
  146. package/cjs/internal/MaskedInput/MaskedInput.d.ts +4 -2
  147. package/cjs/internal/MaskedInput/MaskedInput.js +7 -2
  148. package/cjs/internal/MaskedInput/MaskedInput.js.map +1 -1
  149. package/cjs/internal/Menu/Menu.d.ts +4 -7
  150. package/cjs/internal/Menu/Menu.js +7 -1
  151. package/cjs/internal/Menu/Menu.js.map +1 -1
  152. package/cjs/internal/Popup/Popup.d.ts +10 -16
  153. package/cjs/internal/Popup/Popup.js +21 -7
  154. package/cjs/internal/Popup/Popup.js.map +1 -1
  155. package/cjs/internal/PopupMenu/PopupMenu.d.ts +8 -11
  156. package/cjs/internal/PopupMenu/PopupMenu.js +8 -1
  157. package/cjs/internal/PopupMenu/PopupMenu.js.map +1 -1
  158. package/cjs/internal/RenderLayer/RenderLayer.d.ts +4 -3
  159. package/cjs/internal/RenderLayer/RenderLayer.js +8 -2
  160. package/cjs/internal/RenderLayer/RenderLayer.js.map +1 -1
  161. package/cjs/internal/ThemePlayground/VariableValue.d.ts +5 -4
  162. package/cjs/internal/ThemePlayground/VariableValue.js +6 -1
  163. package/cjs/internal/ThemePlayground/VariableValue.js.map +1 -1
  164. package/cjs/internal/ZIndex/ZIndex.d.ts +7 -11
  165. package/cjs/internal/ZIndex/ZIndex.js +10 -3
  166. package/cjs/internal/ZIndex/ZIndex.js.map +1 -1
  167. package/cjs/lib/createPropsGetter.d.ts +2 -1
  168. package/cjs/lib/createPropsGetter.js +2 -0
  169. package/cjs/lib/createPropsGetter.js.map +1 -1
  170. package/components/Autocomplete/Autocomplete/Autocomplete.js +22 -12
  171. package/components/Autocomplete/Autocomplete/Autocomplete.js.map +1 -1
  172. package/components/Autocomplete/Autocomplete.d.ts +9 -17
  173. package/components/Button/Button/Button.js +11 -5
  174. package/components/Button/Button/Button.js.map +1 -1
  175. package/components/Button/Button.d.ts +4 -5
  176. package/components/Button/Button.mixins/Button.mixins.js +1 -1
  177. package/components/Button/Button.mixins/Button.mixins.js.map +1 -1
  178. package/components/Button/Button.styles/Button.styles.js +18 -18
  179. package/components/Button/Button.styles/Button.styles.js.map +1 -1
  180. package/components/Center/Center/Center.js +7 -5
  181. package/components/Center/Center/Center.js.map +1 -1
  182. package/components/Center/Center.d.ts +4 -3
  183. package/components/ComboBox/ComboBox/ComboBox.js +3 -1
  184. package/components/ComboBox/ComboBox/ComboBox.js.map +1 -1
  185. package/components/ComboBox/ComboBox.d.ts +8 -13
  186. package/components/CurrencyInput/CurrencyInput/CurrencyInput.js +21 -18
  187. package/components/CurrencyInput/CurrencyInput/CurrencyInput.js.map +1 -1
  188. package/components/CurrencyInput/CurrencyInput.d.ts +6 -9
  189. package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js +21 -15
  190. package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js.map +1 -1
  191. package/components/CurrencyLabel/CurrencyLabel.d.ts +3 -9
  192. package/components/DateInput/DateInput/DateInput.js +17 -4
  193. package/components/DateInput/DateInput/DateInput.js.map +1 -1
  194. package/components/DateInput/DateInput.d.ts +8 -11
  195. package/components/DatePicker/DatePicker/DatePicker.js +12 -9
  196. package/components/DatePicker/DatePicker/DatePicker.js.map +1 -1
  197. package/components/DatePicker/DatePicker.d.ts +6 -8
  198. package/components/DropdownMenu/DropdownMenu/DropdownMenu.js +8 -2
  199. package/components/DropdownMenu/DropdownMenu/DropdownMenu.js.map +1 -1
  200. package/components/DropdownMenu/DropdownMenu.d.ts +5 -5
  201. package/components/FxInput/FxInput/FxInput.js +11 -9
  202. package/components/FxInput/FxInput/FxInput.js.map +1 -1
  203. package/components/FxInput/FxInput.d.ts +6 -6
  204. package/components/Gapped/Gapped/Gapped.js +17 -8
  205. package/components/Gapped/Gapped/Gapped.js.map +1 -1
  206. package/components/Gapped/Gapped.d.ts +7 -8
  207. package/components/GlobalLoader/GlobalLoader/GlobalLoader.js +35 -16
  208. package/components/GlobalLoader/GlobalLoader/GlobalLoader.js.map +1 -1
  209. package/components/GlobalLoader/GlobalLoader.d.ts +7 -14
  210. package/components/Hint/Hint/Hint.js +30 -18
  211. package/components/Hint/Hint/Hint.js.map +1 -1
  212. package/components/Hint/Hint.d.ts +7 -11
  213. package/components/Input/Input/Input.js +9 -7
  214. package/components/Input/Input/Input.js.map +1 -1
  215. package/components/Input/Input.d.ts +4 -3
  216. package/components/Kebab/Kebab/Kebab.js +19 -8
  217. package/components/Kebab/Kebab/Kebab.js.map +1 -1
  218. package/components/Kebab/Kebab.d.ts +7 -11
  219. package/components/Link/Link/Link.js +9 -6
  220. package/components/Link/Link/Link.js.map +1 -1
  221. package/components/Link/Link.d.ts +4 -4
  222. package/components/Loader/Loader/Loader.js +22 -17
  223. package/components/Loader/Loader/Loader.js.map +1 -1
  224. package/components/Loader/Loader.d.ts +7 -4
  225. package/components/Modal/Modal/Modal.js +3 -1
  226. package/components/Modal/Modal/Modal.js.map +1 -1
  227. package/components/Modal/Modal.d.ts +4 -3
  228. package/components/Paging/Paging/Paging.js +24 -14
  229. package/components/Paging/Paging/Paging.js.map +1 -1
  230. package/components/Paging/Paging.d.ts +6 -9
  231. package/components/Paging/PagingDefaultComponent/PagingDefaultComponent.js.map +1 -1
  232. package/components/Paging/PagingDefaultComponent.d.ts +1 -1
  233. package/components/PasswordInput/PasswordInput/PasswordInput.js +7 -5
  234. package/components/PasswordInput/PasswordInput/PasswordInput.js.map +1 -1
  235. package/components/PasswordInput/PasswordInput.d.ts +4 -3
  236. package/components/Radio/Radio/Radio.js +7 -5
  237. package/components/Radio/Radio/Radio.js.map +1 -1
  238. package/components/Radio/Radio.d.ts +4 -3
  239. package/components/RadioGroup/RadioGroup/RadioGroup.js +10 -10
  240. package/components/RadioGroup/RadioGroup/RadioGroup.js.map +1 -1
  241. package/components/RadioGroup/RadioGroup.d.ts +2 -4
  242. package/components/ScrollContainer/ScrollContainer/ScrollContainer.js +10 -6
  243. package/components/ScrollContainer/ScrollContainer/ScrollContainer.js.map +1 -1
  244. package/components/ScrollContainer/ScrollContainer.d.ts +6 -7
  245. package/components/Select/Select/Select.js +4 -3
  246. package/components/Select/Select/Select.js.map +1 -1
  247. package/components/Select/Select.d.ts +3 -12
  248. package/components/Select/Select.styles/Select.styles.js +4 -4
  249. package/components/Select/Select.styles/Select.styles.js.map +1 -1
  250. package/components/SidePage/SidePage/SidePage.js +14 -9
  251. package/components/SidePage/SidePage/SidePage.js.map +1 -1
  252. package/components/SidePage/SidePage.d.ts +5 -6
  253. package/components/Spinner/Spinner/Spinner.js +7 -5
  254. package/components/Spinner/Spinner/Spinner.js.map +1 -1
  255. package/components/Spinner/Spinner.d.ts +4 -2
  256. package/components/Sticky/Sticky/Sticky.js +7 -4
  257. package/components/Sticky/Sticky/Sticky.js.map +1 -1
  258. package/components/Sticky/Sticky.d.ts +5 -4
  259. package/components/Tabs/Tab/Tab.js +15 -7
  260. package/components/Tabs/Tab/Tab.js.map +1 -1
  261. package/components/Tabs/Tab.d.ts +4 -4
  262. package/components/Tabs/Tabs/Tabs.js +10 -8
  263. package/components/Tabs/Tabs/Tabs.js.map +1 -1
  264. package/components/Tabs/Tabs.d.ts +4 -4
  265. package/components/Textarea/Textarea/Textarea.js +19 -14
  266. package/components/Textarea/Textarea/Textarea.js.map +1 -1
  267. package/components/Textarea/Textarea.d.ts +8 -10
  268. package/components/Toggle/Toggle/Toggle.js +12 -7
  269. package/components/Toggle/Toggle/Toggle.js.map +1 -1
  270. package/components/Toggle/Toggle.d.ts +5 -6
  271. package/components/TokenInput/TokenInput/TokenInput.js +107 -77
  272. package/components/TokenInput/TokenInput/TokenInput.js.map +1 -1
  273. package/components/TokenInput/TokenInput.d.ts +19 -16
  274. package/components/Tooltip/Tooltip/Tooltip.js +51 -30
  275. package/components/Tooltip/Tooltip/Tooltip.js.map +1 -1
  276. package/components/Tooltip/Tooltip.d.ts +10 -14
  277. package/components/TooltipMenu/TooltipMenu/TooltipMenu.js +15 -13
  278. package/components/TooltipMenu/TooltipMenu/TooltipMenu.js.map +1 -1
  279. package/components/TooltipMenu/TooltipMenu.d.ts +5 -4
  280. package/internal/BGRuler/BGRuler.js +11 -6
  281. package/internal/BGRuler/BGRuler.js.map +1 -1
  282. package/internal/BGRuler.d.ts +13 -15
  283. package/internal/Calendar/Calendar/Calendar.js +11 -5
  284. package/internal/Calendar/Calendar/Calendar.js.map +1 -1
  285. package/internal/Calendar/Calendar.d.ts +4 -13
  286. package/internal/Calendar/DayCellView.styles/DayCellView.styles.js +1 -1
  287. package/internal/Calendar/DayCellView.styles/DayCellView.styles.js.map +1 -1
  288. package/internal/Calendar/Month/Month.js +20 -11
  289. package/internal/Calendar/Month/Month.js.map +1 -1
  290. package/internal/ComponentCombinator/ComponentCombinator.js +8 -5
  291. package/internal/ComponentCombinator/ComponentCombinator.js.map +1 -1
  292. package/internal/ComponentCombinator.d.ts +6 -8
  293. package/internal/ComponentTable/ComponentTable.js +16 -4
  294. package/internal/ComponentTable/ComponentTable.js.map +1 -1
  295. package/internal/ComponentTable.d.ts +5 -6
  296. package/internal/CustomComboBox/ComboBoxMenu/ComboBoxMenu.js +4 -2
  297. package/internal/CustomComboBox/ComboBoxMenu/ComboBoxMenu.js.map +1 -1
  298. package/internal/CustomComboBox/ComboBoxMenu.d.ts +4 -4
  299. package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js +21 -10
  300. package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js.map +1 -1
  301. package/internal/CustomComboBox/ComboBoxView.d.ts +4 -12
  302. package/internal/DateSelect/DateSelect/DateSelect.js +14 -11
  303. package/internal/DateSelect/DateSelect/DateSelect.js.map +1 -1
  304. package/internal/DateSelect/DateSelect.d.ts +4 -6
  305. package/internal/DropdownContainer/DropdownContainer/DropdownContainer.js +6 -10
  306. package/internal/DropdownContainer/DropdownContainer/DropdownContainer.js.map +1 -1
  307. package/internal/DropdownContainer/DropdownContainer.d.ts +3 -6
  308. package/internal/InputLikeText/InputLikeText/InputLikeText.js +4 -2
  309. package/internal/InputLikeText/InputLikeText/InputLikeText.js.map +1 -1
  310. package/internal/InputLikeText/InputLikeText.d.ts +4 -3
  311. package/internal/InternalMenu/InternalMenu/InternalMenu.js +21 -10
  312. package/internal/InternalMenu/InternalMenu/InternalMenu.js.map +1 -1
  313. package/internal/InternalMenu/InternalMenu.d.ts +3 -9
  314. package/internal/MaskedInput/MaskedInput/MaskedInput.js +3 -1
  315. package/internal/MaskedInput/MaskedInput/MaskedInput.js.map +1 -1
  316. package/internal/MaskedInput/MaskedInput.d.ts +4 -2
  317. package/internal/Menu/Menu/Menu.js +10 -3
  318. package/internal/Menu/Menu/Menu.js.map +1 -1
  319. package/internal/Menu/Menu.d.ts +4 -7
  320. package/internal/Popup/Popup/Popup.js +32 -23
  321. package/internal/Popup/Popup/Popup.js.map +1 -1
  322. package/internal/Popup/Popup.d.ts +10 -16
  323. package/internal/PopupMenu/PopupMenu/PopupMenu.js +12 -4
  324. package/internal/PopupMenu/PopupMenu/PopupMenu.js.map +1 -1
  325. package/internal/PopupMenu/PopupMenu.d.ts +8 -11
  326. package/internal/RenderLayer/RenderLayer/RenderLayer.js +8 -4
  327. package/internal/RenderLayer/RenderLayer/RenderLayer.js.map +1 -1
  328. package/internal/RenderLayer/RenderLayer.d.ts +4 -3
  329. package/internal/ThemePlayground/VariableValue/VariableValue.js +4 -2
  330. package/internal/ThemePlayground/VariableValue/VariableValue.js.map +1 -1
  331. package/internal/ThemePlayground/VariableValue.d.ts +5 -4
  332. package/internal/ZIndex/ZIndex/ZIndex.js +15 -13
  333. package/internal/ZIndex/ZIndex/ZIndex.js.map +1 -1
  334. package/internal/ZIndex/ZIndex.d.ts +7 -11
  335. package/lib/createPropsGetter/createPropsGetter.js.map +1 -1
  336. package/lib/createPropsGetter.d.ts +2 -1
  337. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["ComboBoxMenu.tsx"],"names":["ComboBoxMenuDataTids","loading","failed","notFound","items","item","ComboBoxMenu","CustomComboBoxLocaleHelper","renderItem","index","props","onValueChange","React","isValidElement","element","Object","assign","key","onClick","cloneElement","isMobile","state","render","opened","totalCount","refMenu","renderNotFound","renderTotalCount","maxMenuHeight","requestStatus","locale","errorNetworkButton","errorNetworkMessage","renderAddButton","maxHeight","length","ComboBoxRequestStatus","Failed","maxWidth","whiteSpace","repeatRequest","notFoundValue","total","renderedItems","map","countItems","filter","type","__KONTUR_REACT_UI__","fontSize","Component","defaultProps","undefined","Unknown"],"mappings":"uRAAA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,kC;;;;;;;;;;;;;;;;;;;;AAoBO,IAAMA,oBAAoB,GAAG;AAClCC,EAAAA,OAAO,EAAE,uBADyB;AAElCC,EAAAA,MAAM,EAAE,sBAF0B;AAGlCC,EAAAA,QAAQ,EAAE,wBAHwB;AAIlCC,EAAAA,KAAK,EAAE,qBAJ2B;AAKlCC,EAAAA,IAAI,EAAE,oBAL4B,EAA7B,C;;;;AASMC,Y,WADZ,wBAAO,UAAP,EAAmBC,kCAAnB,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,gBACH,6BAAC,kBAAD,IAAU,QAAQ,MAAlB,EAAmB,GAAG,EAAC,OAAvB,EAA+B,QAAQ,EAAEtB,QAAzC,iBACE,sCAAK,KAAK,EAAE,EAAE6B,QAAQ,EAAE,EAAZ,EAAZ,IAA+BtB,gBAAgB,CAACkB,UAAD,EAAarB,UAAb,CAA/C,CADF,CADF,CAKD,CAED,oBACE,6BAAC,UAAD,IAAM,YAAUxB,oBAAoB,CAACI,KAArC,EAA4C,GAAG,EAAEqB,OAAjD,EAA0D,SAAS,EAAES,SAArE,EAAgF,sBAAsB,EAAEd,QAAxG,IACGuB,aADH,EAEGD,KAFH,EAGGT,eAAe,IAAI,cAAC,6BAAC,4BAAD,IAAe,GAAG,EAAC,WAAnB,GAAD,EAAoCA,eAApC,CAHtB,CADF,CAOD,C,uBAjHkCiB,gB,WACrBF,mB,GAAsB,c,UAEtBG,Y,GAAe,EAC3BX,aAAa,EAAE,iCAAMY,SAAN,EADY,EAE3BvB,aAAa,EAAEO,2CAAsBiB,OAFV,E","sourcesContent":["import React, { Component } from 'react';\n\nimport { isNullable } from '../../lib/utils';\nimport { locale } from '../../lib/locale/decorators';\nimport { Menu } from '../Menu';\nimport { MenuItem, MenuItemState } from '../../components/MenuItem';\nimport { Spinner } from '../../components/Spinner';\nimport { Nullable } from '../../typings/utility-types';\nimport { MenuSeparator } from '../../components/MenuSeparator';\n\nimport { ComboBoxRequestStatus } from './CustomComboBoxTypes';\nimport { ComboBoxLocale, CustomComboBoxLocaleHelper } from './locale';\n\nexport interface ComboBoxMenuProps<T> {\n opened?: boolean;\n items?: Nullable<T[]>;\n totalCount?: number;\n loading?: boolean;\n maxMenuHeight?: number | string;\n refMenu?: (menu: Nullable<Menu>) => void;\n renderNotFound?: () => React.ReactNode;\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n renderItem: (item: T, state: MenuItemState) => React.ReactNode;\n onValueChange: (value: T) => any;\n renderAddButton?: () => React.ReactNode;\n caption?: React.ReactNode;\n repeatRequest?: () => void;\n requestStatus?: ComboBoxRequestStatus;\n isMobile?: boolean;\n}\n\nexport const ComboBoxMenuDataTids = {\n loading: 'ComboBoxMenu__loading',\n failed: 'ComboBoxMenu__failed',\n notFound: 'ComboBoxMenu__notFound',\n items: 'ComboBoxMenu__items',\n item: 'ComboBoxMenu__item',\n} as const;\n\n@locale('ComboBox', CustomComboBoxLocaleHelper)\nexport class ComboBoxMenu<T> extends Component<ComboBoxMenuProps<T>> {\n public static __KONTUR_REACT_UI__ = 'ComboBoxMenu';\n\n public static defaultProps = {\n repeatRequest: () => undefined,\n requestStatus: ComboBoxRequestStatus.Unknown,\n };\n\n private readonly locale!: ComboBoxLocale;\n\n public render() {\n const {\n opened,\n items,\n totalCount,\n loading,\n refMenu,\n renderNotFound = () => notFound,\n renderTotalCount,\n maxMenuHeight,\n requestStatus,\n isMobile,\n } = this.props;\n\n const { notFound, errorNetworkButton, errorNetworkMessage } = this.locale;\n\n if (!opened) {\n return null;\n }\n\n let renderAddButton = null;\n if (this.props.renderAddButton) {\n renderAddButton = this.props.renderAddButton();\n }\n\n const maxHeight = isMobile ? 'auto' : maxMenuHeight;\n\n if (loading && (!items || !items.length)) {\n return (\n <Menu\n maxHeight={maxHeight}\n ref={refMenu}\n disableScrollContainer={isMobile}\n data-tid={ComboBoxMenuDataTids.loading}\n >\n <MenuItem disabled isMobile={isMobile}>\n <Spinner type=\"mini\" dimmed />\n </MenuItem>\n </Menu>\n );\n }\n\n if (items === null && requestStatus === ComboBoxRequestStatus.Failed) {\n return (\n <Menu\n ref={refMenu}\n maxHeight={maxHeight}\n disableScrollContainer={isMobile}\n data-tid={ComboBoxMenuDataTids.failed}\n >\n <MenuItem disabled key=\"message\" isMobile={isMobile}>\n <div style={{ maxWidth: 300, whiteSpace: 'normal' }}>{errorNetworkMessage}</div>\n </MenuItem>\n <MenuItem link onClick={this.props.repeatRequest} key=\"retry\" isMobile={isMobile}>\n {errorNetworkButton}\n </MenuItem>\n </Menu>\n );\n }\n\n if ((isNullable(items) || items.length === 0) && renderNotFound) {\n const notFoundValue = renderNotFound();\n if (renderAddButton) {\n return (\n <Menu maxHeight={maxHeight} ref={refMenu} disableScrollContainer={isMobile}>\n {renderAddButton}\n </Menu>\n );\n }\n\n if (notFoundValue) {\n return (\n <Menu maxHeight={maxHeight} ref={refMenu} disableScrollContainer={isMobile}>\n <MenuItem data-tid={ComboBoxMenuDataTids.notFound} disabled isMobile={isMobile}>\n {notFoundValue}\n </MenuItem>\n </Menu>\n );\n }\n\n return null;\n }\n\n let total = null;\n const renderedItems = items && items.map(this.renderItem);\n // @ts-ignore // todo fix checking\n const countItems = renderedItems?.filter((item) => item?.type?.__KONTUR_REACT_UI__ === 'MenuItem').length;\n\n if (countItems && renderTotalCount && totalCount && countItems < totalCount) {\n total = (\n <MenuItem disabled key=\"total\" isMobile={isMobile}>\n <div style={{ fontSize: 12 }}>{renderTotalCount(countItems, totalCount)}</div>\n </MenuItem>\n );\n }\n\n return (\n <Menu data-tid={ComboBoxMenuDataTids.items} ref={refMenu} maxHeight={maxHeight} disableScrollContainer={isMobile}>\n {renderedItems}\n {total}\n {renderAddButton && [<MenuSeparator key=\"separator\" />, renderAddButton]}\n </Menu>\n );\n }\n\n private renderItem = (item: T, index: number): React.ReactNode => {\n // NOTE this is undesireable feature, better\n // to remove it from further versions\n const { renderItem, onValueChange } = this.props;\n if (typeof item === 'function' || React.isValidElement(item)) {\n // @ts-ignore\n const element = typeof item === 'function' ? item() : item;\n const props = Object.assign(\n {\n key: index,\n onClick: () => onValueChange(element.props),\n },\n element.props,\n );\n return React.cloneElement(element, props);\n }\n\n return (\n <MenuItem\n data-tid={ComboBoxMenuDataTids.item}\n onClick={() => onValueChange(item)}\n key={index}\n isMobile={this.props.isMobile}\n >\n {(state) => renderItem(item, state)}\n </MenuItem>\n );\n };\n}\n"]}
1
+ {"version":3,"sources":["ComboBoxMenu.tsx"],"names":["ComboBoxMenuDataTids","loading","failed","notFound","items","item","ComboBoxMenu","CustomComboBoxLocaleHelper","getProps","defaultProps","renderItem","index","props","onValueChange","React","isValidElement","element","Object","assign","key","onClick","cloneElement","isMobile","state","render","opened","totalCount","refMenu","renderNotFound","renderTotalCount","maxMenuHeight","requestStatus","locale","errorNetworkButton","errorNetworkMessage","renderAddButton","maxHeight","length","ComboBoxRequestStatus","Failed","maxWidth","whiteSpace","repeatRequest","notFoundValue","total","renderedItems","map","countItems","filter","type","__KONTUR_REACT_UI__","fontSize","Component","undefined","Unknown"],"mappings":"uRAAA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kC;;;;;;;;;;;;;;;;;;;;AAoBO,IAAMA,oBAAoB,GAAG;AAClCC,EAAAA,OAAO,EAAE,uBADyB;AAElCC,EAAAA,MAAM,EAAE,sBAF0B;AAGlCC,EAAAA,QAAQ,EAAE,wBAHwB;AAIlCC,EAAAA,KAAK,EAAE,qBAJ2B;AAKlCC,EAAAA,IAAI,EAAE,oBAL4B,EAA7B,C;;;;;;AAWMC,Y,WADZ,wBAAO,UAAP,EAAmBC,kCAAnB,C;;;;;;;;AASSC,IAAAA,Q,GAAW,0CAAkBF,YAAY,CAACG,YAA/B,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GXC,IAAAA,U,GAAa,UAACL,IAAD,EAAUM,KAAV,EAA6C;AAChE;AACA;AACA,wBAAsC,MAAKC,KAA3C,CAAQF,UAAR,eAAQA,UAAR,CAAoBG,aAApB,eAAoBA,aAApB;AACA,UAAI,OAAOR,IAAP,KAAgB,UAAhB,iBAA8BS,eAAMC,cAAN,CAAqBV,IAArB,CAAlC,EAA8D;AAC5D;AACA,YAAMW,OAAO,GAAG,OAAOX,IAAP,KAAgB,UAAhB,GAA6BA,IAAI,EAAjC,GAAsCA,IAAtD;AACA,YAAMO,KAAK,GAAGK,MAAM,CAACC,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AI,cAAC,6BAAC,4BAAD,IAAe,GAAG,EAAC,WAAnB,GAAD,EAAoCA,eAApC,CAHtB,CADF,CAOD,C,uBApHkCiB,gB,WACrBF,mB,GAAsB,c,UAEtBzC,Y,GAAsC,EAClDiC,aAAa,EAAE,iCAAMW,SAAN,EADmC,EAElDtB,aAAa,EAAEO,2CAAsBgB,OAFa,E","sourcesContent":["import React, { Component } from 'react';\n\nimport { isNullable } from '../../lib/utils';\nimport { locale } from '../../lib/locale/decorators';\nimport { Menu } from '../Menu';\nimport { MenuItem, MenuItemState } from '../../components/MenuItem';\nimport { Spinner } from '../../components/Spinner';\nimport { Nullable } from '../../typings/utility-types';\nimport { MenuSeparator } from '../../components/MenuSeparator';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { ComboBoxRequestStatus } from './CustomComboBoxTypes';\nimport { ComboBoxLocale, CustomComboBoxLocaleHelper } from './locale';\n\nexport interface ComboBoxMenuProps<T> {\n opened?: boolean;\n items?: Nullable<T[]>;\n totalCount?: number;\n loading?: boolean;\n maxMenuHeight?: number | string;\n refMenu?: (menu: Nullable<Menu>) => void;\n renderNotFound?: () => React.ReactNode;\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n renderItem: (item: T, state: MenuItemState) => React.ReactNode;\n onValueChange: (value: T) => any;\n renderAddButton?: () => React.ReactNode;\n caption?: React.ReactNode;\n repeatRequest?: () => void;\n requestStatus?: ComboBoxRequestStatus;\n isMobile?: boolean;\n}\n\nexport const ComboBoxMenuDataTids = {\n loading: 'ComboBoxMenu__loading',\n failed: 'ComboBoxMenu__failed',\n notFound: 'ComboBoxMenu__notFound',\n items: 'ComboBoxMenu__items',\n item: 'ComboBoxMenu__item',\n} as const;\n\ntype DefaultProps<T> = Required<Pick<ComboBoxMenuProps<T>, 'repeatRequest' | 'requestStatus'>>;\n\n@locale('ComboBox', CustomComboBoxLocaleHelper)\nexport class ComboBoxMenu<T> extends Component<ComboBoxMenuProps<T>> {\n public static __KONTUR_REACT_UI__ = 'ComboBoxMenu';\n\n public static defaultProps: DefaultProps<unknown> = {\n repeatRequest: () => undefined,\n requestStatus: ComboBoxRequestStatus.Unknown,\n };\n\n private getProps = createPropsGetter(ComboBoxMenu.defaultProps);\n\n private readonly locale!: ComboBoxLocale;\n\n public render() {\n const {\n opened,\n items,\n totalCount,\n loading,\n refMenu,\n renderNotFound = () => notFound,\n renderTotalCount,\n maxMenuHeight,\n isMobile,\n } = this.props;\n\n const requestStatus = this.getProps().requestStatus;\n\n const { notFound, errorNetworkButton, errorNetworkMessage } = this.locale;\n\n if (!opened) {\n return null;\n }\n\n let renderAddButton = null;\n if (this.props.renderAddButton) {\n renderAddButton = this.props.renderAddButton();\n }\n\n const maxHeight = isMobile ? 'auto' : maxMenuHeight;\n\n if (loading && (!items || !items.length)) {\n return (\n <Menu\n maxHeight={maxHeight}\n ref={refMenu}\n disableScrollContainer={isMobile}\n data-tid={ComboBoxMenuDataTids.loading}\n >\n <MenuItem disabled isMobile={isMobile}>\n <Spinner type=\"mini\" dimmed />\n </MenuItem>\n </Menu>\n );\n }\n\n if (items === null && requestStatus === ComboBoxRequestStatus.Failed) {\n return (\n <Menu\n ref={refMenu}\n maxHeight={maxHeight}\n disableScrollContainer={isMobile}\n data-tid={ComboBoxMenuDataTids.failed}\n >\n <MenuItem disabled key=\"message\" isMobile={isMobile}>\n <div style={{ maxWidth: 300, whiteSpace: 'normal' }}>{errorNetworkMessage}</div>\n </MenuItem>\n <MenuItem link onClick={this.getProps().repeatRequest} key=\"retry\" isMobile={isMobile}>\n {errorNetworkButton}\n </MenuItem>\n </Menu>\n );\n }\n\n if ((isNullable(items) || items.length === 0) && renderNotFound) {\n const notFoundValue = renderNotFound();\n if (renderAddButton) {\n return (\n <Menu maxHeight={maxHeight} ref={refMenu} disableScrollContainer={isMobile}>\n {renderAddButton}\n </Menu>\n );\n }\n\n if (notFoundValue) {\n return (\n <Menu maxHeight={maxHeight} ref={refMenu} disableScrollContainer={isMobile}>\n <MenuItem data-tid={ComboBoxMenuDataTids.notFound} disabled isMobile={isMobile}>\n {notFoundValue}\n </MenuItem>\n </Menu>\n );\n }\n\n return null;\n }\n\n let total = null;\n const renderedItems = items && items.map(this.renderItem);\n // @ts-ignore // todo fix checking\n const countItems = renderedItems?.filter((item) => item?.type?.__KONTUR_REACT_UI__ === 'MenuItem').length;\n\n if (countItems && renderTotalCount && totalCount && countItems < totalCount) {\n total = (\n <MenuItem disabled key=\"total\" isMobile={isMobile}>\n <div style={{ fontSize: 12 }}>{renderTotalCount(countItems, totalCount)}</div>\n </MenuItem>\n );\n }\n\n return (\n <Menu data-tid={ComboBoxMenuDataTids.items} ref={refMenu} maxHeight={maxHeight} disableScrollContainer={isMobile}>\n {renderedItems}\n {total}\n {renderAddButton && [<MenuSeparator key=\"separator\" />, renderAddButton]}\n </Menu>\n );\n }\n\n private renderItem = (item: T, index: number): React.ReactNode => {\n // NOTE this is undesireable feature, better\n // to remove it from further versions\n const { renderItem, onValueChange } = this.props;\n if (typeof item === 'function' || React.isValidElement(item)) {\n // @ts-ignore\n const element = typeof item === 'function' ? item() : item;\n const props = Object.assign(\n {\n key: index,\n onClick: () => onValueChange(element.props),\n },\n element.props,\n );\n return React.cloneElement(element, props);\n }\n\n return (\n <MenuItem\n data-tid={ComboBoxMenuDataTids.item}\n onClick={() => onValueChange(item)}\n key={index}\n isMobile={this.props.isMobile}\n >\n {(state) => renderItem(item, state)}\n </MenuItem>\n );\n };\n}\n"]}
@@ -53,7 +53,7 @@ interface ComboBoxViewProps<T> extends CommonProps {
53
53
  renderNotFound?: () => React.ReactNode;
54
54
  renderTotalCount?: (found: number, total: number) => React.ReactNode;
55
55
  renderValue?: (item: T) => React.ReactNode;
56
- renderAddButton: (query?: string) => React.ReactNode;
56
+ renderAddButton?: (query?: string) => React.ReactNode;
57
57
  repeatRequest?: () => void;
58
58
  requestStatus?: ComboBoxRequestStatus;
59
59
  refInput?: (input: Nullable<Input>) => void;
@@ -63,19 +63,11 @@ interface ComboBoxViewProps<T> extends CommonProps {
63
63
  interface ComboBoxViewState {
64
64
  isMobileOpened: boolean;
65
65
  }
66
+ declare type DefaultProps<T> = Required<Pick<ComboBoxViewProps<T>, 'renderItem' | 'renderValue' | 'renderAddButton' | 'repeatRequest' | 'requestStatus' | 'onClickOutside' | 'onFocusOutside' | 'size' | 'width'>>;
66
67
  export declare class ComboBoxView<T> extends React.Component<ComboBoxViewProps<T>, ComboBoxViewState> {
67
68
  static __KONTUR_REACT_UI__: string;
68
- static defaultProps: {
69
- renderItem: (item: any) => any;
70
- renderValue: (item: any) => any;
71
- renderAddButton: () => null;
72
- repeatRequest: () => undefined;
73
- requestStatus: ComboBoxRequestStatus;
74
- onClickOutside: () => void;
75
- onFocusOutside: () => void;
76
- size: string;
77
- width: number;
78
- };
69
+ static defaultProps: DefaultProps<unknown>;
70
+ private getProps;
79
71
  private input;
80
72
  private setRootNode;
81
73
  private mobileInput;
@@ -14,6 +14,7 @@ var _CommonWrapper = require("../../internal/CommonWrapper");
14
14
  var _MobilePopup = require("../MobilePopup");
15
15
  var _decorator = require("../../components/ResponsiveLayout/decorator");
16
16
  var _rootNode = require("../../lib/rootNode");
17
+ var _createPropsGetter = require("../../lib/createPropsGetter");
17
18
 
18
19
  var _ComboBoxMenu = require("./ComboBoxMenu");
19
20
  var _CustomComboBoxTypes = require("./CustomComboBoxTypes");
@@ -82,7 +83,6 @@ var _CustomComboBox2 = require("./CustomComboBox");var _class, _class2, _temp;va
82
83
 
83
84
 
84
85
 
85
- ComboBoxView = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function (_React$Component) {(0, _inheritsLoose2.default)(ComboBoxView, _React$Component);function ComboBoxView() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;_this.
86
86
 
87
87
 
88
88
 
@@ -95,6 +95,10 @@ ComboBoxView = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNode)
95
95
 
96
96
 
97
97
 
98
+
99
+
100
+
101
+ ComboBoxView = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNode)(_class = (_temp = _class2 = /*#__PURE__*/function (_React$Component) {(0, _inheritsLoose2.default)(ComboBoxView, _React$Component);function ComboBoxView() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;_this.
98
102
 
99
103
 
100
104
 
@@ -103,9 +107,7 @@ ComboBoxView = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNode)
103
107
 
104
108
 
105
109
 
106
- mobileInput = null;_this.
107
110
 
108
- dropdownContainerRef = /*#__PURE__*/_react.default.createRef();_this.
109
111
 
110
112
 
111
113
 
@@ -114,13 +116,14 @@ ComboBoxView = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNode)
114
116
 
115
117
 
116
118
 
117
- state = {
118
- isMobileOpened: false };_this.
119
119
 
120
+ getProps = (0, _createPropsGetter.createPropsGetter)(ComboBoxView.defaultProps);_this.
120
121
 
121
122
 
122
123
 
124
+ mobileInput = null;_this.
123
125
 
126
+ dropdownContainerRef = /*#__PURE__*/_react.default.createRef();_this.
124
127
 
125
128
 
126
129
 
@@ -129,6 +132,8 @@ ComboBoxView = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNode)
129
132
 
130
133
 
131
134
 
135
+ state = {
136
+ isMobileOpened: false };_this.
132
137
 
133
138
 
134
139
 
@@ -153,8 +158,6 @@ ComboBoxView = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNode)
153
158
 
154
159
 
155
160
 
156
- getComboBoxMenu = function () {
157
- var _this$props =
158
161
 
159
162
 
160
163
 
@@ -166,8 +169,13 @@ ComboBoxView = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNode)
166
169
 
167
170
 
168
171
 
169
- _this.props,items = _this$props.items,loading = _this$props.loading,opened = _this$props.opened,refMenu = _this$props.refMenu,maxMenuHeight = _this$props.maxMenuHeight,renderTotalCount = _this$props.renderTotalCount,renderItem = _this$props.renderItem,renderNotFound = _this$props.renderNotFound,repeatRequest = _this$props.repeatRequest,requestStatus = _this$props.requestStatus,totalCount = _this$props.totalCount;
170
172
 
173
+
174
+
175
+ getComboBoxMenu = function () {
176
+ var _this$props = _this.props,items = _this$props.items,loading = _this$props.loading,opened = _this$props.opened,refMenu = _this$props.refMenu,maxMenuHeight = _this$props.maxMenuHeight,renderTotalCount = _this$props.renderTotalCount,renderNotFound = _this$props.renderNotFound,totalCount = _this$props.totalCount;
177
+
178
+ var _this$getProps = _this.getProps(),repeatRequest = _this$getProps.repeatRequest,requestStatus = _this$getProps.requestStatus,renderItem = _this$getProps.renderItem;
171
179
  return /*#__PURE__*/(
172
180
  _react.default.createElement(_ComboBoxMenu.ComboBoxMenu, {
173
181
  items: items,
@@ -251,7 +259,7 @@ ComboBoxView = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNode)
251
259
  };_this.
252
260
 
253
261
  renderAddButton = function () {
254
- return _this.props.renderAddButton(_this.props.textValue);
262
+ return _this.getProps().renderAddButton(_this.props.textValue);
255
263
  };_this.
256
264
 
257
265
 
@@ -377,4 +385,4 @@ ComboBoxView = (0, _decorator.responsiveLayout)(_class = (0, _rootNode.rootNode)
377
385
 
378
386
  refMobileInput = function (input) {
379
387
  _this.mobileInput = input;
380
- };return _this;}var _proto = ComboBoxView.prototype;_proto.componentDidMount = function componentDidMount() {var _this$dropdownContain;if (this.props.autoFocus && this.props.onFocus) {this.props.onFocus();}this.props.opened && ((_this$dropdownContain = this.dropdownContainerRef.current) == null ? void 0 : _this$dropdownContain.position());};_proto.componentDidUpdate = function componentDidUpdate(prevProps) {var input = this.input,props = this.props;if (props.editing && !prevProps.editing && input) {input.focus();}};_proto.render = function render() {var _this$props5 = this.props,onClickOutside = _this$props5.onClickOutside,onFocusOutside = _this$props5.onFocusOutside,onMouseEnter = _this$props5.onMouseEnter,onMouseLeave = _this$props5.onMouseLeave,onMouseOver = _this$props5.onMouseOver,opened = _this$props5.opened,width = _this$props5.width;var isMobile = this.isMobileLayout;var input = this.renderInput();return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, this.props, /*#__PURE__*/_react.default.createElement(_RenderLayer.RenderLayer, { onClickOutside: onClickOutside, onFocusOutside: onFocusOutside, active: opened }, /*#__PURE__*/_react.default.createElement("span", { "data-tid": _CustomComboBox2.CustomComboBoxDataTids.comboBoxView, style: { width: width }, className: _CustomComboBox.styles.root(), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseOver: onMouseOver, ref: this.setRootNode }, input, isMobile ? this.renderMobileMenu() : this.renderMenu())));};_proto.renderInput = function renderInput() {var isMobile = this.isMobileLayout;var _this$props6 = this.props,align = _this$props6.align,borderless = _this$props6.borderless,disabled = _this$props6.disabled,editing = _this$props6.editing,error = _this$props6.error,onFocus = _this$props6.onFocus,onInputBlur = _this$props6.onInputBlur,onInputValueChange = _this$props6.onInputValueChange,onInputFocus = _this$props6.onInputFocus,onInputClick = _this$props6.onInputClick,onInputKeyDown = _this$props6.onInputKeyDown,placeholder = _this$props6.placeholder,renderValue = _this$props6.renderValue,size = _this$props6.size,textValue = _this$props6.textValue,value = _this$props6.value,warning = _this$props6.warning,refInputLikeText = _this$props6.refInputLikeText,leftIcon = _this$props6.leftIcon,inputMode = _this$props6.inputMode;var rightIcon = this.getRightIcon();if (editing) {return /*#__PURE__*/_react.default.createElement(_Input.Input, { align: align, borderless: borderless, disabled: disabled, error: error, maxLength: this.props.maxLength, onBlur: isMobile ? undefined : onInputBlur, onValueChange: onInputValueChange, onFocus: isMobile ? this.handleFocusMobile : onInputFocus, onClick: isMobile ? this.handleFocusMobile : onInputClick, leftIcon: leftIcon, rightIcon: rightIcon, value: textValue || '', onKeyDown: onInputKeyDown, placeholder: placeholder, width: "100%", size: size, ref: this.refInput, warning: warning, inputMode: inputMode });}return /*#__PURE__*/_react.default.createElement(_InputLikeText.InputLikeText, { align: align, borderless: borderless, error: error, onFocus: onFocus, leftIcon: leftIcon, rightIcon: rightIcon, disabled: disabled, warning: warning, placeholder: placeholder, size: size, width: "100%", ref: refInputLikeText }, (0, _utils.isNonNullable)(value) && renderValue ? renderValue(value) : null);};return ComboBoxView;}(_react.default.Component), _class2.__KONTUR_REACT_UI__ = 'ComboBoxView', _class2.defaultProps = { renderItem: function renderItem(item) {return item;}, renderValue: function renderValue(item) {return item;}, renderAddButton: function renderAddButton() {return null;}, repeatRequest: function repeatRequest() {return undefined;}, requestStatus: _CustomComboBoxTypes.ComboBoxRequestStatus.Unknown, onClickOutside: function onClickOutside() {/**/}, onFocusOutside: function onFocusOutside() {/**/}, size: 'small', width: 250 }, _temp)) || _class) || _class;exports.ComboBoxView = ComboBoxView;
388
+ };return _this;}var _proto = ComboBoxView.prototype;_proto.componentDidMount = function componentDidMount() {var _this$dropdownContain;if (this.props.autoFocus && this.props.onFocus) {this.props.onFocus();}this.props.opened && ((_this$dropdownContain = this.dropdownContainerRef.current) == null ? void 0 : _this$dropdownContain.position());};_proto.componentDidUpdate = function componentDidUpdate(prevProps) {var input = this.input,props = this.props;if (props.editing && !prevProps.editing && input) {input.focus();}};_proto.render = function render() {var _this$props5 = this.props,onMouseEnter = _this$props5.onMouseEnter,onMouseLeave = _this$props5.onMouseLeave,onMouseOver = _this$props5.onMouseOver,opened = _this$props5.opened;var _this$getProps2 = this.getProps(),onClickOutside = _this$getProps2.onClickOutside,onFocusOutside = _this$getProps2.onFocusOutside,width = _this$getProps2.width;var isMobile = this.isMobileLayout;var input = this.renderInput();return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, this.props, /*#__PURE__*/_react.default.createElement(_RenderLayer.RenderLayer, { onClickOutside: onClickOutside, onFocusOutside: onFocusOutside, active: opened }, /*#__PURE__*/_react.default.createElement("span", { "data-tid": _CustomComboBox2.CustomComboBoxDataTids.comboBoxView, style: { width: width }, className: _CustomComboBox.styles.root(), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseOver: onMouseOver, ref: this.setRootNode }, input, isMobile ? this.renderMobileMenu() : this.renderMenu())));};_proto.renderInput = function renderInput() {var isMobile = this.isMobileLayout;var _this$props6 = this.props,align = _this$props6.align,borderless = _this$props6.borderless,disabled = _this$props6.disabled,editing = _this$props6.editing,error = _this$props6.error,onFocus = _this$props6.onFocus,onInputBlur = _this$props6.onInputBlur,onInputValueChange = _this$props6.onInputValueChange,onInputFocus = _this$props6.onInputFocus,onInputClick = _this$props6.onInputClick,onInputKeyDown = _this$props6.onInputKeyDown,placeholder = _this$props6.placeholder,textValue = _this$props6.textValue,value = _this$props6.value,warning = _this$props6.warning,refInputLikeText = _this$props6.refInputLikeText,leftIcon = _this$props6.leftIcon,inputMode = _this$props6.inputMode;var _this$getProps3 = this.getProps(),renderValue = _this$getProps3.renderValue,size = _this$getProps3.size;var rightIcon = this.getRightIcon();if (editing) {return /*#__PURE__*/_react.default.createElement(_Input.Input, { align: align, borderless: borderless, disabled: disabled, error: error, maxLength: this.props.maxLength, onBlur: isMobile ? undefined : onInputBlur, onValueChange: onInputValueChange, onFocus: isMobile ? this.handleFocusMobile : onInputFocus, onClick: isMobile ? this.handleFocusMobile : onInputClick, leftIcon: leftIcon, rightIcon: rightIcon, value: textValue || '', onKeyDown: onInputKeyDown, placeholder: placeholder, width: "100%", size: size, ref: this.refInput, warning: warning, inputMode: inputMode });}return /*#__PURE__*/_react.default.createElement(_InputLikeText.InputLikeText, { align: align, borderless: borderless, error: error, onFocus: onFocus, leftIcon: leftIcon, rightIcon: rightIcon, disabled: disabled, warning: warning, placeholder: placeholder, size: size, width: "100%", ref: refInputLikeText }, (0, _utils.isNonNullable)(value) && renderValue ? renderValue(value) : null);};return ComboBoxView;}(_react.default.Component), _class2.__KONTUR_REACT_UI__ = 'ComboBoxView', _class2.defaultProps = { renderItem: function renderItem(item) {return item;}, renderValue: function renderValue(item) {return item;}, renderAddButton: function renderAddButton() {return null;}, repeatRequest: function repeatRequest() {return undefined;}, requestStatus: _CustomComboBoxTypes.ComboBoxRequestStatus.Unknown, onClickOutside: function onClickOutside() {/**/}, onFocusOutside: function onFocusOutside() {/**/}, size: 'small', width: 250 }, _temp)) || _class) || _class;exports.ComboBoxView = ComboBoxView;
@@ -1 +1 @@
1
- {"version":3,"sources":["ComboBoxView.tsx"],"names":["ComboBoxView","responsiveLayout","rootNode","mobileInput","dropdownContainerRef","React","createRef","state","isMobileOpened","getComboBoxMenu","props","items","loading","opened","refMenu","maxMenuHeight","renderTotalCount","renderItem","renderNotFound","repeatRequest","requestStatus","totalCount","handleItemSelect","renderAddButton","isMobileLayout","renderMenu","menuAlign","getParent","disablePortal","renderMobileMenu","rightIcon","length","renderSpinner","inputProps","autoFocus","width","onFocus","onValueChange","onInputValueChange","value","textValue","placeholder","refMobileInput","handleCloseMobile","setState","onInputBlur","handleFocusMobile","focus","item","refInput","input","styles","spinnerWrapper","getRightIcon","drawArrow","rightIconWrapper","componentDidMount","current","position","componentDidUpdate","prevProps","editing","render","onClickOutside","onFocusOutside","onMouseEnter","onMouseLeave","onMouseOver","isMobile","renderInput","CustomComboBoxDataTids","comboBoxView","root","setRootNode","align","borderless","disabled","error","onInputFocus","onInputClick","onInputKeyDown","renderValue","size","warning","refInputLikeText","leftIcon","inputMode","maxLength","undefined","Component","__KONTUR_REACT_UI__","defaultProps","ComboBoxRequestStatus","Unknown"],"mappings":"wbAAA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEaA,Y,OAFZC,2B,eACAC,kB;;;;;;;;;;;;;;;;;;;;;AAsBSC,IAAAA,W,GAA+B,I;;AAE/BC,IAAAA,oB,gBAAuBC,eAAMC,SAAN,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eAAMoF,S,WAC3BC,mB,GAAsB,c,UAEtBC,Y,GAAe,EAC3B1E,UAAU,EAAE,oBAAC+B,IAAD,UAAeA,IAAf,EADe,EAE3BiC,WAAW,EAAE,qBAACjC,IAAD,UAAeA,IAAf,EAFc,EAG3BzB,eAAe,EAAE,mCAAM,IAAN,EAHU,EAI3BJ,aAAa,EAAE,iCAAMqE,SAAN,EAJY,EAK3BpE,aAAa,EAAEwE,2CAAsBC,OALV,EAM3B9B,cAAc,EAAE,0BAAM,CACpB,IACD,CAR0B,EAS3BC,cAAc,EAAE,0BAAM,CACpB,IACD,CAX0B,EAY3BkB,IAAI,EAAE,OAZqB,EAa3B/C,KAAK,EAAE,GAboB,E","sourcesContent":["import React from 'react';\n\nimport { isNonNullable } from '../../lib/utils';\nimport { DropdownContainer } from '../DropdownContainer';\nimport { Input, InputIconType, InputProps } from '../../components/Input';\nimport { InputLikeText } from '../InputLikeText';\nimport { Menu } from '../Menu';\nimport { MenuItemState } from '../../components/MenuItem';\nimport { RenderLayer } from '../RenderLayer';\nimport { Spinner } from '../../components/Spinner';\nimport { Nullable } from '../../typings/utility-types';\nimport { ArrowChevronDownIcon } from '../icons/16px';\nimport { CommonProps, CommonWrapper } from '../../internal/CommonWrapper';\nimport { MobilePopup } from '../MobilePopup';\nimport { responsiveLayout } from '../../components/ResponsiveLayout/decorator';\nimport { rootNode, getRootNode, TSetRootNode } from '../../lib/rootNode';\n\nimport { ComboBoxMenu } from './ComboBoxMenu';\nimport { ComboBoxRequestStatus } from './CustomComboBoxTypes';\nimport { styles } from './CustomComboBox.styles';\nimport { CustomComboBoxDataTids } from './CustomComboBox';\n\ninterface ComboBoxViewProps<T> extends CommonProps {\n align?: 'left' | 'center' | 'right';\n autoFocus?: boolean;\n borderless?: boolean;\n disablePortal?: boolean;\n disabled?: boolean;\n editing?: boolean;\n /**\n * Cостояние валидации при ошибке.\n */\n error?: boolean;\n items?: Nullable<T[]>;\n loading?: boolean;\n menuAlign?: 'left' | 'right';\n opened?: boolean;\n drawArrow?: boolean;\n placeholder?: string;\n size?: 'small' | 'medium' | 'large';\n textValue?: string;\n totalCount?: number;\n value?: Nullable<T>;\n /**\n * Cостояние валидации при предупреждении.\n */\n warning?: boolean;\n width?: string | number;\n maxLength?: number;\n maxMenuHeight?: number | string;\n leftIcon?: InputIconType;\n rightIcon?: InputIconType;\n inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];\n\n onValueChange?: (value: T) => void;\n onClickOutside?: (e: Event) => void;\n onFocus?: () => void;\n onFocusOutside?: () => void;\n onInputBlur?: () => void;\n onInputValueChange?: (value: string) => void;\n onInputFocus?: () => void;\n onInputClick?: () => void;\n onInputKeyDown?: (e: React.KeyboardEvent) => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseOver?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n renderItem?: (item: T, state: MenuItemState) => React.ReactNode;\n renderNotFound?: () => React.ReactNode;\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n renderValue?: (item: T) => React.ReactNode;\n renderAddButton: (query?: string) => React.ReactNode;\n repeatRequest?: () => void;\n requestStatus?: ComboBoxRequestStatus;\n refInput?: (input: Nullable<Input>) => void;\n refMenu?: (menu: Nullable<Menu>) => void;\n refInputLikeText?: (inputLikeText: Nullable<InputLikeText>) => void;\n}\n\ninterface ComboBoxViewState {\n isMobileOpened: boolean;\n}\n\n@responsiveLayout\n@rootNode\nexport class ComboBoxView<T> extends React.Component<ComboBoxViewProps<T>, ComboBoxViewState> {\n public static __KONTUR_REACT_UI__ = 'ComboBoxView';\n\n public static defaultProps = {\n renderItem: (item: any) => item,\n renderValue: (item: any) => item,\n renderAddButton: () => null,\n repeatRequest: () => undefined,\n requestStatus: ComboBoxRequestStatus.Unknown,\n onClickOutside: () => {\n /**/\n },\n onFocusOutside: () => {\n /**/\n },\n size: 'small',\n width: 250,\n };\n\n private input: Nullable<Input>;\n private setRootNode!: TSetRootNode;\n private mobileInput: Nullable<Input> = null;\n private isMobileLayout!: boolean;\n private dropdownContainerRef = React.createRef<DropdownContainer>();\n\n public componentDidMount() {\n if (this.props.autoFocus && this.props.onFocus) {\n this.props.onFocus();\n }\n this.props.opened && this.dropdownContainerRef.current?.position();\n }\n\n public state: ComboBoxViewState = {\n isMobileOpened: false,\n };\n\n public componentDidUpdate(prevProps: ComboBoxViewProps<T>) {\n const { input, props } = this;\n\n if (props.editing && !prevProps.editing && input) {\n input.focus();\n }\n }\n\n public render() {\n const { onClickOutside, onFocusOutside, onMouseEnter, onMouseLeave, onMouseOver, opened, width } = this.props;\n\n const isMobile = this.isMobileLayout;\n\n const input = this.renderInput();\n\n return (\n <CommonWrapper {...this.props}>\n <RenderLayer onClickOutside={onClickOutside} onFocusOutside={onFocusOutside} active={opened}>\n <span\n data-tid={CustomComboBoxDataTids.comboBoxView}\n style={{ width }}\n className={styles.root()}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onMouseOver={onMouseOver}\n ref={this.setRootNode}\n >\n {input}\n {isMobile ? this.renderMobileMenu() : this.renderMenu()}\n </span>\n </RenderLayer>\n </CommonWrapper>\n );\n }\n\n private getComboBoxMenu = () => {\n const {\n items,\n loading,\n opened,\n refMenu,\n maxMenuHeight,\n renderTotalCount,\n renderItem,\n renderNotFound,\n repeatRequest,\n requestStatus,\n totalCount,\n } = this.props;\n\n return (\n <ComboBoxMenu\n items={items}\n loading={loading}\n maxMenuHeight={maxMenuHeight}\n onValueChange={this.handleItemSelect}\n opened={opened}\n refMenu={refMenu}\n renderTotalCount={renderTotalCount}\n renderItem={renderItem!}\n renderNotFound={renderNotFound}\n renderAddButton={this.renderAddButton}\n repeatRequest={repeatRequest}\n requestStatus={requestStatus}\n totalCount={totalCount}\n isMobile={this.isMobileLayout}\n />\n );\n };\n\n private renderMenu = () => {\n const { menuAlign, opened } = this.props;\n\n return (\n opened && (\n <DropdownContainer\n align={menuAlign}\n getParent={this.getParent}\n offsetY={1}\n disablePortal={this.props.disablePortal}\n ref={this.dropdownContainerRef}\n >\n {this.getComboBoxMenu()}\n </DropdownContainer>\n )\n );\n };\n\n private renderMobileMenu = () => {\n let rightIcon = null;\n\n const { loading, items } = this.props;\n if (loading && items && !!items.length) {\n rightIcon = this.renderSpinner();\n }\n\n const inputProps: InputProps = {\n autoFocus: true,\n width: '100%',\n onFocus: this.props.onFocus,\n onValueChange: this.props.onInputValueChange,\n value: this.props.textValue,\n placeholder: this.props.placeholder,\n rightIcon,\n };\n\n return (\n <MobilePopup\n headerChildComponent={<Input ref={this.refMobileInput} {...inputProps} />}\n useFullHeight\n onCloseRequest={this.handleCloseMobile}\n opened={this.state.isMobileOpened}\n >\n {this.getComboBoxMenu()}\n </MobilePopup>\n );\n };\n\n private handleCloseMobile = () => {\n this.setState({\n isMobileOpened: false,\n });\n\n if (this.props.onInputBlur) {\n this.props.onInputBlur();\n }\n };\n\n private getParent = () => {\n return getRootNode(this);\n };\n\n private renderAddButton = (): React.ReactNode => {\n return this.props.renderAddButton(this.props.textValue);\n };\n\n private renderInput(): React.ReactNode {\n const isMobile = this.isMobileLayout;\n\n const {\n align,\n borderless,\n disabled,\n editing,\n error,\n onFocus,\n onInputBlur,\n onInputValueChange,\n onInputFocus,\n onInputClick,\n onInputKeyDown,\n placeholder,\n renderValue,\n size,\n textValue,\n value,\n warning,\n refInputLikeText,\n leftIcon,\n inputMode,\n } = this.props;\n\n const rightIcon = this.getRightIcon();\n\n if (editing) {\n return (\n <Input\n align={align}\n borderless={borderless}\n disabled={disabled}\n error={error}\n maxLength={this.props.maxLength}\n onBlur={isMobile ? undefined : onInputBlur}\n onValueChange={onInputValueChange}\n onFocus={isMobile ? this.handleFocusMobile : onInputFocus}\n onClick={isMobile ? this.handleFocusMobile : onInputClick}\n leftIcon={leftIcon}\n rightIcon={rightIcon}\n value={textValue || ''}\n onKeyDown={onInputKeyDown}\n placeholder={placeholder}\n width=\"100%\"\n size={size}\n ref={this.refInput}\n warning={warning}\n inputMode={inputMode}\n />\n );\n }\n\n return (\n <InputLikeText\n align={align}\n borderless={borderless}\n error={error}\n onFocus={onFocus}\n leftIcon={leftIcon}\n rightIcon={rightIcon}\n disabled={disabled}\n warning={warning}\n placeholder={placeholder}\n size={size}\n width=\"100%\"\n ref={refInputLikeText}\n >\n {isNonNullable(value) && renderValue ? renderValue(value) : null}\n </InputLikeText>\n );\n }\n\n private handleFocusMobile = () => {\n this.setState({\n isMobileOpened: true,\n });\n\n if (this.mobileInput) {\n this.mobileInput.focus();\n }\n };\n\n private handleItemSelect = (item: T) => {\n if (this.props.onValueChange) {\n this.props.onValueChange(item);\n }\n\n if (this.isMobileLayout) {\n this.handleCloseMobile();\n }\n };\n\n private refInput = (input: Nullable<Input>) => {\n if (this.props.refInput) {\n this.props.refInput(input);\n }\n this.input = input;\n };\n\n private renderSpinner = () => (\n <span className={styles.spinnerWrapper()}>\n <Spinner type=\"mini\" caption=\"\" dimmed />\n </span>\n );\n\n private getRightIcon = () => {\n const { loading, items, drawArrow, rightIcon } = this.props;\n\n if (loading && items && !!items.length) {\n return this.renderSpinner();\n }\n\n if (rightIcon || drawArrow) {\n return <span className={styles.rightIconWrapper()}>{rightIcon ?? <ArrowChevronDownIcon />}</span>;\n }\n\n return null;\n };\n\n private refMobileInput = (input: Nullable<Input>) => {\n this.mobileInput = input;\n };\n}\n"]}
1
+ {"version":3,"sources":["ComboBoxView.tsx"],"names":["ComboBoxView","responsiveLayout","rootNode","getProps","defaultProps","mobileInput","dropdownContainerRef","React","createRef","state","isMobileOpened","getComboBoxMenu","props","items","loading","opened","refMenu","maxMenuHeight","renderTotalCount","renderNotFound","totalCount","repeatRequest","requestStatus","renderItem","handleItemSelect","renderAddButton","isMobileLayout","renderMenu","menuAlign","getParent","disablePortal","renderMobileMenu","rightIcon","length","renderSpinner","inputProps","autoFocus","width","onFocus","onValueChange","onInputValueChange","value","textValue","placeholder","refMobileInput","handleCloseMobile","setState","onInputBlur","handleFocusMobile","focus","item","refInput","input","styles","spinnerWrapper","getRightIcon","drawArrow","rightIconWrapper","componentDidMount","current","position","componentDidUpdate","prevProps","editing","render","onMouseEnter","onMouseLeave","onMouseOver","onClickOutside","onFocusOutside","isMobile","renderInput","CustomComboBoxDataTids","comboBoxView","root","setRootNode","align","borderless","disabled","error","onInputFocus","onInputClick","onInputKeyDown","warning","refInputLikeText","leftIcon","inputMode","renderValue","size","maxLength","undefined","Component","__KONTUR_REACT_UI__","ComboBoxRequestStatus","Unknown"],"mappings":"wbAAA;;AAEA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EaA,Y,OAFZC,2B,eACAC,kB;;;;;;;;;;;;;;;;;;;AAoBSC,IAAAA,Q,GAAW,0CAAkBH,YAAY,CAACI,YAA/B,C;;;;AAIXC,IAAAA,W,GAA+B,I;;AAE/BC,IAAAA,oB,gBAAuBC,eAAMC,SAAN,E;;;;;;;;;AASxBC,IAAAA,K,GAA2B;AAChCC,MAAAA,cAAc,EAAE,KADgB,E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwC1BC,IAAAA,e,GAAkB,YAAM;AAC9B,wBAAyG,MAAKC,KAA9G,CAAQC,KAAR,eAAQA,KAAR,CAAeC,OAAf,eAAeA,OAAf,CAAwBC,MAAxB,eAAwBA,MAAxB,CAAgCC,OAAhC,eAAgCA,OAAhC,CAAyCC,aAAzC,eAAyCA,aAAzC,CAAwDC,gBAAxD,eAAwDA,gBAAxD,CAA0EC,cAA1E,eAA0EA,cAA1E,CAA0FC,UAA1F,eAA0FA,UAA1F;;AAEA,2BAAqD,MAAKjB,QAAL,EAArD,CAAQkB,aAAR,kBAAQA,aAAR,CAAuBC,aAAvB,kBAAuBA,aAAvB,CAAsCC,UAAtC,kBAAsCA,UAAtC;A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4C,EAalDnD,KAAK,EAAE,GAb2C,E","sourcesContent":["import React from 'react';\n\nimport { isNonNullable } from '../../lib/utils';\nimport { DropdownContainer } from '../DropdownContainer';\nimport { Input, InputIconType, InputProps } from '../../components/Input';\nimport { InputLikeText } from '../InputLikeText';\nimport { Menu } from '../Menu';\nimport { MenuItemState } from '../../components/MenuItem';\nimport { RenderLayer } from '../RenderLayer';\nimport { Spinner } from '../../components/Spinner';\nimport { Nullable } from '../../typings/utility-types';\nimport { ArrowChevronDownIcon } from '../icons/16px';\nimport { CommonProps, CommonWrapper } from '../../internal/CommonWrapper';\nimport { MobilePopup } from '../MobilePopup';\nimport { responsiveLayout } from '../../components/ResponsiveLayout/decorator';\nimport { rootNode, getRootNode, TSetRootNode } from '../../lib/rootNode';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { ComboBoxMenu } from './ComboBoxMenu';\nimport { ComboBoxRequestStatus } from './CustomComboBoxTypes';\nimport { styles } from './CustomComboBox.styles';\nimport { CustomComboBoxDataTids } from './CustomComboBox';\n\ninterface ComboBoxViewProps<T> extends CommonProps {\n align?: 'left' | 'center' | 'right';\n autoFocus?: boolean;\n borderless?: boolean;\n disablePortal?: boolean;\n disabled?: boolean;\n editing?: boolean;\n /**\n * Cостояние валидации при ошибке.\n */\n error?: boolean;\n items?: Nullable<T[]>;\n loading?: boolean;\n menuAlign?: 'left' | 'right';\n opened?: boolean;\n drawArrow?: boolean;\n placeholder?: string;\n size?: 'small' | 'medium' | 'large';\n textValue?: string;\n totalCount?: number;\n value?: Nullable<T>;\n /**\n * Cостояние валидации при предупреждении.\n */\n warning?: boolean;\n width?: string | number;\n maxLength?: number;\n maxMenuHeight?: number | string;\n leftIcon?: InputIconType;\n rightIcon?: InputIconType;\n inputMode?: React.HTMLAttributes<HTMLInputElement>['inputMode'];\n\n onValueChange?: (value: T) => void;\n onClickOutside?: (e: Event) => void;\n onFocus?: () => void;\n onFocusOutside?: () => void;\n onInputBlur?: () => void;\n onInputValueChange?: (value: string) => void;\n onInputFocus?: () => void;\n onInputClick?: () => void;\n onInputKeyDown?: (e: React.KeyboardEvent) => void;\n onMouseEnter?: (e: React.MouseEvent) => void;\n onMouseOver?: (e: React.MouseEvent) => void;\n onMouseLeave?: (e: React.MouseEvent) => void;\n renderItem?: (item: T, state: MenuItemState) => React.ReactNode;\n renderNotFound?: () => React.ReactNode;\n renderTotalCount?: (found: number, total: number) => React.ReactNode;\n renderValue?: (item: T) => React.ReactNode;\n renderAddButton?: (query?: string) => React.ReactNode;\n repeatRequest?: () => void;\n requestStatus?: ComboBoxRequestStatus;\n refInput?: (input: Nullable<Input>) => void;\n refMenu?: (menu: Nullable<Menu>) => void;\n refInputLikeText?: (inputLikeText: Nullable<InputLikeText>) => void;\n}\n\ninterface ComboBoxViewState {\n isMobileOpened: boolean;\n}\n\ntype DefaultProps<T> = Required<\n Pick<\n ComboBoxViewProps<T>,\n | 'renderItem'\n | 'renderValue'\n | 'renderAddButton'\n | 'repeatRequest'\n | 'requestStatus'\n | 'onClickOutside'\n | 'onFocusOutside'\n | 'size'\n | 'width'\n >\n>;\n\n@responsiveLayout\n@rootNode\nexport class ComboBoxView<T> extends React.Component<ComboBoxViewProps<T>, ComboBoxViewState> {\n public static __KONTUR_REACT_UI__ = 'ComboBoxView';\n\n public static defaultProps: DefaultProps<unknown> = {\n renderItem: (item: any) => item,\n renderValue: (item: any) => item,\n renderAddButton: () => null,\n repeatRequest: () => undefined,\n requestStatus: ComboBoxRequestStatus.Unknown,\n onClickOutside: () => {\n /**/\n },\n onFocusOutside: () => {\n /**/\n },\n size: 'small',\n width: 250,\n };\n\n private getProps = createPropsGetter(ComboBoxView.defaultProps);\n\n private input: Nullable<Input>;\n private setRootNode!: TSetRootNode;\n private mobileInput: Nullable<Input> = null;\n private isMobileLayout!: boolean;\n private dropdownContainerRef = React.createRef<DropdownContainer>();\n\n public componentDidMount() {\n if (this.props.autoFocus && this.props.onFocus) {\n this.props.onFocus();\n }\n this.props.opened && this.dropdownContainerRef.current?.position();\n }\n\n public state: ComboBoxViewState = {\n isMobileOpened: false,\n };\n\n public componentDidUpdate(prevProps: ComboBoxViewProps<T>) {\n const { input, props } = this;\n\n if (props.editing && !prevProps.editing && input) {\n input.focus();\n }\n }\n\n public render() {\n const { onMouseEnter, onMouseLeave, onMouseOver, opened } = this.props;\n const { onClickOutside, onFocusOutside, width } = this.getProps();\n\n const isMobile = this.isMobileLayout;\n\n const input = this.renderInput();\n\n return (\n <CommonWrapper {...this.props}>\n <RenderLayer onClickOutside={onClickOutside} onFocusOutside={onFocusOutside} active={opened}>\n <span\n data-tid={CustomComboBoxDataTids.comboBoxView}\n style={{ width }}\n className={styles.root()}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onMouseOver={onMouseOver}\n ref={this.setRootNode}\n >\n {input}\n {isMobile ? this.renderMobileMenu() : this.renderMenu()}\n </span>\n </RenderLayer>\n </CommonWrapper>\n );\n }\n\n private getComboBoxMenu = () => {\n const { items, loading, opened, refMenu, maxMenuHeight, renderTotalCount, renderNotFound, totalCount } = this.props;\n\n const { repeatRequest, requestStatus, renderItem } = this.getProps();\n return (\n <ComboBoxMenu\n items={items}\n loading={loading}\n maxMenuHeight={maxMenuHeight}\n onValueChange={this.handleItemSelect}\n opened={opened}\n refMenu={refMenu}\n renderTotalCount={renderTotalCount}\n renderItem={renderItem}\n renderNotFound={renderNotFound}\n renderAddButton={this.renderAddButton}\n repeatRequest={repeatRequest}\n requestStatus={requestStatus}\n totalCount={totalCount}\n isMobile={this.isMobileLayout}\n />\n );\n };\n\n private renderMenu = () => {\n const { menuAlign, opened } = this.props;\n\n return (\n opened && (\n <DropdownContainer\n align={menuAlign}\n getParent={this.getParent}\n offsetY={1}\n disablePortal={this.props.disablePortal}\n ref={this.dropdownContainerRef}\n >\n {this.getComboBoxMenu()}\n </DropdownContainer>\n )\n );\n };\n\n private renderMobileMenu = () => {\n let rightIcon = null;\n\n const { loading, items } = this.props;\n if (loading && items && !!items.length) {\n rightIcon = this.renderSpinner();\n }\n\n const inputProps: InputProps = {\n autoFocus: true,\n width: '100%',\n onFocus: this.props.onFocus,\n onValueChange: this.props.onInputValueChange,\n value: this.props.textValue,\n placeholder: this.props.placeholder,\n rightIcon,\n };\n\n return (\n <MobilePopup\n headerChildComponent={<Input ref={this.refMobileInput} {...inputProps} />}\n useFullHeight\n onCloseRequest={this.handleCloseMobile}\n opened={this.state.isMobileOpened}\n >\n {this.getComboBoxMenu()}\n </MobilePopup>\n );\n };\n\n private handleCloseMobile = () => {\n this.setState({\n isMobileOpened: false,\n });\n\n if (this.props.onInputBlur) {\n this.props.onInputBlur();\n }\n };\n\n private getParent = () => {\n return getRootNode(this);\n };\n\n private renderAddButton = (): React.ReactNode => {\n return this.getProps().renderAddButton(this.props.textValue);\n };\n\n private renderInput(): React.ReactNode {\n const isMobile = this.isMobileLayout;\n\n const {\n align,\n borderless,\n disabled,\n editing,\n error,\n onFocus,\n onInputBlur,\n onInputValueChange,\n onInputFocus,\n onInputClick,\n onInputKeyDown,\n placeholder,\n textValue,\n value,\n warning,\n refInputLikeText,\n leftIcon,\n inputMode,\n } = this.props;\n\n const { renderValue, size } = this.getProps();\n\n const rightIcon = this.getRightIcon();\n\n if (editing) {\n return (\n <Input\n align={align}\n borderless={borderless}\n disabled={disabled}\n error={error}\n maxLength={this.props.maxLength}\n onBlur={isMobile ? undefined : onInputBlur}\n onValueChange={onInputValueChange}\n onFocus={isMobile ? this.handleFocusMobile : onInputFocus}\n onClick={isMobile ? this.handleFocusMobile : onInputClick}\n leftIcon={leftIcon}\n rightIcon={rightIcon}\n value={textValue || ''}\n onKeyDown={onInputKeyDown}\n placeholder={placeholder}\n width=\"100%\"\n size={size}\n ref={this.refInput}\n warning={warning}\n inputMode={inputMode}\n />\n );\n }\n\n return (\n <InputLikeText\n align={align}\n borderless={borderless}\n error={error}\n onFocus={onFocus}\n leftIcon={leftIcon}\n rightIcon={rightIcon}\n disabled={disabled}\n warning={warning}\n placeholder={placeholder}\n size={size}\n width=\"100%\"\n ref={refInputLikeText}\n >\n {isNonNullable(value) && renderValue ? renderValue(value) : null}\n </InputLikeText>\n );\n }\n\n private handleFocusMobile = () => {\n this.setState({\n isMobileOpened: true,\n });\n\n if (this.mobileInput) {\n this.mobileInput.focus();\n }\n };\n\n private handleItemSelect = (item: T) => {\n if (this.props.onValueChange) {\n this.props.onValueChange(item);\n }\n\n if (this.isMobileLayout) {\n this.handleCloseMobile();\n }\n };\n\n private refInput = (input: Nullable<Input>) => {\n if (this.props.refInput) {\n this.props.refInput(input);\n }\n this.input = input;\n };\n\n private renderSpinner = () => (\n <span className={styles.spinnerWrapper()}>\n <Spinner type=\"mini\" caption=\"\" dimmed />\n </span>\n );\n\n private getRightIcon = () => {\n const { loading, items, drawArrow, rightIcon } = this.props;\n\n if (loading && items && !!items.length) {\n return this.renderSpinner();\n }\n\n if (rightIcon || drawArrow) {\n return <span className={styles.rightIconWrapper()}>{rightIcon ?? <ArrowChevronDownIcon />}</span>;\n }\n\n return null;\n };\n\n private refMobileInput = (input: Nullable<Input>) => {\n this.mobileInput = input;\n };\n}\n"]}
@@ -24,6 +24,7 @@ export declare const DateSelectDataTids: {
24
24
  readonly caption: "DateSelect__caption";
25
25
  readonly menuItem: "DateSelect__menuItem";
26
26
  };
27
+ declare type DefaultProps = Required<Pick<DateSelectProps, 'type' | 'width'>>;
27
28
  export declare class DateSelect extends React.PureComponent<DateSelectProps, DateSelectState> {
28
29
  static __KONTUR_REACT_UI__: string;
29
30
  static propTypes: {
@@ -35,12 +36,8 @@ export declare class DateSelect extends React.PureComponent<DateSelectProps, Dat
35
36
  minValue: PropTypes.Requireable<number>;
36
37
  maxValue: PropTypes.Requireable<number>;
37
38
  };
38
- static defaultProps: {
39
- type: string;
40
- minMonth: number;
41
- maxMonth: number;
42
- width: string;
43
- };
39
+ static defaultProps: DefaultProps;
40
+ private getProps;
44
41
  state: {
45
42
  botCapped: boolean;
46
43
  current: number;
@@ -95,3 +92,4 @@ export declare class DateSelect extends React.PureComponent<DateSelectProps, Dat
95
92
  private getMinPos;
96
93
  private getMaxPos;
97
94
  }
95
+ export {};
@@ -15,6 +15,7 @@ var _px = require("../icons/16px");
15
15
  var _client = require("../../lib/client");
16
16
  var _Emotion = require("../../lib/theming/Emotion");
17
17
  var _getDOMRect = require("../../lib/dom/getDOMRect");
18
+ var _createPropsGetter = require("../../lib/createPropsGetter");
18
19
 
19
20
  var _DateSelect = require("./DateSelect.styles");var _dec, _class, _class2, _temp;function _getRequireWildcardCache(nodeInterop) {if (typeof WeakMap !== "function") return null;var cacheBabelInterop = new WeakMap();var cacheNodeInterop = new WeakMap();return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {return nodeInterop ? cacheNodeInterop : cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj, nodeInterop) {if (!nodeInterop && obj && obj.__esModule) {return obj;}if (obj === null || typeof obj !== "object" && typeof obj !== "function") {return { default: obj };}var cache = _getRequireWildcardCache(nodeInterop);if (cache && cache.has(obj)) {return cache.get(obj);}var newObj = {};var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;for (var key in obj) {if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;if (desc && (desc.get || desc.set)) {Object.defineProperty(newObj, key, desc);} else {newObj[key] = obj[key];}}}newObj.default = obj;if (cache) {cache.set(obj, newObj);}return newObj;}
20
21
 
@@ -64,9 +65,10 @@ var DateSelectDataTids = {
64
65
 
65
66
 
66
67
 
67
- DateSelect = (_dec = (0, _decorators.locale)('DatePicker', _locale.DatePickerLocaleHelper), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_React$PureComponent) {(0, _inheritsLoose2.default)(DateSelect, _React$PureComponent);function DateSelect() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;_this.
68
68
 
69
69
 
70
+ DateSelect = (_dec = (0, _decorators.locale)('DatePicker', _locale.DatePickerLocaleHelper), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_React$PureComponent) {(0, _inheritsLoose2.default)(DateSelect, _React$PureComponent);function DateSelect() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this;_this.
71
+
70
72
 
71
73
 
72
74
 
@@ -89,6 +91,7 @@ DateSelect = (_dec = (0, _decorators.locale)('DatePicker', _locale.DatePickerLoc
89
91
 
90
92
 
91
93
 
94
+ getProps = (0, _createPropsGetter.createPropsGetter)(DateSelect.defaultProps);_this.
92
95
 
93
96
  state = {
94
97
  botCapped: false,
@@ -205,6 +208,7 @@ DateSelect = (_dec = (0, _decorators.locale)('DatePicker', _locale.DatePickerLoc
205
208
 
206
209
 
207
210
 
211
+
208
212
 
209
213
 
210
214
  refRoot = function (element) {
@@ -466,9 +470,9 @@ DateSelect = (_dec = (0, _decorators.locale)('DatePicker', _locale.DatePickerLoc
466
470
  _this.setPosition(_this.state.pos + itemHeight * _this.yearStep);
467
471
  };return _this;}var _proto = DateSelect.prototype;_proto.componentDidUpdate = function componentDidUpdate() {this.setNodeTop();};_proto.componentDidMount = function componentDidMount() {this.listener = LayoutEvents.addListener(this.setNodeTop);this.setNodeTop();window.addEventListener('keydown', this.handleKey);};_proto.componentWillUnmount = function componentWillUnmount() {if (this.listener) {this.listener.remove();}if (this.timeout) {clearTimeout(this.timeout);}if (this.longClickTimer) {clearTimeout(this.longClickTimer);}if (this.setPositionRepeatTimer) {clearTimeout(this.setPositionRepeatTimer);}window.removeEventListener('keydown', this.handleKey);} /**
468
472
  * @public
469
- */;_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});};_proto.renderMain = function renderMain() {var _cx, _cx2;var _this$props = this.props,width = _this$props.width,disabled = _this$props.disabled;var rootProps = { className: (0, _Emotion.cx)((_cx = {}, _cx[_DateSelect.styles.root(this.theme)] = true, _cx[_DateSelect.styles.disabled()] = Boolean(disabled), _cx)), style: { width: width }, ref: this.refRoot };return /*#__PURE__*/_react.default.createElement("span", rootProps, /*#__PURE__*/_react.default.createElement("div", { "data-tid": DateSelectDataTids.caption, className: _DateSelect.styles.caption(), onClick: this.open }, this.getItem(0), /*#__PURE__*/_react.default.createElement("div", { className: (0, _Emotion.cx)((_cx2 = {}, _cx2[_DateSelect.styles.arrow(this.theme)] = true, _cx2[_DateSelect.styles.arrowDisabled()] = Boolean(disabled), _cx2)) }, /*#__PURE__*/_react.default.createElement(_px.ArrowTriangleUpDownIcon, { size: 12 }))), this.state.opened && this.renderMenu());};_proto.disableItems = function disableItems(index) {var value = this.props.value + index;if ((0, _utils.isNonNullable)(this.props.maxValue) && (0, _utils.isNonNullable)(this.props.minValue)) {return value > this.props.maxValue || value < this.props.minValue;}if ((0, _utils.isNonNullable)(this.props.minValue)) {return value < this.props.minValue;}if ((0, _utils.isNonNullable)(this.props.maxValue)) {return value > this.props.maxValue;}};_proto.renderMenu = function renderMenu() {var _this3 = this,_cx3;var _this$state = this.state,top = _this$state.top,height = _this$state.height,nodeTop = _this$state.nodeTop;var shift = this.state.pos % itemHeight;if (shift < 0) {shift += itemHeight;}var from = (this.state.pos - shift + top) / itemHeight;var to = from + Math.ceil((height + shift) / itemHeight);var items = [];var _loop = function _loop(i) {var _cx4;var disableItems = _this3.disableItems(i) || false;var className = (0, _Emotion.cx)((_cx4 = {}, _cx4[_DateSelect.styles.menuItem(_this3.theme)] = true, _cx4[_DateSelect.styles.menuItemSelected(_this3.theme)] = i === 0, _cx4[_DateSelect.styles.menuItemActive(_this3.theme)] = i === _this3.state.current, _cx4[_DateSelect.styles.menuItemDisabled(_this3.theme)] = disableItems, _cx4));var clickHandler = { onMouseDown: preventDefault, onClick: _this3.handleItemClick(i) };items.push( /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({ "data-tid": DateSelectDataTids.menuItem, "data-prop-disabled": disableItems, key: i, className: className, onMouseEnter: function onMouseEnter() {return _this3.setState({ current: i });}, onMouseLeave: function onMouseLeave() {return _this3.setState({ current: null });} }, clickHandler), _this3.getItem(i)));};for (var i = from; i < to; ++i) {_loop(i);}var style = { top: top - 5, left: 0, right: 0 };var shiftStyle = { position: 'relative', top: -shift };var holderClass = (0, _Emotion.cx)((_cx3 = {}, _cx3[_DateSelect.styles.menuHolder(this.theme)] = true, _cx3[_DateSelect.styles.isTopCapped()] = this.state.topCapped, _cx3[_DateSelect.styles.isBotCapped()] = this.state.botCapped, _cx3));var dropdownOffset = -itemHeight;if (nodeTop < -top) {var overflowOffsetDelta = this.state.topCapped ? 6 : 17;dropdownOffset -= nodeTop + top - overflowOffsetDelta;}return /*#__PURE__*/_react.default.createElement(_RenderLayer.RenderLayer, { onClickOutside: this.close, onFocusOutside: this.close, active: true }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_DropdownContainer.DropdownContainer, { getParent: this.getAnchor, offsetY: dropdownOffset, offsetX: -10 }, /*#__PURE__*/_react.default.createElement("div", { className: holderClass, style: style }, !this.state.topCapped && /*#__PURE__*/_react.default.createElement("div", { className: (0, _Emotion.cx)(_DateSelect.styles.menu(this.theme), _DateSelect.styles.menuUp()), onClick: this.handleUp, onMouseDown: this.handleLongClickUp, onMouseUp: this.handleLongClickStop, onMouseLeave: this.handleLongClickStop, onTouchStart: this.handleLongClickUp, onTouchEnd: this.handleLongClickStop }, /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_px.ArrowChevronUpIcon, null))), /*#__PURE__*/_react.default.createElement("div", { className: _DateSelect.styles.itemsHolder(), style: { height: height } }, /*#__PURE__*/_react.default.createElement("div", { ref: this.refItemsContainer, style: shiftStyle }, items)), !this.state.botCapped && /*#__PURE__*/_react.default.createElement("div", { className: (0, _Emotion.cx)(_DateSelect.styles.menu(this.theme), _DateSelect.styles.menuDown()), onClick: this.handleDown, onMouseDown: this.handleLongClickDown, onMouseUp: this.handleLongClickStop, onMouseLeave: this.handleLongClickStop, onTouchStart: this.handleLongClickDown, onTouchEnd: this.handleLongClickStop }, /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_px.ArrowChevronDownIcon, null)))))));};_proto.getItem = function getItem(index) {
473
+ */;_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = theme;return _this2.renderMain();});};_proto.renderMain = function renderMain() {var _cx, _cx2;var disabled = this.props.disabled;var width = this.getProps().width;var rootProps = { className: (0, _Emotion.cx)((_cx = {}, _cx[_DateSelect.styles.root(this.theme)] = true, _cx[_DateSelect.styles.disabled()] = Boolean(disabled), _cx)), style: { width: width }, ref: this.refRoot };return /*#__PURE__*/_react.default.createElement("span", rootProps, /*#__PURE__*/_react.default.createElement("div", { "data-tid": DateSelectDataTids.caption, className: _DateSelect.styles.caption(), onClick: this.open }, this.getItem(0), /*#__PURE__*/_react.default.createElement("div", { className: (0, _Emotion.cx)((_cx2 = {}, _cx2[_DateSelect.styles.arrow(this.theme)] = true, _cx2[_DateSelect.styles.arrowDisabled()] = Boolean(disabled), _cx2)) }, /*#__PURE__*/_react.default.createElement(_px.ArrowTriangleUpDownIcon, { size: 12 }))), this.state.opened && this.renderMenu());};_proto.disableItems = function disableItems(index) {var value = this.props.value + index;if ((0, _utils.isNonNullable)(this.props.maxValue) && (0, _utils.isNonNullable)(this.props.minValue)) {return value > this.props.maxValue || value < this.props.minValue;}if ((0, _utils.isNonNullable)(this.props.minValue)) {return value < this.props.minValue;}if ((0, _utils.isNonNullable)(this.props.maxValue)) {return value > this.props.maxValue;}};_proto.renderMenu = function renderMenu() {var _this3 = this,_cx3;var _this$state = this.state,top = _this$state.top,height = _this$state.height,nodeTop = _this$state.nodeTop;var shift = this.state.pos % itemHeight;if (shift < 0) {shift += itemHeight;}var from = (this.state.pos - shift + top) / itemHeight;var to = from + Math.ceil((height + shift) / itemHeight);var items = [];var _loop = function _loop(i) {var _cx4;var disableItems = _this3.disableItems(i) || false;var className = (0, _Emotion.cx)((_cx4 = {}, _cx4[_DateSelect.styles.menuItem(_this3.theme)] = true, _cx4[_DateSelect.styles.menuItemSelected(_this3.theme)] = i === 0, _cx4[_DateSelect.styles.menuItemActive(_this3.theme)] = i === _this3.state.current, _cx4[_DateSelect.styles.menuItemDisabled(_this3.theme)] = disableItems, _cx4));var clickHandler = { onMouseDown: preventDefault, onClick: _this3.handleItemClick(i) };items.push( /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({ "data-tid": DateSelectDataTids.menuItem, "data-prop-disabled": disableItems, key: i, className: className, onMouseEnter: function onMouseEnter() {return _this3.setState({ current: i });}, onMouseLeave: function onMouseLeave() {return _this3.setState({ current: null });} }, clickHandler), _this3.getItem(i)));};for (var i = from; i < to; ++i) {_loop(i);}var style = { top: top - 5, left: 0, right: 0 };var shiftStyle = { position: 'relative', top: -shift };var holderClass = (0, _Emotion.cx)((_cx3 = {}, _cx3[_DateSelect.styles.menuHolder(this.theme)] = true, _cx3[_DateSelect.styles.isTopCapped()] = this.state.topCapped, _cx3[_DateSelect.styles.isBotCapped()] = this.state.botCapped, _cx3));var dropdownOffset = -itemHeight;if (nodeTop < -top) {var overflowOffsetDelta = this.state.topCapped ? 6 : 17;dropdownOffset -= nodeTop + top - overflowOffsetDelta;}return /*#__PURE__*/_react.default.createElement(_RenderLayer.RenderLayer, { onClickOutside: this.close, onFocusOutside: this.close, active: true }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_DropdownContainer.DropdownContainer, { getParent: this.getAnchor, offsetY: dropdownOffset, offsetX: -10 }, /*#__PURE__*/_react.default.createElement("div", { className: holderClass, style: style }, !this.state.topCapped && /*#__PURE__*/_react.default.createElement("div", { className: (0, _Emotion.cx)(_DateSelect.styles.menu(this.theme), _DateSelect.styles.menuUp()), onClick: this.handleUp, onMouseDown: this.handleLongClickUp, onMouseUp: this.handleLongClickStop, onMouseLeave: this.handleLongClickStop, onTouchStart: this.handleLongClickUp, onTouchEnd: this.handleLongClickStop }, /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_px.ArrowChevronUpIcon, null))), /*#__PURE__*/_react.default.createElement("div", { className: _DateSelect.styles.itemsHolder(), style: { height: height } }, /*#__PURE__*/_react.default.createElement("div", { ref: this.refItemsContainer, style: shiftStyle }, items)), !this.state.botCapped && /*#__PURE__*/_react.default.createElement("div", { className: (0, _Emotion.cx)(_DateSelect.styles.menu(this.theme), _DateSelect.styles.menuDown()), onClick: this.handleDown, onMouseDown: this.handleLongClickDown, onMouseUp: this.handleLongClickStop, onMouseLeave: this.handleLongClickStop, onTouchStart: this.handleLongClickDown, onTouchEnd: this.handleLongClickStop }, /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_px.ArrowChevronDownIcon, null)))))));};_proto.getItem = function getItem(index) {
470
474
  var value = this.props.value + index;
471
- if (this.props.type === 'month') {
475
+ if (this.getProps().type === 'month') {
472
476
  return this.locale.months[value];
473
477
  }
474
478
  return value;
@@ -477,7 +481,7 @@ DateSelect = (_dec = (0, _decorators.locale)('DatePicker', _locale.DatePickerLoc
477
481
  setPosition = function setPosition(pos) {
478
482
  var top = itemsToMoveCount * itemHeight;
479
483
  var height = visibleYearsCount * itemHeight;
480
- if (this.props.type === 'month') {
484
+ if (this.getProps().type === 'month') {
481
485
  top = -this.props.value * itemHeight;
482
486
  height = monthsCount * itemHeight;
483
487
  }
@@ -493,22 +497,24 @@ DateSelect = (_dec = (0, _decorators.locale)('DatePicker', _locale.DatePickerLoc
493
497
  };_proto.
494
498
 
495
499
  getMinPos = function getMinPos() {
496
- if (this.props.type === 'month') {
500
+ var type = this.getProps().type;
501
+ if (type === 'month') {
497
502
  return -this.props.value * itemHeight;
498
- } else if (this.props.type === 'year') {
503
+ } else if (type === 'year') {
499
504
  return ((this.props.minValue || defaultMinYear) - this.props.value) * itemHeight;
500
505
  }
501
506
  return -Infinity; // Be defensive.
502
507
  };_proto.
503
508
 
504
509
  getMaxPos = function getMaxPos() {
505
- if (this.props.type === 'month') {
510
+ var type = this.getProps().type;
511
+ if (type === 'month') {
506
512
  return (visibleYearsCount - this.props.value) * itemHeight;
507
- } else if (this.props.type === 'year') {
513
+ } else if (type === 'year') {
508
514
  return ((this.props.maxValue || defaultMaxYear) - this.props.value) * itemHeight;
509
515
  }
510
516
  return Infinity; // Be defensive.
511
- };return DateSelect;}(_react.default.PureComponent), _class2.__KONTUR_REACT_UI__ = 'DateSelect', _class2.propTypes = { disabled: _propTypes.default.bool, type: _propTypes.default.string, value: _propTypes.default.number.isRequired, width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]), onValueChange: _propTypes.default.func, minValue: _propTypes.default.number, maxValue: _propTypes.default.number }, _class2.defaultProps = { type: 'year', minMonth: 0, maxMonth: 11, width: 'auto' }, _temp)) || _class);exports.DateSelect = DateSelect;
517
+ };return DateSelect;}(_react.default.PureComponent), _class2.__KONTUR_REACT_UI__ = 'DateSelect', _class2.propTypes = { disabled: _propTypes.default.bool, type: _propTypes.default.string, value: _propTypes.default.number.isRequired, width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]), onValueChange: _propTypes.default.func, minValue: _propTypes.default.number, maxValue: _propTypes.default.number }, _class2.defaultProps = { type: 'year', width: 'auto' }, _temp)) || _class);exports.DateSelect = DateSelect;
512
518
 
513
519
 
514
520
  function preventDefault(e) {
@@ -1 +1 @@
1
- {"version":3,"sources":["DateSelect.tsx"],"names":["itemHeight","visibleYearsCount","itemsToMoveCount","monthsCount","defaultMinYear","defaultMaxYear","calculatePos","pos","minPos","maxPos","DateSelectDataTids","caption","menuItem","DateSelect","DatePickerLocaleHelper","state","botCapped","current","height","opened","top","topCapped","nodeTop","Infinity","root","itemsContainer","longClickTimer","setPositionRepeatTimer","yearStep","touchStartY","open","props","disabled","setPosition","setState","close","refRoot","element","setNodeTop","timeout","clearTimeout","setTimeout","refItemsContainer","addEventListener","handleWheel","passive","removeEventListener","isMobile","handleTouchStart","handleTouchMove","handleLongClickUp","event","preventDefault","window","setInterval","handleLongClickDown","handleLongClickStop","getAnchor","WheelEvent","stopPropagation","deltaY","deltaMode","TouchEvent","targetTouches","clientY","changedTouches","pixelRatio","devicePixelRatio","handleItemClick","shift","e","value","onValueChange","handleKey","handleUp","handleDown","componentDidUpdate","componentDidMount","listener","LayoutEvents","addListener","componentWillUnmount","remove","render","theme","renderMain","width","rootProps","className","styles","Boolean","style","ref","getItem","arrow","arrowDisabled","renderMenu","disableItems","index","maxValue","minValue","from","to","Math","ceil","items","i","menuItemSelected","menuItemActive","menuItemDisabled","clickHandler","onMouseDown","onClick","push","left","right","shiftStyle","position","holderClass","menuHolder","isTopCapped","isBotCapped","dropdownOffset","overflowOffsetDelta","menu","menuUp","itemsHolder","menuDown","type","locale","months","getMinPos","getMaxPos","calculatedPos","React","PureComponent","__KONTUR_REACT_UI__","propTypes","PropTypes","bool","string","number","isRequired","oneOfType","func","defaultProps","minMonth","maxMonth"],"mappings":"qWAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA,iD;;AAEA,IAAMA,UAAU,GAAG,EAAnB;AACA,IAAMC,iBAAiB,GAAG,EAA1B;AACA,IAAMC,gBAAgB,GAAG,CAAC,CAA1B;AACA,IAAMC,WAAW,GAAG,EAApB;AACA,IAAMC,cAAc,GAAG,IAAvB;AACA,IAAMC,cAAc,GAAG,IAAvB;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,GAAD,EAAcC,MAAd,EAA8BC,MAA9B,EAAiD;AACpE,MAAIA,MAAM,IAAIF,GAAd,E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B,KAAL,CAAWwC,KAAtD,IAA+DvE,UAAtE;AACD;AACD,WAAOuB,QAAP,CANkB,CAMD;AAClB,G,qBA5b6B+G,eAAMC,a,WACtBC,mB,GAAsB,Y,UAEtBC,S,GAAY,EACxBzG,QAAQ,EAAE0G,mBAAUC,IADI,EAGxBX,IAAI,EAAEU,mBAAUE,MAHQ,EAKxBrE,KAAK,EAAEmE,mBAAUG,MAAV,CAAiBC,UALA,EAOxBxD,KAAK,EAAEoD,mBAAUK,SAAV,CAAoB,CAACL,mBAAUG,MAAX,EAAmBH,mBAAUE,MAA7B,CAApB,CAPiB,EASxBpE,aAAa,EAAEkE,mBAAUM,IATD,EAWxB5C,QAAQ,EAAEsC,mBAAUG,MAXI,EAaxB1C,QAAQ,EAAEuC,mBAAUG,MAbI,E,UAgBZI,Y,GAAe,EAC3BjB,IAAI,EAAE,MADqB,EAE3BkB,QAAQ,EAAE,CAFiB,EAG3BC,QAAQ,EAAE,EAHiB,EAI3B7D,KAAK,EAAE,MAJoB,E;;;AA4a/B,SAASlC,cAAT,CAAwBkB,CAAxB,EAAiD;AAC/CA,EAAAA,CAAC,CAAClB,cAAF;AACD","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { isNonNullable } from '../../lib/utils';\nimport { isKeyEscape } from '../../lib/events/keyboard/identifiers';\nimport { DatePickerLocale, DatePickerLocaleHelper } from '../../components/DatePicker/locale';\nimport { locale } from '../../lib/locale/decorators';\nimport { RenderLayer } from '../RenderLayer';\nimport { DropdownContainer } from '../DropdownContainer';\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport { Nullable } from '../../typings/utility-types';\nimport { Theme } from '../../lib/theming/Theme';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { ArrowTriangleUpDownIcon, ArrowChevronDownIcon, ArrowChevronUpIcon } from '../icons/16px';\nimport { isMobile } from '../../lib/client';\nimport { cx } from '../../lib/theming/Emotion';\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\n\nimport { styles } from './DateSelect.styles';\n\nconst itemHeight = 24;\nconst visibleYearsCount = 11;\nconst itemsToMoveCount = -5;\nconst monthsCount = 12;\nconst defaultMinYear = 1900;\nconst defaultMaxYear = 2100;\n\nexport interface DateSelectProps {\n disabled?: boolean | null;\n onValueChange: (value: number) => void;\n type?: 'month' | 'year';\n value: number;\n width?: number | string;\n minValue?: number;\n maxValue?: number;\n}\n\nexport interface DateSelectState {\n botCapped: boolean;\n current: Nullable<number>;\n height: number;\n opened: boolean;\n pos: number;\n top: number;\n topCapped: boolean;\n nodeTop: number;\n}\n\nconst calculatePos = (pos: number, minPos: number, maxPos: number) => {\n if (maxPos <= pos) {\n return maxPos;\n }\n\n if (minPos >= pos) {\n return minPos;\n }\n\n return pos;\n};\n\nexport const DateSelectDataTids = {\n caption: 'DateSelect__caption',\n menuItem: 'DateSelect__menuItem',\n} as const;\n\n@locale('DatePicker', DatePickerLocaleHelper)\nexport class DateSelect extends React.PureComponent<DateSelectProps, DateSelectState> {\n public static __KONTUR_REACT_UI__ = 'DateSelect';\n\n public static propTypes = {\n disabled: PropTypes.bool,\n\n type: PropTypes.string,\n\n value: PropTypes.number.isRequired,\n\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n onValueChange: PropTypes.func,\n\n minValue: PropTypes.number,\n\n maxValue: PropTypes.number,\n };\n\n public static defaultProps = {\n type: 'year',\n minMonth: 0,\n maxMonth: 11,\n width: 'auto',\n };\n\n public state = {\n botCapped: false,\n current: 0,\n height: 0,\n opened: false,\n pos: 0,\n top: 0,\n topCapped: false,\n nodeTop: Infinity,\n };\n\n private theme!: Theme;\n private readonly locale!: DatePickerLocale;\n private root: HTMLElement | null = null;\n private itemsContainer: HTMLElement | null = null;\n private listener: Nullable<ReturnType<typeof LayoutEvents.addListener>>;\n private timeout: NodeJS.Timeout | undefined;\n private longClickTimer = 0;\n private setPositionRepeatTimer = 0;\n private yearStep = 3;\n private touchStartY: Nullable<number> = null;\n\n public componentDidUpdate() {\n this.setNodeTop();\n }\n\n public componentDidMount() {\n this.listener = LayoutEvents.addListener(this.setNodeTop);\n this.setNodeTop();\n window.addEventListener('keydown', this.handleKey);\n }\n\n public componentWillUnmount() {\n if (this.listener) {\n this.listener.remove();\n }\n if (this.timeout) {\n clearTimeout(this.timeout);\n }\n if (this.longClickTimer) {\n clearTimeout(this.longClickTimer);\n }\n if (this.setPositionRepeatTimer) {\n clearTimeout(this.setPositionRepeatTimer);\n }\n window.removeEventListener('keydown', this.handleKey);\n }\n\n /**\n * @public\n */\n public open = () => {\n if (this.props.disabled) {\n return;\n }\n\n if (this.state.opened) {\n return;\n }\n\n this.setPosition(0);\n this.setState({\n opened: true,\n current: 0,\n });\n };\n\n /**\n * @public\n */\n public close = () => {\n if (!this.state.opened) {\n return;\n }\n\n this.setState({ opened: false });\n };\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain() {\n const { width, disabled } = this.props;\n const rootProps = {\n className: cx({\n [styles.root(this.theme)]: true,\n [styles.disabled()]: Boolean(disabled),\n }),\n style: { width },\n ref: this.refRoot,\n };\n return (\n <span {...rootProps}>\n <div data-tid={DateSelectDataTids.caption} className={styles.caption()} onClick={this.open}>\n {this.getItem(0)}\n <div\n className={cx({\n [styles.arrow(this.theme)]: true,\n [styles.arrowDisabled()]: Boolean(disabled),\n })}\n >\n <ArrowTriangleUpDownIcon size={12} />\n </div>\n </div>\n {this.state.opened && this.renderMenu()}\n </span>\n );\n }\n\n private refRoot = (element: HTMLElement | null) => {\n this.root = element;\n };\n\n private setNodeTop = () => {\n const root = this.root;\n if (!root) {\n return;\n }\n if (this.timeout) {\n clearTimeout(this.timeout);\n }\n this.timeout = setTimeout(() =>\n this.setState({\n nodeTop: getDOMRect(root).top,\n }),\n );\n };\n\n private disableItems(index: number) {\n const value = this.props.value + index;\n if (isNonNullable(this.props.maxValue) && isNonNullable(this.props.minValue)) {\n return value > this.props.maxValue || value < this.props.minValue;\n }\n\n if (isNonNullable(this.props.minValue)) {\n return value < this.props.minValue;\n }\n\n if (isNonNullable(this.props.maxValue)) {\n return value > this.props.maxValue;\n }\n }\n\n private renderMenu(): React.ReactNode {\n const { top, height, nodeTop } = this.state;\n\n let shift = this.state.pos % itemHeight;\n if (shift < 0) {\n shift += itemHeight;\n }\n\n const from = (this.state.pos - shift + top) / itemHeight;\n const to = from + Math.ceil((height + shift) / itemHeight);\n const items = [];\n\n for (let i = from; i < to; ++i) {\n const disableItems = this.disableItems(i) || false;\n const className = cx({\n [styles.menuItem(this.theme)]: true,\n [styles.menuItemSelected(this.theme)]: i === 0,\n [styles.menuItemActive(this.theme)]: i === this.state.current,\n [styles.menuItemDisabled(this.theme)]: disableItems,\n });\n const clickHandler = {\n onMouseDown: preventDefault,\n onClick: this.handleItemClick(i),\n };\n items.push(\n <div\n data-tid={DateSelectDataTids.menuItem}\n data-prop-disabled={disableItems}\n key={i}\n className={className}\n onMouseEnter={() => this.setState({ current: i })}\n onMouseLeave={() => this.setState({ current: null })}\n {...clickHandler}\n >\n {this.getItem(i)}\n </div>,\n );\n }\n const style: {\n left?: number | string;\n right?: number | string;\n top: number;\n width?: number | string;\n } = {\n top: top - 5,\n left: 0,\n right: 0,\n };\n\n const shiftStyle: React.CSSProperties = {\n position: 'relative',\n top: -shift,\n };\n\n const holderClass = cx({\n [styles.menuHolder(this.theme)]: true,\n [styles.isTopCapped()]: this.state.topCapped,\n [styles.isBotCapped()]: this.state.botCapped,\n });\n\n let dropdownOffset = -itemHeight;\n if (nodeTop < -top) {\n const overflowOffsetDelta = this.state.topCapped ? 6 : 17;\n dropdownOffset -= nodeTop + top - overflowOffsetDelta;\n }\n\n return (\n <RenderLayer onClickOutside={this.close} onFocusOutside={this.close} active>\n <div>\n <DropdownContainer getParent={this.getAnchor} offsetY={dropdownOffset} offsetX={-10}>\n <div className={holderClass} style={style}>\n {!this.state.topCapped && (\n <div\n className={cx(styles.menu(this.theme), styles.menuUp())}\n onClick={this.handleUp}\n onMouseDown={this.handleLongClickUp}\n onMouseUp={this.handleLongClickStop}\n onMouseLeave={this.handleLongClickStop}\n onTouchStart={this.handleLongClickUp}\n onTouchEnd={this.handleLongClickStop}\n >\n <span>\n <ArrowChevronUpIcon />\n </span>\n </div>\n )}\n <div className={styles.itemsHolder()} style={{ height }}>\n <div ref={this.refItemsContainer} style={shiftStyle}>\n {items}\n </div>\n </div>\n {!this.state.botCapped && (\n <div\n className={cx(styles.menu(this.theme), styles.menuDown())}\n onClick={this.handleDown}\n onMouseDown={this.handleLongClickDown}\n onMouseUp={this.handleLongClickStop}\n onMouseLeave={this.handleLongClickStop}\n onTouchStart={this.handleLongClickDown}\n onTouchEnd={this.handleLongClickStop}\n >\n <span>\n <ArrowChevronDownIcon />\n </span>\n </div>\n )}\n </div>\n </DropdownContainer>\n </div>\n </RenderLayer>\n );\n }\n\n private refItemsContainer = (element: HTMLElement | null) => {\n if (!this.itemsContainer && element) {\n element.addEventListener('wheel', this.handleWheel, { passive: false });\n }\n if (this.itemsContainer && !element) {\n this.itemsContainer.removeEventListener('wheel', this.handleWheel);\n }\n\n if (isMobile) {\n if (!this.itemsContainer && element) {\n element.addEventListener('touchstart', this.handleTouchStart);\n element.addEventListener('touchmove', this.handleTouchMove);\n }\n if (this.itemsContainer && !element) {\n this.itemsContainer.removeEventListener('touchstart', this.handleTouchStart);\n this.itemsContainer.removeEventListener('touchmove', this.handleTouchMove);\n }\n }\n\n this.itemsContainer = element;\n };\n\n private handleLongClickUp = (event: React.MouseEvent | React.TouchEvent) => {\n event.preventDefault();\n this.longClickTimer = window.setTimeout(() => {\n this.setPositionRepeatTimer = window.setInterval(() => this.setPosition(this.state.pos - itemHeight), 100);\n }, 200);\n };\n\n private handleLongClickDown = (event: React.MouseEvent | React.TouchEvent) => {\n event.preventDefault();\n this.longClickTimer = window.setTimeout(() => {\n this.setPositionRepeatTimer = window.setInterval(() => this.setPosition(this.state.pos + itemHeight), 100);\n }, 200);\n };\n\n private handleLongClickStop = () => {\n clearTimeout(this.longClickTimer);\n clearTimeout(this.setPositionRepeatTimer);\n };\n\n private getAnchor = () => this.root;\n\n private handleWheel = (event: Event) => {\n if (!(event instanceof WheelEvent)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n let deltaY = event.deltaY;\n if (event.deltaMode === 1) {\n deltaY *= itemHeight;\n } else if (event.deltaMode === 2) {\n deltaY *= itemHeight * 4;\n }\n const pos = this.state.pos + deltaY;\n this.setPosition(pos);\n };\n\n private handleTouchStart = (event: Event) => {\n if (!(event instanceof TouchEvent)) {\n return;\n }\n\n this.touchStartY = event.targetTouches[0].clientY;\n };\n\n private handleTouchMove = (event: Event) => {\n if (!(event instanceof TouchEvent)) {\n return;\n }\n\n const { clientY } = event.changedTouches[0];\n const pixelRatio = window.devicePixelRatio;\n\n const deltaY = ((this.touchStartY || 0) - clientY) / pixelRatio;\n const pos = this.state.pos + deltaY + deltaY / itemHeight;\n\n this.touchStartY = clientY;\n\n this.setPosition(pos);\n };\n\n private handleItemClick = (shift: number) => {\n return (e: React.MouseEvent<HTMLElement>) => {\n const value = this.props.value + shift;\n if (this.props.onValueChange) {\n this.props.onValueChange(value);\n }\n this.setState({ opened: false });\n };\n };\n\n private handleKey = (e: KeyboardEvent) => {\n if (this.state.opened && isKeyEscape(e)) {\n e.preventDefault();\n this.close();\n e.stopPropagation();\n }\n };\n\n private handleUp = (event: React.MouseEvent) => {\n event.preventDefault();\n this.setPosition(this.state.pos - itemHeight * this.yearStep);\n };\n\n private handleDown = (event: React.MouseEvent) => {\n event.preventDefault();\n this.setPosition(this.state.pos + itemHeight * this.yearStep);\n };\n\n private getItem(index: number) {\n const value = this.props.value + index;\n if (this.props.type === 'month') {\n return this.locale.months[value];\n }\n return value;\n }\n\n private setPosition(pos: number) {\n let top = itemsToMoveCount * itemHeight;\n let height = visibleYearsCount * itemHeight;\n if (this.props.type === 'month') {\n top = -this.props.value * itemHeight;\n height = monthsCount * itemHeight;\n }\n\n const minPos = this.getMinPos() - top;\n const maxPos = this.getMaxPos() - top - height + itemHeight;\n\n const calculatedPos = calculatePos(pos, minPos, maxPos);\n const topCapped = calculatedPos <= minPos;\n const botCapped = calculatedPos >= maxPos;\n\n this.setState({ pos: calculatedPos, top, height, topCapped, botCapped });\n }\n\n private getMinPos() {\n if (this.props.type === 'month') {\n return -this.props.value * itemHeight;\n } else if (this.props.type === 'year') {\n return ((this.props.minValue || defaultMinYear) - this.props.value) * itemHeight;\n }\n return -Infinity; // Be defensive.\n }\n\n private getMaxPos() {\n if (this.props.type === 'month') {\n return (visibleYearsCount - this.props.value) * itemHeight;\n } else if (this.props.type === 'year') {\n return ((this.props.maxValue || defaultMaxYear) - this.props.value) * itemHeight;\n }\n return Infinity; // Be defensive.\n }\n}\n\nfunction preventDefault(e: React.SyntheticEvent) {\n e.preventDefault();\n}\n"]}
1
+ {"version":3,"sources":["DateSelect.tsx"],"names":["itemHeight","visibleYearsCount","itemsToMoveCount","monthsCount","defaultMinYear","defaultMaxYear","calculatePos","pos","minPos","maxPos","DateSelectDataTids","caption","menuItem","DateSelect","DatePickerLocaleHelper","getProps","defaultProps","state","botCapped","current","height","opened","top","topCapped","nodeTop","Infinity","root","itemsContainer","longClickTimer","setPositionRepeatTimer","yearStep","touchStartY","open","props","disabled","setPosition","setState","close","refRoot","element","setNodeTop","timeout","clearTimeout","setTimeout","refItemsContainer","addEventListener","handleWheel","passive","removeEventListener","isMobile","handleTouchStart","handleTouchMove","handleLongClickUp","event","preventDefault","window","setInterval","handleLongClickDown","handleLongClickStop","getAnchor","WheelEvent","stopPropagation","deltaY","deltaMode","TouchEvent","targetTouches","clientY","changedTouches","pixelRatio","devicePixelRatio","handleItemClick","shift","e","value","onValueChange","handleKey","handleUp","handleDown","componentDidUpdate","componentDidMount","listener","LayoutEvents","addListener","componentWillUnmount","remove","render","theme","renderMain","width","rootProps","className","styles","Boolean","style","ref","getItem","arrow","arrowDisabled","renderMenu","disableItems","index","maxValue","minValue","from","to","Math","ceil","items","i","menuItemSelected","menuItemActive","menuItemDisabled","clickHandler","onMouseDown","onClick","push","left","right","shiftStyle","position","holderClass","menuHolder","isTopCapped","isBotCapped","dropdownOffset","overflowOffsetDelta","menu","menuUp","itemsHolder","menuDown","type","locale","months","getMinPos","getMaxPos","calculatedPos","React","PureComponent","__KONTUR_REACT_UI__","propTypes","PropTypes","bool","string","number","isRequired","oneOfType","func"],"mappings":"qWAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA,iD;;AAEA,IAAMA,UAAU,GAAG,EAAnB;AACA,IAAMC,iBAAiB,GAAG,EAA1B;AACA,IAAMC,gBAAgB,GAAG,CAAC,CAA1B;AACA,IAAMC,WAAW,GAAG,EAApB;AACA,IAAMC,cAAc,GAAG,IAAvB;AACA,IAAMC,cAAc,GAAG,IAAvB;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CAACC,GAAD,EAAcC,MAAd,EAA8BC,MAA9B,EAAiD;AACpE,MAAIA,MAAM,IAAIF,GAAd,EAAmB;AACjB,WAAOE,MAAP;AACD;;AAED,MAAID,MAAM,IAAID,GAAd,EAAmB;AACjB,WAAOC,MAAP;AACD;;AAED,SAAOD,GAAP;AACD,CAVD;;AAYO,IAAMG,kBAAkB,GAAG;AAChCC,EAAAA,OAAO,EAAE,qBADuB;AAEhCC,EAAAA,QAAQ,EAAE,sBAFsB,EAA3B,C;;;;;;AAQMC,U,WADZ,wBAAO,YAAP,EAAqBC,8BAArB,C;;;;;;;;;;;;;;;;;;;;;;;;AAyBSC,IAAAA,Q,GAAW,0CAAkBF,UAAU,CAACG,YAA7B,C;;AAEZC,IAAAA,K,GAAQ;AACbC,MAAAA,SAAS,EAAE,KADE;AAEbC,MAAAA,OAAO,EAAE,CAFI;AAGbC,MAAAA,MAAM,EAAE,CAHK;AAIbC,MAA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E,mBAAUM,IATD,EAWxB5C,QAAQ,EAAEsC,mBAAUG,MAXI,EAaxB1C,QAAQ,EAAEuC,mBAAUG,MAbI,E,UAgBZ/H,Y,GAA6B,EACzCkH,IAAI,EAAE,MADmC,EAEzC1C,KAAK,EAAE,MAFkC,E;;;AA+a7C,SAASlC,cAAT,CAAwBkB,CAAxB,EAAiD;AAC/CA,EAAAA,CAAC,CAAClB,cAAF;AACD","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { isNonNullable } from '../../lib/utils';\nimport { isKeyEscape } from '../../lib/events/keyboard/identifiers';\nimport { DatePickerLocale, DatePickerLocaleHelper } from '../../components/DatePicker/locale';\nimport { locale } from '../../lib/locale/decorators';\nimport { RenderLayer } from '../RenderLayer';\nimport { DropdownContainer } from '../DropdownContainer';\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport { Nullable } from '../../typings/utility-types';\nimport { Theme } from '../../lib/theming/Theme';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { ArrowTriangleUpDownIcon, ArrowChevronDownIcon, ArrowChevronUpIcon } from '../icons/16px';\nimport { isMobile } from '../../lib/client';\nimport { cx } from '../../lib/theming/Emotion';\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { styles } from './DateSelect.styles';\n\nconst itemHeight = 24;\nconst visibleYearsCount = 11;\nconst itemsToMoveCount = -5;\nconst monthsCount = 12;\nconst defaultMinYear = 1900;\nconst defaultMaxYear = 2100;\n\nexport interface DateSelectProps {\n disabled?: boolean | null;\n onValueChange: (value: number) => void;\n type?: 'month' | 'year';\n value: number;\n width?: number | string;\n minValue?: number;\n maxValue?: number;\n}\n\nexport interface DateSelectState {\n botCapped: boolean;\n current: Nullable<number>;\n height: number;\n opened: boolean;\n pos: number;\n top: number;\n topCapped: boolean;\n nodeTop: number;\n}\n\nconst calculatePos = (pos: number, minPos: number, maxPos: number) => {\n if (maxPos <= pos) {\n return maxPos;\n }\n\n if (minPos >= pos) {\n return minPos;\n }\n\n return pos;\n};\n\nexport const DateSelectDataTids = {\n caption: 'DateSelect__caption',\n menuItem: 'DateSelect__menuItem',\n} as const;\n\ntype DefaultProps = Required<Pick<DateSelectProps, 'type' | 'width'>>;\n\n@locale('DatePicker', DatePickerLocaleHelper)\nexport class DateSelect extends React.PureComponent<DateSelectProps, DateSelectState> {\n public static __KONTUR_REACT_UI__ = 'DateSelect';\n\n public static propTypes = {\n disabled: PropTypes.bool,\n\n type: PropTypes.string,\n\n value: PropTypes.number.isRequired,\n\n width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n\n onValueChange: PropTypes.func,\n\n minValue: PropTypes.number,\n\n maxValue: PropTypes.number,\n };\n\n public static defaultProps: DefaultProps = {\n type: 'year',\n width: 'auto',\n };\n\n private getProps = createPropsGetter(DateSelect.defaultProps);\n\n public state = {\n botCapped: false,\n current: 0,\n height: 0,\n opened: false,\n pos: 0,\n top: 0,\n topCapped: false,\n nodeTop: Infinity,\n };\n\n private theme!: Theme;\n private readonly locale!: DatePickerLocale;\n private root: HTMLElement | null = null;\n private itemsContainer: HTMLElement | null = null;\n private listener: Nullable<ReturnType<typeof LayoutEvents.addListener>>;\n private timeout: NodeJS.Timeout | undefined;\n private longClickTimer = 0;\n private setPositionRepeatTimer = 0;\n private yearStep = 3;\n private touchStartY: Nullable<number> = null;\n\n public componentDidUpdate() {\n this.setNodeTop();\n }\n\n public componentDidMount() {\n this.listener = LayoutEvents.addListener(this.setNodeTop);\n this.setNodeTop();\n window.addEventListener('keydown', this.handleKey);\n }\n\n public componentWillUnmount() {\n if (this.listener) {\n this.listener.remove();\n }\n if (this.timeout) {\n clearTimeout(this.timeout);\n }\n if (this.longClickTimer) {\n clearTimeout(this.longClickTimer);\n }\n if (this.setPositionRepeatTimer) {\n clearTimeout(this.setPositionRepeatTimer);\n }\n window.removeEventListener('keydown', this.handleKey);\n }\n\n /**\n * @public\n */\n public open = () => {\n if (this.props.disabled) {\n return;\n }\n\n if (this.state.opened) {\n return;\n }\n\n this.setPosition(0);\n this.setState({\n opened: true,\n current: 0,\n });\n };\n\n /**\n * @public\n */\n public close = () => {\n if (!this.state.opened) {\n return;\n }\n\n this.setState({ opened: false });\n };\n\n public render() {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n private renderMain() {\n const { disabled } = this.props;\n const width = this.getProps().width;\n const rootProps = {\n className: cx({\n [styles.root(this.theme)]: true,\n [styles.disabled()]: Boolean(disabled),\n }),\n style: { width },\n ref: this.refRoot,\n };\n return (\n <span {...rootProps}>\n <div data-tid={DateSelectDataTids.caption} className={styles.caption()} onClick={this.open}>\n {this.getItem(0)}\n <div\n className={cx({\n [styles.arrow(this.theme)]: true,\n [styles.arrowDisabled()]: Boolean(disabled),\n })}\n >\n <ArrowTriangleUpDownIcon size={12} />\n </div>\n </div>\n {this.state.opened && this.renderMenu()}\n </span>\n );\n }\n\n private refRoot = (element: HTMLElement | null) => {\n this.root = element;\n };\n\n private setNodeTop = () => {\n const root = this.root;\n if (!root) {\n return;\n }\n if (this.timeout) {\n clearTimeout(this.timeout);\n }\n this.timeout = setTimeout(() =>\n this.setState({\n nodeTop: getDOMRect(root).top,\n }),\n );\n };\n\n private disableItems(index: number) {\n const value = this.props.value + index;\n if (isNonNullable(this.props.maxValue) && isNonNullable(this.props.minValue)) {\n return value > this.props.maxValue || value < this.props.minValue;\n }\n\n if (isNonNullable(this.props.minValue)) {\n return value < this.props.minValue;\n }\n\n if (isNonNullable(this.props.maxValue)) {\n return value > this.props.maxValue;\n }\n }\n\n private renderMenu(): React.ReactNode {\n const { top, height, nodeTop } = this.state;\n\n let shift = this.state.pos % itemHeight;\n if (shift < 0) {\n shift += itemHeight;\n }\n\n const from = (this.state.pos - shift + top) / itemHeight;\n const to = from + Math.ceil((height + shift) / itemHeight);\n const items = [];\n\n for (let i = from; i < to; ++i) {\n const disableItems = this.disableItems(i) || false;\n const className = cx({\n [styles.menuItem(this.theme)]: true,\n [styles.menuItemSelected(this.theme)]: i === 0,\n [styles.menuItemActive(this.theme)]: i === this.state.current,\n [styles.menuItemDisabled(this.theme)]: disableItems,\n });\n const clickHandler = {\n onMouseDown: preventDefault,\n onClick: this.handleItemClick(i),\n };\n items.push(\n <div\n data-tid={DateSelectDataTids.menuItem}\n data-prop-disabled={disableItems}\n key={i}\n className={className}\n onMouseEnter={() => this.setState({ current: i })}\n onMouseLeave={() => this.setState({ current: null })}\n {...clickHandler}\n >\n {this.getItem(i)}\n </div>,\n );\n }\n const style: {\n left?: number | string;\n right?: number | string;\n top: number;\n width?: number | string;\n } = {\n top: top - 5,\n left: 0,\n right: 0,\n };\n\n const shiftStyle: React.CSSProperties = {\n position: 'relative',\n top: -shift,\n };\n\n const holderClass = cx({\n [styles.menuHolder(this.theme)]: true,\n [styles.isTopCapped()]: this.state.topCapped,\n [styles.isBotCapped()]: this.state.botCapped,\n });\n\n let dropdownOffset = -itemHeight;\n if (nodeTop < -top) {\n const overflowOffsetDelta = this.state.topCapped ? 6 : 17;\n dropdownOffset -= nodeTop + top - overflowOffsetDelta;\n }\n\n return (\n <RenderLayer onClickOutside={this.close} onFocusOutside={this.close} active>\n <div>\n <DropdownContainer getParent={this.getAnchor} offsetY={dropdownOffset} offsetX={-10}>\n <div className={holderClass} style={style}>\n {!this.state.topCapped && (\n <div\n className={cx(styles.menu(this.theme), styles.menuUp())}\n onClick={this.handleUp}\n onMouseDown={this.handleLongClickUp}\n onMouseUp={this.handleLongClickStop}\n onMouseLeave={this.handleLongClickStop}\n onTouchStart={this.handleLongClickUp}\n onTouchEnd={this.handleLongClickStop}\n >\n <span>\n <ArrowChevronUpIcon />\n </span>\n </div>\n )}\n <div className={styles.itemsHolder()} style={{ height }}>\n <div ref={this.refItemsContainer} style={shiftStyle}>\n {items}\n </div>\n </div>\n {!this.state.botCapped && (\n <div\n className={cx(styles.menu(this.theme), styles.menuDown())}\n onClick={this.handleDown}\n onMouseDown={this.handleLongClickDown}\n onMouseUp={this.handleLongClickStop}\n onMouseLeave={this.handleLongClickStop}\n onTouchStart={this.handleLongClickDown}\n onTouchEnd={this.handleLongClickStop}\n >\n <span>\n <ArrowChevronDownIcon />\n </span>\n </div>\n )}\n </div>\n </DropdownContainer>\n </div>\n </RenderLayer>\n );\n }\n\n private refItemsContainer = (element: HTMLElement | null) => {\n if (!this.itemsContainer && element) {\n element.addEventListener('wheel', this.handleWheel, { passive: false });\n }\n if (this.itemsContainer && !element) {\n this.itemsContainer.removeEventListener('wheel', this.handleWheel);\n }\n\n if (isMobile) {\n if (!this.itemsContainer && element) {\n element.addEventListener('touchstart', this.handleTouchStart);\n element.addEventListener('touchmove', this.handleTouchMove);\n }\n if (this.itemsContainer && !element) {\n this.itemsContainer.removeEventListener('touchstart', this.handleTouchStart);\n this.itemsContainer.removeEventListener('touchmove', this.handleTouchMove);\n }\n }\n\n this.itemsContainer = element;\n };\n\n private handleLongClickUp = (event: React.MouseEvent | React.TouchEvent) => {\n event.preventDefault();\n this.longClickTimer = window.setTimeout(() => {\n this.setPositionRepeatTimer = window.setInterval(() => this.setPosition(this.state.pos - itemHeight), 100);\n }, 200);\n };\n\n private handleLongClickDown = (event: React.MouseEvent | React.TouchEvent) => {\n event.preventDefault();\n this.longClickTimer = window.setTimeout(() => {\n this.setPositionRepeatTimer = window.setInterval(() => this.setPosition(this.state.pos + itemHeight), 100);\n }, 200);\n };\n\n private handleLongClickStop = () => {\n clearTimeout(this.longClickTimer);\n clearTimeout(this.setPositionRepeatTimer);\n };\n\n private getAnchor = () => this.root;\n\n private handleWheel = (event: Event) => {\n if (!(event instanceof WheelEvent)) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n\n let deltaY = event.deltaY;\n if (event.deltaMode === 1) {\n deltaY *= itemHeight;\n } else if (event.deltaMode === 2) {\n deltaY *= itemHeight * 4;\n }\n const pos = this.state.pos + deltaY;\n this.setPosition(pos);\n };\n\n private handleTouchStart = (event: Event) => {\n if (!(event instanceof TouchEvent)) {\n return;\n }\n\n this.touchStartY = event.targetTouches[0].clientY;\n };\n\n private handleTouchMove = (event: Event) => {\n if (!(event instanceof TouchEvent)) {\n return;\n }\n\n const { clientY } = event.changedTouches[0];\n const pixelRatio = window.devicePixelRatio;\n\n const deltaY = ((this.touchStartY || 0) - clientY) / pixelRatio;\n const pos = this.state.pos + deltaY + deltaY / itemHeight;\n\n this.touchStartY = clientY;\n\n this.setPosition(pos);\n };\n\n private handleItemClick = (shift: number) => {\n return (e: React.MouseEvent<HTMLElement>) => {\n const value = this.props.value + shift;\n if (this.props.onValueChange) {\n this.props.onValueChange(value);\n }\n this.setState({ opened: false });\n };\n };\n\n private handleKey = (e: KeyboardEvent) => {\n if (this.state.opened && isKeyEscape(e)) {\n e.preventDefault();\n this.close();\n e.stopPropagation();\n }\n };\n\n private handleUp = (event: React.MouseEvent) => {\n event.preventDefault();\n this.setPosition(this.state.pos - itemHeight * this.yearStep);\n };\n\n private handleDown = (event: React.MouseEvent) => {\n event.preventDefault();\n this.setPosition(this.state.pos + itemHeight * this.yearStep);\n };\n\n private getItem(index: number) {\n const value = this.props.value + index;\n if (this.getProps().type === 'month') {\n return this.locale.months[value];\n }\n return value;\n }\n\n private setPosition(pos: number) {\n let top = itemsToMoveCount * itemHeight;\n let height = visibleYearsCount * itemHeight;\n if (this.getProps().type === 'month') {\n top = -this.props.value * itemHeight;\n height = monthsCount * itemHeight;\n }\n\n const minPos = this.getMinPos() - top;\n const maxPos = this.getMaxPos() - top - height + itemHeight;\n\n const calculatedPos = calculatePos(pos, minPos, maxPos);\n const topCapped = calculatedPos <= minPos;\n const botCapped = calculatedPos >= maxPos;\n\n this.setState({ pos: calculatedPos, top, height, topCapped, botCapped });\n }\n\n private getMinPos() {\n const type = this.getProps().type;\n if (type === 'month') {\n return -this.props.value * itemHeight;\n } else if (type === 'year') {\n return ((this.props.minValue || defaultMinYear) - this.props.value) * itemHeight;\n }\n return -Infinity; // Be defensive.\n }\n\n private getMaxPos() {\n const type = this.getProps().type;\n if (type === 'month') {\n return (visibleYearsCount - this.props.value) * itemHeight;\n } else if (type === 'year') {\n return ((this.props.maxValue || defaultMaxYear) - this.props.value) * itemHeight;\n }\n return Infinity; // Be defensive.\n }\n}\n\nfunction preventDefault(e: React.SyntheticEvent) {\n e.preventDefault();\n}\n"]}