@skbkontur/react-ui 5.2.1 → 5.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 (554) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +7 -7
  3. package/cjs/components/Autocomplete/Autocomplete.d.ts +6 -23
  4. package/cjs/components/Autocomplete/Autocomplete.js +49 -46
  5. package/cjs/components/Autocomplete/Autocomplete.js.map +1 -1
  6. package/cjs/components/Button/Button.d.ts +2 -0
  7. package/cjs/components/Button/Button.js +29 -1
  8. package/cjs/components/Button/Button.js.map +1 -1
  9. package/cjs/components/Button/Button.styles.d.ts +6 -0
  10. package/cjs/components/Button/Button.styles.js +107 -75
  11. package/cjs/components/Button/Button.styles.js.map +1 -1
  12. package/cjs/components/Calendar/Calendar.d.ts +2 -0
  13. package/cjs/components/Calendar/Calendar.js +1 -0
  14. package/cjs/components/Calendar/Calendar.js.map +1 -1
  15. package/cjs/components/Center/Center.d.ts +2 -0
  16. package/cjs/components/Center/Center.js +1 -0
  17. package/cjs/components/Center/Center.js.map +1 -1
  18. package/cjs/components/Checkbox/Checkbox.d.ts +2 -12
  19. package/cjs/components/Checkbox/Checkbox.js +2 -14
  20. package/cjs/components/Checkbox/Checkbox.js.map +1 -1
  21. package/cjs/components/ComboBox/ComboBox.d.ts +2 -0
  22. package/cjs/components/ComboBox/ComboBox.js +1 -0
  23. package/cjs/components/ComboBox/ComboBox.js.map +1 -1
  24. package/cjs/components/CurrencyInput/CurrencyInput.d.ts +6 -24
  25. package/cjs/components/CurrencyInput/CurrencyInput.js +5 -28
  26. package/cjs/components/CurrencyInput/CurrencyInput.js.map +1 -1
  27. package/cjs/components/CurrencyInput/constants.js +1 -2
  28. package/cjs/components/CurrencyInput/constants.js.map +1 -1
  29. package/cjs/components/CurrencyLabel/CurrencyLabel.js +21 -28
  30. package/cjs/components/CurrencyLabel/CurrencyLabel.js.map +1 -1
  31. package/cjs/components/DateInput/DateInput.d.ts +2 -0
  32. package/cjs/components/DateInput/DateInput.js +1 -0
  33. package/cjs/components/DateInput/DateInput.js.map +1 -1
  34. package/cjs/components/DatePicker/DatePicker.d.ts +6 -33
  35. package/cjs/components/DatePicker/DatePicker.js +6 -60
  36. package/cjs/components/DatePicker/DatePicker.js.map +1 -1
  37. package/cjs/components/Dropdown/Dropdown.d.ts +2 -47
  38. package/cjs/components/Dropdown/Dropdown.js +2 -82
  39. package/cjs/components/Dropdown/Dropdown.js.map +1 -1
  40. package/cjs/components/DropdownMenu/DropdownMenu.d.ts +4 -2
  41. package/cjs/components/DropdownMenu/DropdownMenu.js +1 -0
  42. package/cjs/components/DropdownMenu/DropdownMenu.js.map +1 -1
  43. package/cjs/components/FxInput/FxInput.d.ts +2 -5
  44. package/cjs/components/FxInput/FxInput.js +2 -7
  45. package/cjs/components/FxInput/FxInput.js.map +1 -1
  46. package/cjs/components/Gapped/Gapped.d.ts +2 -15
  47. package/cjs/components/Gapped/Gapped.js +1 -24
  48. package/cjs/components/Gapped/Gapped.js.map +1 -1
  49. package/cjs/components/GlobalLoader/GlobalLoader.d.ts +2 -0
  50. package/cjs/components/GlobalLoader/GlobalLoader.js +1 -0
  51. package/cjs/components/GlobalLoader/GlobalLoader.js.map +1 -1
  52. package/cjs/components/Group/Group.d.ts +5 -4
  53. package/cjs/components/Group/Group.js +91 -40
  54. package/cjs/components/Group/Group.js.map +1 -1
  55. package/cjs/components/Group/Group.styles.d.ts +1 -0
  56. package/cjs/components/Group/Group.styles.js +12 -6
  57. package/cjs/components/Group/Group.styles.js.map +1 -1
  58. package/cjs/components/Hint/Hint.d.ts +2 -0
  59. package/cjs/components/Hint/Hint.js +1 -0
  60. package/cjs/components/Hint/Hint.js.map +1 -1
  61. package/cjs/components/Input/Input.d.ts +2 -0
  62. package/cjs/components/Input/Input.js +1 -0
  63. package/cjs/components/Input/Input.js.map +1 -1
  64. package/cjs/components/Kebab/Kebab.d.ts +2 -1
  65. package/cjs/components/Kebab/Kebab.js +2 -26
  66. package/cjs/components/Kebab/Kebab.js.map +1 -1
  67. package/cjs/components/Link/Link.d.ts +2 -0
  68. package/cjs/components/Link/Link.js +1 -0
  69. package/cjs/components/Link/Link.js.map +1 -1
  70. package/cjs/components/Loader/Loader.d.ts +6 -36
  71. package/cjs/components/Loader/Loader.js +3 -57
  72. package/cjs/components/Loader/Loader.js.map +1 -1
  73. package/cjs/components/MaskedInput/MaskedInput.d.ts +1 -0
  74. package/cjs/components/MaskedInput/MaskedInput.js +17 -1
  75. package/cjs/components/MaskedInput/MaskedInput.js.map +1 -1
  76. package/cjs/components/MenuItem/MenuItem.d.ts +2 -12
  77. package/cjs/components/MenuItem/MenuItem.js +2 -22
  78. package/cjs/components/MenuItem/MenuItem.js.map +1 -1
  79. package/cjs/components/MiniModal/MiniModal.styles.d.ts +1 -0
  80. package/cjs/components/MiniModal/MiniModal.styles.js +14 -7
  81. package/cjs/components/MiniModal/MiniModal.styles.js.map +1 -1
  82. package/cjs/components/MiniModal/MiniModalBody.js +17 -2
  83. package/cjs/components/MiniModal/MiniModalBody.js.map +1 -1
  84. package/cjs/components/Modal/Modal.styles.d.ts +1 -0
  85. package/cjs/components/Modal/Modal.styles.js +36 -28
  86. package/cjs/components/Modal/Modal.styles.js.map +1 -1
  87. package/cjs/components/Modal/ModalBody.d.ts +2 -0
  88. package/cjs/components/Modal/ModalBody.js +1 -0
  89. package/cjs/components/Modal/ModalBody.js.map +1 -1
  90. package/cjs/components/Modal/ModalHeader.d.ts +5 -0
  91. package/cjs/components/Modal/ModalHeader.js +8 -1
  92. package/cjs/components/Modal/ModalHeader.js.map +1 -1
  93. package/cjs/components/Paging/DotsIcon.d.ts +3 -0
  94. package/cjs/components/Paging/DotsIcon.js +13 -0
  95. package/cjs/components/Paging/DotsIcon.js.map +1 -0
  96. package/cjs/components/Paging/ForwardIcon.d.ts +3 -0
  97. package/cjs/components/Paging/ForwardIcon.js +13 -1
  98. package/cjs/components/Paging/ForwardIcon.js.map +1 -1
  99. package/cjs/components/Paging/NavigationHelper.d.ts +3 -2
  100. package/cjs/components/Paging/NavigationHelper.js +8 -6
  101. package/cjs/components/Paging/NavigationHelper.js.map +1 -1
  102. package/cjs/components/Paging/Paging.d.ts +13 -2
  103. package/cjs/components/Paging/Paging.js +120 -50
  104. package/cjs/components/Paging/Paging.js.map +1 -1
  105. package/cjs/components/Paging/Paging.styles.d.ts +24 -1
  106. package/cjs/components/Paging/Paging.styles.js +151 -22
  107. package/cjs/components/Paging/Paging.styles.js.map +1 -1
  108. package/cjs/components/Paging/PagingHelper.d.ts +1 -1
  109. package/cjs/components/Paging/PagingHelper.js +18 -11
  110. package/cjs/components/Paging/PagingHelper.js.map +1 -1
  111. package/cjs/components/PasswordInput/PasswordInput.d.ts +2 -7
  112. package/cjs/components/PasswordInput/PasswordInput.js +2 -11
  113. package/cjs/components/PasswordInput/PasswordInput.js.map +1 -1
  114. package/cjs/components/Radio/Radio.d.ts +2 -0
  115. package/cjs/components/Radio/Radio.js +1 -0
  116. package/cjs/components/Radio/Radio.js.map +1 -1
  117. package/cjs/components/RadioGroup/RadioGroup.d.ts +2 -0
  118. package/cjs/components/RadioGroup/RadioGroup.js +1 -0
  119. package/cjs/components/RadioGroup/RadioGroup.js.map +1 -1
  120. package/cjs/components/ScrollContainer/ScrollContainer.d.ts +2 -9
  121. package/cjs/components/ScrollContainer/ScrollContainer.js +2 -11
  122. package/cjs/components/ScrollContainer/ScrollContainer.js.map +1 -1
  123. package/cjs/components/Select/Select.d.ts +2 -0
  124. package/cjs/components/Select/Select.js +1 -0
  125. package/cjs/components/Select/Select.js.map +1 -1
  126. package/cjs/components/SidePage/SidePage.styles.d.ts +3 -1
  127. package/cjs/components/SidePage/SidePage.styles.js +52 -38
  128. package/cjs/components/SidePage/SidePage.styles.js.map +1 -1
  129. package/cjs/components/SidePage/SidePageBody.d.ts +2 -0
  130. package/cjs/components/SidePage/SidePageBody.js +1 -0
  131. package/cjs/components/SidePage/SidePageBody.js.map +1 -1
  132. package/cjs/components/SidePage/SidePageContainer.d.ts +2 -0
  133. package/cjs/components/SidePage/SidePageContainer.js +1 -0
  134. package/cjs/components/SidePage/SidePageContainer.js.map +1 -1
  135. package/cjs/components/SidePage/SidePageFooter.d.ts +2 -0
  136. package/cjs/components/SidePage/SidePageFooter.js +1 -0
  137. package/cjs/components/SidePage/SidePageFooter.js.map +1 -1
  138. package/cjs/components/SidePage/SidePageHeader.d.ts +12 -2
  139. package/cjs/components/SidePage/SidePageHeader.js +60 -19
  140. package/cjs/components/SidePage/SidePageHeader.js.map +1 -1
  141. package/cjs/components/Spinner/Spinner.d.ts +2 -18
  142. package/cjs/components/Spinner/Spinner.js +2 -32
  143. package/cjs/components/Spinner/Spinner.js.map +1 -1
  144. package/cjs/components/Sticky/Sticky.d.ts +2 -13
  145. package/cjs/components/Sticky/Sticky.js +2 -22
  146. package/cjs/components/Sticky/Sticky.js.map +1 -1
  147. package/cjs/components/Switcher/Switcher.d.ts +6 -21
  148. package/cjs/components/Switcher/Switcher.js +11 -20
  149. package/cjs/components/Switcher/Switcher.js.map +1 -1
  150. package/cjs/components/Switcher/Switcher.styles.d.ts +1 -0
  151. package/cjs/components/Switcher/Switcher.styles.js +17 -9
  152. package/cjs/components/Switcher/Switcher.styles.js.map +1 -1
  153. package/cjs/components/Tabs/Indicator.d.ts +2 -0
  154. package/cjs/components/Tabs/Indicator.js +1 -0
  155. package/cjs/components/Tabs/Indicator.js.map +1 -1
  156. package/cjs/components/Tabs/Tab.d.ts +2 -0
  157. package/cjs/components/Tabs/Tab.js +1 -0
  158. package/cjs/components/Tabs/Tab.js.map +1 -1
  159. package/cjs/components/Tabs/Tabs.d.ts +2 -0
  160. package/cjs/components/Tabs/Tabs.js +1 -0
  161. package/cjs/components/Tabs/Tabs.js.map +1 -1
  162. package/cjs/components/Textarea/Textarea.d.ts +2 -44
  163. package/cjs/components/Textarea/Textarea.js +2 -56
  164. package/cjs/components/Textarea/Textarea.js.map +1 -1
  165. package/cjs/components/Textarea/TextareaCounter.js +2 -13
  166. package/cjs/components/Textarea/TextareaCounter.js.map +1 -1
  167. package/cjs/components/Toast/Toast.d.ts +2 -0
  168. package/cjs/components/Toast/Toast.js +1 -0
  169. package/cjs/components/Toast/Toast.js.map +1 -1
  170. package/cjs/components/Toast/ToastView.d.ts +2 -14
  171. package/cjs/components/Toast/ToastView.js +3 -22
  172. package/cjs/components/Toast/ToastView.js.map +1 -1
  173. package/cjs/components/Toggle/Toggle.d.ts +2 -10
  174. package/cjs/components/Toggle/Toggle.js +1 -11
  175. package/cjs/components/Toggle/Toggle.js.map +1 -1
  176. package/cjs/components/Token/Token.d.ts +2 -0
  177. package/cjs/components/Token/Token.js +1 -0
  178. package/cjs/components/Token/Token.js.map +1 -1
  179. package/cjs/components/TokenInput/TokenInput.d.ts +2 -0
  180. package/cjs/components/TokenInput/TokenInput.js +1 -0
  181. package/cjs/components/TokenInput/TokenInput.js.map +1 -1
  182. package/cjs/components/Tooltip/Tooltip.d.ts +14 -9
  183. package/cjs/components/Tooltip/Tooltip.js +95 -13
  184. package/cjs/components/Tooltip/Tooltip.js.map +1 -1
  185. package/cjs/components/Tooltip/Tooltip.styles.d.ts +7 -1
  186. package/cjs/components/Tooltip/Tooltip.styles.js +50 -12
  187. package/cjs/components/Tooltip/Tooltip.styles.js.map +1 -1
  188. package/cjs/components/TooltipMenu/TooltipMenu.d.ts +4 -2
  189. package/cjs/components/TooltipMenu/TooltipMenu.js +1 -0
  190. package/cjs/components/TooltipMenu/TooltipMenu.js.map +1 -1
  191. package/cjs/index.d.ts +1 -0
  192. package/cjs/index.js.map +1 -1
  193. package/cjs/internal/CommonWrapper/CommonWrapper.d.ts +2 -0
  194. package/cjs/internal/CommonWrapper/CommonWrapper.js +1 -0
  195. package/cjs/internal/CommonWrapper/CommonWrapper.js.map +1 -1
  196. package/cjs/internal/ComponentTable.js +2 -3
  197. package/cjs/internal/ComponentTable.js.map +1 -1
  198. package/cjs/internal/CustomComboBox/ComboBoxView.d.ts +2 -0
  199. package/cjs/internal/CustomComboBox/ComboBoxView.js +1 -0
  200. package/cjs/internal/CustomComboBox/ComboBoxView.js.map +1 -1
  201. package/cjs/internal/CustomComboBox/CustomComboBox.d.ts +2 -0
  202. package/cjs/internal/CustomComboBox/CustomComboBox.js +1 -0
  203. package/cjs/internal/CustomComboBox/CustomComboBox.js.map +1 -1
  204. package/cjs/internal/DateSelect/DateSelect.d.ts +0 -10
  205. package/cjs/internal/DateSelect/DateSelect.js +1 -18
  206. package/cjs/internal/DateSelect/DateSelect.js.map +1 -1
  207. package/cjs/internal/FocusTrap/FocusTrap.d.ts +2 -0
  208. package/cjs/internal/FocusTrap/FocusTrap.js +1 -0
  209. package/cjs/internal/FocusTrap/FocusTrap.js.map +1 -1
  210. package/cjs/internal/IgnoreLayerClick/IgnoreLayerClick.js +1 -0
  211. package/cjs/internal/IgnoreLayerClick/IgnoreLayerClick.js.map +1 -1
  212. package/cjs/internal/InputLikeText/InputLikeText.d.ts +2 -0
  213. package/cjs/internal/InputLikeText/InputLikeText.js +1 -0
  214. package/cjs/internal/InputLikeText/InputLikeText.js.map +1 -1
  215. package/cjs/internal/Menu/Menu.d.ts +2 -0
  216. package/cjs/internal/Menu/Menu.js +1 -0
  217. package/cjs/internal/Menu/Menu.js.map +1 -1
  218. package/cjs/internal/MobilePopup/MobilePopup.d.ts +2 -0
  219. package/cjs/internal/MobilePopup/MobilePopup.js +1 -0
  220. package/cjs/internal/MobilePopup/MobilePopup.js.map +1 -1
  221. package/cjs/internal/Popup/Popup.d.ts +41 -59
  222. package/cjs/internal/Popup/Popup.js +36 -79
  223. package/cjs/internal/Popup/Popup.js.map +1 -1
  224. package/cjs/internal/Popup/PopupPin.d.ts +23 -33
  225. package/cjs/internal/Popup/PopupPin.js +2 -35
  226. package/cjs/internal/Popup/PopupPin.js.map +1 -1
  227. package/cjs/internal/Popup/PopupPinNew.d.ts +31 -0
  228. package/cjs/internal/Popup/PopupPinNew.js +180 -0
  229. package/cjs/internal/Popup/PopupPinNew.js.map +1 -0
  230. package/cjs/internal/Popup/PopupPinNew.styles.d.ts +7 -0
  231. package/cjs/internal/Popup/PopupPinNew.styles.js +33 -0
  232. package/cjs/internal/Popup/PopupPinNew.styles.js.map +1 -0
  233. package/cjs/internal/PopupMenu/PopupMenu.d.ts +2 -0
  234. package/cjs/internal/PopupMenu/PopupMenu.js +1 -0
  235. package/cjs/internal/PopupMenu/PopupMenu.js.map +1 -1
  236. package/cjs/internal/RenderContainer/RenderInnerContainer.d.ts +0 -6
  237. package/cjs/internal/RenderContainer/RenderInnerContainer.js +0 -9
  238. package/cjs/internal/RenderContainer/RenderInnerContainer.js.map +1 -1
  239. package/cjs/internal/RenderLayer/RenderLayer.d.ts +2 -3
  240. package/cjs/internal/RenderLayer/RenderLayer.js +3 -12
  241. package/cjs/internal/RenderLayer/RenderLayer.js.map +1 -1
  242. package/cjs/internal/ThemePlayground/Playground.js +1 -1
  243. package/cjs/internal/ThemePlayground/Playground.js.map +1 -1
  244. package/cjs/internal/ThemePlayground/Playground.styles.js +5 -8
  245. package/cjs/internal/ThemePlayground/Playground.styles.js.map +1 -1
  246. package/cjs/internal/ThemePlayground/ShowcaseGroup.js +12 -1
  247. package/cjs/internal/ThemePlayground/ShowcaseGroup.js.map +1 -1
  248. package/cjs/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
  249. package/cjs/internal/ZIndex/ZIndex.d.ts +3 -3
  250. package/cjs/internal/ZIndex/ZIndex.js +5 -1
  251. package/cjs/internal/ZIndex/ZIndex.js.map +1 -1
  252. package/cjs/internal/icons2022/UiMenuDots3HIcon/UiMenuDots3HIcon16Regular.d.ts +2 -0
  253. package/cjs/internal/icons2022/UiMenuDots3HIcon/UiMenuDots3HIcon16Regular.js +16 -0
  254. package/cjs/internal/icons2022/UiMenuDots3HIcon/UiMenuDots3HIcon16Regular.js.map +1 -0
  255. package/cjs/internal/themes/BasicTheme.d.ts +112 -20
  256. package/cjs/internal/themes/BasicTheme.js +149 -18
  257. package/cjs/internal/themes/BasicTheme.js.map +1 -1
  258. package/cjs/internal/themes/DarkTheme5_2.js +1 -1
  259. package/cjs/internal/themes/DarkTheme5_2.js.map +1 -1
  260. package/cjs/internal/themes/DarkTheme5_3.d.ts +1 -0
  261. package/cjs/internal/themes/DarkTheme5_3.js +13 -0
  262. package/cjs/internal/themes/DarkTheme5_3.js.map +1 -0
  263. package/cjs/internal/themes/LightTheme5_3.d.ts +1 -0
  264. package/cjs/internal/themes/LightTheme5_3.js +13 -0
  265. package/cjs/internal/themes/LightTheme5_3.js.map +1 -0
  266. package/cjs/lib/delay.mts +3 -0
  267. package/cjs/lib/featureFlagsContext/FeatureFlagsHelpers.d.ts +5 -0
  268. package/cjs/lib/featureFlagsContext/ReactUIFeatureFlagsContext.d.ts +5 -0
  269. package/cjs/lib/featureFlagsContext/ReactUIFeatureFlagsContext.js +11 -1
  270. package/cjs/lib/featureFlagsContext/ReactUIFeatureFlagsContext.js.map +1 -1
  271. package/cjs/lib/forwardRefAndName.d.ts +1 -1
  272. package/cjs/lib/forwardRefAndName.js +0 -1
  273. package/cjs/lib/forwardRefAndName.js.map +1 -1
  274. package/cjs/lib/rootNode/rootNodeDecorator.d.ts +2 -1
  275. package/cjs/lib/rootNode/rootNodeDecorator.js +1 -0
  276. package/cjs/lib/rootNode/rootNodeDecorator.js.map +1 -1
  277. package/cjs/lib/theming/ThemeVersions.d.ts +1 -1
  278. package/cjs/lib/theming/ThemeVersions.js.map +1 -1
  279. package/cjs/lib/theming/themes/DarkTheme.d.ts +1 -0
  280. package/cjs/lib/theming/themes/DarkTheme.js +4 -2
  281. package/cjs/lib/theming/themes/DarkTheme.js.map +1 -1
  282. package/cjs/lib/theming/themes/LightTheme.d.ts +1 -0
  283. package/cjs/lib/theming/themes/LightTheme.js +4 -2
  284. package/cjs/lib/theming/themes/LightTheme.js.map +1 -1
  285. package/cjs/lib/utils.d.ts +4 -0
  286. package/cjs/lib/utils.js +5 -1
  287. package/cjs/lib/utils.js.map +1 -1
  288. package/components/Autocomplete/Autocomplete/Autocomplete.js +49 -45
  289. package/components/Autocomplete/Autocomplete/Autocomplete.js.map +1 -1
  290. package/components/Autocomplete/Autocomplete.d.ts +6 -23
  291. package/components/Button/Button/Button.js +26 -5
  292. package/components/Button/Button/Button.js.map +1 -1
  293. package/components/Button/Button.d.ts +2 -0
  294. package/components/Button/Button.styles/Button.styles.js +78 -60
  295. package/components/Button/Button.styles/Button.styles.js.map +1 -1
  296. package/components/Button/Button.styles.d.ts +6 -0
  297. package/components/Calendar/Calendar/Calendar.js.map +1 -1
  298. package/components/Calendar/Calendar.d.ts +2 -0
  299. package/components/Center/Center/Center.js.map +1 -1
  300. package/components/Center/Center.d.ts +2 -0
  301. package/components/Checkbox/Checkbox/Checkbox.js +0 -11
  302. package/components/Checkbox/Checkbox/Checkbox.js.map +1 -1
  303. package/components/Checkbox/Checkbox.d.ts +2 -12
  304. package/components/ComboBox/ComboBox/ComboBox.js.map +1 -1
  305. package/components/ComboBox/ComboBox.d.ts +2 -0
  306. package/components/CurrencyInput/CurrencyInput/CurrencyInput.js +12 -36
  307. package/components/CurrencyInput/CurrencyInput/CurrencyInput.js.map +1 -1
  308. package/components/CurrencyInput/CurrencyInput.d.ts +6 -24
  309. package/components/CurrencyInput/constants/constants.js +0 -1
  310. package/components/CurrencyInput/constants/constants.js.map +1 -1
  311. package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js +10 -22
  312. package/components/CurrencyLabel/CurrencyLabel/CurrencyLabel.js.map +1 -1
  313. package/components/DateInput/DateInput/DateInput.js.map +1 -1
  314. package/components/DateInput/DateInput.d.ts +2 -0
  315. package/components/DatePicker/DatePicker/DatePicker.js +1 -32
  316. package/components/DatePicker/DatePicker/DatePicker.js.map +1 -1
  317. package/components/DatePicker/DatePicker.d.ts +6 -33
  318. package/components/Dropdown/Dropdown/Dropdown.js +1 -47
  319. package/components/Dropdown/Dropdown/Dropdown.js.map +1 -1
  320. package/components/Dropdown/Dropdown.d.ts +2 -47
  321. package/components/DropdownMenu/DropdownMenu/DropdownMenu.js.map +1 -1
  322. package/components/DropdownMenu/DropdownMenu.d.ts +4 -2
  323. package/components/FxInput/FxInput/FxInput.js +1 -5
  324. package/components/FxInput/FxInput/FxInput.js.map +1 -1
  325. package/components/FxInput/FxInput.d.ts +2 -5
  326. package/components/Gapped/Gapped/Gapped.js +1 -15
  327. package/components/Gapped/Gapped/Gapped.js.map +1 -1
  328. package/components/Gapped/Gapped.d.ts +2 -15
  329. package/components/GlobalLoader/GlobalLoader/GlobalLoader.js.map +1 -1
  330. package/components/GlobalLoader/GlobalLoader.d.ts +2 -0
  331. package/components/Group/Group/Group.js +64 -28
  332. package/components/Group/Group/Group.js.map +1 -1
  333. package/components/Group/Group.d.ts +5 -4
  334. package/components/Group/Group.styles/Group.styles.js +9 -6
  335. package/components/Group/Group.styles/Group.styles.js.map +1 -1
  336. package/components/Group/Group.styles.d.ts +1 -0
  337. package/components/Hint/Hint/Hint.js.map +1 -1
  338. package/components/Hint/Hint.d.ts +2 -0
  339. package/components/Input/Input/Input.js.map +1 -1
  340. package/components/Input/Input.d.ts +2 -0
  341. package/components/Kebab/Kebab/Kebab.js +2 -20
  342. package/components/Kebab/Kebab/Kebab.js.map +1 -1
  343. package/components/Kebab/Kebab.d.ts +2 -1
  344. package/components/Link/Link/Link.js.map +1 -1
  345. package/components/Link/Link.d.ts +2 -0
  346. package/components/Loader/Loader/Loader.js +0 -33
  347. package/components/Loader/Loader/Loader.js.map +1 -1
  348. package/components/Loader/Loader.d.ts +6 -36
  349. package/components/MaskedInput/MaskedInput/MaskedInput.js +14 -0
  350. package/components/MaskedInput/MaskedInput/MaskedInput.js.map +1 -1
  351. package/components/MaskedInput/MaskedInput.d.ts +1 -0
  352. package/components/MenuItem/MenuItem/MenuItem.js +1 -12
  353. package/components/MenuItem/MenuItem/MenuItem.js.map +1 -1
  354. package/components/MenuItem/MenuItem.d.ts +2 -12
  355. package/components/MiniModal/MiniModal.styles/MiniModal.styles.js +10 -7
  356. package/components/MiniModal/MiniModal.styles/MiniModal.styles.js.map +1 -1
  357. package/components/MiniModal/MiniModal.styles.d.ts +1 -0
  358. package/components/MiniModal/MiniModalBody/MiniModalBody.js +13 -5
  359. package/components/MiniModal/MiniModalBody/MiniModalBody.js.map +1 -1
  360. package/components/Modal/Modal.styles/Modal.styles.js +31 -28
  361. package/components/Modal/Modal.styles/Modal.styles.js.map +1 -1
  362. package/components/Modal/Modal.styles.d.ts +1 -0
  363. package/components/Modal/ModalBody/ModalBody.js.map +1 -1
  364. package/components/Modal/ModalBody.d.ts +2 -0
  365. package/components/Modal/ModalHeader/ModalHeader.js +3 -1
  366. package/components/Modal/ModalHeader/ModalHeader.js.map +1 -1
  367. package/components/Modal/ModalHeader.d.ts +5 -0
  368. package/components/Paging/DotsIcon/DotsIcon.js +14 -0
  369. package/components/Paging/DotsIcon/DotsIcon.js.map +1 -0
  370. package/components/Paging/DotsIcon/package.json +6 -0
  371. package/components/Paging/DotsIcon.d.ts +3 -0
  372. package/components/Paging/ForwardIcon/ForwardIcon.js +15 -1
  373. package/components/Paging/ForwardIcon/ForwardIcon.js.map +1 -1
  374. package/components/Paging/ForwardIcon.d.ts +3 -0
  375. package/components/Paging/NavigationHelper/NavigationHelper.js +9 -8
  376. package/components/Paging/NavigationHelper/NavigationHelper.js.map +1 -1
  377. package/components/Paging/NavigationHelper.d.ts +3 -2
  378. package/components/Paging/Paging/Paging.js +96 -47
  379. package/components/Paging/Paging/Paging.js.map +1 -1
  380. package/components/Paging/Paging.d.ts +13 -2
  381. package/components/Paging/Paging.styles/Paging.styles.js +77 -16
  382. package/components/Paging/Paging.styles/Paging.styles.js.map +1 -1
  383. package/components/Paging/Paging.styles.d.ts +24 -1
  384. package/components/Paging/PagingHelper/PagingHelper.js +16 -8
  385. package/components/Paging/PagingHelper/PagingHelper.js.map +1 -1
  386. package/components/Paging/PagingHelper.d.ts +1 -1
  387. package/components/PasswordInput/PasswordInput/PasswordInput.js +1 -7
  388. package/components/PasswordInput/PasswordInput/PasswordInput.js.map +1 -1
  389. package/components/PasswordInput/PasswordInput.d.ts +2 -7
  390. package/components/Radio/Radio/Radio.js.map +1 -1
  391. package/components/Radio/Radio.d.ts +2 -0
  392. package/components/RadioGroup/RadioGroup/RadioGroup.js.map +1 -1
  393. package/components/RadioGroup/RadioGroup.d.ts +2 -0
  394. package/components/ScrollContainer/ScrollContainer/ScrollContainer.js +1 -9
  395. package/components/ScrollContainer/ScrollContainer/ScrollContainer.js.map +1 -1
  396. package/components/ScrollContainer/ScrollContainer.d.ts +2 -9
  397. package/components/Select/Select/Select.js.map +1 -1
  398. package/components/Select/Select.d.ts +2 -0
  399. package/components/SidePage/SidePage.styles/SidePage.styles.js +41 -35
  400. package/components/SidePage/SidePage.styles/SidePage.styles.js.map +1 -1
  401. package/components/SidePage/SidePage.styles.d.ts +3 -1
  402. package/components/SidePage/SidePageBody/SidePageBody.js.map +1 -1
  403. package/components/SidePage/SidePageBody.d.ts +2 -0
  404. package/components/SidePage/SidePageContainer/SidePageContainer.js.map +1 -1
  405. package/components/SidePage/SidePageContainer.d.ts +2 -0
  406. package/components/SidePage/SidePageFooter/SidePageFooter.js.map +1 -1
  407. package/components/SidePage/SidePageFooter.d.ts +2 -0
  408. package/components/SidePage/SidePageHeader/SidePageHeader.js +61 -39
  409. package/components/SidePage/SidePageHeader/SidePageHeader.js.map +1 -1
  410. package/components/SidePage/SidePageHeader.d.ts +12 -2
  411. package/components/Spinner/Spinner/Spinner.js +1 -18
  412. package/components/Spinner/Spinner/Spinner.js.map +1 -1
  413. package/components/Spinner/Spinner.d.ts +2 -18
  414. package/components/Sticky/Sticky/Sticky.js +1 -13
  415. package/components/Sticky/Sticky/Sticky.js.map +1 -1
  416. package/components/Sticky/Sticky.d.ts +2 -13
  417. package/components/Switcher/Switcher/Switcher.js +19 -16
  418. package/components/Switcher/Switcher/Switcher.js.map +1 -1
  419. package/components/Switcher/Switcher.d.ts +6 -21
  420. package/components/Switcher/Switcher.styles/Switcher.styles.js +12 -9
  421. package/components/Switcher/Switcher.styles/Switcher.styles.js.map +1 -1
  422. package/components/Switcher/Switcher.styles.d.ts +1 -0
  423. package/components/Tabs/Indicator/Indicator.js.map +1 -1
  424. package/components/Tabs/Indicator.d.ts +2 -0
  425. package/components/Tabs/Tab/Tab.js.map +1 -1
  426. package/components/Tabs/Tab.d.ts +2 -0
  427. package/components/Tabs/Tabs/Tabs.js.map +1 -1
  428. package/components/Tabs/Tabs.d.ts +2 -0
  429. package/components/Textarea/Textarea/Textarea.js +1 -44
  430. package/components/Textarea/Textarea/Textarea.js.map +1 -1
  431. package/components/Textarea/Textarea.d.ts +2 -44
  432. package/components/Textarea/TextareaCounter/TextareaCounter.js +1 -11
  433. package/components/Textarea/TextareaCounter/TextareaCounter.js.map +1 -1
  434. package/components/Toast/Toast/Toast.js.map +1 -1
  435. package/components/Toast/Toast.d.ts +2 -0
  436. package/components/Toast/ToastView/ToastView.js +3 -17
  437. package/components/Toast/ToastView/ToastView.js.map +1 -1
  438. package/components/Toast/ToastView.d.ts +2 -14
  439. package/components/Toggle/Toggle/Toggle.js +1 -10
  440. package/components/Toggle/Toggle/Toggle.js.map +1 -1
  441. package/components/Toggle/Toggle.d.ts +2 -10
  442. package/components/Token/Token/Token.js.map +1 -1
  443. package/components/Token/Token.d.ts +2 -0
  444. package/components/TokenInput/TokenInput/TokenInput.js.map +1 -1
  445. package/components/TokenInput/TokenInput.d.ts +2 -0
  446. package/components/Tooltip/Tooltip/Tooltip.js +67 -20
  447. package/components/Tooltip/Tooltip/Tooltip.js.map +1 -1
  448. package/components/Tooltip/Tooltip.d.ts +14 -9
  449. package/components/Tooltip/Tooltip.styles/Tooltip.styles.js +22 -4
  450. package/components/Tooltip/Tooltip.styles/Tooltip.styles.js.map +1 -1
  451. package/components/Tooltip/Tooltip.styles.d.ts +7 -1
  452. package/components/TooltipMenu/TooltipMenu/TooltipMenu.js.map +1 -1
  453. package/components/TooltipMenu/TooltipMenu.d.ts +4 -2
  454. package/index.d.ts +1 -0
  455. package/index.js +1 -0
  456. package/index.js.map +1 -1
  457. package/internal/CommonWrapper/CommonWrapper/CommonWrapper.js.map +1 -1
  458. package/internal/CommonWrapper/CommonWrapper.d.ts +2 -0
  459. package/internal/ComponentTable/ComponentTable.js +0 -2
  460. package/internal/ComponentTable/ComponentTable.js.map +1 -1
  461. package/internal/CustomComboBox/ComboBoxView/ComboBoxView.js.map +1 -1
  462. package/internal/CustomComboBox/ComboBoxView.d.ts +2 -0
  463. package/internal/CustomComboBox/CustomComboBox/CustomComboBox.js.map +1 -1
  464. package/internal/CustomComboBox/CustomComboBox.d.ts +2 -0
  465. package/internal/DateSelect/DateSelect/DateSelect.js +1 -10
  466. package/internal/DateSelect/DateSelect/DateSelect.js.map +1 -1
  467. package/internal/DateSelect/DateSelect.d.ts +0 -10
  468. package/internal/FocusTrap/FocusTrap/FocusTrap.js.map +1 -1
  469. package/internal/FocusTrap/FocusTrap.d.ts +2 -0
  470. package/internal/IgnoreLayerClick/IgnoreLayerClick/IgnoreLayerClick.js.map +1 -1
  471. package/internal/InputLikeText/InputLikeText/InputLikeText.js.map +1 -1
  472. package/internal/InputLikeText/InputLikeText.d.ts +2 -0
  473. package/internal/Menu/Menu/Menu.js.map +1 -1
  474. package/internal/Menu/Menu.d.ts +2 -0
  475. package/internal/MobilePopup/MobilePopup/MobilePopup.js.map +1 -1
  476. package/internal/MobilePopup/MobilePopup.d.ts +2 -0
  477. package/internal/Popup/Popup/Popup.js +14 -64
  478. package/internal/Popup/Popup/Popup.js.map +1 -1
  479. package/internal/Popup/Popup.d.ts +41 -59
  480. package/internal/Popup/PopupPin/PopupPin.js +1 -34
  481. package/internal/Popup/PopupPin/PopupPin.js.map +1 -1
  482. package/internal/Popup/PopupPin.d.ts +23 -33
  483. package/internal/Popup/PopupPinNew/PopupPinNew.js +146 -0
  484. package/internal/Popup/PopupPinNew/PopupPinNew.js.map +1 -0
  485. package/internal/Popup/PopupPinNew/package.json +6 -0
  486. package/internal/Popup/PopupPinNew.d.ts +31 -0
  487. package/internal/Popup/PopupPinNew.styles/PopupPinNew.styles.js +20 -0
  488. package/internal/Popup/PopupPinNew.styles/PopupPinNew.styles.js.map +1 -0
  489. package/internal/Popup/PopupPinNew.styles/package.json +6 -0
  490. package/internal/Popup/PopupPinNew.styles.d.ts +7 -0
  491. package/internal/PopupMenu/PopupMenu/PopupMenu.js.map +1 -1
  492. package/internal/PopupMenu/PopupMenu.d.ts +2 -0
  493. package/internal/RenderContainer/RenderInnerContainer/RenderInnerContainer.js +0 -8
  494. package/internal/RenderContainer/RenderInnerContainer/RenderInnerContainer.js.map +1 -1
  495. package/internal/RenderContainer/RenderInnerContainer.d.ts +0 -6
  496. package/internal/RenderLayer/RenderLayer/RenderLayer.js +3 -11
  497. package/internal/RenderLayer/RenderLayer/RenderLayer.js.map +1 -1
  498. package/internal/RenderLayer/RenderLayer.d.ts +2 -3
  499. package/internal/ThemePlayground/Playground/Playground.js +4 -3
  500. package/internal/ThemePlayground/Playground/Playground.js.map +1 -1
  501. package/internal/ThemePlayground/Playground.styles/Playground.styles.js +4 -4
  502. package/internal/ThemePlayground/Playground.styles/Playground.styles.js.map +1 -1
  503. package/internal/ThemePlayground/ShowcaseGroup/ShowcaseGroup.js +6 -1
  504. package/internal/ThemePlayground/ShowcaseGroup/ShowcaseGroup.js.map +1 -1
  505. package/internal/ThemeShowcase/VariablesCollector.d.ts +1 -1
  506. package/internal/ZIndex/ZIndex/ZIndex.js +8 -10
  507. package/internal/ZIndex/ZIndex/ZIndex.js.map +1 -1
  508. package/internal/ZIndex/ZIndex.d.ts +3 -3
  509. package/internal/icons2022/UiMenuDots3HIcon/UiMenuDots3HIcon16Regular/UiMenuDots3HIcon16Regular.js +21 -0
  510. package/internal/icons2022/UiMenuDots3HIcon/UiMenuDots3HIcon16Regular/UiMenuDots3HIcon16Regular.js.map +1 -0
  511. package/internal/icons2022/UiMenuDots3HIcon/UiMenuDots3HIcon16Regular/package.json +6 -0
  512. package/internal/icons2022/UiMenuDots3HIcon/UiMenuDots3HIcon16Regular.d.ts +2 -0
  513. package/internal/themes/BasicTheme/BasicTheme.js +170 -26
  514. package/internal/themes/BasicTheme/BasicTheme.js.map +1 -1
  515. package/internal/themes/BasicTheme.d.ts +112 -20
  516. package/internal/themes/DarkTheme5_2/DarkTheme5_2.js +3 -3
  517. package/internal/themes/DarkTheme5_2/DarkTheme5_2.js.map +1 -1
  518. package/internal/themes/DarkTheme5_3/DarkTheme5_3.js +16 -0
  519. package/internal/themes/DarkTheme5_3/DarkTheme5_3.js.map +1 -0
  520. package/internal/themes/DarkTheme5_3/package.json +6 -0
  521. package/internal/themes/DarkTheme5_3.d.ts +1 -0
  522. package/internal/themes/LightTheme5_3/LightTheme5_3.js +16 -0
  523. package/internal/themes/LightTheme5_3/LightTheme5_3.js.map +1 -0
  524. package/internal/themes/LightTheme5_3/package.json +6 -0
  525. package/internal/themes/LightTheme5_3.d.ts +1 -0
  526. package/lib/delay.d.mts +1 -0
  527. package/lib/delay.mts +3 -0
  528. package/lib/featureFlagsContext/FeatureFlagsHelpers.d.ts +5 -0
  529. package/lib/featureFlagsContext/ReactUIFeatureFlagsContext/ReactUIFeatureFlagsContext.js +6 -1
  530. package/lib/featureFlagsContext/ReactUIFeatureFlagsContext/ReactUIFeatureFlagsContext.js.map +1 -1
  531. package/lib/featureFlagsContext/ReactUIFeatureFlagsContext.d.ts +5 -0
  532. package/lib/forwardRefAndName/forwardRefAndName.js.map +1 -1
  533. package/lib/forwardRefAndName.d.ts +1 -1
  534. package/lib/rootNode/rootNodeDecorator/rootNodeDecorator.js.map +1 -1
  535. package/lib/rootNode/rootNodeDecorator.d.ts +2 -1
  536. package/lib/theming/ThemeVersions/ThemeVersions.js.map +1 -1
  537. package/lib/theming/ThemeVersions.d.ts +1 -1
  538. package/lib/theming/themes/DarkTheme/DarkTheme.js +3 -1
  539. package/lib/theming/themes/DarkTheme/DarkTheme.js.map +1 -1
  540. package/lib/theming/themes/DarkTheme.d.ts +1 -0
  541. package/lib/theming/themes/LightTheme/LightTheme.js +3 -1
  542. package/lib/theming/themes/LightTheme/LightTheme.js.map +1 -1
  543. package/lib/theming/themes/LightTheme.d.ts +1 -0
  544. package/lib/utils/utils.js +2 -0
  545. package/lib/utils/utils.js.map +1 -1
  546. package/lib/utils.d.ts +4 -0
  547. package/package.json +10 -13
  548. package/cjs/lib/SSRSafe.d.ts +0 -2
  549. package/cjs/lib/SSRSafe.js +0 -5
  550. package/cjs/lib/SSRSafe.js.map +0 -1
  551. package/lib/SSRSafe/SSRSafe.js +0 -4
  552. package/lib/SSRSafe/SSRSafe.js.map +0 -1
  553. package/lib/SSRSafe/package.json +0 -6
  554. package/lib/SSRSafe.d.ts +0 -2
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_globalObject","_Sticky","_utils","_ThemeContext","_CommonWrapper","_Emotion","_decorator","_rootNode","_getDOMRect","_ModalSeparator","_ThemeHelpers","_featureFlagsContext","_SidePage","_SidePageContext","_SidePageCloseButton","_class","_SidePageHeader","SidePageHeaderDataTids","exports","root","close","SidePageHeader","responsiveLayout","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","context","state","isReadyToFix","wrapper","sticky","lastRegularHeight","componentDidMount","globalObject","addEventListener","update","setHasHeader","headerRef","componentWillUnmount","removeEventListener","_this$sticky","reflow","updateReadyToFix","renderHeader","fixed","_cx","_cx2","isDisplayed","props","hasSeparator","default","createElement","className","cx","styles","header","theme","headerFixed","mobileHeader","isMobileLayout","renderClose","title","title5_1","isThemeGTE","mobileTitle","titleFixed","isFunction","children","ModalSeparator","_cx3","stickyOffset","parseInt","sidePageHeaderStickyOffset","versionGTE5_1","wrapperClose","wrapperClose5_1","wrapperCloseFixed","wrapperCloseFixed5_1","mobileWrapperClose","mobileWrapperClose5_1","SidePageCloseButton","isHeaderFixed","isMobile","Sticky","side","offset","wrapperScrolledUp","getDOMRect","top","regularHeight","fixedHeaderHeight","setState","_extends2","wrapperRef","el","stickyRef","_inheritsLoose2","_proto","prototype","render","_this2","ThemeContext","Consumer","renderMain","getStickyProp","isStickyDesktop","isStickyMobile","CommonWrapper","rootNodeRef","setRootNode","ref","headerWrapper","ReactUIFeatureFlagsContext","Provider","value","stickyReduceLayoutEvents","_createClass2","key","get","height","sidePageHeaderFixedLineHeight","sidePageHeaderFixedPaddingY","React","Component","__KONTUR_REACT_UI__","displayName","contextType","SidePageContext","defaultProps"],"sources":["SidePageHeader.tsx"],"sourcesContent":["import React from 'react';\nimport { globalObject } from '@skbkontur/global-object';\n\nimport { Sticky } from '../Sticky';\nimport { isFunction } from '../../lib/utils';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport type { Theme } from '../../lib/theming/Theme';\nimport type { CommonProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { responsiveLayout } from '../ResponsiveLayout/decorator';\nimport type { TSetRootNode } from '../../lib/rootNode';\nimport { rootNode } from '../../lib/rootNode';\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\nimport { ModalSeparator } from '../Modal/ModalSeparator';\nimport { isThemeGTE } from '../../lib/theming/ThemeHelpers';\nimport { ReactUIFeatureFlagsContext } from '../../lib/featureFlagsContext';\n\nimport { styles } from './SidePage.styles';\nimport type { SidePageContextType } from './SidePageContext';\nimport { SidePageContext } from './SidePageContext';\nimport { SidePageCloseButton } from './SidePageCloseButton';\n\nexport interface SidePageHeaderProps extends Omit<CommonProps, 'children'> {\n children?: React.ReactNode | ((fixed: boolean) => React.ReactNode);\n /** Закрепляет хедер сверху сайдпейджа. */\n sticky?: boolean;\n\n /** Определяет, нужно ли показывать ModalSeparator. */\n hasSeparator?: boolean;\n}\n\nexport interface SidePageHeaderState {\n isReadyToFix: boolean;\n}\n\nexport const SidePageHeaderDataTids = {\n root: 'SidePageHeader__root',\n close: 'SidePage__close',\n} as const;\n\n/**\n * Шапка сайдпейджа\n *\n * @visibleName SidePage.Header\n */\n@responsiveLayout\n@rootNode\nexport class SidePageHeader extends React.Component<SidePageHeaderProps, SidePageHeaderState> {\n public static __KONTUR_REACT_UI__ = 'SidePageHeader';\n public static displayName = 'SidePageHeader';\n\n public static contextType = SidePageContext;\n public context: SidePageContextType = this.context;\n\n private isMobileLayout!: boolean;\n\n public state: SidePageHeaderState = {\n isReadyToFix: false,\n };\n\n public static defaultProps: Partial<SidePageHeaderProps> = {\n hasSeparator: false,\n };\n\n private theme!: Theme;\n private wrapper: HTMLElement | null = null;\n private sticky: Sticky | null = null;\n private lastRegularHeight = 0;\n private setRootNode!: TSetRootNode;\n public get regularHeight(): number {\n const { isReadyToFix } = this.state;\n if (!this.wrapper) {\n return 0;\n }\n if (!isReadyToFix) {\n this.lastRegularHeight = getDOMRect(this.wrapper).height;\n }\n return this.lastRegularHeight;\n }\n\n public get fixedHeaderHeight(): number {\n const { theme } = this;\n return parseInt(theme.sidePageHeaderFixedLineHeight) + parseInt(theme.sidePageHeaderFixedPaddingY) * 2;\n }\n\n public componentDidMount = () => {\n globalObject.addEventListener?.('scroll', this.update, true);\n this.context.setHasHeader?.();\n this.context.headerRef(this);\n };\n\n public componentWillUnmount = () => {\n globalObject.removeEventListener?.('scroll', this.update, true);\n this.context.setHasHeader?.(false);\n this.context.headerRef(null);\n };\n\n public update = () => {\n this.sticky?.reflow();\n this.updateReadyToFix();\n };\n\n public render(): JSX.Element {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n public getStickyProp() {\n if (typeof this.props.sticky !== 'undefined') {\n return this.props.sticky;\n }\n\n if (this.isMobileLayout) {\n return false;\n }\n\n return true;\n }\n\n private renderMain() {\n const { isReadyToFix } = this.state;\n\n const isStickyDesktop = !this.isMobileLayout && this.getStickyProp() && isReadyToFix;\n const isStickyMobile = this.isMobileLayout && this.getStickyProp();\n\n const header = this.renderHeader;\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <div data-tid={SidePageHeaderDataTids.root} ref={this.wrapperRef} className={styles.headerWrapper()}>\n <ReactUIFeatureFlagsContext.Provider value={{ stickyReduceLayoutEvents: true }}>\n {isStickyDesktop || isStickyMobile ? (\n <Sticky ref={this.stickyRef} side=\"top\">\n {header}\n </Sticky>\n ) : (\n header()\n )}\n </ReactUIFeatureFlagsContext.Provider>\n </div>\n </CommonWrapper>\n );\n }\n\n private renderHeader = (fixed = false) => {\n const isDisplayed = this.props.hasSeparator || fixed;\n return (\n <div>\n <div\n className={cx(styles.header(this.theme), {\n [styles.headerFixed(this.theme)]: fixed,\n [styles.mobileHeader(this.theme)]: this.isMobileLayout,\n })}\n >\n {this.renderClose(fixed)}\n <div\n className={cx(styles.title(this.theme), {\n [styles.title5_1(this.theme)]: isThemeGTE(this.theme, '5.1'),\n [styles.mobileTitle(this.theme)]: this.isMobileLayout,\n [styles.titleFixed()]: fixed,\n })}\n >\n {isFunction(this.props.children) ? this.props.children(fixed) : this.props.children}\n </div>\n </div>\n {isDisplayed && <ModalSeparator fixed={fixed} />}\n </div>\n );\n };\n\n private renderClose = (fixed: boolean) => {\n const stickyOffset = parseInt(this.theme.sidePageHeaderStickyOffset);\n const versionGTE5_1 = isThemeGTE(this.theme, '5.1');\n return (\n <div\n className={cx(styles.wrapperClose(this.theme), {\n [styles.wrapperClose5_1(this.theme)]: versionGTE5_1,\n [styles.wrapperCloseFixed(this.theme)]: fixed,\n [styles.wrapperCloseFixed5_1(this.theme)]: fixed && versionGTE5_1,\n [styles.mobileWrapperClose(this.theme)]: this.isMobileLayout,\n [styles.mobileWrapperClose5_1(this.theme)]: this.isMobileLayout && versionGTE5_1,\n })}\n >\n {this.isMobileLayout ? (\n <SidePageCloseButton isHeaderFixed={fixed} isMobile />\n ) : (\n <Sticky side=\"top\" offset={stickyOffset}>\n <SidePageCloseButton isHeaderFixed={fixed} />\n </Sticky>\n )}\n </div>\n );\n };\n\n private updateReadyToFix = () => {\n if (this.wrapper) {\n const wrapperScrolledUp = getDOMRect(this.wrapper).top;\n const isReadyToFix = this.regularHeight + wrapperScrolledUp <= this.fixedHeaderHeight;\n this.setState((state) => (state.isReadyToFix !== isReadyToFix ? { ...state, isReadyToFix } : state));\n }\n };\n\n private wrapperRef = (el: HTMLElement | null) => {\n this.wrapper = el;\n };\n\n private stickyRef = (el: Sticky | null) => {\n this.sticky = el;\n };\n}\n"],"mappings":"+cAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;;;AAGA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;;AAEA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,eAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AACA,IAAAY,oBAAA,GAAAZ,OAAA;;AAEA,IAAAa,SAAA,GAAAb,OAAA;;AAEA,IAAAc,gBAAA,GAAAd,OAAA;AACA,IAAAe,oBAAA,GAAAf,OAAA,0BAA4D,IAAAgB,MAAA,EAAAC,eAAA;;;;;;;;;;;;;;;AAerD,IAAMC,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG;EACpCE,IAAI,EAAE,sBAAsB;EAC5BC,KAAK,EAAE;AACT,CAAU;;AAEV;AACA;AACA;AACA;AACA,GAJA;;;AAOaC,cAAc,GAAAH,OAAA,CAAAG,cAAA,OAF1BC,2BAAgB,EAAAP,MAAA,OAChBQ,kBAAQ,EAAAR,MAAA,IAAAC,eAAA,0BAAAQ,gBAAA,YAAAH,eAAA,OAAAI,KAAA,UAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,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nCqH,mBAAmB,GAAG,gBAAgB,EAAArH,eAAA,CACtCsH,WAAW,GAAG,gBAAgB,EAAAtH,eAAA,CAE9BuH,WAAW,GAAGC,gCAAe,EAAAxH,eAAA,CAS7ByH,YAAY,GAAiC,EACzD/E,YAAY,EAAE,KAAK,CACrB,CAAC,EAAA1C,eAAA,MAAAD,MAAA,KAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_lodash","_Sticky","_utils","_ThemeContext","_CommonWrapper","_Emotion","_decorator","_rootNode","_getDOMRect","_ModalSeparator","_ThemeHelpers","_featureFlagsContext","_SidePage","_SidePageContext","_SidePageCloseButton","_class","_SidePageHeader","SidePageHeaderDataTids","exports","root","close","SidePageHeader","responsiveLayout","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","context","state","isNativeStuck","isReadyToStuck","wrapper","sticky","lastRegularHeight","componentDidMount","_getRootNode","getRootNode","parentNode","addEventListener","throttleHandleScroll","setHasHeader","headerRef","componentWillUnmount","_getRootNode2","removeEventListener","throttle","event","target","currentTarget","scrollTop","setState","update","_this$sticky","reflow","featureFlags","sidePageDisableHeaderShrink","updateReadyToStuck","renderHeader","fixed","_cx","_this$props$cutTitleO","_cx2","isDisplayed","props","hasSeparator","default","createElement","className","cx","styles","header","theme","headerFixed","headerShrink","mobileHeader","isMobileLayout","renderClose","title","title5_1","isThemeGTE","mobileTitle","titleCut","cutTitleOnStuck","sidePageNotCutTitleOnStuckByDefault","isFunction","children","ModalSeparator","_cx3","stickyOffset","parseInt","sidePageHeaderStickyOffset","versionGTE5_1","wrapperClose","wrapperClose5_1","wrapperCloseFixed","wrapperCloseFixed5_1","mobileWrapperClose","mobileWrapperClose5_1","Sticky","side","offset","SidePageCloseButton","isHeaderFixed","isMobile","wrapperScrolledUp","getDOMRect","top","regularHeight","fixedHeaderHeight","_extends2","wrapperRef","el","stickyRef","_inheritsLoose2","_proto","prototype","render","_this2","ThemeContext","Consumer","renderMain","getStickyProp","_this3","isStickyDesktop","isStickyMobile","ReactUIFeatureFlagsContext","flags","_cx4","getFullReactUIFlagsContext","CommonWrapper","rootNodeRef","setRootNode","ref","headerWrapper","headerNativeStuck","Provider","value","stickyReduceLayoutEvents","_createClass2","key","get","height","sidePageHeaderFixedLineHeight","sidePageHeaderFixedPaddingY","React","Component","__KONTUR_REACT_UI__","displayName","contextType","SidePageContext","defaultProps"],"sources":["SidePageHeader.tsx"],"sourcesContent":["import React from 'react';\nimport throttle from 'lodash.throttle';\n\nimport { Sticky } from '../Sticky';\nimport { isFunction } from '../../lib/utils';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport type { Theme } from '../../lib/theming/Theme';\nimport type { CommonProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport { responsiveLayout } from '../ResponsiveLayout/decorator';\nimport type { TGetRootNode, TSetRootNode } from '../../lib/rootNode';\nimport { getRootNode, rootNode } from '../../lib/rootNode';\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\nimport { ModalSeparator } from '../Modal/ModalSeparator';\nimport { isThemeGTE } from '../../lib/theming/ThemeHelpers';\nimport type { ReactUIFeatureFlags } from '../../lib/featureFlagsContext';\nimport { getFullReactUIFlagsContext, ReactUIFeatureFlagsContext } from '../../lib/featureFlagsContext';\n\nimport { styles } from './SidePage.styles';\nimport type { SidePageContextType } from './SidePageContext';\nimport { SidePageContext } from './SidePageContext';\nimport { SidePageCloseButton } from './SidePageCloseButton';\n\nexport interface SidePageHeaderProps extends Omit<CommonProps, 'children'> {\n children?: React.ReactNode | ((fixed: boolean) => React.ReactNode);\n /** Закрепляет хедер сверху сайдпейджа. */\n sticky?: boolean;\n\n /** Определяет, нужно ли показывать ModalSeparator. */\n hasSeparator?: boolean;\n\n /**\n * Обрезает длинный заголовок при «залипании» шапки.\n * @default true. Если включить флаг sidePageNotCutTitleOnStuckByDefault, дефолтное значение - false\n */\n cutTitleOnStuck?: boolean;\n}\n\nexport interface SidePageHeaderState {\n isNativeStuck: boolean;\n isReadyToStuck: boolean;\n}\n\nexport const SidePageHeaderDataTids = {\n root: 'SidePageHeader__root',\n close: 'SidePage__close',\n} as const;\n\n/**\n * Шапка сайдпейджа\n *\n * @visibleName SidePage.Header\n */\n@responsiveLayout\n@rootNode\nexport class SidePageHeader extends React.Component<SidePageHeaderProps, SidePageHeaderState> {\n public static __KONTUR_REACT_UI__ = 'SidePageHeader';\n public static displayName = 'SidePageHeader';\n\n public static contextType = SidePageContext;\n public context: SidePageContextType = this.context;\n\n private isMobileLayout!: boolean;\n\n public state: SidePageHeaderState = {\n isNativeStuck: true,\n isReadyToStuck: false,\n };\n\n public static defaultProps: Partial<SidePageHeaderProps> = {\n hasSeparator: false,\n };\n\n private theme!: Theme;\n private wrapper: HTMLElement | null = null;\n private sticky: Sticky | null = null;\n private lastRegularHeight = 0;\n public getRootNode!: TGetRootNode;\n private setRootNode!: TSetRootNode;\n private featureFlags!: ReactUIFeatureFlags;\n public get regularHeight(): number {\n const { isReadyToStuck } = this.state;\n if (!this.wrapper) {\n return 0;\n }\n if (!isReadyToStuck) {\n this.lastRegularHeight = getDOMRect(this.wrapper).height;\n }\n return this.lastRegularHeight;\n }\n\n public get fixedHeaderHeight(): number {\n const { theme } = this;\n return parseInt(theme.sidePageHeaderFixedLineHeight) + parseInt(theme.sidePageHeaderFixedPaddingY) * 2;\n }\n\n public componentDidMount = () => {\n getRootNode(this)?.parentNode?.addEventListener?.('scroll', this.throttleHandleScroll, true);\n this.context.setHasHeader?.();\n this.context.headerRef(this);\n };\n\n public componentWillUnmount = () => {\n getRootNode(this)?.parentNode?.removeEventListener?.('scroll', this.throttleHandleScroll, true);\n this.context.setHasHeader?.(false);\n this.context.headerRef(null);\n };\n\n private throttleHandleScroll = throttle((event: Event) => {\n const target = event.currentTarget as HTMLElement;\n if (target && typeof target.scrollTop === 'number') {\n this.setState({ isNativeStuck: target.scrollTop === 0 });\n }\n this.update();\n }, 5);\n\n public update = () => {\n this.sticky?.reflow();\n if (!this.featureFlags.sidePageDisableHeaderShrink) {\n this.updateReadyToStuck();\n }\n };\n\n public render(): JSX.Element {\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n return this.renderMain();\n }}\n </ThemeContext.Consumer>\n );\n }\n\n public getStickyProp() {\n if (typeof this.props.sticky !== 'undefined') {\n return this.props.sticky;\n }\n\n if (this.isMobileLayout) {\n return false;\n }\n\n return true;\n }\n\n private renderMain() {\n const { isReadyToStuck } = this.state;\n\n let isStickyDesktop = !this.isMobileLayout && this.getStickyProp();\n const isStickyMobile = this.isMobileLayout && this.getStickyProp();\n\n const header = this.renderHeader;\n\n return (\n <ReactUIFeatureFlagsContext.Consumer>\n {(flags) => {\n this.featureFlags = getFullReactUIFlagsContext(flags);\n if (!this.featureFlags.sidePageDisableHeaderShrink) {\n isStickyDesktop = isStickyDesktop && isReadyToStuck;\n }\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <div\n data-tid={SidePageHeaderDataTids.root}\n ref={this.wrapperRef}\n className={cx(styles.headerWrapper(), {\n [styles.headerNativeStuck(this.theme)]: this.state.isNativeStuck,\n })}\n >\n <ReactUIFeatureFlagsContext.Provider value={{ stickyReduceLayoutEvents: true }}>\n {!this.state.isNativeStuck && (isStickyDesktop || isStickyMobile) ? (\n <Sticky ref={this.stickyRef} side=\"top\">\n {header}\n </Sticky>\n ) : (\n header()\n )}\n </ReactUIFeatureFlagsContext.Provider>\n </div>\n </CommonWrapper>\n );\n }}\n </ReactUIFeatureFlagsContext.Consumer>\n );\n }\n\n private renderHeader = (fixed = false) => {\n const isDisplayed = this.props.hasSeparator || fixed;\n return (\n <div>\n <div\n className={cx(styles.header(this.theme), {\n [styles.headerFixed(this.theme)]: fixed,\n [styles.headerShrink(this.theme)]: fixed && !this.featureFlags.sidePageDisableHeaderShrink,\n [styles.mobileHeader(this.theme)]: this.isMobileLayout,\n })}\n >\n {this.renderClose(fixed)}\n <div\n className={cx(styles.title(this.theme), {\n [styles.title5_1(this.theme)]: isThemeGTE(this.theme, '5.1'),\n [styles.mobileTitle(this.theme)]: this.isMobileLayout,\n [styles.titleCut()]:\n fixed && (this.props.cutTitleOnStuck ?? !this.featureFlags.sidePageNotCutTitleOnStuckByDefault),\n })}\n >\n {isFunction(this.props.children) ? this.props.children(fixed) : this.props.children}\n </div>\n </div>\n {isDisplayed && <ModalSeparator fixed={fixed} />}\n </div>\n );\n };\n\n private renderClose = (fixed: boolean) => {\n const stickyOffset = parseInt(this.theme.sidePageHeaderStickyOffset);\n const versionGTE5_1 = isThemeGTE(this.theme, '5.1');\n return (\n <div\n className={cx(styles.wrapperClose(this.theme), {\n [styles.wrapperClose5_1(this.theme)]: versionGTE5_1,\n [styles.wrapperCloseFixed(this.theme)]: fixed && !this.featureFlags.sidePageDisableHeaderShrink,\n [styles.wrapperCloseFixed5_1(this.theme)]:\n fixed && versionGTE5_1 && !this.featureFlags.sidePageDisableHeaderShrink,\n [styles.mobileWrapperClose(this.theme)]: this.isMobileLayout,\n [styles.mobileWrapperClose5_1(this.theme)]: this.isMobileLayout && versionGTE5_1,\n })}\n >\n {!(this.isMobileLayout || this.featureFlags.sidePageDisableHeaderShrink) ? (\n <Sticky side=\"top\" offset={stickyOffset}>\n <SidePageCloseButton isHeaderFixed={fixed} />\n </Sticky>\n ) : (\n <SidePageCloseButton isHeaderFixed={fixed} isMobile={this.isMobileLayout} />\n )}\n </div>\n );\n };\n\n private updateReadyToStuck = () => {\n if (this.wrapper) {\n const wrapperScrolledUp = getDOMRect(this.wrapper).top;\n const isReadyToStuck = this.regularHeight + wrapperScrolledUp <= this.fixedHeaderHeight;\n this.setState((state) => (state.isReadyToStuck !== isReadyToStuck ? { ...state, isReadyToStuck } : state));\n }\n };\n\n private wrapperRef = (el: HTMLElement | null) => {\n this.wrapper = el;\n };\n\n private stickyRef = (el: Sticky | null) => {\n this.sticky = el;\n };\n}\n"],"mappings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AAC,GAAA,EAED,SAAAA,IAAA,EAAuC,CACrC,IAAQrE,KAAK,GAAK,IAAI,CAAdA,KAAK,CACb,OAAOkB,QAAQ,CAAClB,KAAK,CAACuE,6BAA6B,CAAC,GAAGrD,QAAQ,CAAClB,KAAK,CAACwE,2BAA2B,CAAC,GAAG,CAAC,CACxG,CAAC,OAvCiCC,cAAK,CAACC,SAAS,GAAAzI,eAAA,CACnC0I,mBAAmB,GAAG,gBAAgB,EAAA1I,eAAA,CACtC2I,WAAW,GAAG,gBAAgB,EAAA3I,eAAA,CAE9B4I,WAAW,GAAGC,gCAAe,EAAA7I,eAAA,CAU7B8I,YAAY,GAAiC,EACzDtF,YAAY,EAAE,KAAK,CACrB,CAAC,EAAAxD,eAAA,MAAAD,MAAA,KAAAA,MAAA","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import type { CommonProps } from '../../internal/CommonWrapper';
3
+ import type { TGetRootNode } from '../../lib/rootNode';
4
4
  declare const types: readonly ["big", "mini", "normal"];
5
5
  export type SpinnerType = (typeof types)[number];
6
6
  export interface SpinnerProps extends CommonProps {
@@ -35,27 +35,11 @@ type DefaultProps = Required<Pick<SpinnerProps, 'type'>>;
35
35
  export declare class Spinner extends React.Component<SpinnerProps> {
36
36
  static __KONTUR_REACT_UI__: string;
37
37
  static displayName: string;
38
- static propTypes: {
39
- /**
40
- * Текст рядом с мини-лоадером.
41
- *
42
- * 'Загрузка' - значение по-умолчанию
43
- */
44
- caption: PropTypes.Requireable<PropTypes.ReactNodeLike>;
45
- dimmed: PropTypes.Requireable<boolean>;
46
- /**
47
- * Тип спиннера: mini, normal, big
48
- *
49
- * Значение по-умолчанию - normal
50
- *
51
- * Spinner.types - все доступные типы
52
- */
53
- type: PropTypes.Requireable<"big" | "normal" | "mini">;
54
- };
55
38
  static defaultProps: DefaultProps;
56
39
  private getProps;
57
40
  static Types: Record<SpinnerType, SpinnerType>;
58
41
  private theme;
42
+ getRootNode: TGetRootNode;
59
43
  private setRootNode;
60
44
  render(): React.JSX.Element;
61
45
  private renderMain;
@@ -1,5 +1,4 @@
1
1
  "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.SpinnerDataTids = exports.Spinner = void 0;var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _react = _interopRequireDefault(require("react"));
2
- var _propTypes = _interopRequireDefault(require("prop-types"));
3
2
 
4
3
 
5
4
  var _ThemeContext = require("../../lib/theming/ThemeContext");
@@ -62,26 +61,6 @@ Spinner = exports.Spinner = (0, _rootNode.rootNode)(_class = (_Spinner = /*#__PU
62
61
 
63
62
 
64
63
 
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
64
 
86
65
  getProps = (0, _createPropsGetter.createPropsGetter)(Spinner.defaultProps);_this.
87
66
 
@@ -112,6 +91,7 @@ Spinner = exports.Spinner = (0, _rootNode.rootNode)(_class = (_Spinner = /*#__PU
112
91
 
113
92
 
114
93
 
94
+
115
95
 
116
96
 
117
97
  renderSpinner = function (type, dimmed, inline) {var _cx;
@@ -132,14 +112,4 @@ Spinner = exports.Spinner = (0, _rootNode.rootNode)(_class = (_Spinner = /*#__PU
132
112
  };_this.
133
113
 
134
114
  renderCaption = function (type, caption) {return /*#__PURE__*/(
135
- _react.default.createElement("span", { className: (0, _Emotion.cx)(_Spinner2.styles[type](_this.theme), _Spinner2.styles.captionColor(_this.theme)) }, caption));};return _this;}(0, _inheritsLoose2.default)(Spinner, _React$Component);var _proto = Spinner.prototype;_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 _this$props = this.props,_this$props$caption = _this$props.caption,caption = _this$props$caption === void 0 ? null : _this$props$caption,dimmed = _this$props.dimmed,inline = _this$props.inline;var type = this.getProps().type;return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement("div", { "data-tid": SpinnerDataTids.root, className: _Spinner2.styles.spinner() }, /*#__PURE__*/_react.default.createElement("span", { className: _Spinner2.styles.inner() }, this.renderSpinner(type, dimmed, inline)), caption && this.renderCaption(type, caption)));};return Spinner;}(_react.default.Component), _Spinner.__KONTUR_REACT_UI__ = 'Spinner', _Spinner.displayName = 'Spinner', _Spinner.propTypes = { /**
136
- * Текст рядом с мини-лоадером.
137
- *
138
- * 'Загрузка' - значение по-умолчанию
139
- */caption: _propTypes.default.node, dimmed: _propTypes.default.bool, /**
140
- * Тип спиннера: mini, normal, big
141
- *
142
- * Значение по-умолчанию - normal
143
- *
144
- * Spinner.types - все доступные типы
145
- */type: _propTypes.default.oneOf(types) }, _Spinner.defaultProps = { type: 'normal' }, _Spinner.Types = Object.assign.apply(Object, [{}].concat(types.map(function (type) {var _ref;return _ref = {}, _ref[type] = type, _ref;}))), _Spinner)) || _class;
115
+ _react.default.createElement("span", { className: (0, _Emotion.cx)(_Spinner2.styles[type](_this.theme), _Spinner2.styles.captionColor(_this.theme)) }, caption));};return _this;}(0, _inheritsLoose2.default)(Spinner, _React$Component);var _proto = Spinner.prototype;_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 _this$props = this.props,_this$props$caption = _this$props.caption,caption = _this$props$caption === void 0 ? null : _this$props$caption,dimmed = _this$props.dimmed,inline = _this$props.inline;var type = this.getProps().type;return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement("div", { "data-tid": SpinnerDataTids.root, className: _Spinner2.styles.spinner() }, /*#__PURE__*/_react.default.createElement("span", { className: _Spinner2.styles.inner() }, this.renderSpinner(type, dimmed, inline)), caption && this.renderCaption(type, caption)));};return Spinner;}(_react.default.Component), _Spinner.__KONTUR_REACT_UI__ = 'Spinner', _Spinner.displayName = 'Spinner', _Spinner.defaultProps = { type: 'normal' }, _Spinner.Types = Object.assign.apply(Object, [{}].concat(types.map(function (type) {var _ref;return _ref = {}, _ref[type] = type, _ref;}))), _Spinner)) || _class;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_propTypes","_ThemeContext","_SpinnerIcon","_CommonWrapper","_Emotion","_rootNode","_createPropsGetter","_Spinner2","_class","_Spinner","types","SpinnerDataTids","exports","root","Spinner","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","getProps","createPropsGetter","defaultProps","renderSpinner","type","dimmed","inline","_cx","default","createElement","SpinnerIcon","size","className","cx","styles","circle","theme","props","color","circleDimmedColor","circleWithoutColorAnimation","width","renderCaption","caption","captionColor","_inheritsLoose2","_proto","prototype","render","_this2","ThemeContext","Consumer","renderMain","_this$props","_this$props$caption","CommonWrapper","_extends2","rootNodeRef","setRootNode","spinner","inner","React","Component","__KONTUR_REACT_UI__","displayName","propTypes","PropTypes","node","bool","oneOf","Types","Object","assign","map","_ref"],"sources":["Spinner.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport type { Theme } from '../../lib/theming/Theme';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { SpinnerIcon } from '../../internal/SpinnerIcon/SpinnerIcon';\nimport type { CommonProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport type { TSetRootNode } from '../../lib/rootNode';\nimport { rootNode } from '../../lib/rootNode';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { styles } from './Spinner.styles';\n\nconst types = ['big', 'mini', 'normal'] as const;\n\nexport type SpinnerType = (typeof types)[number];\n\nexport interface SpinnerProps extends CommonProps {\n /** Задает подпись под спиннером.\n * @default \"Загрузка\" */\n caption?: React.ReactNode;\n\n /** Переводит спиннер в \"затемнённый режим\".\n * Цвет спиннера в \"затемнённом режиме\" определяется переменной `spinnerDimmedColor`. */\n dimmed?: boolean;\n\n /** Задает размер спиннера и текста.\n * @default normal. */\n type?: SpinnerType;\n\n /** Уменьшает спиннер для вставки в инлайн элемент. При type = \"big\"|\"normal\" размер спиннера уменьшается. */\n inline?: boolean;\n\n /** Задает толщину спиннера. */\n width?: number;\n\n /** Задает цвет спиннера. Не работает с пропом dimmed. */\n color?: React.CSSProperties['color'];\n}\n\nexport const SpinnerDataTids = {\n root: 'Spinner__root',\n} as const;\n\ntype DefaultProps = Required<Pick<SpinnerProps, 'type'>>;\n\n/**\n * `Spinner` — это зацикленный индикатор, не отображающий прогресс выполнения задачи.\n *\n * Используйте `Spinner`, чтобы показать, что система выполняет команду, которую дал пользователь.\n * Не применяйте `Spinner` для заполнения паузы при загрузке контента, для этого предназначен GlobalLoader.\n *\n * Используйте компонент `Spinner`, если вам нужен спиннер, без дополнительного функционала, который предоставляет компонент Loader.\n */\n@rootNode\nexport class Spinner extends React.Component<SpinnerProps> {\n public static __KONTUR_REACT_UI__ = 'Spinner';\n public static displayName = 'Spinner';\n\n public static propTypes = {\n /**\n * Текст рядом с мини-лоадером.\n *\n * 'Загрузка' - значение по-умолчанию\n */\n caption: PropTypes.node,\n\n dimmed: PropTypes.bool,\n\n /**\n * Тип спиннера: mini, normal, big\n *\n * Значение по-умолчанию - normal\n *\n * Spinner.types - все доступные типы\n */\n type: PropTypes.oneOf(types),\n };\n\n public static defaultProps: DefaultProps = {\n type: 'normal',\n };\n\n private getProps = createPropsGetter(Spinner.defaultProps);\n\n public static Types: Record<SpinnerType, SpinnerType> = Object.assign({}, ...types.map((type) => ({ [type]: type })));\n private theme!: Theme;\n private setRootNode!: TSetRootNode;\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 { caption = null, dimmed, inline } = this.props;\n const type = this.getProps().type;\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <div data-tid={SpinnerDataTids.root} className={styles.spinner()}>\n <span className={styles.inner()}>{this.renderSpinner(type, dimmed, inline)}</span>\n {caption && this.renderCaption(type, caption)}\n </div>\n </CommonWrapper>\n );\n }\n\n private renderSpinner = (type: SpinnerType, dimmed?: boolean, inline?: boolean) => {\n return (\n <SpinnerIcon\n size={type}\n className={cx({\n [styles.circle(this.theme)]: !dimmed && !this.props.color,\n [styles.circleDimmedColor(this.theme)]: dimmed,\n [styles.circleWithoutColorAnimation()]: dimmed || !!this.props.color,\n })}\n dimmed={dimmed}\n width={this.props.width}\n color={this.props.color}\n inline={inline}\n />\n );\n };\n\n private renderCaption = (type: SpinnerType, caption: React.ReactNode) => (\n <span className={cx(styles[type](this.theme), styles.captionColor(this.theme))}>{caption}</span>\n );\n}\n"],"mappings":"uWAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;;;AAGA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;;AAEA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;;AAEA,IAAAQ,SAAA,GAAAR,OAAA,qBAA0C,IAAAS,MAAA,EAAAC,QAAA;;AAE1C,IAAMC,KAAK,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BzC,IAAMC,eAAe,GAAAC,OAAA,CA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AI,OAAAkD,IAAA,QAAAA,IAAA,OAAAA,IAAA,CAASlD,IAAI,IAAGA,IAAI,EAAAkD,IAAA,EAAG,CAAC,EAAC,EAAAxE,QAAA,MAAAD,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_ThemeContext","_SpinnerIcon","_CommonWrapper","_Emotion","_rootNode","_createPropsGetter","_Spinner2","_class","_Spinner","types","SpinnerDataTids","exports","root","Spinner","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","getProps","createPropsGetter","defaultProps","renderSpinner","type","dimmed","inline","_cx","default","createElement","SpinnerIcon","size","className","cx","styles","circle","theme","props","color","circleDimmedColor","circleWithoutColorAnimation","width","renderCaption","caption","captionColor","_inheritsLoose2","_proto","prototype","render","_this2","ThemeContext","Consumer","renderMain","_this$props","_this$props$caption","CommonWrapper","_extends2","rootNodeRef","setRootNode","spinner","inner","React","Component","__KONTUR_REACT_UI__","displayName","Types","Object","assign","map","_ref"],"sources":["Spinner.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { Theme } from '../../lib/theming/Theme';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport { SpinnerIcon } from '../../internal/SpinnerIcon/SpinnerIcon';\nimport type { CommonProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport type { TGetRootNode, TSetRootNode } from '../../lib/rootNode';\nimport { rootNode } from '../../lib/rootNode';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\n\nimport { styles } from './Spinner.styles';\n\nconst types = ['big', 'mini', 'normal'] as const;\n\nexport type SpinnerType = (typeof types)[number];\n\nexport interface SpinnerProps extends CommonProps {\n /** Задает подпись под спиннером.\n * @default \"Загрузка\" */\n caption?: React.ReactNode;\n\n /** Переводит спиннер в \"затемнённый режим\".\n * Цвет спиннера в \"затемнённом режиме\" определяется переменной `spinnerDimmedColor`. */\n dimmed?: boolean;\n\n /** Задает размер спиннера и текста.\n * @default normal. */\n type?: SpinnerType;\n\n /** Уменьшает спиннер для вставки в инлайн элемент. При type = \"big\"|\"normal\" размер спиннера уменьшается. */\n inline?: boolean;\n\n /** Задает толщину спиннера. */\n width?: number;\n\n /** Задает цвет спиннера. Не работает с пропом dimmed. */\n color?: React.CSSProperties['color'];\n}\n\nexport const SpinnerDataTids = {\n root: 'Spinner__root',\n} as const;\n\ntype DefaultProps = Required<Pick<SpinnerProps, 'type'>>;\n\n/**\n * `Spinner` — это зацикленный индикатор, не отображающий прогресс выполнения задачи.\n *\n * Используйте `Spinner`, чтобы показать, что система выполняет команду, которую дал пользователь.\n * Не применяйте `Spinner` для заполнения паузы при загрузке контента, для этого предназначен GlobalLoader.\n *\n * Используйте компонент `Spinner`, если вам нужен спиннер, без дополнительного функционала, который предоставляет компонент Loader.\n */\n@rootNode\nexport class Spinner extends React.Component<SpinnerProps> {\n public static __KONTUR_REACT_UI__ = 'Spinner';\n public static displayName = 'Spinner';\n\n public static defaultProps: DefaultProps = {\n type: 'normal',\n };\n\n private getProps = createPropsGetter(Spinner.defaultProps);\n\n public static Types: Record<SpinnerType, SpinnerType> = Object.assign({}, ...types.map((type) => ({ [type]: type })));\n private theme!: Theme;\n public getRootNode!: TGetRootNode;\n private setRootNode!: TSetRootNode;\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 { caption = null, dimmed, inline } = this.props;\n const type = this.getProps().type;\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <div data-tid={SpinnerDataTids.root} className={styles.spinner()}>\n <span className={styles.inner()}>{this.renderSpinner(type, dimmed, inline)}</span>\n {caption && this.renderCaption(type, caption)}\n </div>\n </CommonWrapper>\n );\n }\n\n private renderSpinner = (type: SpinnerType, dimmed?: boolean, inline?: boolean) => {\n return (\n <SpinnerIcon\n size={type}\n className={cx({\n [styles.circle(this.theme)]: !dimmed && !this.props.color,\n [styles.circleDimmedColor(this.theme)]: dimmed,\n [styles.circleWithoutColorAnimation()]: dimmed || !!this.props.color,\n })}\n dimmed={dimmed}\n width={this.props.width}\n color={this.props.color}\n inline={inline}\n />\n );\n };\n\n private renderCaption = (type: SpinnerType, caption: React.ReactNode) => (\n <span className={cx(styles[type](this.theme), styles.captionColor(this.theme))}>{caption}</span>\n );\n}\n"],"mappings":"uWAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;;;AAGA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;;AAEA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;;AAEA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;;AAEA,IAAAO,SAAA,GAAAP,OAAA,qBAA0C,IAAAQ,MAAA,EAAAC,QAAA;;AAE1C,IAAMC,KAAK,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BzC,IAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG;EAC7BE,IAAI,EAAE;AACR,CAAU;;;;AAIV;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAPA;;AASaC,OAAO,GAAAF,OAAA,CAAAE,OAAA,OADnBC,kBAAQ,EAAAP,MAAA,IAAAC,QAAA,0BAAAO,gBAAA,YAAAF,QAAA,OAAAG,KAAA,UAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA,KAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA,GAAAN,KAAA,GAAAD,gBAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,gBAAA,SAAAU,MAAA,CAAA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FiB,OAAO,IAAI,IAAI,CAACD,aAAa,CAAClB,IAAI,EAAEmB,OAAO,CACzC,CACQ,CAAC,CAEpB,CAAC,QAAApC,OAAA,GAtC0BsD,cAAK,CAACC,SAAS,GAAA5D,QAAA,CAC5B6D,mBAAmB,GAAG,SAAS,EAAA7D,QAAA,CAC/B8D,WAAW,GAAG,SAAS,EAAA9D,QAAA,CAEvBoB,YAAY,GAAiB,EACzCE,IAAI,EAAE,QAAQ,CAChB,CAAC,EAAAtB,QAAA,CAIa+D,KAAK,GAAqCC,MAAM,CAACC,MAAM,CAAAjD,KAAA,CAAbgD,MAAM,GAAQ,CAAC,CAAC,EAAA/C,MAAA,CAAKhB,KAAK,CAACiE,GAAG,CAAC,UAAC5C,IAAI,OAAA6C,IAAA,QAAAA,IAAA,OAAAA,IAAA,CAAS7C,IAAI,IAAGA,IAAI,EAAA6C,IAAA,EAAG,CAAC,EAAC,EAAAnE,QAAA,MAAAD,MAAA","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import type { Nullable } from '../../typings/utility-types';
4
3
  import type { CommonProps } from '../../internal/CommonWrapper';
4
+ import type { TGetRootNode } from '../../lib/rootNode';
5
5
  import type { ReactUIFeatureFlags } from '../../lib/featureFlagsContext';
6
6
  export interface StickyProps extends Omit<CommonProps, 'children'> {
7
7
  /** Задает сторону залипания. */
@@ -34,18 +34,6 @@ type DefaultProps = Required<Pick<StickyProps, 'offset'>>;
34
34
  export declare class Sticky extends React.Component<StickyProps, StickyState> {
35
35
  static __KONTUR_REACT_UI__: string;
36
36
  static displayName: string;
37
- static propTypes: {
38
- children: PropTypes.Requireable<NonNullable<((...args: any[]) => any) | PropTypes.ReactNodeLike>>;
39
- /**
40
- * Функция, которая возвращает DOM-элемент, который нельзя пересекать.
41
- */
42
- getStop: PropTypes.Requireable<(...args: any[]) => any>;
43
- /**
44
- * Отступ от границы в пикселях
45
- */
46
- offset: PropTypes.Requireable<number>;
47
- side: PropTypes.Validator<string>;
48
- };
49
37
  static defaultProps: DefaultProps;
50
38
  private getProps;
51
39
  state: StickyState;
@@ -53,6 +41,7 @@ export declare class Sticky extends React.Component<StickyProps, StickyState> {
53
41
  private inner;
54
42
  private layoutSubscription;
55
43
  private reflowCounter;
44
+ getRootNode: TGetRootNode;
56
45
  private setRootNode;
57
46
  featureFlags: ReactUIFeatureFlags;
58
47
  componentDidMount(): void;
@@ -1,5 +1,4 @@
1
1
  "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;exports.__esModule = true;exports.StickyDataTids = exports.Sticky = void 0;var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _react = _interopRequireDefault(require("react"));
2
- var _propTypes = _interopRequireDefault(require("prop-types"));
3
2
  var _shallowequal = _interopRequireDefault(require("shallowequal"));
4
3
  var _globalObject = require("@skbkontur/global-object");
5
4
 
@@ -58,22 +57,6 @@ var StickyDataTids = exports.StickyDataTids = {
58
57
  */var
59
58
 
60
59
  Sticky = exports.Sticky = (0, _rootNode.rootNode)(_class = (_Sticky = /*#__PURE__*/function (_React$Component) {function Sticky() {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.
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
60
 
78
61
 
79
62
 
@@ -170,6 +153,7 @@ Sticky = exports.Sticky = (0, _rootNode.rootNode)(_class = (_Sticky = /*#__PURE_
170
153
 
171
154
 
172
155
 
156
+
173
157
 
174
158
 
175
159
  refWrapper = function (ref) {return _this.wrapper = ref;};_this.
@@ -224,8 +208,4 @@ Sticky = exports.Sticky = (0, _rootNode.rootNode)(_class = (_Sticky = /*#__PURE_
224
208
  _this.setState({ relativeTop: relativeTop, deltaHeight: deltaHeight, stopped: stopped });
225
209
  }
226
210
  }
227
- };return _this;}(0, _inheritsLoose2.default)(Sticky, _React$Component);var _proto = Sticky.prototype;_proto.componentDidMount = function componentDidMount() {this.reflow();this.layoutSubscription = LayoutEvents.addListener(this.reflow);};_proto.componentWillUnmount = function componentWillUnmount() {if (this.layoutSubscription.remove) {this.layoutSubscription.remove();}};_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {if (!(0, _shallowequal.default)(prevProps, this.props) || !(0, _shallowequal.default)(prevState, this.state)) {if (this.reflowCounter < MAX_REFLOW_RETRIES) {this.featureFlags.stickyReduceLayoutEvents ? this.reflow() : LayoutEvents.emit();this.reflowCounter += 1;return;}}this.reflowCounter = 0;};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_featureFlagsContext.ReactUIFeatureFlagsContext.Consumer, null, function (flags) {_this2.featureFlags = (0, _featureFlagsContext.getFullReactUIFlagsContext)(flags);return _this2.renderMain();});};_proto.renderMain = function renderMain() {var _cx;var children = this.props.children;var side = this.props.side;var offset = this.getProps().offset;var _this$state2 = this.state,fixed = _this$state2.fixed,stopped = _this$state2.stopped,relativeTop = _this$state2.relativeTop,deltaHeight = _this$state2.deltaHeight,width = _this$state2.width,height = _this$state2.height,left = _this$state2.left;var innerStyle = {};if (fixed) {if (stopped) {innerStyle.top = relativeTop;innerStyle[side === 'top' ? 'marginTop' : 'marginBottom'] = deltaHeight;} else {innerStyle.width = width;innerStyle[side] = offset;innerStyle.left = left;}}if ((0, _utils.isFunction)(children)) {children = children(fixed);}return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement("div", { "data-tid": StickyDataTids.root, ref: this.refWrapper, className: _Sticky2.styles.wrapper() }, /*#__PURE__*/_react.default.createElement(_ZIndex.ZIndex, { priority: "Sticky", applyZIndex: fixed, className: (0, _Emotion.cx)(_Sticky2.styles.inner(), (_cx = {}, _cx[_Sticky2.styles.fixed()] = fixed && !stopped, _cx[_Sticky2.styles.stopped()] = stopped, _cx)), style: innerStyle, wrapperRef: this.refInner }, /*#__PURE__*/_react.default.createElement("div", { className: _Sticky2.styles.container() }, children)), fixed && !stopped ? /*#__PURE__*/_react.default.createElement("div", { style: { width: width, height: height } }) : null));};return Sticky;}(_react.default.Component), _Sticky.__KONTUR_REACT_UI__ = 'Sticky', _Sticky.displayName = 'Sticky', _Sticky.propTypes = { children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]), /**
228
- * Функция, которая возвращает DOM-элемент, который нельзя пересекать.
229
- */getStop: _propTypes.default.func, /**
230
- * Отступ от границы в пикселях
231
- */offset: _propTypes.default.number, side: _propTypes.default.oneOf(['top', 'bottom']).isRequired }, _Sticky.defaultProps = { offset: 0 }, _Sticky)) || _class;
211
+ };return _this;}(0, _inheritsLoose2.default)(Sticky, _React$Component);var _proto = Sticky.prototype;_proto.componentDidMount = function componentDidMount() {this.reflow();this.layoutSubscription = LayoutEvents.addListener(this.reflow);};_proto.componentWillUnmount = function componentWillUnmount() {if (this.layoutSubscription.remove) {this.layoutSubscription.remove();}};_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {if (!(0, _shallowequal.default)(prevProps, this.props) || !(0, _shallowequal.default)(prevState, this.state)) {if (this.reflowCounter < MAX_REFLOW_RETRIES) {this.featureFlags.stickyReduceLayoutEvents ? this.reflow() : LayoutEvents.emit();this.reflowCounter += 1;return;}}this.reflowCounter = 0;};_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_featureFlagsContext.ReactUIFeatureFlagsContext.Consumer, null, function (flags) {_this2.featureFlags = (0, _featureFlagsContext.getFullReactUIFlagsContext)(flags);return _this2.renderMain();});};_proto.renderMain = function renderMain() {var _cx;var children = this.props.children;var side = this.props.side;var offset = this.getProps().offset;var _this$state2 = this.state,fixed = _this$state2.fixed,stopped = _this$state2.stopped,relativeTop = _this$state2.relativeTop,deltaHeight = _this$state2.deltaHeight,width = _this$state2.width,height = _this$state2.height,left = _this$state2.left;var innerStyle = {};if (fixed) {if (stopped) {innerStyle.top = relativeTop;innerStyle[side === 'top' ? 'marginTop' : 'marginBottom'] = deltaHeight;} else {innerStyle.width = width;innerStyle[side] = offset;innerStyle.left = left;}}if ((0, _utils.isFunction)(children)) {children = children(fixed);}return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement("div", { "data-tid": StickyDataTids.root, ref: this.refWrapper, className: _Sticky2.styles.wrapper() }, /*#__PURE__*/_react.default.createElement(_ZIndex.ZIndex, { priority: "Sticky", applyZIndex: fixed, className: (0, _Emotion.cx)(_Sticky2.styles.inner(), (_cx = {}, _cx[_Sticky2.styles.fixed()] = fixed && !stopped, _cx[_Sticky2.styles.stopped()] = stopped, _cx)), style: innerStyle, wrapperRef: this.refInner }, /*#__PURE__*/_react.default.createElement("div", { className: _Sticky2.styles.container() }, children)), fixed && !stopped ? /*#__PURE__*/_react.default.createElement("div", { style: { width: width, height: height } }) : null));};return Sticky;}(_react.default.Component), _Sticky.__KONTUR_REACT_UI__ = 'Sticky', _Sticky.displayName = 'Sticky', _Sticky.defaultProps = { offset: 0 }, _Sticky)) || _class;
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_propTypes","_shallowequal","_globalObject","LayoutEvents","_interopRequireWildcard","_utils","_ZIndex","_CommonWrapper","_Emotion","_rootNode","_getDOMRect3","_createPropsGetter","_featureFlagsContext","_Sticky2","_class","_Sticky","MAX_REFLOW_RETRIES","StickyDataTids","exports","root","Sticky","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","getProps","createPropsGetter","defaultProps","state","fixed","deltaHeight","stopped","relativeTop","layoutSubscription","remove","reflowCounter","refWrapper","ref","wrapper","refInner","inner","reflow","_globalObject$documen","globalObject","document","documentElement","Error","windowHeight","innerHeight","clientHeight","_getDOMRect","getDOMRect","top","bottom","left","width","_getDOMRect2","height","_this$props","props","getStop","side","_this$state","prevFixed","_this$state$height","prevHeight","offset","Math","ceil","floor","setState","stop","stopRect","outerHeight","_inheritsLoose2","default","_proto","prototype","componentDidMount","addListener","componentWillUnmount","componentDidUpdate","prevProps","prevState","shallowEqual","featureFlags","stickyReduceLayoutEvents","emit","render","_this2","createElement","ReactUIFeatureFlagsContext","Consumer","flags","getFullReactUIFlagsContext","renderMain","_cx","children","_this$state2","innerStyle","isFunction","CommonWrapper","_extends2","rootNodeRef","setRootNode","className","styles","ZIndex","priority","applyZIndex","cx","style","wrapperRef","container","React","Component","__KONTUR_REACT_UI__","displayName","propTypes","PropTypes","oneOfType","node","func","number","oneOf","isRequired"],"sources":["Sticky.tsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport shallowEqual from 'shallowequal';\nimport { globalObject } from '@skbkontur/global-object';\n\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport type { Nullable } from '../../typings/utility-types';\nimport { isFunction } from '../../lib/utils';\nimport { ZIndex } from '../../internal/ZIndex';\nimport type { CommonProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport type { TSetRootNode } from '../../lib/rootNode';\nimport { rootNode } from '../../lib/rootNode';\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport type { ReactUIFeatureFlags } from '../../lib/featureFlagsContext';\nimport { getFullReactUIFlagsContext, ReactUIFeatureFlagsContext } from '../../lib/featureFlagsContext';\n\nimport { styles } from './Sticky.styles';\n\nconst MAX_REFLOW_RETRIES = 5;\n\nexport interface StickyProps extends Omit<CommonProps, 'children'> {\n /** Задает сторону залипания. */\n side: 'top' | 'bottom';\n\n /** Задает отступ от края экрана в пикселях, на который сдвигается элемент в залипшем состоянии.\n * @default 0 */\n offset?: number;\n\n /** Задает функцию, которая возвращает DOM-элемент, который нельзя пересекать. */\n getStop?: () => Nullable<HTMLElement>;\n\n /** @ignore */\n children?: React.ReactNode | ((fixed: boolean) => React.ReactNode);\n}\n\nexport interface StickyState {\n fixed: boolean;\n deltaHeight: number;\n height?: number;\n width?: number;\n left?: number;\n stopped: boolean;\n relativeTop: number;\n}\n\nexport const StickyDataTids = {\n root: 'Sticky__root',\n} as const;\n\ntype DefaultProps = Required<Pick<StickyProps, 'offset'>>;\n\n/**\n * `Sticky` позволяет закреплять элемент интерфейса в определенной позиции на экране при прокрутке страницы.\n * Это полезно для создания \"прилипающих\" элементов, которые остаются видимыми при прокрутке содержимого.\n */\n@rootNode\nexport class Sticky extends React.Component<StickyProps, StickyState> {\n public static __KONTUR_REACT_UI__ = 'Sticky';\n public static displayName = 'Sticky';\n\n public static propTypes = {\n children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),\n\n /**\n * Функция, которая возвращает DOM-элемент, который нельзя пересекать.\n */\n getStop: PropTypes.func,\n\n /**\n * Отступ от границы в пикселях\n */\n offset: PropTypes.number,\n\n side: PropTypes.oneOf(['top', 'bottom']).isRequired,\n };\n\n public static defaultProps: DefaultProps = { offset: 0 };\n\n private getProps = createPropsGetter(Sticky.defaultProps);\n\n public state: StickyState = {\n fixed: false,\n deltaHeight: 0,\n stopped: false,\n relativeTop: 0,\n };\n\n private wrapper: Nullable<HTMLElement>;\n private inner: Nullable<HTMLElement>;\n private layoutSubscription: { remove: Nullable<() => void> } = { remove: null };\n private reflowCounter = 0;\n private setRootNode!: TSetRootNode;\n public featureFlags!: ReactUIFeatureFlags;\n\n public componentDidMount() {\n this.reflow();\n\n this.layoutSubscription = LayoutEvents.addListener(this.reflow);\n }\n\n public componentWillUnmount() {\n if (this.layoutSubscription.remove) {\n this.layoutSubscription.remove();\n }\n }\n\n public componentDidUpdate(prevProps: StickyProps, prevState: StickyState) {\n if (!shallowEqual(prevProps, this.props) || !shallowEqual(prevState, this.state)) {\n if (this.reflowCounter < MAX_REFLOW_RETRIES) {\n this.featureFlags.stickyReduceLayoutEvents ? this.reflow() : LayoutEvents.emit();\n this.reflowCounter += 1;\n return;\n }\n }\n this.reflowCounter = 0;\n }\n\n public render() {\n return (\n <ReactUIFeatureFlagsContext.Consumer>\n {(flags) => {\n this.featureFlags = getFullReactUIFlagsContext(flags);\n return this.renderMain();\n }}\n </ReactUIFeatureFlagsContext.Consumer>\n );\n }\n\n private renderMain() {\n let { children } = this.props;\n const { side } = this.props;\n const offset = this.getProps().offset;\n const { fixed, stopped, relativeTop, deltaHeight, width, height, left } = this.state;\n const innerStyle: React.CSSProperties = {};\n\n if (fixed) {\n if (stopped) {\n innerStyle.top = relativeTop;\n innerStyle[side === 'top' ? 'marginTop' : 'marginBottom'] = deltaHeight;\n } else {\n innerStyle.width = width;\n innerStyle[side] = offset;\n innerStyle.left = left;\n }\n }\n\n if (isFunction(children)) {\n children = children(fixed);\n }\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <div data-tid={StickyDataTids.root} ref={this.refWrapper} className={styles.wrapper()}>\n <ZIndex\n priority=\"Sticky\"\n applyZIndex={fixed}\n className={cx(styles.inner(), {\n [styles.fixed()]: fixed && !stopped,\n [styles.stopped()]: stopped,\n })}\n style={innerStyle}\n wrapperRef={this.refInner}\n >\n <div className={styles.container()}>{children}</div>\n </ZIndex>\n {fixed && !stopped ? <div style={{ width, height }} /> : null}\n </div>\n </CommonWrapper>\n );\n }\n\n private refWrapper = (ref: Nullable<HTMLElement>) => (this.wrapper = ref);\n\n private refInner = (ref: Nullable<HTMLElement>) => (this.inner = ref);\n\n /**\n * Пересчитать габариты и позицию залипшего элемента\n *\n * @public\n */\n public reflow = () => {\n if (!globalObject.document?.documentElement) {\n throw Error('There is no \"documentElement\" in document');\n }\n\n const windowHeight = globalObject.innerHeight || globalObject.document.documentElement.clientHeight;\n if (!this.wrapper || !this.inner) {\n return;\n }\n const { top, bottom, left, width } = getDOMRect(this.wrapper);\n const { height } = getDOMRect(this.inner);\n const { getStop, side } = this.props;\n const { fixed: prevFixed, height: prevHeight = height } = this.state;\n const offset = this.getProps().offset;\n const fixed = side === 'top' ? Math.ceil(top) < offset : Math.floor(bottom) > windowHeight - offset;\n\n this.setState({ fixed, left });\n\n if (fixed && !prevFixed) {\n this.setState({ width, height });\n }\n\n if (fixed) {\n this.setState({ width });\n const stop = getStop && getStop();\n if (stop) {\n const deltaHeight = prevHeight - height;\n const stopRect = getDOMRect(stop);\n const outerHeight = height + offset;\n let stopped = false;\n let relativeTop = 0;\n\n if (side === 'top') {\n stopped = stopRect.top - outerHeight < 0;\n relativeTop = stopRect.top - prevHeight - top;\n } else {\n stopped = stopRect.bottom + outerHeight > windowHeight;\n relativeTop = stopRect.bottom - top;\n }\n\n this.setState({ relativeTop, deltaHeight, stopped });\n }\n }\n };\n}\n"],"mappings":"ocAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;;AAEA,IAAAI,YAAA,GAAAC,uBAAA,CAAAL,OAAA;;AAEA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;;AAEA,IAAAQ,cAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;;AAEA,IAAAU,SAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAX,OAAA;AACA,IAAAY,kBAAA,GAAAZ,OAAA;;AAEA,IAAAa,oBAAA,GAAAb,OAAA;;AAEA,IAAAc,QAAA,GAAAd,OAAA,oBAAyC,IAAAe,MAAA,EAAAC,OAAA;;AAEzC,IAAMC,kBAAkB,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BrB,I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,CAACC,SAAS,CAAC,CAACD,kBAAS,CAACE,IAAI,EAAEF,kBAAS,CAACG,IAAI,CAAC,CAAC,EAE/D;AACJ;AACA,KACI9D,OAAO,EAAE2D,kBAAS,CAACG,IAAI,EAEvB;AACJ;AACA,KACIxD,MAAM,EAAEqD,kBAAS,CAACI,MAAM,EAExB9D,IAAI,EAAE0D,kBAAS,CAACK,KAAK,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAACC,UAAU,CACrD,CAAC,EAAAtH,OAAA,CAEaoB,YAAY,GAAiB,EAAEuC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAA3D,OAAA,MAAAD,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_shallowequal","_globalObject","LayoutEvents","_interopRequireWildcard","_utils","_ZIndex","_CommonWrapper","_Emotion","_rootNode","_getDOMRect3","_createPropsGetter","_featureFlagsContext","_Sticky2","_class","_Sticky","MAX_REFLOW_RETRIES","StickyDataTids","exports","root","Sticky","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","getProps","createPropsGetter","defaultProps","state","fixed","deltaHeight","stopped","relativeTop","layoutSubscription","remove","reflowCounter","refWrapper","ref","wrapper","refInner","inner","reflow","_globalObject$documen","globalObject","document","documentElement","Error","windowHeight","innerHeight","clientHeight","_getDOMRect","getDOMRect","top","bottom","left","width","_getDOMRect2","height","_this$props","props","getStop","side","_this$state","prevFixed","_this$state$height","prevHeight","offset","Math","ceil","floor","setState","stop","stopRect","outerHeight","_inheritsLoose2","default","_proto","prototype","componentDidMount","addListener","componentWillUnmount","componentDidUpdate","prevProps","prevState","shallowEqual","featureFlags","stickyReduceLayoutEvents","emit","render","_this2","createElement","ReactUIFeatureFlagsContext","Consumer","flags","getFullReactUIFlagsContext","renderMain","_cx","children","_this$state2","innerStyle","isFunction","CommonWrapper","_extends2","rootNodeRef","setRootNode","className","styles","ZIndex","priority","applyZIndex","cx","style","wrapperRef","container","React","Component","__KONTUR_REACT_UI__","displayName"],"sources":["Sticky.tsx"],"sourcesContent":["import React from 'react';\nimport shallowEqual from 'shallowequal';\nimport { globalObject } from '@skbkontur/global-object';\n\nimport * as LayoutEvents from '../../lib/LayoutEvents';\nimport type { Nullable } from '../../typings/utility-types';\nimport { isFunction } from '../../lib/utils';\nimport { ZIndex } from '../../internal/ZIndex';\nimport type { CommonProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport { cx } from '../../lib/theming/Emotion';\nimport type { TGetRootNode, TSetRootNode } from '../../lib/rootNode';\nimport { rootNode } from '../../lib/rootNode';\nimport { getDOMRect } from '../../lib/dom/getDOMRect';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport type { ReactUIFeatureFlags } from '../../lib/featureFlagsContext';\nimport { getFullReactUIFlagsContext, ReactUIFeatureFlagsContext } from '../../lib/featureFlagsContext';\n\nimport { styles } from './Sticky.styles';\n\nconst MAX_REFLOW_RETRIES = 5;\n\nexport interface StickyProps extends Omit<CommonProps, 'children'> {\n /** Задает сторону залипания. */\n side: 'top' | 'bottom';\n\n /** Задает отступ от края экрана в пикселях, на который сдвигается элемент в залипшем состоянии.\n * @default 0 */\n offset?: number;\n\n /** Задает функцию, которая возвращает DOM-элемент, который нельзя пересекать. */\n getStop?: () => Nullable<HTMLElement>;\n\n /** @ignore */\n children?: React.ReactNode | ((fixed: boolean) => React.ReactNode);\n}\n\nexport interface StickyState {\n fixed: boolean;\n deltaHeight: number;\n height?: number;\n width?: number;\n left?: number;\n stopped: boolean;\n relativeTop: number;\n}\n\nexport const StickyDataTids = {\n root: 'Sticky__root',\n} as const;\n\ntype DefaultProps = Required<Pick<StickyProps, 'offset'>>;\n\n/**\n * `Sticky` позволяет закреплять элемент интерфейса в определенной позиции на экране при прокрутке страницы.\n * Это полезно для создания \"прилипающих\" элементов, которые остаются видимыми при прокрутке содержимого.\n */\n@rootNode\nexport class Sticky extends React.Component<StickyProps, StickyState> {\n public static __KONTUR_REACT_UI__ = 'Sticky';\n public static displayName = 'Sticky';\n\n public static defaultProps: DefaultProps = { offset: 0 };\n\n private getProps = createPropsGetter(Sticky.defaultProps);\n\n public state: StickyState = {\n fixed: false,\n deltaHeight: 0,\n stopped: false,\n relativeTop: 0,\n };\n\n private wrapper: Nullable<HTMLElement>;\n private inner: Nullable<HTMLElement>;\n private layoutSubscription: { remove: Nullable<() => void> } = { remove: null };\n private reflowCounter = 0;\n public getRootNode!: TGetRootNode;\n private setRootNode!: TSetRootNode;\n public featureFlags!: ReactUIFeatureFlags;\n\n public componentDidMount() {\n this.reflow();\n\n this.layoutSubscription = LayoutEvents.addListener(this.reflow);\n }\n\n public componentWillUnmount() {\n if (this.layoutSubscription.remove) {\n this.layoutSubscription.remove();\n }\n }\n\n public componentDidUpdate(prevProps: StickyProps, prevState: StickyState) {\n if (!shallowEqual(prevProps, this.props) || !shallowEqual(prevState, this.state)) {\n if (this.reflowCounter < MAX_REFLOW_RETRIES) {\n this.featureFlags.stickyReduceLayoutEvents ? this.reflow() : LayoutEvents.emit();\n this.reflowCounter += 1;\n return;\n }\n }\n this.reflowCounter = 0;\n }\n\n public render() {\n return (\n <ReactUIFeatureFlagsContext.Consumer>\n {(flags) => {\n this.featureFlags = getFullReactUIFlagsContext(flags);\n return this.renderMain();\n }}\n </ReactUIFeatureFlagsContext.Consumer>\n );\n }\n\n private renderMain() {\n let { children } = this.props;\n const { side } = this.props;\n const offset = this.getProps().offset;\n const { fixed, stopped, relativeTop, deltaHeight, width, height, left } = this.state;\n const innerStyle: React.CSSProperties = {};\n\n if (fixed) {\n if (stopped) {\n innerStyle.top = relativeTop;\n innerStyle[side === 'top' ? 'marginTop' : 'marginBottom'] = deltaHeight;\n } else {\n innerStyle.width = width;\n innerStyle[side] = offset;\n innerStyle.left = left;\n }\n }\n\n if (isFunction(children)) {\n children = children(fixed);\n }\n\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <div data-tid={StickyDataTids.root} ref={this.refWrapper} className={styles.wrapper()}>\n <ZIndex\n priority=\"Sticky\"\n applyZIndex={fixed}\n className={cx(styles.inner(), {\n [styles.fixed()]: fixed && !stopped,\n [styles.stopped()]: stopped,\n })}\n style={innerStyle}\n wrapperRef={this.refInner}\n >\n <div className={styles.container()}>{children}</div>\n </ZIndex>\n {fixed && !stopped ? <div style={{ width, height }} /> : null}\n </div>\n </CommonWrapper>\n );\n }\n\n private refWrapper = (ref: Nullable<HTMLElement>) => (this.wrapper = ref);\n\n private refInner = (ref: Nullable<HTMLElement>) => (this.inner = ref);\n\n /**\n * Пересчитать габариты и позицию залипшего элемента\n *\n * @public\n */\n public reflow = () => {\n if (!globalObject.document?.documentElement) {\n throw Error('There is no \"documentElement\" in document');\n }\n\n const windowHeight = globalObject.innerHeight || globalObject.document.documentElement.clientHeight;\n if (!this.wrapper || !this.inner) {\n return;\n }\n const { top, bottom, left, width } = getDOMRect(this.wrapper);\n const { height } = getDOMRect(this.inner);\n const { getStop, side } = this.props;\n const { fixed: prevFixed, height: prevHeight = height } = this.state;\n const offset = this.getProps().offset;\n const fixed = side === 'top' ? Math.ceil(top) < offset : Math.floor(bottom) > windowHeight - offset;\n\n this.setState({ fixed, left });\n\n if (fixed && !prevFixed) {\n this.setState({ width, height });\n }\n\n if (fixed) {\n this.setState({ width });\n const stop = getStop && getStop();\n if (stop) {\n const deltaHeight = prevHeight - height;\n const stopRect = getDOMRect(stop);\n const outerHeight = height + offset;\n let stopped = false;\n let relativeTop = 0;\n\n if (side === 'top') {\n stopped = stopRect.top - outerHeight < 0;\n relativeTop = stopRect.top - prevHeight - top;\n } else {\n stopped = stopRect.bottom + outerHeight > windowHeight;\n relativeTop = stopRect.bottom - top;\n }\n\n this.setState({ relativeTop, deltaHeight, stopped });\n }\n }\n };\n}\n"],"mappings":"ocAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAA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CAACO,SAAS,CAAC,CAAE,IAAEhB,QAAc,CAC7C,CAAC,EACRpE,KAAK,IAAI,CAACE,OAAO,gBAAGzC,MAAA,CAAAqF,OAAA,CAAAe,aAAA,UAAKqB,KAAK,EAAE,EAAExD,KAAK,EAALA,KAAK,EAAEE,MAAM,EAANA,MAAM,CAAC,CAAE,EAAE,CAAC,GAAG,IACtD,CACQ,CAAC,CAEpB,CAAC,QAAA7C,MAAA,GAlGyBsG,cAAK,CAACC,SAAS,GAAA5G,OAAA,CAC3B6G,mBAAmB,GAAG,QAAQ,EAAA7G,OAAA,CAC9B8G,WAAW,GAAG,QAAQ,EAAA9G,OAAA,CAEtBoB,YAAY,GAAiB,EAAEuC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAA3D,OAAA,MAAAD,MAAA","ignoreList":[]}
@@ -1,16 +1,16 @@
1
1
  import type { HTMLAttributes } from 'react';
2
2
  import React from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import type { ButtonProps } from '../Button';
5
4
  import type { Nullable } from '../../typings/utility-types';
6
5
  import type { CommonProps } from '../../internal/CommonWrapper';
6
+ import type { TGetRootNode } from '../../lib/rootNode';
7
7
  import type { SizeProp } from '../../lib/types/props';
8
8
  export type SwitcherItems = string | SwitcherItem;
9
9
  export declare const SwitcherDataTids: {
10
10
  readonly root: "Switcher__root";
11
11
  };
12
12
  export interface SwitcherProps extends Pick<HTMLAttributes<unknown>, 'role'>, CommonProps {
13
- /** Задает список строк или список элементов типа `{ label: string, value: string, buttonProps?: Partial<ButtonProps> }`. */
13
+ /** Задает список элементов в свитчере. Это массив строк или объектов типа `{ label: string, value: string, buttonProps?: Partial<ButtonProps> }` */
14
14
  items: SwitcherItems[];
15
15
  /** Устанавливает значение свитчера. */
16
16
  value?: string;
@@ -22,15 +22,11 @@ export interface SwitcherProps extends Pick<HTMLAttributes<unknown>, 'role'>, Co
22
22
  error?: boolean;
23
23
  /** Задает размер контрола. */
24
24
  size?: SizeProp;
25
+ /** Задает ширину контрола. С этим пропом элементы внутри автоматически равномерно растянутся. */
26
+ width?: React.CSSProperties['width'];
25
27
  /** Делает компонент недоступным. */
26
28
  disabled?: boolean;
27
- /** Задает функцию отрисовки элемента.
28
- * @param `label` -
29
- * @param `value` -
30
- * @param `buttonProps` -
31
- * @param `renderDefault` -
32
- * @param `ariaLabel` -
33
- */
29
+ /** Задает функцию отрисовки элемента. Параметр `renderDefault` - это встроенная дефолтная функция отрисовки элемента, которую можно вызывать в `renderItem`. */
34
30
  renderItem?: (label: string, value: string, buttonProps: ButtonProps, renderDefault: () => React.ReactNode, ariaLabel?: string) => React.ReactNode;
35
31
  }
36
32
  type DefaultProps = Required<Pick<SwitcherProps, 'role'>>;
@@ -52,20 +48,9 @@ export declare class Switcher extends React.Component<SwitcherProps, SwitcherSta
52
48
  static __KONTUR_REACT_UI__: string;
53
49
  static displayName: string;
54
50
  static defaultProps: DefaultProps;
55
- static propTypes: {
56
- error: PropTypes.Requireable<boolean>;
57
- disabled: PropTypes.Requireable<boolean>;
58
- items: PropTypes.Validator<NonNullable<NonNullable<(string | null | undefined)[] | (PropTypes.InferProps<{
59
- label: PropTypes.Requireable<string>;
60
- value: PropTypes.Requireable<string>;
61
- }> | null | undefined)[] | null | undefined>>>;
62
- caption: PropTypes.Requireable<string>;
63
- value: PropTypes.Requireable<string>;
64
- onValueChange: PropTypes.Requireable<(...args: any[]) => any>;
65
- renderItem: PropTypes.Requireable<(...args: any[]) => any>;
66
- };
67
51
  state: SwitcherState;
68
52
  private theme;
53
+ getRootNode: TGetRootNode;
69
54
  private setRootNode;
70
55
  render(): React.JSX.Element;
71
56
  private renderMain;
@@ -1,6 +1,5 @@
1
1
  "use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.SwitcherDataTids = exports.Switcher = void 0;var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
2
2
  var _react = _interopRequireDefault(require("react"));
3
- var _propTypes = _interopRequireDefault(require("prop-types"));
4
3
 
5
4
  var _identifiers = require("../../lib/events/keyboard/identifiers");
6
5
  var _Group = require("../Group");
@@ -16,6 +15,7 @@ var _Emotion = require("../../lib/theming/Emotion");
16
15
  var _rootNode = require("../../lib/rootNode");
17
16
 
18
17
  var _ThemeHelpers = require("../../lib/theming/ThemeHelpers");
18
+ var _featureFlagsContext = require("../../lib/featureFlagsContext");
19
19
 
20
20
  var _Switcher2 = require("./Switcher.styles");
21
21
  var _switcherTheme = require("./switcherTheme");
@@ -71,9 +71,6 @@ var SwitcherDataTids = exports.SwitcherDataTids = {
71
71
 
72
72
 
73
73
 
74
-
75
-
76
-
77
74
 
78
75
 
79
76
 
@@ -92,6 +89,9 @@ Switcher = exports.Switcher = (0, _rootNode.rootNode)(_class = (_Switcher = /*#_
92
89
 
93
90
 
94
91
 
92
+ state = {
93
+ focusedIndex: null
94
+ };_this.
95
95
 
96
96
 
97
97
 
@@ -110,19 +110,6 @@ Switcher = exports.Switcher = (0, _rootNode.rootNode)(_class = (_Switcher = /*#_
110
110
 
111
111
 
112
112
 
113
- state = {
114
- focusedIndex: null
115
- };_this.
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
113
 
127
114
 
128
115
 
@@ -241,7 +228,8 @@ Switcher = exports.Switcher = (0, _rootNode.rootNode)(_class = (_Switcher = /*#_
241
228
  };_this.
242
229
 
243
230
  _renderItems = function () {
244
- var _this$props2 = _this.props,items = _this$props2.items,value = _this$props2.value,size = _this$props2.size,disabled = _this$props2.disabled,role = _this$props2.role,renderItem = _this$props2.renderItem;
231
+ var _this$props2 = _this.props,items = _this$props2.items,value = _this$props2.value,size = _this$props2.size,width = _this$props2.width,disabled = _this$props2.disabled,role = _this$props2.role,renderItem = _this$props2.renderItem;
232
+
245
233
  return items.map(function (item, i) {
246
234
  var _this$_extractPropsFr4 =
247
235
 
@@ -270,8 +258,11 @@ Switcher = exports.Switcher = (0, _rootNode.rootNode)(_class = (_Switcher = /*#_
270
258
  customButtonProps);
271
259
 
272
260
 
273
- var renderDefault = function renderDefault() {return _this.renderDefaultItem(label, itemValue, buttonProps, ariaLabel);};
261
+ if (!buttonProps.width && width) {
262
+ buttonProps.width = '100%';
263
+ }
274
264
 
265
+ var renderDefault = function renderDefault() {return _this.renderDefaultItem(label, itemValue, buttonProps, ariaLabel);};
275
266
  return renderItem ? renderItem(label, itemValue, buttonProps, renderDefault, ariaLabel) : renderDefault();
276
267
  });
277
268
  };_this.
@@ -292,4 +283,4 @@ Switcher = exports.Switcher = (0, _rootNode.rootNode)(_class = (_Switcher = /*#_
292
283
  default:
293
284
  return _Switcher2.styles.captionSmall(_this.theme);
294
285
  }
295
- };return _this;}(0, _inheritsLoose2.default)(Switcher, _React$Component);var _proto = Switcher.prototype;_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = (0, _switcherTheme.getSwitcherTheme)(theme);return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Provider, { value: _this2.theme }, _this2.renderMain());});};_proto.renderMain = function renderMain() {var inputProps = { type: 'checkbox', onKeyDown: this.handleKey, onFocus: this._handleFocus, onBlur: this._handleBlur, className: _Switcher2.styles.input() };var isThemeGTE_5_1 = (0, _ThemeHelpers.isThemeGTE)(this.theme, '5.1');var isTheme_5_0 = !isThemeGTE_5_1;var items = /*#__PURE__*/_react.default.createElement(_Group.Group, null, this._renderItems());var captionClassName = (0, _Emotion.cx)(_Switcher2.styles.caption(this.theme), this.getLabelSizeClassName());var wrapperClassName = (0, _Emotion.cx)(_Switcher2.styles.wrap(), isThemeGTE_5_1 && this.props.error && _Switcher2.styles.error5_1(this.theme));var errorClassName = (0, _Emotion.cx)(isTheme_5_0 && this.props.error && _Switcher2.styles.error(this.theme));return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement("div", { "data-tid": SwitcherDataTids.root, className: _Switcher2.styles.root() }, this.props.caption ? /*#__PURE__*/_react.default.createElement("div", { className: captionClassName }, this.props.caption) : null, /*#__PURE__*/_react.default.createElement("div", { className: wrapperClassName }, /*#__PURE__*/_react.default.createElement("input", inputProps), isThemeGTE_5_1 ? items : /*#__PURE__*/_react.default.createElement("div", { className: errorClassName }, items))));};return Switcher;}(_react.default.Component), _Switcher.__KONTUR_REACT_UI__ = 'Switcher', _Switcher.displayName = 'Switcher', _Switcher.defaultProps = { role: 'switch' }, _Switcher.propTypes = { error: _propTypes.default.bool, disabled: _propTypes.default.bool, items: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.arrayOf(_propTypes.default.shape({ label: _propTypes.default.string, value: _propTypes.default.string }))]).isRequired, caption: _propTypes.default.string, value: _propTypes.default.string, onValueChange: _propTypes.default.func, renderItem: _propTypes.default.func }, _Switcher)) || _class;
286
+ };return _this;}(0, _inheritsLoose2.default)(Switcher, _React$Component);var _proto = Switcher.prototype;_proto.render = function render() {var _this2 = this;return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Consumer, null, function (theme) {_this2.theme = (0, _switcherTheme.getSwitcherTheme)(theme);return /*#__PURE__*/_react.default.createElement(_ThemeContext.ThemeContext.Provider, { value: _this2.theme }, _this2.renderMain());});};_proto.renderMain = function renderMain() {var _cx, _cx2;var inputProps = { type: 'checkbox', onKeyDown: this.handleKey, onFocus: this._handleFocus, onBlur: this._handleBlur, className: _Switcher2.styles.input() };var isThemeGTE_5_1 = (0, _ThemeHelpers.isThemeGTE)(this.theme, '5.1');var isTheme_5_0 = !isThemeGTE_5_1;var items = /*#__PURE__*/_react.default.createElement(_featureFlagsContext.ReactUIFeatureFlagsContext.Provider, { value: { groupAddHintAndTooltipSupport: true } }, /*#__PURE__*/_react.default.createElement(_Group.Group, { width: '100%' }, this._renderItems()));var captionClassName = (0, _Emotion.cx)(_Switcher2.styles.caption(this.theme), this.getLabelSizeClassName());var wrapperClassName = (0, _Emotion.cx)(_Switcher2.styles.wrap(), (_cx = {}, _cx[_Switcher2.styles.error5_1(this.theme)] = isThemeGTE_5_1 && this.props.error, _cx[_Switcher2.styles.wrapCustomWidth()] = this.props.width !== undefined, _cx));var errorClassName = (0, _Emotion.cx)((_cx2 = {}, _cx2[_Switcher2.styles.error(this.theme)] = isTheme_5_0 && this.props.error, _cx2));return /*#__PURE__*/_react.default.createElement(_CommonWrapper.CommonWrapper, (0, _extends2.default)({ rootNodeRef: this.setRootNode }, this.props), /*#__PURE__*/_react.default.createElement("div", { "data-tid": SwitcherDataTids.root, className: _Switcher2.styles.root(), style: { width: this.props.width } }, this.props.caption ? /*#__PURE__*/_react.default.createElement("div", { className: captionClassName }, this.props.caption) : null, /*#__PURE__*/_react.default.createElement("div", { className: wrapperClassName }, /*#__PURE__*/_react.default.createElement("input", inputProps), isThemeGTE_5_1 ? items : /*#__PURE__*/_react.default.createElement("div", { className: errorClassName }, items))));};return Switcher;}(_react.default.Component), _Switcher.__KONTUR_REACT_UI__ = 'Switcher', _Switcher.displayName = 'Switcher', _Switcher.defaultProps = { role: 'switch' }, _Switcher)) || _class;