@skbkontur/react-ui 5.4.7-7ccf0.0 → 5.4.7-a27a4.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 (281) hide show
  1. package/cjs/components/Button/Button.d.ts +1 -0
  2. package/cjs/components/Button/Button.js.map +1 -1
  3. package/cjs/components/Calendar/Calendar.d.ts +1 -1
  4. package/cjs/components/Calendar/Calendar.js.map +1 -1
  5. package/cjs/components/DateInput/DateFragmentsView.d.ts +2 -2
  6. package/cjs/components/DateInput/DateFragmentsView.js.map +1 -1
  7. package/cjs/components/DateRangePicker/DateRangePicker.d.ts +2 -2
  8. package/cjs/components/DateRangePicker/DateRangePicker.js.map +1 -1
  9. package/cjs/components/DateRangePicker/DateRangePickerContext.d.ts +3 -3
  10. package/cjs/components/DateRangePicker/DateRangePickerContext.js.map +1 -1
  11. package/cjs/components/DateRangePicker/DateRangePickerInput.js.map +1 -1
  12. package/cjs/components/Dropdown/Dropdown.d.ts +4 -4
  13. package/cjs/components/Dropdown/Dropdown.js.map +1 -1
  14. package/cjs/components/DropdownMenu/DropdownMenu.js +3 -1
  15. package/cjs/components/DropdownMenu/DropdownMenu.js.map +1 -1
  16. package/cjs/components/FileUploader/FileUploader.d.ts +1 -1
  17. package/cjs/components/FileUploader/FileUploaderFile.js.map +1 -1
  18. package/cjs/components/GlobalLoader/GlobalLoaderView.d.ts +3 -2
  19. package/cjs/components/GlobalLoader/GlobalLoaderView.js +49 -50
  20. package/cjs/components/GlobalLoader/GlobalLoaderView.js.map +1 -1
  21. package/cjs/components/Input/Input.d.ts +2 -2
  22. package/cjs/components/Input/Input.js.map +1 -1
  23. package/cjs/components/Input/InputLayout/InputLayout.d.ts +3 -1
  24. package/cjs/components/Input/InputLayout/InputLayout.js +2 -1
  25. package/cjs/components/Input/InputLayout/InputLayout.js.map +1 -1
  26. package/cjs/components/Input/InputLayout/InputLayoutAsideIcon.js +6 -4
  27. package/cjs/components/Input/InputLayout/InputLayoutAsideIcon.js.map +1 -1
  28. package/cjs/components/Kebab/Kebab.d.ts +1 -1
  29. package/cjs/components/Kebab/Kebab.js.map +1 -1
  30. package/cjs/components/Link/Link.d.ts +1 -1
  31. package/cjs/components/Link/Link.js.map +1 -1
  32. package/cjs/components/MaskedInput/ColorableInputElement/ColorableInputElement.d.ts +1 -1
  33. package/cjs/components/MaskedInput/ColorableInputElement/ColorableInputElement.js +1 -1
  34. package/cjs/components/MaskedInput/ColorableInputElement/ColorableInputElement.js.map +1 -1
  35. package/cjs/components/MaskedInput/FixedIMaskInput.js +3 -1
  36. package/cjs/components/MaskedInput/FixedIMaskInput.js.map +1 -1
  37. package/cjs/components/MaskedInput/MaskedInput.js +2 -2
  38. package/cjs/components/MaskedInput/MaskedInput.js.map +1 -1
  39. package/cjs/components/MenuItem/MenuItem.d.ts +1 -1
  40. package/cjs/components/MenuItem/MenuItem.js.map +1 -1
  41. package/cjs/components/Modal/Modal.d.ts +4 -1
  42. package/cjs/components/Modal/Modal.js +8 -3
  43. package/cjs/components/Modal/Modal.js.map +1 -1
  44. package/cjs/components/Modal/ModalBody.d.ts +2 -2
  45. package/cjs/components/Modal/ModalBody.js.map +1 -1
  46. package/cjs/components/Paging/Paging.d.ts +2 -2
  47. package/cjs/components/Paging/Paging.js.map +1 -1
  48. package/cjs/components/PasswordInput/PasswordInput.d.ts +1 -1
  49. package/cjs/components/PasswordInput/PasswordInput.js.map +1 -1
  50. package/cjs/components/RadioGroup/RadioGroup.d.ts +2 -2
  51. package/cjs/components/RadioGroup/RadioGroup.js.map +1 -1
  52. package/cjs/components/ResponsiveLayout/decorator.d.ts +0 -3
  53. package/cjs/components/ScrollContainer/ScrollContainer.d.ts +1 -1
  54. package/cjs/components/ScrollContainer/ScrollContainer.js.map +1 -1
  55. package/cjs/components/Select/Select.d.ts +1 -1
  56. package/cjs/components/Select/Select.js.map +1 -1
  57. package/cjs/components/SidePage/SidePage.d.ts +5 -2
  58. package/cjs/components/SidePage/SidePage.js +9 -3
  59. package/cjs/components/SidePage/SidePage.js.map +1 -1
  60. package/cjs/components/SidePage/SidePageFooter.d.ts +1 -1
  61. package/cjs/components/SidePage/SidePageFooter.js.map +1 -1
  62. package/cjs/components/SidePage/SidePageHeader.d.ts +1 -1
  63. package/cjs/components/SidePage/SidePageHeader.js.map +1 -1
  64. package/cjs/components/SingleToast/SingleToast.d.ts +1 -1
  65. package/cjs/components/Sticky/Sticky.js +6 -2
  66. package/cjs/components/Sticky/Sticky.js.map +1 -1
  67. package/cjs/components/Tabs/Tabs.d.ts +1 -1
  68. package/cjs/components/Tabs/Tabs.js.map +1 -1
  69. package/cjs/components/Token/TokenView.d.ts +2 -1
  70. package/cjs/components/Token/TokenView.js +4 -4
  71. package/cjs/components/Token/TokenView.js.map +1 -1
  72. package/cjs/components/TokenInput/TextWidthHelper.js +3 -1
  73. package/cjs/components/TokenInput/TextWidthHelper.js.map +1 -1
  74. package/cjs/components/TokenInput/TokenInput.js +14 -7
  75. package/cjs/components/TokenInput/TokenInput.js.map +1 -1
  76. package/cjs/components/Tooltip/Tooltip.d.ts +4 -4
  77. package/cjs/components/Tooltip/Tooltip.js.map +1 -1
  78. package/cjs/hooks/useDrop.js +1 -1
  79. package/cjs/hooks/useDrop.js.map +1 -1
  80. package/cjs/internal/CommonWrapper/CommonWrapper.js +3 -2
  81. package/cjs/internal/CommonWrapper/CommonWrapper.js.map +1 -1
  82. package/cjs/internal/FileUploaderControl/FileUploaderControlProvider.d.ts +3 -6
  83. package/cjs/internal/FileUploaderControl/FileUploaderControlProvider.js +84 -83
  84. package/cjs/internal/FileUploaderControl/FileUploaderControlProvider.js.map +1 -1
  85. package/cjs/internal/FileUploaderControl/withFileUploaderControlProvider.d.ts +1 -1
  86. package/cjs/internal/FileUploaderControl/withFileUploaderControlProvider.js +11 -12
  87. package/cjs/internal/FileUploaderControl/withFileUploaderControlProvider.js.map +1 -1
  88. package/cjs/internal/FocusControlWrapper/FocusControlWrapper.d.ts +5 -6
  89. package/cjs/internal/FocusControlWrapper/FocusControlWrapper.js +28 -23
  90. package/cjs/internal/FocusControlWrapper/FocusControlWrapper.js.map +1 -1
  91. package/cjs/internal/IgnoreLayerClick/IgnoreLayerClick.d.ts +1 -1
  92. package/cjs/internal/InputLikeText/InputLikeText.d.ts +2 -2
  93. package/cjs/internal/InputLikeText/InputLikeText.js.map +1 -1
  94. package/cjs/internal/Menu/Menu.js +6 -2
  95. package/cjs/internal/Menu/Menu.js.map +1 -1
  96. package/cjs/internal/Menu/MenuNavigation.d.ts +1 -1
  97. package/cjs/internal/Menu/MenuNavigation.js.map +1 -1
  98. package/cjs/internal/MobilePopup/MobilePopup.d.ts +1 -0
  99. package/cjs/internal/MobilePopup/MobilePopup.js +9 -1
  100. package/cjs/internal/MobilePopup/MobilePopup.js.map +1 -1
  101. package/cjs/internal/Popup/Popup.js +2 -4
  102. package/cjs/internal/Popup/Popup.js.map +1 -1
  103. package/cjs/internal/PopupMenu/PopupMenu.d.ts +1 -1
  104. package/cjs/internal/PopupMenu/PopupMenu.js +9 -3
  105. package/cjs/internal/PopupMenu/PopupMenu.js.map +1 -1
  106. package/cjs/internal/RenderLayer/RenderLayer.d.ts +2 -2
  107. package/cjs/internal/RenderLayer/RenderLayer.js.map +1 -1
  108. package/cjs/internal/TextWidthHelper/TextWidthHelper.js +3 -1
  109. package/cjs/internal/TextWidthHelper/TextWidthHelper.js.map +1 -1
  110. package/cjs/internal/ThemePlayground/FxInputPlayground.d.ts +1 -1
  111. package/cjs/internal/ThemePlayground/FxInputPlayground.js.map +1 -1
  112. package/cjs/lib/dom/getDOMRect.d.ts +1 -1
  113. package/cjs/lib/dom/getDOMRect.js +3 -1
  114. package/cjs/lib/dom/getDOMRect.js.map +1 -1
  115. package/cjs/lib/events/fixFirefoxModifiedClickOnLabel.d.ts +1 -1
  116. package/cjs/lib/events/fixFirefoxModifiedClickOnLabel.js.map +1 -1
  117. package/cjs/lib/forwardRefAndName.d.ts +3 -2
  118. package/cjs/lib/forwardRefAndName.js +2 -1
  119. package/cjs/lib/forwardRefAndName.js.map +1 -1
  120. package/cjs/lib/getElementRef.d.ts +5 -0
  121. package/cjs/lib/getElementRef.js +16 -0
  122. package/cjs/lib/getElementRef.js.map +1 -0
  123. package/cjs/lib/locale/decorators.d.ts +0 -3
  124. package/cjs/lib/mergeRefs.d.ts +2 -3
  125. package/cjs/lib/mergeRefs.js +1 -1
  126. package/cjs/lib/mergeRefs.js.map +1 -1
  127. package/cjs/lib/reactGetTextContent.js +6 -1
  128. package/cjs/lib/reactGetTextContent.js.map +1 -1
  129. package/cjs/lib/renderEnvironment/RenderEnvironmentDecorator.d.ts +0 -3
  130. package/cjs/lib/rootNode/getRootNode.js +1 -24
  131. package/cjs/lib/rootNode/getRootNode.js.map +1 -1
  132. package/cjs/lib/rootNode/rootNodeDecorator.d.ts +0 -3
  133. package/cjs/lib/size/SizeDecorator.d.ts +0 -3
  134. package/cjs/lib/types/polymorphic-component.d.ts +2 -1
  135. package/cjs/lib/types/polymorphic-component.js.map +1 -1
  136. package/cjs/lib/utils.d.ts +4 -3
  137. package/cjs/lib/utils.js +4 -3
  138. package/cjs/lib/utils.js.map +1 -1
  139. package/cjs/lib/withClassWrapper.d.ts +3 -8
  140. package/components/Button/Button/Button.js +1 -1
  141. package/components/Button/Button/Button.js.map +1 -1
  142. package/components/Button/Button.d.ts +1 -0
  143. package/components/Calendar/Calendar/Calendar.js.map +1 -1
  144. package/components/Calendar/Calendar.d.ts +1 -1
  145. package/components/DateInput/DateFragmentsView/DateFragmentsView.js.map +1 -1
  146. package/components/DateInput/DateFragmentsView.d.ts +2 -2
  147. package/components/DateRangePicker/DateRangePicker/DateRangePicker.js +1 -1
  148. package/components/DateRangePicker/DateRangePicker/DateRangePicker.js.map +1 -1
  149. package/components/DateRangePicker/DateRangePicker.d.ts +2 -2
  150. package/components/DateRangePicker/DateRangePickerContext/DateRangePickerContext.js.map +1 -1
  151. package/components/DateRangePicker/DateRangePickerContext.d.ts +3 -3
  152. package/components/DateRangePicker/DateRangePickerInput/DateRangePickerInput.js.map +1 -1
  153. package/components/Dropdown/Dropdown/Dropdown.js.map +1 -1
  154. package/components/Dropdown/Dropdown.d.ts +4 -4
  155. package/components/DropdownMenu/DropdownMenu/DropdownMenu.js +1 -1
  156. package/components/DropdownMenu/DropdownMenu/DropdownMenu.js.map +1 -1
  157. package/components/FileUploader/FileUploader.d.ts +1 -1
  158. package/components/FileUploader/FileUploaderFile/FileUploaderFile.js +1 -1
  159. package/components/FileUploader/FileUploaderFile/FileUploaderFile.js.map +1 -1
  160. package/components/GlobalLoader/GlobalLoaderView/GlobalLoaderView.js +5 -4
  161. package/components/GlobalLoader/GlobalLoaderView/GlobalLoaderView.js.map +1 -1
  162. package/components/GlobalLoader/GlobalLoaderView.d.ts +3 -2
  163. package/components/Input/Input/Input.js.map +1 -1
  164. package/components/Input/Input.d.ts +2 -2
  165. package/components/Input/InputLayout/InputLayout/InputLayout.js +4 -2
  166. package/components/Input/InputLayout/InputLayout/InputLayout.js.map +1 -1
  167. package/components/Input/InputLayout/InputLayout.d.ts +3 -1
  168. package/components/Input/InputLayout/InputLayoutAsideIcon/InputLayoutAsideIcon.js +2 -2
  169. package/components/Input/InputLayout/InputLayoutAsideIcon/InputLayoutAsideIcon.js.map +1 -1
  170. package/components/Kebab/Kebab/Kebab.js.map +1 -1
  171. package/components/Kebab/Kebab.d.ts +1 -1
  172. package/components/Link/Link/Link.js.map +1 -1
  173. package/components/Link/Link.d.ts +1 -1
  174. package/components/MaskedInput/ColorableInputElement/ColorableInputElement/ColorableInputElement.js +1 -1
  175. package/components/MaskedInput/ColorableInputElement/ColorableInputElement/ColorableInputElement.js.map +1 -1
  176. package/components/MaskedInput/ColorableInputElement/ColorableInputElement.d.ts +1 -1
  177. package/components/MaskedInput/FixedIMaskInput/FixedIMaskInput.js +1 -1
  178. package/components/MaskedInput/FixedIMaskInput/FixedIMaskInput.js.map +1 -1
  179. package/components/MaskedInput/MaskedInput/MaskedInput.js +2 -2
  180. package/components/MaskedInput/MaskedInput/MaskedInput.js.map +1 -1
  181. package/components/MenuItem/MenuItem/MenuItem.js.map +1 -1
  182. package/components/MenuItem/MenuItem.d.ts +1 -1
  183. package/components/Modal/Modal/Modal.js +7 -3
  184. package/components/Modal/Modal/Modal.js.map +1 -1
  185. package/components/Modal/Modal.d.ts +4 -1
  186. package/components/Modal/ModalBody/ModalBody.js.map +1 -1
  187. package/components/Modal/ModalBody.d.ts +2 -2
  188. package/components/Paging/Paging/Paging.js.map +1 -1
  189. package/components/Paging/Paging.d.ts +2 -2
  190. package/components/PasswordInput/PasswordInput/PasswordInput.js.map +1 -1
  191. package/components/PasswordInput/PasswordInput.d.ts +1 -1
  192. package/components/RadioGroup/RadioGroup/RadioGroup.js.map +1 -1
  193. package/components/RadioGroup/RadioGroup.d.ts +2 -2
  194. package/components/ResponsiveLayout/decorator.d.ts +0 -3
  195. package/components/ScrollContainer/ScrollContainer/ScrollContainer.js +1 -1
  196. package/components/ScrollContainer/ScrollContainer/ScrollContainer.js.map +1 -1
  197. package/components/ScrollContainer/ScrollContainer.d.ts +1 -1
  198. package/components/Select/Select/Select.js.map +1 -1
  199. package/components/Select/Select.d.ts +1 -1
  200. package/components/SidePage/SidePage/SidePage.js +7 -3
  201. package/components/SidePage/SidePage/SidePage.js.map +1 -1
  202. package/components/SidePage/SidePage.d.ts +5 -2
  203. package/components/SidePage/SidePageFooter/SidePageFooter.js.map +1 -1
  204. package/components/SidePage/SidePageFooter.d.ts +1 -1
  205. package/components/SidePage/SidePageHeader/SidePageHeader.js.map +1 -1
  206. package/components/SidePage/SidePageHeader.d.ts +1 -1
  207. package/components/SingleToast/SingleToast.d.ts +1 -1
  208. package/components/Sticky/Sticky/Sticky.js +2 -2
  209. package/components/Sticky/Sticky/Sticky.js.map +1 -1
  210. package/components/Tabs/Tabs/Tabs.js.map +1 -1
  211. package/components/Tabs/Tabs.d.ts +1 -1
  212. package/components/Token/TokenView/TokenView.js +6 -4
  213. package/components/Token/TokenView/TokenView.js.map +1 -1
  214. package/components/Token/TokenView.d.ts +2 -1
  215. package/components/TokenInput/TextWidthHelper/TextWidthHelper.js +1 -1
  216. package/components/TokenInput/TextWidthHelper/TextWidthHelper.js.map +1 -1
  217. package/components/TokenInput/TokenInput/TokenInput.js +5 -5
  218. package/components/TokenInput/TokenInput/TokenInput.js.map +1 -1
  219. package/components/Tooltip/Tooltip/Tooltip.js.map +1 -1
  220. package/components/Tooltip/Tooltip.d.ts +4 -4
  221. package/hooks/useDrop/useDrop.js +1 -1
  222. package/hooks/useDrop/useDrop.js.map +1 -1
  223. package/internal/CommonWrapper/CommonWrapper/CommonWrapper.js +3 -2
  224. package/internal/CommonWrapper/CommonWrapper/CommonWrapper.js.map +1 -1
  225. package/internal/FileUploaderControl/FileUploaderControlProvider/FileUploaderControlProvider.js +2 -2
  226. package/internal/FileUploaderControl/FileUploaderControlProvider/FileUploaderControlProvider.js.map +1 -1
  227. package/internal/FileUploaderControl/FileUploaderControlProvider.d.ts +3 -6
  228. package/internal/FileUploaderControl/withFileUploaderControlProvider/withFileUploaderControlProvider.js +2 -3
  229. package/internal/FileUploaderControl/withFileUploaderControlProvider/withFileUploaderControlProvider.js.map +1 -1
  230. package/internal/FileUploaderControl/withFileUploaderControlProvider.d.ts +1 -1
  231. package/internal/FocusControlWrapper/FocusControlWrapper/FocusControlWrapper.js +7 -4
  232. package/internal/FocusControlWrapper/FocusControlWrapper/FocusControlWrapper.js.map +1 -1
  233. package/internal/FocusControlWrapper/FocusControlWrapper.d.ts +5 -6
  234. package/internal/IgnoreLayerClick/IgnoreLayerClick.d.ts +1 -1
  235. package/internal/InputLikeText/InputLikeText/InputLikeText.js.map +1 -1
  236. package/internal/InputLikeText/InputLikeText.d.ts +2 -2
  237. package/internal/Menu/Menu/Menu.js +2 -2
  238. package/internal/Menu/Menu/Menu.js.map +1 -1
  239. package/internal/Menu/MenuNavigation/MenuNavigation.js.map +1 -1
  240. package/internal/Menu/MenuNavigation.d.ts +1 -1
  241. package/internal/MobilePopup/MobilePopup/MobilePopup.js +5 -2
  242. package/internal/MobilePopup/MobilePopup/MobilePopup.js.map +1 -1
  243. package/internal/MobilePopup/MobilePopup.d.ts +1 -0
  244. package/internal/Popup/Popup/Popup.js +2 -2
  245. package/internal/Popup/Popup/Popup.js.map +1 -1
  246. package/internal/PopupMenu/PopupMenu/PopupMenu.js +3 -3
  247. package/internal/PopupMenu/PopupMenu/PopupMenu.js.map +1 -1
  248. package/internal/PopupMenu/PopupMenu.d.ts +1 -1
  249. package/internal/RenderLayer/RenderLayer/RenderLayer.js.map +1 -1
  250. package/internal/RenderLayer/RenderLayer.d.ts +2 -2
  251. package/internal/TextWidthHelper/TextWidthHelper/TextWidthHelper.js +1 -1
  252. package/internal/TextWidthHelper/TextWidthHelper/TextWidthHelper.js.map +1 -1
  253. package/internal/ThemePlayground/FxInputPlayground/FxInputPlayground.js.map +1 -1
  254. package/internal/ThemePlayground/FxInputPlayground.d.ts +1 -1
  255. package/lib/dom/getDOMRect/getDOMRect.js.map +1 -1
  256. package/lib/dom/getDOMRect.d.ts +1 -1
  257. package/lib/events/fixFirefoxModifiedClickOnLabel/fixFirefoxModifiedClickOnLabel.js.map +1 -1
  258. package/lib/events/fixFirefoxModifiedClickOnLabel.d.ts +1 -1
  259. package/lib/forwardRefAndName/forwardRefAndName.js.map +1 -1
  260. package/lib/forwardRefAndName.d.ts +3 -2
  261. package/lib/getElementRef/getElementRef.js +11 -0
  262. package/lib/getElementRef/getElementRef.js.map +1 -0
  263. package/lib/getElementRef/package.json +6 -0
  264. package/lib/getElementRef.d.ts +5 -0
  265. package/lib/locale/decorators.d.ts +0 -3
  266. package/lib/mergeRefs/mergeRefs.js.map +1 -1
  267. package/lib/mergeRefs.d.ts +2 -3
  268. package/lib/reactGetTextContent/reactGetTextContent.js +1 -1
  269. package/lib/reactGetTextContent/reactGetTextContent.js.map +1 -1
  270. package/lib/renderEnvironment/RenderEnvironmentDecorator.d.ts +0 -3
  271. package/lib/rootNode/getRootNode/getRootNode.js +0 -15
  272. package/lib/rootNode/getRootNode/getRootNode.js.map +1 -1
  273. package/lib/rootNode/rootNodeDecorator.d.ts +0 -3
  274. package/lib/size/SizeDecorator.d.ts +0 -3
  275. package/lib/types/polymorphic-component/polymorphic-component.js.map +1 -1
  276. package/lib/types/polymorphic-component.d.ts +2 -1
  277. package/lib/utils/utils.js +2 -2
  278. package/lib/utils/utils.js.map +1 -1
  279. package/lib/utils.d.ts +4 -3
  280. package/lib/withClassWrapper.d.ts +3 -8
  281. package/package.json +10 -9
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { type JSX } from 'react';
2
2
  import type { PopupPositionsType, ShortPopupPositionsType } from '../../internal/Popup';
3
3
  import type { Nullable } from '../../typings/utility-types';
4
4
  import type { CommonProps } from '../../internal/CommonWrapper';
@@ -104,9 +104,9 @@ export declare class Tooltip extends React.PureComponent<TooltipProps, TooltipSt
104
104
  componentDidMount(): void;
105
105
  componentDidUpdate(): void;
106
106
  componentWillUnmount(): void;
107
- render(): React.JSX.Element;
108
- renderContent: () => React.JSX.Element | null;
109
- renderCloseButton(): React.JSX.Element | null;
107
+ render(): JSX.Element;
108
+ renderContent: () => JSX.Element | null;
109
+ renderCloseButton(): JSX.Element | null;
110
110
  getAnchorElement: () => Nullable<Element>;
111
111
  /**
112
112
  * Программно открывает тултип.
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_warning","_utils","_ThemeFactory","_Popup","_RenderLayer","_listenFocusOutside","_ThemeContext","_currentEnvironment","_CommonWrapper","_rootNode","_createPropsGetter","_CloseButtonIcon","_isInstanceOf","_SizeDecorator","_renderEnvironment","_Tooltip2","_class","_Tooltip","DEFAULT_DELAY","TooltipDataTids","exports","root","content","crossIcon","DefaultPositions","Tooltip","withRenderEnvironment","rootNode","withSize","_React$PureComponent","_this","_len","arguments","length","args","Array","_key","call","apply","concat","getProps","createPropsGetter","defaultProps","state","opened","focused","contentElement","clickedOutside","popupRef","React","createRef","renderContent","props","render","isNullable","default","createElement","ref","refContent","className","cx","styles","tooltipContent","theme","sizeVariables","contentStyle","renderCloseButton","getAnchorElement","_this$popupRef$curren","current","anchorElement","getPositions","allowedPositions","filter","item","includes","node","open","setState","close","handleMouseEnter","event","isHoverAnchor","trigger","target","clearHoverTimeout","hoverTimeout","setTimeout","delayBeforeShow","handleMouseLeave","relatedTarget","delay","handleClick","handleClickOutsideAnchor","isClickOutsideContent","onCloseRequest","handleFocus","handleBlur","handleCloseButtonClick","stopPropagation","onCloseClick","defaultPrevented","getSizeVariables","size","closeButtonStyle","closeButtonSmall","tooltipContentSmall","borderRadius","tooltipBorderRadiusSmall","pinSize","tooltipPinSizeSmall","pinOffsetX","tooltipPinOffsetXSmall","pinOffsetY","tooltipPinOffsetYSmall","margin","tooltipMarginSmall","closeButtonMedium","tooltipContentMedium","tooltipBorderRadiusMedium","tooltipPinSizeMedium","tooltipPinOffsetXMedium","tooltipPinOffsetYMedium","tooltipMarginMedium","closeButtonLarge","tooltipContentLarge","tooltipBorderRadiusLarge","tooltipPinSizeLarge","tooltipPinOffsetXLarge","tooltipPinOffsetYLarge","tooltipMarginLarge","warning","_inheritsLoose2","_proto","prototype","validateProps","children","getAllowedPositions","componentDidMount","componentDidUpdate","_this$getProps","componentWillUnmount","_this2","getStyles","emotion","ThemeContext","Consumer","Provider","value","ThemeFactory","create","popupBackground","tooltipBg","popupBorder","tooltipBorder","popupBorderRadius","popupPinSize","popupPinOffsetX","popupPinOffsetY","popupMargin","renderMain","hasCross","closeButton","undefined","triggersWithoutCloseButton","icon","CloseButtonIcon","tabbable","side","parseInt","tooltipCloseBtnSide","color","tooltipCloseBtnColor","colorHover","tooltipCloseBtnHoverColor","onClick","show","hide","_this$getPopupAndLaye","getPopupAndLayerProps","popupProps","_this$getPopupAndLaye2","layerProps","active","popup","renderPopup","RenderLayer","_extends2","_this$getProps2","disableAnimations","CommonWrapper","rootNodeRef","setRootNode","Popup","hasPin","hasShadow","maxWidth","positions","pos","ignoreHover","onOpen","onClose","tryPreserveFirstRenderedPosition","withoutMobile","useWrapper","defaultPopupAndLayerProps","onMouseEnter","onMouseLeave","onClickOutside","onFocus","onBlur","clearTimeout","isInstanceOf","globalObject","Element","containsTargetOrRenderContainer","PureComponent","__KONTUR_REACT_UI__","displayName","isTestEnv"],"sources":["Tooltip.tsx"],"sourcesContent":["import React from 'react';\nimport warning from 'warning';\nimport type { Emotion } from '@emotion/css/types/create-instance';\n\nimport type { GlobalObject, SafeTimer } from '../../lib/globalObject';\nimport { isNullable } from '../../lib/utils';\nimport { ThemeFactory } from '../../lib/theming/ThemeFactory';\nimport type { PopupProps, PopupPositionsType, ShortPopupPositionsType } from '../../internal/Popup';\nimport { Popup } from '../../internal/Popup';\nimport type { RenderLayerProps } from '../../internal/RenderLayer';\nimport { RenderLayer } from '../../internal/RenderLayer';\nimport type { Nullable } from '../../typings/utility-types';\nimport type { MouseEventType } from '../../typings/event-types';\nimport { containsTargetOrRenderContainer } from '../../lib/listenFocusOutside';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport type { Theme } from '../../lib/theming/Theme';\nimport { isTestEnv } from '../../lib/currentEnvironment';\nimport type { CommonProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport type { TGetRootNode, TSetRootNode } from '../../lib/rootNode';\nimport { rootNode } from '../../lib/rootNode';\nimport type { InstanceWithAnchorElement } from '../../lib/InstanceWithAnchorElement';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { CloseButtonIcon } from '../../internal/CloseButtonIcon/CloseButtonIcon';\nimport { isInstanceOf } from '../../lib/isInstanceOf';\nimport type { SizeProp } from '../../lib/types/props';\nimport { withSize } from '../../lib/size/SizeDecorator';\nimport { withRenderEnvironment } from '../../lib/renderEnvironment';\n\nimport { getStyles } from './Tooltip.styles';\n\nexport type TooltipTrigger =\n /** Наведение на children и на тултип */\n | 'hover'\n /** Клик на children */\n | 'click'\n /** Фокус на children */\n | 'focus'\n /** Наведение на children и на тултип и фокус на children */\n | 'hover&focus'\n /** Просто открыт */\n | 'opened'\n /** Просто закрыт */\n | 'closed'\n /** Наведение ТОЛЬКО на children, а не на тултип */\n | 'hoverAnchor'\n /** Управление через публичные функции show и hide */\n | 'manual';\n\nexport interface TooltipProps extends CommonProps {\n /** Указывает элемент, относительно которого позиционировать тултип. */\n anchorElement?: HTMLElement;\n\n /** @ignore */\n children?: React.ReactNode;\n\n /** Задает HTML-атрибут class. */\n className?: string;\n\n /** Отображает крестик для закрытия тултипа. По-умолчанию крестик виден, если проп *trigger* не равен `hover` или `focus`. */\n closeButton?: boolean;\n\n /** Задает функцию, которая возвращает содержимое тултипа. Если функция вернула `null`, то тултип не показывается. */\n render?: Nullable<() => React.ReactNode>;\n\n /** Задает приоритетное расположение подсказки относительно текста. */\n pos?: ShortPopupPositionsType | PopupPositionsType;\n\n /** Задает размер тултипа.\n * @default 'small' */\n size?: SizeProp;\n\n /** Задает триггер открытия тултипа. */\n trigger?: TooltipTrigger;\n\n /** Задает хендлер, который вызывается при клике по крестику. */\n onCloseClick?: React.MouseEventHandler<HTMLElement>;\n\n /** Задает хендлер, который вызывается при клике по крестику или снаружи тултипа. */\n onCloseRequest?: (event?: Event | React.MouseEvent) => void;\n\n /** Задает хендлер, который вызывается при закрытии тултипа. */\n onClose?: () => void;\n\n /** Задает хендлер, который вызывается при открытии тултипа. */\n onOpen?: () => void;\n\n /** Задает список позиций, которые тултип будет занимать.\n * Если положение тултипа в определенной позиции будет выходить за край экрана, то будет выбрана следующая позиция.\n * Обязательно должен включать позицию указанную в `pos`. */\n allowedPositions?: PopupPositionsType[];\n\n /** Отключает анимацию.\n * @default false */\n disableAnimations?: boolean;\n\n /** Явно указывает, что вложенные элементы должны быть обёрнуты в `<span/>`.\n * Используется для корректного позиционирования тултипа при двух и более вложенных элементах.\n * _Примечание_: при **двух и более** вложенных элементах обёртка будет добавлена автоматически. */\n useWrapper?: boolean;\n\n /** Устанавливает задержку в миллисекундах до появления лоадера. */\n delayBeforeShow?: number;\n}\n\nconst DEFAULT_DELAY = 100;\n\nexport interface TooltipState {\n opened: boolean;\n focused: boolean;\n}\n\nexport const TooltipDataTids = {\n root: 'Tooltip__root',\n content: 'Tooltip__content',\n crossIcon: 'Tooltip__crossIcon',\n} as const;\n\nconst DefaultPositions: PopupPositionsType[] = [\n 'right bottom',\n 'right middle',\n 'right top',\n 'top right',\n 'top center',\n 'top left',\n 'left top',\n 'left middle',\n 'left bottom',\n 'bottom left',\n 'bottom center',\n 'bottom right',\n];\n\ninterface TooltipSizeVariables {\n closeButtonStyle: string;\n contentStyle: string;\n borderRadius: string;\n pinSize: string;\n pinOffsetX: string;\n pinOffsetY: string;\n margin: string;\n}\n\ntype DefaultProps = Required<Pick<TooltipProps, 'trigger' | 'disableAnimations' | 'useWrapper' | 'delayBeforeShow'>>;\n\n/**\n * `Tooltip` — это подсказка, которая объясняет состояние контрола или даёт контекстную справку.\n *\n * Открывается по клику, фокусом на элемент или по наведению. В отличие от `Hint`, `Tooltip` может содержать\n * изображения, кнопки, ссылки и прочие интерактивные элементы.\n */\n@withRenderEnvironment\n@rootNode\n@withSize\nexport class Tooltip extends React.PureComponent<TooltipProps, TooltipState> implements InstanceWithAnchorElement {\n public static __KONTUR_REACT_UI__ = 'Tooltip';\n public static displayName = 'Tooltip';\n\n public static defaultProps: DefaultProps = {\n trigger: 'hover',\n disableAnimations: isTestEnv,\n useWrapper: false,\n delayBeforeShow: DEFAULT_DELAY,\n };\n\n private getProps = createPropsGetter(Tooltip.defaultProps);\n private validateProps(props: TooltipProps): void {\n warning(\n props.children || props.anchorElement,\n `[Tooltip]: you must provide either 'children' or 'anchorElement' prop for Tooltip to work properly`,\n );\n }\n\n public static delay = DEFAULT_DELAY;\n private static triggersWithoutCloseButton: TooltipTrigger[] = ['hover', 'hoverAnchor', 'focus', 'hover&focus'];\n\n public state: TooltipState = { opened: false, focused: false };\n private globalObject!: GlobalObject;\n private emotion!: Emotion;\n private cx!: Emotion['cx'];\n private styles!: ReturnType<typeof getStyles>;\n private theme!: Theme;\n private size!: SizeProp;\n private sizeVariables!: TooltipSizeVariables;\n private hoverTimeout: SafeTimer;\n private contentElement: Nullable<HTMLElement> = null;\n private clickedOutside = true;\n public getRootNode!: TGetRootNode;\n private setRootNode!: TSetRootNode;\n\n private popupRef = React.createRef<Popup>();\n\n public getAllowedPositions() {\n return this.props.allowedPositions ? this.props.allowedPositions : DefaultPositions;\n }\n\n public componentDidMount(): void {\n this.validateProps(this.getProps());\n }\n\n public componentDidUpdate() {\n const { trigger } = this.getProps();\n\n this.validateProps(this.getProps());\n if (trigger === 'closed' && this.state.opened) {\n this.close();\n }\n }\n\n public componentWillUnmount() {\n this.clearHoverTimeout();\n }\n\n public render() {\n this.styles = getStyles(this.emotion);\n\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n this.sizeVariables = this.getSizeVariables();\n return (\n <ThemeContext.Provider\n value={ThemeFactory.create(\n {\n popupBackground: theme.tooltipBg,\n popupBorder: theme.tooltipBorder,\n popupBorderRadius: this.sizeVariables.borderRadius,\n popupPinSize: this.sizeVariables.pinSize,\n popupPinOffsetX: this.sizeVariables.pinOffsetX,\n popupPinOffsetY: this.sizeVariables.pinOffsetY,\n popupMargin: this.sizeVariables.margin,\n },\n theme,\n )}\n >\n {this.renderMain()}\n </ThemeContext.Provider>\n );\n }}\n </ThemeContext.Consumer>\n );\n }\n\n public renderContent = () => {\n const content = this.props.render ? this.props.render() : null;\n if (isNullable(content)) {\n return null;\n }\n\n return (\n <div\n ref={this.refContent}\n className={this.cx(this.styles.tooltipContent(this.theme), this.sizeVariables.contentStyle)}\n data-tid={TooltipDataTids.content}\n >\n {content}\n {this.renderCloseButton()}\n </div>\n );\n };\n\n public renderCloseButton() {\n const hasCross =\n this.props.closeButton === undefined\n ? !Tooltip.triggersWithoutCloseButton.includes(this.getProps().trigger)\n : this.props.closeButton;\n\n if (!hasCross) {\n return null;\n }\n\n const icon = (\n <CloseButtonIcon\n tabbable={false}\n side={parseInt(this.theme.tooltipCloseBtnSide)}\n color={this.theme.tooltipCloseBtnColor}\n colorHover={this.theme.tooltipCloseBtnHoverColor}\n />\n );\n\n return (\n <div\n className={this.cx(this.styles.closeButton(this.theme), this.sizeVariables.closeButtonStyle)}\n onClick={this.handleCloseButtonClick}\n data-tid={TooltipDataTids.crossIcon}\n >\n {icon}\n </div>\n );\n }\n\n public getAnchorElement = (): Nullable<Element> => {\n return this.popupRef.current?.anchorElement;\n };\n\n /**\n * Программно открывает тултип.\n * <p>Не действует если проп *trigger* `'opened'` или `'closed'`.</p>\n * @public\n */\n public show() {\n if (this.state.opened) {\n return;\n }\n const trigger = this.getProps().trigger;\n if (trigger === 'opened' || trigger === 'closed') {\n warning(false, `Function 'show' is not supported with trigger specified '${trigger}'`);\n return;\n }\n this.open();\n }\n\n /**\n * Программно закрывает тултип.\n * <p>Не действует если проп *trigger* `'opened'` или `'closed'`.</p>\n * @public\n */\n public hide() {\n const trigger = this.getProps().trigger;\n if (trigger === 'opened' || trigger === 'closed') {\n warning(false, `Function 'hide' is not supported with trigger specified '${trigger}'`);\n return;\n }\n this.close();\n }\n\n private renderMain() {\n const props = this.props;\n const content = this.renderContent();\n const { popupProps, layerProps = { active: false } } = this.getPopupAndLayerProps();\n const anchorElement = props.children || props.anchorElement;\n const popup = this.renderPopup(anchorElement, popupProps, content);\n\n return (\n <RenderLayer {...layerProps} getAnchorElement={this.getAnchorElement}>\n {popup}\n </RenderLayer>\n );\n }\n\n private renderPopup(\n anchorElement: React.ReactNode | HTMLElement,\n popupProps: Partial<PopupProps>,\n content: JSX.Element | null,\n ) {\n const { disableAnimations, trigger } = this.getProps();\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <Popup\n data-tid={TooltipDataTids.root}\n anchorElement={anchorElement}\n hasPin\n hasShadow\n maxWidth=\"none\"\n opened={this.state.opened}\n disableAnimations={disableAnimations}\n positions={this.getPositions()}\n pos={this.props.pos}\n ignoreHover={trigger === 'hoverAnchor'}\n onOpen={this.props.onOpen}\n onClose={this.props.onClose}\n tryPreserveFirstRenderedPosition\n ref={this.popupRef}\n withoutMobile\n {...popupProps}\n >\n {content}\n </Popup>\n </CommonWrapper>\n );\n }\n\n private getPositions = (): PopupPositionsType[] =>\n this.props.allowedPositions\n ? this.props.allowedPositions.filter((item) => DefaultPositions.includes(item))\n : DefaultPositions;\n\n private refContent = (node: HTMLElement | null) => {\n this.contentElement = node;\n };\n\n private getPopupAndLayerProps(): {\n layerProps?: Partial<RenderLayerProps>;\n popupProps: Partial<PopupProps>;\n } {\n const props = this.props;\n const useWrapper = !!props.children && this.getProps().useWrapper;\n const trigger = this.getProps().trigger;\n\n const defaultPopupAndLayerProps: ReturnType<typeof this.getPopupAndLayerProps> = {\n popupProps: {\n onMouseEnter: this.handleMouseEnter,\n onMouseLeave: this.handleMouseLeave,\n useWrapper,\n },\n };\n\n switch (trigger) {\n case 'opened':\n return {\n layerProps: {\n active: true,\n onClickOutside: this.handleClickOutsideAnchor,\n },\n popupProps: {\n opened: true,\n useWrapper,\n },\n };\n\n case 'closed':\n return {\n popupProps: {\n opened: false,\n useWrapper,\n },\n };\n\n case 'manual':\n return {\n popupProps: {\n useWrapper,\n },\n };\n case 'click':\n return {\n layerProps: {\n active: this.state.opened,\n onClickOutside: this.handleClickOutsideAnchor,\n },\n popupProps: {\n onClick: this.handleClick,\n useWrapper,\n },\n };\n\n case 'focus':\n return {\n popupProps: {\n onFocus: this.handleFocus,\n onBlur: this.handleBlur,\n useWrapper,\n },\n };\n\n case 'hover&focus':\n return {\n layerProps: {\n active: this.state.opened,\n onClickOutside: this.handleClickOutsideAnchor,\n },\n popupProps: {\n onFocus: this.handleFocus,\n onBlur: this.handleBlur,\n onMouseEnter: this.handleMouseEnter,\n onMouseLeave: this.handleMouseLeave,\n useWrapper,\n },\n };\n\n case 'hoverAnchor':\n case 'hover':\n return defaultPopupAndLayerProps;\n default:\n warning(false, `Unknown trigger specified: ${trigger}. Returning default value.`);\n return defaultPopupAndLayerProps;\n }\n }\n\n private open = () => this.setState({ opened: true });\n\n private close = () => this.setState({ opened: false });\n\n private clearHoverTimeout() {\n if (this.hoverTimeout) {\n clearTimeout(this.hoverTimeout);\n this.hoverTimeout = null;\n }\n }\n\n private handleMouseEnter = (event: MouseEventType) => {\n const isHoverAnchor = this.getProps().trigger === 'hoverAnchor';\n if (isHoverAnchor && event.target === this.contentElement) {\n return;\n }\n\n this.clearHoverTimeout();\n this.hoverTimeout = setTimeout(this.open, this.getProps().delayBeforeShow);\n };\n\n private handleMouseLeave = (event: MouseEventType) => {\n const trigger = this.getProps().trigger;\n if (\n (trigger === 'hover&focus' && this.state.focused) ||\n (trigger === 'hover' && event.relatedTarget === this.contentElement)\n ) {\n return;\n }\n\n this.clearHoverTimeout();\n\n if (trigger === 'hoverAnchor') {\n this.close();\n } else {\n this.hoverTimeout = setTimeout(this.close, Tooltip.delay);\n }\n };\n\n private handleClick = () => {\n this.open();\n };\n\n private handleClickOutsideAnchor = (event: Event) => {\n this.clickedOutside = this.isClickOutsideContent(event);\n if (this.clickedOutside) {\n if (this.props.onCloseRequest) {\n this.props.onCloseRequest(event);\n }\n this.close();\n }\n };\n\n private isClickOutsideContent(event: Event) {\n if (this.contentElement && isInstanceOf(event.target, this.globalObject.Element)) {\n return !containsTargetOrRenderContainer(event.target)(this.contentElement);\n }\n\n return true;\n }\n\n private handleFocus = () => {\n this.setState({ focused: true });\n this.open();\n };\n\n private handleBlur = () => {\n const trigger = this.getProps().trigger;\n if (trigger === 'hover&focus' && this.clickedOutside) {\n this.close();\n }\n\n if (trigger === 'focus') {\n this.close();\n }\n\n this.clickedOutside = true;\n this.setState({ focused: false });\n };\n\n private handleCloseButtonClick = (event: React.MouseEvent<HTMLElement>) => {\n event.stopPropagation();\n\n if (this.props.onCloseClick) {\n this.props.onCloseClick(event);\n }\n\n if (event.defaultPrevented) {\n return;\n }\n\n if (this.props.onCloseRequest) {\n this.props.onCloseRequest(event);\n }\n\n this.close();\n };\n\n private getSizeVariables = (): TooltipSizeVariables => {\n switch (this.size) {\n case 'small':\n return {\n closeButtonStyle: this.styles.closeButtonSmall(this.theme),\n contentStyle: this.styles.tooltipContentSmall(this.theme),\n borderRadius: this.theme.tooltipBorderRadiusSmall,\n pinSize: this.theme.tooltipPinSizeSmall,\n pinOffsetX: this.theme.tooltipPinOffsetXSmall,\n pinOffsetY: this.theme.tooltipPinOffsetYSmall,\n margin: this.theme.tooltipMarginSmall,\n };\n case 'medium':\n return {\n closeButtonStyle: this.styles.closeButtonMedium(this.theme),\n contentStyle: this.styles.tooltipContentMedium(this.theme),\n borderRadius: this.theme.tooltipBorderRadiusMedium,\n pinSize: this.theme.tooltipPinSizeMedium,\n pinOffsetX: this.theme.tooltipPinOffsetXMedium,\n pinOffsetY: this.theme.tooltipPinOffsetYMedium,\n margin: this.theme.tooltipMarginMedium,\n };\n case 'large':\n return {\n closeButtonStyle: this.styles.closeButtonLarge(this.theme),\n contentStyle: this.styles.tooltipContentLarge(this.theme),\n borderRadius: this.theme.tooltipBorderRadiusLarge,\n pinSize: this.theme.tooltipPinSizeLarge,\n pinOffsetX: this.theme.tooltipPinOffsetXLarge,\n pinOffsetY: this.theme.tooltipPinOffsetYLarge,\n margin: this.theme.tooltipMarginLarge,\n };\n default:\n warning(false, `Can't get size variables: invalid value in size prop '${this.props.size}'. Returning default`);\n return {\n closeButtonStyle: this.styles.closeButtonSmall(this.theme),\n contentStyle: this.styles.tooltipContentSmall(this.theme),\n borderRadius: this.theme.tooltipBorderRadiusSmall,\n pinSize: this.theme.tooltipPinSizeSmall,\n pinOffsetX: this.theme.tooltipPinOffsetXSmall,\n pinOffsetY: this.theme.tooltipPinOffsetYSmall,\n margin: this.theme.tooltipMarginSmall,\n };\n }\n };\n}\n"],"mappings":"uWAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAA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CAACA,YAAY,GAAG,IAAI,CAC1B,CACF,CAAC,CAAA+C,MAAA,CA4COvC,qBAAqB,GAA7B,SAAAA,sBAA8Bb,KAAY,EAAE,CAC1C,IAAI,IAAI,CAACnC,cAAc,IAAI,IAAAsK,0BAAY,EAACnI,KAAK,CAACG,MAAM,EAAE,IAAI,CAACiI,YAAY,CAACC,OAAO,CAAC,EAAE,CAChF,OAAO,CAAC,IAAAC,mDAA+B,EAACtI,KAAK,CAACG,MAAM,CAAC,CAAC,IAAI,CAACtC,cAAc,CAAC,CAC5E,CAEA,OAAO,IAAI,CACb,CAAC,QAAArB,OAAA,GAvX0BwB,cAAK,CAACuK,aAAa,GAAAvM,QAAA,CAChCwM,mBAAmB,GAAG,SAAS,EAAAxM,QAAA,CAC/ByM,WAAW,GAAG,SAAS,EAAAzM,QAAA,CAEvByB,YAAY,GAAiB,EACzCyC,OAAO,EAAE,OAAO,EAChB0G,iBAAiB,EAAE8B,6BAAS,EAC5Bf,UAAU,EAAE,KAAK,EACjBpH,eAAe,EAAEtE,aAAa,CAChC,CAAC,EAAAD,QAAA,CAUa0E,KAAK,GAAGzE,aAAa,EAAAD,QAAA,CACpBmJ,0BAA0B,GAAqB,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,CAAC,EAAAnJ,QAAA,MAAAD,MAAA,KAAAA,MAAA,KAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_warning","_utils","_ThemeFactory","_Popup","_RenderLayer","_listenFocusOutside","_ThemeContext","_currentEnvironment","_CommonWrapper","_rootNode","_createPropsGetter","_CloseButtonIcon","_isInstanceOf","_SizeDecorator","_renderEnvironment","_Tooltip2","_class","_Tooltip","DEFAULT_DELAY","TooltipDataTids","exports","root","content","crossIcon","DefaultPositions","Tooltip","withRenderEnvironment","rootNode","withSize","_React$PureComponent","_this","_len","arguments","length","args","Array","_key","call","apply","concat","getProps","createPropsGetter","defaultProps","state","opened","focused","contentElement","clickedOutside","popupRef","React","createRef","renderContent","props","render","isNullable","default","createElement","ref","refContent","className","cx","styles","tooltipContent","theme","sizeVariables","contentStyle","renderCloseButton","getAnchorElement","_this$popupRef$curren","current","anchorElement","getPositions","allowedPositions","filter","item","includes","node","open","setState","close","handleMouseEnter","event","isHoverAnchor","trigger","target","clearHoverTimeout","hoverTimeout","setTimeout","delayBeforeShow","handleMouseLeave","relatedTarget","delay","handleClick","handleClickOutsideAnchor","isClickOutsideContent","onCloseRequest","handleFocus","handleBlur","handleCloseButtonClick","stopPropagation","onCloseClick","defaultPrevented","getSizeVariables","size","closeButtonStyle","closeButtonSmall","tooltipContentSmall","borderRadius","tooltipBorderRadiusSmall","pinSize","tooltipPinSizeSmall","pinOffsetX","tooltipPinOffsetXSmall","pinOffsetY","tooltipPinOffsetYSmall","margin","tooltipMarginSmall","closeButtonMedium","tooltipContentMedium","tooltipBorderRadiusMedium","tooltipPinSizeMedium","tooltipPinOffsetXMedium","tooltipPinOffsetYMedium","tooltipMarginMedium","closeButtonLarge","tooltipContentLarge","tooltipBorderRadiusLarge","tooltipPinSizeLarge","tooltipPinOffsetXLarge","tooltipPinOffsetYLarge","tooltipMarginLarge","warning","_inheritsLoose2","_proto","prototype","validateProps","children","getAllowedPositions","componentDidMount","componentDidUpdate","_this$getProps","componentWillUnmount","_this2","getStyles","emotion","ThemeContext","Consumer","Provider","value","ThemeFactory","create","popupBackground","tooltipBg","popupBorder","tooltipBorder","popupBorderRadius","popupPinSize","popupPinOffsetX","popupPinOffsetY","popupMargin","renderMain","hasCross","closeButton","undefined","triggersWithoutCloseButton","icon","CloseButtonIcon","tabbable","side","parseInt","tooltipCloseBtnSide","color","tooltipCloseBtnColor","colorHover","tooltipCloseBtnHoverColor","onClick","show","hide","_this$getPopupAndLaye","getPopupAndLayerProps","popupProps","_this$getPopupAndLaye2","layerProps","active","popup","renderPopup","RenderLayer","_extends2","_this$getProps2","disableAnimations","CommonWrapper","rootNodeRef","setRootNode","Popup","hasPin","hasShadow","maxWidth","positions","pos","ignoreHover","onOpen","onClose","tryPreserveFirstRenderedPosition","withoutMobile","useWrapper","defaultPopupAndLayerProps","onMouseEnter","onMouseLeave","onClickOutside","onFocus","onBlur","clearTimeout","isInstanceOf","globalObject","Element","containsTargetOrRenderContainer","PureComponent","__KONTUR_REACT_UI__","displayName","isTestEnv"],"sources":["Tooltip.tsx"],"sourcesContent":["import React, { type JSX } from 'react';\nimport warning from 'warning';\nimport type { Emotion } from '@emotion/css/types/create-instance';\n\nimport type { GlobalObject, SafeTimer } from '../../lib/globalObject';\nimport { isNullable } from '../../lib/utils';\nimport { ThemeFactory } from '../../lib/theming/ThemeFactory';\nimport type { PopupPositionsType, PopupProps, ShortPopupPositionsType } from '../../internal/Popup';\nimport { Popup } from '../../internal/Popup';\nimport type { RenderLayerProps } from '../../internal/RenderLayer';\nimport { RenderLayer } from '../../internal/RenderLayer';\nimport type { Nullable } from '../../typings/utility-types';\nimport type { MouseEventType } from '../../typings/event-types';\nimport { containsTargetOrRenderContainer } from '../../lib/listenFocusOutside';\nimport { ThemeContext } from '../../lib/theming/ThemeContext';\nimport type { Theme } from '../../lib/theming/Theme';\nimport { isTestEnv } from '../../lib/currentEnvironment';\nimport type { CommonProps } from '../../internal/CommonWrapper';\nimport { CommonWrapper } from '../../internal/CommonWrapper';\nimport type { TGetRootNode, TSetRootNode } from '../../lib/rootNode';\nimport { rootNode } from '../../lib/rootNode';\nimport type { InstanceWithAnchorElement } from '../../lib/InstanceWithAnchorElement';\nimport { createPropsGetter } from '../../lib/createPropsGetter';\nimport { CloseButtonIcon } from '../../internal/CloseButtonIcon/CloseButtonIcon';\nimport { isInstanceOf } from '../../lib/isInstanceOf';\nimport type { SizeProp } from '../../lib/types/props';\nimport { withSize } from '../../lib/size/SizeDecorator';\nimport { withRenderEnvironment } from '../../lib/renderEnvironment';\n\nimport { getStyles } from './Tooltip.styles';\n\nexport type TooltipTrigger =\n /** Наведение на children и на тултип */\n | 'hover'\n /** Клик на children */\n | 'click'\n /** Фокус на children */\n | 'focus'\n /** Наведение на children и на тултип и фокус на children */\n | 'hover&focus'\n /** Просто открыт */\n | 'opened'\n /** Просто закрыт */\n | 'closed'\n /** Наведение ТОЛЬКО на children, а не на тултип */\n | 'hoverAnchor'\n /** Управление через публичные функции show и hide */\n | 'manual';\n\nexport interface TooltipProps extends CommonProps {\n /** Указывает элемент, относительно которого позиционировать тултип. */\n anchorElement?: HTMLElement;\n\n /** @ignore */\n children?: React.ReactNode;\n\n /** Задает HTML-атрибут class. */\n className?: string;\n\n /** Отображает крестик для закрытия тултипа. По-умолчанию крестик виден, если проп *trigger* не равен `hover` или `focus`. */\n closeButton?: boolean;\n\n /** Задает функцию, которая возвращает содержимое тултипа. Если функция вернула `null`, то тултип не показывается. */\n render?: Nullable<() => React.ReactNode>;\n\n /** Задает приоритетное расположение подсказки относительно текста. */\n pos?: ShortPopupPositionsType | PopupPositionsType;\n\n /** Задает размер тултипа.\n * @default 'small' */\n size?: SizeProp;\n\n /** Задает триггер открытия тултипа. */\n trigger?: TooltipTrigger;\n\n /** Задает хендлер, который вызывается при клике по крестику. */\n onCloseClick?: React.MouseEventHandler<HTMLElement>;\n\n /** Задает хендлер, который вызывается при клике по крестику или снаружи тултипа. */\n onCloseRequest?: (event?: Event | React.MouseEvent) => void;\n\n /** Задает хендлер, который вызывается при закрытии тултипа. */\n onClose?: () => void;\n\n /** Задает хендлер, который вызывается при открытии тултипа. */\n onOpen?: () => void;\n\n /** Задает список позиций, которые тултип будет занимать.\n * Если положение тултипа в определенной позиции будет выходить за край экрана, то будет выбрана следующая позиция.\n * Обязательно должен включать позицию указанную в `pos`. */\n allowedPositions?: PopupPositionsType[];\n\n /** Отключает анимацию.\n * @default false */\n disableAnimations?: boolean;\n\n /** Явно указывает, что вложенные элементы должны быть обёрнуты в `<span/>`.\n * Используется для корректного позиционирования тултипа при двух и более вложенных элементах.\n * _Примечание_: при **двух и более** вложенных элементах обёртка будет добавлена автоматически. */\n useWrapper?: boolean;\n\n /** Устанавливает задержку в миллисекундах до появления лоадера. */\n delayBeforeShow?: number;\n}\n\nconst DEFAULT_DELAY = 100;\n\nexport interface TooltipState {\n opened: boolean;\n focused: boolean;\n}\n\nexport const TooltipDataTids = {\n root: 'Tooltip__root',\n content: 'Tooltip__content',\n crossIcon: 'Tooltip__crossIcon',\n} as const;\n\nconst DefaultPositions: PopupPositionsType[] = [\n 'right bottom',\n 'right middle',\n 'right top',\n 'top right',\n 'top center',\n 'top left',\n 'left top',\n 'left middle',\n 'left bottom',\n 'bottom left',\n 'bottom center',\n 'bottom right',\n];\n\ninterface TooltipSizeVariables {\n closeButtonStyle: string;\n contentStyle: string;\n borderRadius: string;\n pinSize: string;\n pinOffsetX: string;\n pinOffsetY: string;\n margin: string;\n}\n\ntype DefaultProps = Required<Pick<TooltipProps, 'trigger' | 'disableAnimations' | 'useWrapper' | 'delayBeforeShow'>>;\n\n/**\n * `Tooltip` — это подсказка, которая объясняет состояние контрола или даёт контекстную справку.\n *\n * Открывается по клику, фокусом на элемент или по наведению. В отличие от `Hint`, `Tooltip` может содержать\n * изображения, кнопки, ссылки и прочие интерактивные элементы.\n */\n@withRenderEnvironment\n@rootNode\n@withSize\nexport class Tooltip extends React.PureComponent<TooltipProps, TooltipState> implements InstanceWithAnchorElement {\n public static __KONTUR_REACT_UI__ = 'Tooltip';\n public static displayName = 'Tooltip';\n\n public static defaultProps: DefaultProps = {\n trigger: 'hover',\n disableAnimations: isTestEnv,\n useWrapper: false,\n delayBeforeShow: DEFAULT_DELAY,\n };\n\n private getProps = createPropsGetter(Tooltip.defaultProps);\n private validateProps(props: TooltipProps): void {\n warning(\n props.children || props.anchorElement,\n `[Tooltip]: you must provide either 'children' or 'anchorElement' prop for Tooltip to work properly`,\n );\n }\n\n public static delay = DEFAULT_DELAY;\n private static triggersWithoutCloseButton: TooltipTrigger[] = ['hover', 'hoverAnchor', 'focus', 'hover&focus'];\n\n public state: TooltipState = { opened: false, focused: false };\n private globalObject!: GlobalObject;\n private emotion!: Emotion;\n private cx!: Emotion['cx'];\n private styles!: ReturnType<typeof getStyles>;\n private theme!: Theme;\n private size!: SizeProp;\n private sizeVariables!: TooltipSizeVariables;\n private hoverTimeout: SafeTimer;\n private contentElement: Nullable<HTMLElement> = null;\n private clickedOutside = true;\n public getRootNode!: TGetRootNode;\n private setRootNode!: TSetRootNode;\n\n private popupRef = React.createRef<Popup>();\n\n public getAllowedPositions() {\n return this.props.allowedPositions ? this.props.allowedPositions : DefaultPositions;\n }\n\n public componentDidMount(): void {\n this.validateProps(this.getProps());\n }\n\n public componentDidUpdate() {\n const { trigger } = this.getProps();\n\n this.validateProps(this.getProps());\n if (trigger === 'closed' && this.state.opened) {\n this.close();\n }\n }\n\n public componentWillUnmount() {\n this.clearHoverTimeout();\n }\n\n public render() {\n this.styles = getStyles(this.emotion);\n\n return (\n <ThemeContext.Consumer>\n {(theme) => {\n this.theme = theme;\n this.sizeVariables = this.getSizeVariables();\n return (\n <ThemeContext.Provider\n value={ThemeFactory.create(\n {\n popupBackground: theme.tooltipBg,\n popupBorder: theme.tooltipBorder,\n popupBorderRadius: this.sizeVariables.borderRadius,\n popupPinSize: this.sizeVariables.pinSize,\n popupPinOffsetX: this.sizeVariables.pinOffsetX,\n popupPinOffsetY: this.sizeVariables.pinOffsetY,\n popupMargin: this.sizeVariables.margin,\n },\n theme,\n )}\n >\n {this.renderMain()}\n </ThemeContext.Provider>\n );\n }}\n </ThemeContext.Consumer>\n );\n }\n\n public renderContent = () => {\n const content = this.props.render ? this.props.render() : null;\n if (isNullable(content)) {\n return null;\n }\n\n return (\n <div\n ref={this.refContent}\n className={this.cx(this.styles.tooltipContent(this.theme), this.sizeVariables.contentStyle)}\n data-tid={TooltipDataTids.content}\n >\n {content}\n {this.renderCloseButton()}\n </div>\n );\n };\n\n public renderCloseButton() {\n const hasCross =\n this.props.closeButton === undefined\n ? !Tooltip.triggersWithoutCloseButton.includes(this.getProps().trigger)\n : this.props.closeButton;\n\n if (!hasCross) {\n return null;\n }\n\n const icon = (\n <CloseButtonIcon\n tabbable={false}\n side={parseInt(this.theme.tooltipCloseBtnSide)}\n color={this.theme.tooltipCloseBtnColor}\n colorHover={this.theme.tooltipCloseBtnHoverColor}\n />\n );\n\n return (\n <div\n className={this.cx(this.styles.closeButton(this.theme), this.sizeVariables.closeButtonStyle)}\n onClick={this.handleCloseButtonClick}\n data-tid={TooltipDataTids.crossIcon}\n >\n {icon}\n </div>\n );\n }\n\n public getAnchorElement = (): Nullable<Element> => {\n return this.popupRef.current?.anchorElement;\n };\n\n /**\n * Программно открывает тултип.\n * <p>Не действует если проп *trigger* `'opened'` или `'closed'`.</p>\n * @public\n */\n public show() {\n if (this.state.opened) {\n return;\n }\n const trigger = this.getProps().trigger;\n if (trigger === 'opened' || trigger === 'closed') {\n warning(false, `Function 'show' is not supported with trigger specified '${trigger}'`);\n return;\n }\n this.open();\n }\n\n /**\n * Программно закрывает тултип.\n * <p>Не действует если проп *trigger* `'opened'` или `'closed'`.</p>\n * @public\n */\n public hide() {\n const trigger = this.getProps().trigger;\n if (trigger === 'opened' || trigger === 'closed') {\n warning(false, `Function 'hide' is not supported with trigger specified '${trigger}'`);\n return;\n }\n this.close();\n }\n\n private renderMain() {\n const props = this.props;\n const content = this.renderContent();\n const { popupProps, layerProps = { active: false } } = this.getPopupAndLayerProps();\n const anchorElement = props.children || props.anchorElement;\n const popup = this.renderPopup(anchorElement, popupProps, content);\n\n return (\n <RenderLayer {...layerProps} getAnchorElement={this.getAnchorElement}>\n {popup}\n </RenderLayer>\n );\n }\n\n private renderPopup(\n anchorElement: React.ReactNode | HTMLElement,\n popupProps: Partial<PopupProps>,\n content: JSX.Element | null,\n ) {\n const { disableAnimations, trigger } = this.getProps();\n return (\n <CommonWrapper rootNodeRef={this.setRootNode} {...this.props}>\n <Popup\n data-tid={TooltipDataTids.root}\n anchorElement={anchorElement}\n hasPin\n hasShadow\n maxWidth=\"none\"\n opened={this.state.opened}\n disableAnimations={disableAnimations}\n positions={this.getPositions()}\n pos={this.props.pos}\n ignoreHover={trigger === 'hoverAnchor'}\n onOpen={this.props.onOpen}\n onClose={this.props.onClose}\n tryPreserveFirstRenderedPosition\n ref={this.popupRef}\n withoutMobile\n {...popupProps}\n >\n {content}\n </Popup>\n </CommonWrapper>\n );\n }\n\n private getPositions = (): PopupPositionsType[] =>\n this.props.allowedPositions\n ? this.props.allowedPositions.filter((item) => DefaultPositions.includes(item))\n : DefaultPositions;\n\n private refContent = (node: HTMLElement | null) => {\n this.contentElement = node;\n };\n\n private getPopupAndLayerProps(): {\n layerProps?: Partial<RenderLayerProps>;\n popupProps: Partial<PopupProps>;\n } {\n const props = this.props;\n const useWrapper = !!props.children && this.getProps().useWrapper;\n const trigger = this.getProps().trigger;\n\n const defaultPopupAndLayerProps: ReturnType<typeof this.getPopupAndLayerProps> = {\n popupProps: {\n onMouseEnter: this.handleMouseEnter,\n onMouseLeave: this.handleMouseLeave,\n useWrapper,\n },\n };\n\n switch (trigger) {\n case 'opened':\n return {\n layerProps: {\n active: true,\n onClickOutside: this.handleClickOutsideAnchor,\n },\n popupProps: {\n opened: true,\n useWrapper,\n },\n };\n\n case 'closed':\n return {\n popupProps: {\n opened: false,\n useWrapper,\n },\n };\n\n case 'manual':\n return {\n popupProps: {\n useWrapper,\n },\n };\n case 'click':\n return {\n layerProps: {\n active: this.state.opened,\n onClickOutside: this.handleClickOutsideAnchor,\n },\n popupProps: {\n onClick: this.handleClick,\n useWrapper,\n },\n };\n\n case 'focus':\n return {\n popupProps: {\n onFocus: this.handleFocus,\n onBlur: this.handleBlur,\n useWrapper,\n },\n };\n\n case 'hover&focus':\n return {\n layerProps: {\n active: this.state.opened,\n onClickOutside: this.handleClickOutsideAnchor,\n },\n popupProps: {\n onFocus: this.handleFocus,\n onBlur: this.handleBlur,\n onMouseEnter: this.handleMouseEnter,\n onMouseLeave: this.handleMouseLeave,\n useWrapper,\n },\n };\n\n case 'hoverAnchor':\n case 'hover':\n return defaultPopupAndLayerProps;\n default:\n warning(false, `Unknown trigger specified: ${trigger}. Returning default value.`);\n return defaultPopupAndLayerProps;\n }\n }\n\n private open = () => this.setState({ opened: true });\n\n private close = () => this.setState({ opened: false });\n\n private clearHoverTimeout() {\n if (this.hoverTimeout) {\n clearTimeout(this.hoverTimeout);\n this.hoverTimeout = null;\n }\n }\n\n private handleMouseEnter = (event: MouseEventType) => {\n const isHoverAnchor = this.getProps().trigger === 'hoverAnchor';\n if (isHoverAnchor && event.target === this.contentElement) {\n return;\n }\n\n this.clearHoverTimeout();\n this.hoverTimeout = setTimeout(this.open, this.getProps().delayBeforeShow);\n };\n\n private handleMouseLeave = (event: MouseEventType) => {\n const trigger = this.getProps().trigger;\n if (\n (trigger === 'hover&focus' && this.state.focused) ||\n (trigger === 'hover' && event.relatedTarget === this.contentElement)\n ) {\n return;\n }\n\n this.clearHoverTimeout();\n\n if (trigger === 'hoverAnchor') {\n this.close();\n } else {\n this.hoverTimeout = setTimeout(this.close, Tooltip.delay);\n }\n };\n\n private handleClick = () => {\n this.open();\n };\n\n private handleClickOutsideAnchor = (event: Event) => {\n this.clickedOutside = this.isClickOutsideContent(event);\n if (this.clickedOutside) {\n if (this.props.onCloseRequest) {\n this.props.onCloseRequest(event);\n }\n this.close();\n }\n };\n\n private isClickOutsideContent(event: Event) {\n if (this.contentElement && isInstanceOf(event.target, this.globalObject.Element)) {\n return !containsTargetOrRenderContainer(event.target)(this.contentElement);\n }\n\n return true;\n }\n\n private handleFocus = () => {\n this.setState({ focused: true });\n this.open();\n };\n\n private handleBlur = () => {\n const trigger = this.getProps().trigger;\n if (trigger === 'hover&focus' && this.clickedOutside) {\n this.close();\n }\n\n if (trigger === 'focus') {\n this.close();\n }\n\n this.clickedOutside = true;\n this.setState({ focused: false });\n };\n\n private handleCloseButtonClick = (event: React.MouseEvent<HTMLElement>) => {\n event.stopPropagation();\n\n if (this.props.onCloseClick) {\n this.props.onCloseClick(event);\n }\n\n if (event.defaultPrevented) {\n return;\n }\n\n if (this.props.onCloseRequest) {\n this.props.onCloseRequest(event);\n }\n\n this.close();\n };\n\n private getSizeVariables = (): TooltipSizeVariables => {\n switch (this.size) {\n case 'small':\n return {\n closeButtonStyle: this.styles.closeButtonSmall(this.theme),\n contentStyle: this.styles.tooltipContentSmall(this.theme),\n borderRadius: this.theme.tooltipBorderRadiusSmall,\n pinSize: this.theme.tooltipPinSizeSmall,\n pinOffsetX: this.theme.tooltipPinOffsetXSmall,\n pinOffsetY: this.theme.tooltipPinOffsetYSmall,\n margin: this.theme.tooltipMarginSmall,\n };\n case 'medium':\n return {\n closeButtonStyle: this.styles.closeButtonMedium(this.theme),\n contentStyle: this.styles.tooltipContentMedium(this.theme),\n borderRadius: this.theme.tooltipBorderRadiusMedium,\n pinSize: this.theme.tooltipPinSizeMedium,\n pinOffsetX: this.theme.tooltipPinOffsetXMedium,\n pinOffsetY: this.theme.tooltipPinOffsetYMedium,\n margin: this.theme.tooltipMarginMedium,\n };\n case 'large':\n return {\n closeButtonStyle: this.styles.closeButtonLarge(this.theme),\n contentStyle: this.styles.tooltipContentLarge(this.theme),\n borderRadius: this.theme.tooltipBorderRadiusLarge,\n pinSize: this.theme.tooltipPinSizeLarge,\n pinOffsetX: this.theme.tooltipPinOffsetXLarge,\n pinOffsetY: this.theme.tooltipPinOffsetYLarge,\n margin: this.theme.tooltipMarginLarge,\n };\n default:\n warning(false, `Can't get size variables: invalid value in size prop '${this.props.size}'. Returning default`);\n return {\n closeButtonStyle: this.styles.closeButtonSmall(this.theme),\n contentStyle: this.styles.tooltipContentSmall(this.theme),\n borderRadius: this.theme.tooltipBorderRadiusSmall,\n pinSize: this.theme.tooltipPinSizeSmall,\n pinOffsetX: this.theme.tooltipPinOffsetXSmall,\n pinOffsetY: this.theme.tooltipPinOffsetYSmall,\n margin: this.theme.tooltipMarginSmall,\n };\n }\n };\n}\n"],"mappings":"uWAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,s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C/B,IAAI,CAACA,YAAY,GAAG,IAAI,CAC1B,CACF,CAAC,CAAA+C,MAAA,CA4COvC,qBAAqB,GAA7B,SAAAA,sBAA8Bb,KAAY,EAAE,CAC1C,IAAI,IAAI,CAACnC,cAAc,IAAI,IAAAsK,0BAAY,EAACnI,KAAK,CAACG,MAAM,EAAE,IAAI,CAACiI,YAAY,CAACC,OAAO,CAAC,EAAE,CAChF,OAAO,CAAC,IAAAC,mDAA+B,EAACtI,KAAK,CAACG,MAAM,CAAC,CAAC,IAAI,CAACtC,cAAc,CAAC,CAC5E,CAEA,OAAO,IAAI,CACb,CAAC,QAAArB,OAAA,GAvX0BwB,cAAK,CAACuK,aAAa,GAAAvM,QAAA,CAChCwM,mBAAmB,GAAG,SAAS,EAAAxM,QAAA,CAC/ByM,WAAW,GAAG,SAAS,EAAAzM,QAAA,CAEvByB,YAAY,GAAiB,EACzCyC,OAAO,EAAE,OAAO,EAChB0G,iBAAiB,EAAE8B,6BAAS,EAC5Bf,UAAU,EAAE,KAAK,EACjBpH,eAAe,EAAEtE,aAAa,CAChC,CAAC,EAAAD,QAAA,CAUa0E,KAAK,GAAGzE,aAAa,EAAAD,QAAA,CACpBmJ,0BAA0B,GAAqB,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,CAAC,EAAAnJ,QAAA,MAAAD,MAAA,KAAAA,MAAA,KAAAA,MAAA","ignoreList":[]}
@@ -19,7 +19,7 @@ var useDrop = exports.useDrop = function useDrop(props) {if (props === void 0) {
19
19
 
20
20
  var droppableRef = (0, _react.useRef)(null);
21
21
  var overRef = (0, _react.useRef)(false);
22
- var timerId = (0, _react.useRef)();
22
+ var timerId = (0, _react.useRef)(undefined);
23
23
  var _useState = (0, _react.useState)(false),isDraggable = _useState[0],setIsDraggable = _useState[1];
24
24
 
25
25
  var clearTimer = (0, _react.useCallback)(function () {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","useDrop","exports","props","_props","onDrop","droppableRef","useRef","overRef","timerId","_useState","useState","isDraggable","setIsDraggable","clearTimer","useCallback","current","clearTimeout","handleDragOver","event","preventDefault","setTimeout","stopPropagation","handleDrop","useEffect","ref","addEventListener","removeEventListener"],"sources":["useDrop.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport type { SafeTimer } from '../lib/globalObject';\n\ninterface IUseDropProps {\n onDrop?: (event: DragEvent) => void;\n}\n\ntype IElementWithListener = Pick<HTMLElement, 'addEventListener' | 'removeEventListener'>;\n\ninterface IUseDropResult<TElement extends IElementWithListener> {\n isDraggable: boolean;\n ref: MutableRefObject<TElement | null>;\n}\n\nexport const useDrop = <TElement extends IElementWithListener>(props: IUseDropProps = {}): IUseDropResult<TElement> => {\n const { onDrop } = props;\n\n const droppableRef = useRef<TElement>(null);\n const overRef = useRef<boolean>(false);\n const timerId = useRef<SafeTimer>();\n const [isDraggable, setIsDraggable] = useState<boolean>(false);\n\n const clearTimer = useCallback(() => {\n timerId.current && clearTimeout(timerId.current);\n }, []);\n\n const handleDragOver = useCallback(\n (event: DragEvent) => {\n event.preventDefault();\n setIsDraggable(true);\n\n clearTimer();\n timerId.current = setTimeout(() => {\n overRef.current = false;\n setIsDraggable(false);\n }, 200);\n },\n [clearTimer],\n );\n\n const preventDefault = useCallback((event: DragEvent) => {\n event.preventDefault();\n event.stopPropagation();\n }, []);\n\n const handleDrop = useCallback(\n (event: DragEvent) => {\n preventDefault(event);\n setIsDraggable(false);\n overRef.current = false;\n\n onDrop?.(event);\n },\n [preventDefault, onDrop],\n );\n\n useEffect(() => {\n const ref = droppableRef.current;\n\n if (!ref) {\n return;\n }\n\n ref.addEventListener('dragenter', preventDefault);\n ref.addEventListener('dragleave', preventDefault);\n ref.addEventListener('dragover', handleDragOver);\n ref.addEventListener('drop', handleDrop);\n\n return () => {\n ref.removeEventListener('dragenter', preventDefault);\n ref.removeEventListener('dragleave', preventDefault);\n ref.removeEventListener('dragover', handleDragOver);\n ref.removeEventListener('drop', handleDrop);\n };\n }, [handleDrop, handleDragOver, preventDefault]);\n\n return { isDraggable, ref: droppableRef };\n};\n"],"mappings":";AACA,IAAAA,MAAA,GAAAC,OAAA;;;;;;;;;;;;;;;AAeO,IAAMC,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,SAAVA,OAAOA,CAA2CE,KAAoB,EAAoC,KAAxDA,KAAoB,cAApBA,KAAoB,GAAG,CAAC,CAAC;EACtF,IAAAC,MAAA,GAAmBD,KAAK,CAAhBE,MAAM,GAAAD,MAAA,CAANC,MAAM;;EAEd,IAAMC,YAAY,GAAG,IAAAC,aAAM,EAAW,IAAI,CAAC;EAC3C,IAAMC,OAAO,GAAG,IAAAD,aAAM,EAAU,KAAK,CAAC;EACtC,IAAME,OAAO,GAAG,IAAAF,aAAM,EAAY,CAAC;EACnC,IAAAG,SAAA,GAAsC,IAAAC,eAAQ,EAAU,KAAK,CAAC,CAAvDC,WAAW,GAAAF,SAAA,IAAEG,cAAc,GAAAH,SAAA;;EAElC,IAAMI,UAAU,GAAG,IAAAC,kBAAW,EAAC,YAAM;IACnCN,OAAO,CAACO,OAAO,IAAIC,YAAY,CAACR,OAAO,CAACO,OAAO,CAAC;EAClD,CAAC,EAAE,EAAE,CAAC;;EAEN,IAAME,cAAc,GAAG,IAAAH,kBAAW;IAChC,UAACI,KAAgB,EAAK;MACpBA,KAAK,CAACC,cAAc,CAAC,CAAC;MACtBP,cAAc,CAAC,IAAI,CAAC;;MAEpBC,UAAU,CAAC,CAAC;MACZL,OAAO,CAACO,OAAO,GAAGK,UAAU,CAAC,YAAM;QACjCb,OAAO,CAACQ,OAAO,GAAG,KAAK;QACvBH,cAAc,CAAC,KAAK,CAAC;MACvB,CAAC,EAAE,GAAG,CAAC;IACT,CAAC;IACD,CAACC,UAAU;EACb,CAAC;;EAED,IAAMM,cAAc,GAAG,IAAAL,kBAAW,EAAC,UAACI,KAAgB,EAAK;IACvDA,KAAK,CAACC,cAAc,CAAC,CAAC;IACtBD,KAAK,CAACG,eAAe,CAAC,CAAC;EACzB,CAAC,EAAE,EAAE,CAAC;;EAEN,IAAMC,UAAU,GAAG,IAAAR,kBAAW;IAC5B,UAACI,KAAgB,EAAK;MACpBC,cAAc,CAACD,KAAK,CAAC;MACrBN,cAAc,CAAC,KAAK,CAAC;MACrBL,OAAO,CAACQ,OAAO,GAAG,KAAK;;MAEvBX,MAAM,YAANA,MAAM,CAAGc,KAAK,CAAC;IACjB,CAAC;IACD,CAACC,cAAc,EAAEf,MAAM;EACzB,CAAC;;EAED,IAAAmB,gBAAS,EAAC,YAAM;IACd,IAAMC,GAAG,GAAGnB,YAAY,CAACU,OAAO;;IAEhC,IAAI,CAACS,GAAG,EAAE;MACR;IACF;;IAEAA,GAAG,CAACC,gBAAgB,CAAC,WAAW,EAAEN,cAAc,CAAC;IACjDK,GAAG,CAACC,gBAAgB,CAAC,WAAW,EAAEN,cAAc,CAAC;IACjDK,GAAG,CAACC,gBAAgB,CAAC,UAAU,EAAER,cAAc,CAAC;IAChDO,GAAG,CAACC,gBAAgB,CAAC,MAAM,EAAEH,UAAU,CAAC;;IAExC,OAAO,YAAM;MACXE,GAAG,CAACE,mBAAmB,CAAC,WAAW,EAAEP,cAAc,CAAC;MACpDK,GAAG,CAACE,mBAAmB,CAAC,WAAW,EAAEP,cAAc,CAAC;MACpDK,GAAG,CAACE,mBAAmB,CAAC,UAAU,EAAET,cAAc,CAAC;MACnDO,GAAG,CAACE,mBAAmB,CAAC,MAAM,EAAEJ,UAAU,CAAC;IAC7C,CAAC;EACH,CAAC,EAAE,CAACA,UAAU,EAAEL,cAAc,EAAEE,cAAc,CAAC,CAAC;;EAEhD,OAAO,EAAER,WAAW,EAAXA,WAAW,EAAEa,GAAG,EAAEnB,YAAY,CAAC,CAAC;AAC3C,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","useDrop","exports","props","_props","onDrop","droppableRef","useRef","overRef","timerId","undefined","_useState","useState","isDraggable","setIsDraggable","clearTimer","useCallback","current","clearTimeout","handleDragOver","event","preventDefault","setTimeout","stopPropagation","handleDrop","useEffect","ref","addEventListener","removeEventListener"],"sources":["useDrop.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport type { SafeTimer } from '../lib/globalObject';\n\ninterface IUseDropProps {\n onDrop?: (event: DragEvent) => void;\n}\n\ntype IElementWithListener = Pick<HTMLElement, 'addEventListener' | 'removeEventListener'>;\n\ninterface IUseDropResult<TElement extends IElementWithListener> {\n isDraggable: boolean;\n ref: MutableRefObject<TElement | null>;\n}\n\nexport const useDrop = <TElement extends IElementWithListener>(props: IUseDropProps = {}): IUseDropResult<TElement> => {\n const { onDrop } = props;\n\n const droppableRef = useRef<TElement>(null);\n const overRef = useRef<boolean>(false);\n const timerId = useRef<SafeTimer>(undefined);\n const [isDraggable, setIsDraggable] = useState<boolean>(false);\n\n const clearTimer = useCallback(() => {\n timerId.current && clearTimeout(timerId.current);\n }, []);\n\n const handleDragOver = useCallback(\n (event: DragEvent) => {\n event.preventDefault();\n setIsDraggable(true);\n\n clearTimer();\n timerId.current = setTimeout(() => {\n overRef.current = false;\n setIsDraggable(false);\n }, 200);\n },\n [clearTimer],\n );\n\n const preventDefault = useCallback((event: DragEvent) => {\n event.preventDefault();\n event.stopPropagation();\n }, []);\n\n const handleDrop = useCallback(\n (event: DragEvent) => {\n preventDefault(event);\n setIsDraggable(false);\n overRef.current = false;\n\n onDrop?.(event);\n },\n [preventDefault, onDrop],\n );\n\n useEffect(() => {\n const ref = droppableRef.current;\n\n if (!ref) {\n return;\n }\n\n ref.addEventListener('dragenter', preventDefault);\n ref.addEventListener('dragleave', preventDefault);\n ref.addEventListener('dragover', handleDragOver);\n ref.addEventListener('drop', handleDrop);\n\n return () => {\n ref.removeEventListener('dragenter', preventDefault);\n ref.removeEventListener('dragleave', preventDefault);\n ref.removeEventListener('dragover', handleDragOver);\n ref.removeEventListener('drop', handleDrop);\n };\n },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ACG,eAAe,CAAC,CAAC;EACzB,CAAC,EAAE,EAAE,CAAC;;EAEN,IAAMC,UAAU,GAAG,IAAAR,kBAAW;IAC5B,UAACI,KAAgB,EAAK;MACpBC,cAAc,CAACD,KAAK,CAAC;MACrBN,cAAc,CAAC,KAAK,CAAC;MACrBN,OAAO,CAACS,OAAO,GAAG,KAAK;;MAEvBZ,MAAM,YAANA,MAAM,CAAGe,KAAK,CAAC;IACjB,CAAC;IACD,CAACC,cAAc,EAAEhB,MAAM;EACzB,CAAC;;EAED,IAAAoB,gBAAS,EAAC,YAAM;IACd,IAAMC,GAAG,GAAGpB,YAAY,CAACW,OAAO;;IAEhC,IAAI,CAACS,GAAG,EAAE;MACR;IACF;;IAEAA,GAAG,CAACC,gBAAgB,CAAC,WAAW,EAAEN,cAAc,CAAC;IACjDK,GAAG,CAACC,gBAAgB,CAAC,WAAW,EAAEN,cAAc,CAAC;IACjDK,GAAG,CAACC,gBAAgB,CAAC,UAAU,EAAER,cAAc,CAAC;IAChDO,GAAG,CAACC,gBAAgB,CAAC,MAAM,EAAEH,UAAU,CAAC;;IAExC,OAAO,YAAM;MACXE,GAAG,CAACE,mBAAmB,CAAC,WAAW,EAAEP,cAAc,CAAC;MACpDK,GAAG,CAACE,mBAAmB,CAAC,WAAW,EAAEP,cAAc,CAAC;MACpDK,GAAG,CAACE,mBAAmB,CAAC,UAAU,EAAET,cAAc,CAAC;MACnDO,GAAG,CAACE,mBAAmB,CAAC,MAAM,EAAEJ,UAAU,CAAC;IAC7C,CAAC;EACH,CAAC,EAAE,CAACA,UAAU,EAAEL,cAAc,EAAEE,cAAc,CAAC,CAAC;;EAEhD,OAAO,EAAER,WAAW,EAAXA,WAAW,EAAEa,GAAG,EAAEpB,YAAY,CAAC,CAAC;AAC3C,CAAC","ignoreList":[]}
@@ -6,6 +6,7 @@ var _utils = require("../../lib/utils");
6
6
 
7
7
  var _rootNode = require("../../lib/rootNode");
8
8
  var _callChildRef = require("../../lib/callChildRef/callChildRef");
9
+ var _getElementRef = require("../../lib/getElementRef");
9
10
  var _renderEnvironment = require("../../lib/renderEnvironment");
10
11
 
11
12
 
@@ -54,7 +55,7 @@ CommonWrapper = exports.CommonWrapper = (0, _renderEnvironment.withRenderEnviron
54
55
 
55
56
 
56
57
 
57
- ref = function (instance) {var _this$rootNodeSubscri, _this$child;
58
+ ref = function (instance) {var _this$rootNodeSubscri;
58
59
  _this.setRootNode(instance);
59
60
  _this.props.rootNodeRef == null || _this.props.rootNodeRef((0, _rootNode.getRootNode)(instance));
60
61
 
@@ -70,7 +71,7 @@ CommonWrapper = exports.CommonWrapper = (0, _renderEnvironment.withRenderEnviron
70
71
  });
71
72
  }
72
73
 
73
- var originalRef = (_this$child = _this.child) == null ? void 0 : _this$child.ref;
74
+ var originalRef = (0, _getElementRef.getElementRef)(_this.child);
74
75
  if (typeof originalRef === 'function' || originalRef && typeof originalRef === 'object') {
75
76
  originalRef && (0, _callChildRef.callChildRef)(originalRef, instance);
76
77
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_utils","_rootNode","_callChildRef","_renderEnvironment","_extractCommonProps2","_getCommonVisualStateDataAttributes","_excluded","_class","_CommonWrapper","CommonWrapper","exports","withRenderEnvironment","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","rootNodeSubscription","ref","instance","_this$rootNodeSubscri","_this$child","setRootNode","props","rootNodeRef","getRootNode","remove","isInstanceWithRootNode","addRootNodeChangeListener","node","originalRef","child","callChildRef","_inheritsLoose2","default","_proto","prototype","render","_this2","_extractCommonProps","extractCommonProps","_extractCommonProps$","className","style","children","dataProps","_objectWithoutPropertiesLoose2","rest","_extends2","_objectDestructuringEmpty2","isFunction","getChildProps","childProps","getCommonVisualStateDataAttributes","isRefableElement","classNames","cx","styles","Object","keys","React","isValidElement","cloneElement","Component","__KONTUR_REACT_UI__","displayName"],"sources":["CommonWrapper.tsx"],"sourcesContent":["import React from 'react';\nimport type { Emotion } from '@emotion/css/types/create-instance';\n\nimport { isFunction, isRefableElement } from '../../lib/utils';\nimport type { Nullable } from '../../typings/utility-types';\nimport type { TGetRootNode, TRootNodeSubscription, TSetRootNode } from '../../lib/rootNode';\nimport { getRootNode, isInstanceWithRootNode, rootNode } from '../../lib/rootNode';\nimport { callChildRef } from '../../lib/callChildRef/callChildRef';\nimport { withRenderEnvironment } from '../../lib/renderEnvironment';\n\nimport type { CommonProps, CommonPropsRootNodeRef, CommonWrapperProps } from './types';\nimport { extractCommonProps } from './utils/extractCommonProps';\nimport { getCommonVisualStateDataAttributes } from './utils/getCommonVisualStateDataAttributes';\n\nexport type CommonPropsWithRootNodeRef = CommonProps & CommonPropsRootNodeRef;\n\n@withRenderEnvironment\n@rootNode\nexport class CommonWrapper<P extends CommonPropsWithRootNodeRef> extends React.Component<\n CommonWrapperProps<P> & CommonPropsRootNodeRef\n> {\n public static __KONTUR_REACT_UI__ = 'CommonWrapper';\n public static displayName = 'CommonWrapper';\n\n private cx!: Emotion['cx'];\n private child: React.ReactNode;\n public getRootNode!: TGetRootNode;\n private setRootNode!: TSetRootNode;\n private rootNodeSubscription: Nullable<TRootNodeSubscription> = null;\n\n render() {\n const [{ className, style, children, rootNodeRef, ...dataProps }, { ...rest }] = extractCommonProps(this.props);\n this.child = isFunction(children) ? children(rest) : children;\n\n const getChildProps = (child: React.ReactElement<CommonProps & React.RefAttributes<any>>) => {\n const childProps: Record<string, unknown> = {\n ...getCommonVisualStateDataAttributes(rest),\n ...dataProps,\n };\n\n isRefableElement(child) && (childProps.ref = this.ref);\n\n const classNames: string = this.cx(child.props.className, className);\n classNames && (childProps.className = classNames);\n\n const styles: React.CSSProperties = { ...child.props.style, ...style };\n Object.keys(styles).length && (childProps.style = styles);\n\n return childProps;\n };\n\n return React.isValidElement<CommonProps & React.RefAttributes<any>>(this.child)\n ? React.cloneElement(this.child, getChildProps(this.child))\n : this.child;\n }\n\n private ref = (instance: Nullable<React.ReactInstance>) => {\n this.setRootNode(instance);\n this.props.rootNodeRef?.(getRootNode(instance));\n\n // refs are called when instances change,\n // so we have to renew or remove old subscription\n this.rootNodeSubscription?.remove();\n this.rootNodeSubscription = null;\n\n if (instance && isInstanceWithRootNode(instance)) {\n this.rootNodeSubscription = instance.addRootNodeChangeListener?.((node) => {\n this.setRootNode(node);\n this.props.rootNodeRef?.(node);\n });\n }\n\n const originalRef = (this.child as React.RefAttributes<any>)?.ref;\n if (typeof originalRef === 'function' || (originalRef && typeof originalRef === 'object')) {\n originalRef && callChildRef(originalRef, instance);\n }\n };\n}\n"],"mappings":"mkBAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;;;AAGA,IAAAC,MAAA,GAAAD,OAAA;;;AAGA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;;;AAGA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,mCAAA,GAAAN,OAAA,+CAAgG,IAAAO,SAAA,yDAAAC,MAAA,EAAAC,cAAA;;;;;;AAMnFC,aAAa,GAAAC,OAAA,CAAAD,aAAA,OAFzBE,wCAAqB,EAAAJ,MAAA,OACrBK,kBAAQ,EAAAL,MAAA,IAAAC,cAAA,0BAAAK,gBAAA,YAAAJ,cAAA,OAAAK,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,CAAAL,IAAA,WAAAJ,KAAA;;;;;;;;;;IAWCU,oBAAoB,GAAoC,IAAI,CAAAV,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4B5DW,GAAG,GAAG,UAACC,QAAuC,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6B,cAAK,CAACE,YAAY,CAAC,IAAI,CAAC/B,KAAK,EAAEoB,aAAa,CAAC,IAAI,CAACpB,KAAK,CAAC,CAAC,GACzD,IAAI,CAACA,KAAK,CAChB,CAAC,QAAA7B,aAAA,GApCsE0D,cAAK,CAACG,SAAS,GAAA9D,cAAA,CAGxE+D,mBAAmB,GAAG,eAAe,EAAA/D,cAAA,CACrCgE,WAAW,GAAG,eAAe,EAAAhE,cAAA,MAAAD,MAAA,KAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_utils","_rootNode","_callChildRef","_getElementRef","_renderEnvironment","_extractCommonProps2","_getCommonVisualStateDataAttributes","_excluded","_class","_CommonWrapper","CommonWrapper","exports","withRenderEnvironment","rootNode","_React$Component","_this","_len","arguments","length","args","Array","_key","call","apply","concat","rootNodeSubscription","ref","instance","_this$rootNodeSubscri","setRootNode","props","rootNodeRef","getRootNode","remove","isInstanceWithRootNode","addRootNodeChangeListener","node","originalRef","getElementRef","child","callChildRef","_inheritsLoose2","default","_proto","prototype","render","_this2","_extractCommonProps","extractCommonProps","_extractCommonProps$","className","style","children","dataProps","_objectWithoutPropertiesLoose2","rest","_extends2","_objectDestructuringEmpty2","isFunction","getChildProps","childProps","getCommonVisualStateDataAttributes","isRefableElement","classNames","cx","styles","Object","keys","React","isValidElement","cloneElement","Component","__KONTUR_REACT_UI__","displayName"],"sources":["CommonWrapper.tsx"],"sourcesContent":["import React from 'react';\nimport type { Emotion } from '@emotion/css/types/create-instance';\n\nimport { isFunction, isRefableElement } from '../../lib/utils';\nimport type { Nullable } from '../../typings/utility-types';\nimport type { TGetRootNode, TRootNodeSubscription, TSetRootNode } from '../../lib/rootNode';\nimport { getRootNode, isInstanceWithRootNode, rootNode } from '../../lib/rootNode';\nimport { callChildRef } from '../../lib/callChildRef/callChildRef';\nimport { getElementRef } from '../../lib/getElementRef';\nimport { withRenderEnvironment } from '../../lib/renderEnvironment';\n\nimport type { CommonProps, CommonPropsRootNodeRef, CommonWrapperProps } from './types';\nimport { extractCommonProps } from './utils/extractCommonProps';\nimport { getCommonVisualStateDataAttributes } from './utils/getCommonVisualStateDataAttributes';\n\nexport type CommonPropsWithRootNodeRef = CommonProps & CommonPropsRootNodeRef;\n\n@withRenderEnvironment\n@rootNode\nexport class CommonWrapper<P extends CommonPropsWithRootNodeRef> extends React.Component<\n CommonWrapperProps<P> & CommonPropsRootNodeRef\n> {\n public static __KONTUR_REACT_UI__ = 'CommonWrapper';\n public static displayName = 'CommonWrapper';\n\n private cx!: Emotion['cx'];\n private child: React.ReactNode;\n public getRootNode!: TGetRootNode;\n private setRootNode!: TSetRootNode;\n private rootNodeSubscription: Nullable<TRootNodeSubscription> = null;\n\n render() {\n const [{ className, style, children, rootNodeRef, ...dataProps }, { ...rest }] = extractCommonProps(this.props);\n this.child = isFunction(children) ? children(rest) : children;\n\n const getChildProps = (child: React.ReactElement<CommonProps & React.RefAttributes<any>>) => {\n const childProps: Record<string, unknown> = {\n ...getCommonVisualStateDataAttributes(rest),\n ...dataProps,\n };\n\n isRefableElement(child) && (childProps.ref = this.ref);\n\n const classNames: string = this.cx(child.props.className, className);\n classNames && (childProps.className = classNames);\n\n const styles: React.CSSProperties = { ...child.props.style, ...style };\n Object.keys(styles).length && (childProps.style = styles);\n\n return childProps;\n };\n\n return React.isValidElement<CommonProps & React.RefAttributes<any>>(this.child)\n ? React.cloneElement(this.child, getChildProps(this.child))\n : this.child;\n }\n\n private ref = (instance: Nullable<React.ReactInstance>) => {\n this.setRootNode(instance);\n this.props.rootNodeRef?.(getRootNode(instance));\n\n // refs are called when instances change,\n // so we have to renew or remove old subscription\n this.rootNodeSubscription?.remove();\n this.rootNodeSubscription = null;\n\n if (instance && isInstanceWithRootNode(instance)) {\n this.rootNodeSubscription = instance.addRootNodeChangeListener?.((node) => {\n this.setRootNode(node);\n this.props.rootNodeRef?.(node);\n });\n }\n\n const originalRef = getElementRef(this.child as React.ReactElement);\n if (typeof originalRef === 'function' ||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,MAAAD,MAAA,KAAAA,MAAA","ignoreList":[]}
@@ -11,9 +11,6 @@ export interface FileUploaderControlProviderProps {
11
11
  /** Срабатывает при onAttach, onRemove и других изменениях файлов. В files передает текущее состояние всего списка файлов */
12
12
  onValueChange?: (files: FileUploaderAttachedFile[]) => void;
13
13
  }
14
- export declare const FileUploaderControlProvider: {
15
- (props: PropsWithChildren<FileUploaderControlProviderProps & {
16
- multiple?: boolean;
17
- }>): React.JSX.Element;
18
- displayName: string;
19
- };
14
+ export declare const FileUploaderControlProvider: React.MemoExoticComponent<(props: PropsWithChildren<FileUploaderControlProviderProps & {
15
+ multiple?: boolean;
16
+ }>) => React.JSX.Element>;
@@ -44,88 +44,89 @@ getFileUpdatedProps)
44
44
  return newFiles;
45
45
  };
46
46
 
47
- var FileUploaderControlProvider = exports.FileUploaderControlProvider = function FileUploaderControlProvider(
48
- props)
49
-
50
-
51
-
52
-
53
- {
54
- var initialFiles = props.initialFiles,multiple = props.multiple,children = props.children,onValueChange = props.onValueChange,onRemove = props.onRemove,onAttach = props.onAttach;
55
-
56
- var _useState = (0, _react.useState)(function () {
57
- if (initialFiles && initialFiles.length > 0) {
58
- var attachedFiles = initialFiles.map(function (item) {return (0, _fileUtils.getAttachedFile)(item);});
59
-
60
- return multiple ? attachedFiles : [attachedFiles[0]];
61
- }
62
- return [];
63
- }),files = _useState[0],setFiles = _useState[1];
64
- var _useState2 = (0, _react.useState)(false),isMinLengthReached = _useState2[0],setIsMinLengthReached = _useState2[1];
65
- var locale = (0, _useControlLocale.useControlLocale)();
66
-
67
- (0, _useEffectWithoutInitCall.useEffectWithoutInitCall)(function () {
68
- onValueChange == null || onValueChange(files);
69
- }, [files]);
70
-
71
- var setFileStatus = (0, _react.useCallback)(
72
- function (fileId, status) {
73
- setFiles(function (files) {return (
74
- updateFile(files, fileId, function (file) {return {
75
- status: status,
76
- validationResult:
77
- status === _fileUtils.FileUploaderFileStatus.Error || status === _fileUtils.FileUploaderFileStatus.Warning ?
78
- _FileUploaderFileValidationResult.FileUploaderFileValidationResult.error(locale.requestErrorText) :
79
- file.validationResult
80
- };}));}
81
- );
82
- },
83
- [locale]
84
- );
85
-
86
- var handleExternalSetFiles = (0, _react.useCallback)(
87
- function (files) {
88
- onAttach == null || onAttach(files);
89
- setFiles(function (state) {return [].concat(state, files);});
90
- },
91
- [onAttach]
92
- );
93
-
94
- var removeFile = (0, _react.useCallback)(
95
- function (fileId) {
96
- onRemove == null || onRemove(fileId);
97
- setFiles(function (state) {return state.filter(function (file) {return file.id !== fileId;});});
98
- },
99
- [onRemove]
100
- );
101
-
102
- var setFileValidationResult = (0, _react.useCallback)(
103
- function (fileId, validationResult, status) {
104
- setFiles(function (files) {return updateFile(files, fileId, function () {return { validationResult: validationResult, status: status };});});
105
- },
106
- []
107
- );
108
-
109
- var reset = _react.default.useCallback(function () {
110
- setFiles(function () {return [];});
111
- }, []);
112
-
113
- return /*#__PURE__*/(
114
- _react.default.createElement(_FileUploaderControlContext.FileUploaderControlContext.Provider, {
115
- value: (0, _useMemoObject.useMemoObject)({
116
- setFileStatus: setFileStatus,
117
- files: files,
118
- setFiles: handleExternalSetFiles,
119
- removeFile: removeFile,
120
- setFileValidationResult: setFileValidationResult,
121
- reset: reset,
122
- isMinLengthReached: isMinLengthReached,
123
- setIsMinLengthReached: setIsMinLengthReached
124
- }) },
125
-
126
- children
127
- ));
128
-
129
- };
47
+ var FileUploaderControlProvider = exports.FileUploaderControlProvider = /*#__PURE__*/_react.default.memo(
48
+ function (
49
+ props)
50
+
51
+
52
+
53
+
54
+ {
55
+ var initialFiles = props.initialFiles,multiple = props.multiple,children = props.children,onValueChange = props.onValueChange,onRemove = props.onRemove,onAttach = props.onAttach;
56
+
57
+ var _useState = (0, _react.useState)(function () {
58
+ if (initialFiles && initialFiles.length > 0) {
59
+ var attachedFiles = initialFiles.map(function (item) {return (0, _fileUtils.getAttachedFile)(item);});
60
+
61
+ return multiple ? attachedFiles : [attachedFiles[0]];
62
+ }
63
+ return [];
64
+ }),files = _useState[0],setFiles = _useState[1];
65
+ var _useState2 = (0, _react.useState)(false),isMinLengthReached = _useState2[0],setIsMinLengthReached = _useState2[1];
66
+ var locale = (0, _useControlLocale.useControlLocale)();
67
+
68
+ (0, _useEffectWithoutInitCall.useEffectWithoutInitCall)(function () {
69
+ onValueChange == null || onValueChange(files);
70
+ }, [files]);
71
+
72
+ var setFileStatus = (0, _react.useCallback)(
73
+ function (fileId, status) {
74
+ setFiles(function (files) {return (
75
+ updateFile(files, fileId, function (file) {return {
76
+ status: status,
77
+ validationResult:
78
+ status === _fileUtils.FileUploaderFileStatus.Error || status === _fileUtils.FileUploaderFileStatus.Warning ?
79
+ _FileUploaderFileValidationResult.FileUploaderFileValidationResult.error(locale.requestErrorText) :
80
+ file.validationResult
81
+ };}));}
82
+ );
83
+ },
84
+ [locale]
85
+ );
86
+
87
+ var handleExternalSetFiles = (0, _react.useCallback)(
88
+ function (files) {
89
+ onAttach == null || onAttach(files);
90
+ setFiles(function (state) {return [].concat(state, files);});
91
+ },
92
+ [onAttach]
93
+ );
94
+
95
+ var removeFile = (0, _react.useCallback)(
96
+ function (fileId) {
97
+ onRemove == null || onRemove(fileId);
98
+ setFiles(function (state) {return state.filter(function (file) {return file.id !== fileId;});});
99
+ },
100
+ [onRemove]
101
+ );
102
+
103
+ var setFileValidationResult = (0, _react.useCallback)(
104
+ function (fileId, validationResult, status) {
105
+ setFiles(function (files) {return updateFile(files, fileId, function () {return { validationResult: validationResult, status: status };});});
106
+ },
107
+ []
108
+ );
109
+
110
+ var reset = _react.default.useCallback(function () {
111
+ setFiles(function () {return [];});
112
+ }, []);
113
+
114
+ return /*#__PURE__*/(
115
+ _react.default.createElement(_FileUploaderControlContext.FileUploaderControlContext.Provider, {
116
+ value: (0, _useMemoObject.useMemoObject)({
117
+ setFileStatus: setFileStatus,
118
+ files: files,
119
+ setFiles: handleExternalSetFiles,
120
+ removeFile: removeFile,
121
+ setFileValidationResult: setFileValidationResult,
122
+ reset: reset,
123
+ isMinLengthReached: isMinLengthReached,
124
+ setIsMinLengthReached: setIsMinLengthReached
125
+ }) },
126
+
127
+ children
128
+ ));
130
129
 
130
+ }
131
+ );
131
132
  FileUploaderControlProvider.displayName = 'FileUploaderControlProvider';
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_useMemoObject","_useEffectWithoutInitCall","_fileUtils","_FileUploaderControlContext","_useControlLocale","_FileUploaderFileValidationResult","updateFile","files","fileId","getFileUpdatedProps","fileIndex","findIndex","file","id","newFiles","concat","updatedProps","_extends2","default","FileUploaderControlProvider","exports","props","initialFiles","multiple","children","onValueChange","onRemove","onAttach","_useState","useState","length","attachedFiles","map","item","getAttachedFile","setFiles","_useState2","isMinLengthReached","setIsMinLengthReached","locale","useControlLocale","useEffectWithoutInitCall","setFileStatus","useCallback","status","validationResult","FileUploaderFileStatus","Error","Warning","FileUploaderFileValidationResult","error","requestErrorText","handleExternalSetFiles","state","removeFile","filter","setFileValidationResult","reset","React","createElement","FileUploaderControlContext","Provider","value","useMemoObject","displayName"],"sources":["FileUploaderControlProvider.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport React, { useCallback, useState } from 'react';\n\nimport { useMemoObject } from '../../hooks/useMemoObject';\nimport { useEffectWithoutInitCall } from '../../hooks/useEffectWithoutInitCall';\n\nimport type { FileUploaderAttachedFile } from './fileUtils';\nimport { FileUploaderFileStatus, getAttachedFile } from './fileUtils';\nimport { FileUploaderControlContext } from './FileUploaderControlContext';\nimport { useControlLocale } from './hooks/useControlLocale';\nimport { FileUploaderFileValidationResult } from './FileUploaderFileValidationResult';\n\nexport interface FileUploaderControlProviderProps {\n /** Начальное состояние загруженных файлов */\n initialFiles?: File[];\n /** Срабатывает при выборе файлов */\n onAttach?: (files: FileUploaderAttachedFile[]) => void;\n /** Срабатывает при удалении файла из контрола */\n onRemove?: (fileId: string) => void;\n /** Срабатывает при onAttach, onRemove и других изменениях файлов. В files передает текущее состояние всего списка файлов */\n onValueChange?: (files: FileUploaderAttachedFile[]) => void;\n}\n\nconst updateFile = (\n files: FileUploaderAttachedFile[],\n fileId: string,\n getFileUpdatedProps: (file: FileUploaderAttachedFile) => Partial<FileUploaderAttachedFile>,\n): FileUploaderAttachedFile[] => {\n const fileIndex = files.findIndex((file) => file.id === fileId);\n if (fileIndex === -1) {\n return files;\n }\n\n const newFiles = [...files];\n const file = files[fileIndex];\n\n const updatedProps = getFileUpdatedProps(file);\n\n newFiles[fileIndex] = {\n ...file,\n ...updatedProps,\n };\n\n return newFiles;\n};\n\nexport const FileUploaderControlProvider = (\n props: PropsWithChildren<\n FileUploaderControlProviderProps & {\n multiple?: boolean;\n }\n >,\n) => {\n const { initialFiles, multiple, children, onValueChange, onRemove, onAttach } = props;\n\n const [files, setFiles] = useState<FileUploaderAttachedFile[]>(() => {\n if (initialFiles && initialFiles.length > 0) {\n const attachedFiles = initialFiles.map((item: File) => getAttachedFile(item));\n\n return multiple ? attachedFiles : [attachedFiles[0]];\n }\n return [];\n });\n const [isMinLengthReached, setIsMinLengthReached] = useState<boolean>(false);\n const locale = useControlLocale();\n\n useEffectWithoutInitCall(() => {\n onValueChange?.(files);\n }, [files]);\n\n const setFileStatus = useCallback(\n (fileId: string, status: FileUploaderFileStatus) => {\n setFiles((files) =>\n updateFile(files, fileId, (file) => ({\n status,\n validationResult:\n status === FileUploaderFileStatus.Error || status === FileUploaderFileStatus.Warning\n ? FileUploaderFileValidationResult.error(locale.requestErrorText)\n : file.validationResult,\n })),\n );\n },\n [locale],\n );\n\n const handleExternalSetFiles = useCallback(\n (files: FileUploaderAttachedFile[]) => {\n onAttach?.(files);\n setFiles((state) => [...state, ...files]);\n },\n [onAttach],\n );\n\n const removeFile = useCallback(\n (fileId: string) => {\n onRemove?.(fileId);\n setFiles((state) => state.filter((file) => file.id !== fileId));\n },\n [onRemove],\n );\n\n const setFileValidationResult = useCallback(\n (fileId: string, validationResult: FileUploaderFileValidationResult, status?: FileUploaderFileStatus) => {\n setFiles((files) => updateFile(files, fileId, () => ({ validationResult, status })));\n },\n [],\n );\n\n const reset = React.useCallback(() => {\n setFiles(() => [] as FileUploaderAttachedFile[]);\n }, []);\n\n return (\n <FileUploaderControlContext.Provider\n value={useMemoObject({\n setFileStatus,\n files,\n setFiles: handleExternalSetFiles,\n removeFile,\n setFileValidationResult,\n reset,\n isMinLengthReached,\n setIsMinLengthReached,\n })}\n >\n {children}\n </FileUploaderControlContext.Provider>\n );\n};\n\nFileUploaderControlProvider.displayName = 'FileUploaderControlProvider';\n"],"mappings":";AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA;;;AAGA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,2BAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,iCAAA,GAAAN,OAAA;;;;;;;;;;;;;AAaA,IAAMO,UAAU,GAAG,SAAbA,UAAUA;AACdC,KAAiC;AACjCC,MAAc;AACdC,mBAA0F;AAC3D;EAC/B,IAAMC,SAAS,GAAGH,KAAK,CAACI,SAAS,CAAC,UAACC,IAAI,UAAKA,IAAI,CAACC,EAAE,KAAKL,MAAM,GAAC;EAC/D,IAAIE,SAAS,KAAK,CAAC,CAAC,EAAE;IACpB,OAAOH,KAAK;EACd;;EAEA,IAAMO,QAAQ,MAAAC,MAAA,CAAOR,KAAK,CAAC;EAC3B,IAAMK,IAAI,GAAGL,KAAK,CAACG,SAAS,CAAC;;EAE7B,IAAMM,YAAY,GAAGP,mBAAmB,CAACG,IAAI,CAAC;;EAE9CE,QAAQ,CAACJ,SAAS,CAAC,OAAAO,SAAA,CAAAC,OAAA;EACdN,IAAI;EACJI,YAAY,CAChB;;;EAED,OAAOF,QAAQ;AACjB,CAAC;;AAEM,IAAMK,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,GAAG,SAA9BA,2BAA2BA;AACtC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AAA,CAACxD,2BAAA,CAAAyD,0BAA0B,CAACC,QAAQ;MAClCC,KAAK,EAAE,IAAAC,4BAAa,EAAC;QACnBrB,aAAa,EAAbA,aAAa;QACbnC,KAAK,EAALA,KAAK;QACL4B,QAAQ,EAAEiB,sBAAsB;QAChCE,UAAU,EAAVA,UAAU;QACVE,uBAAuB,EAAvBA,uBAAuB;QACvBC,KAAK,EAALA,KAAK;QACLpB,kBAAkB,EAAlBA,kBAAkB;QAClBC,qBAAqB,EAArBA;MACF,CAAC,CAAE;;IAEFd;IACkC,CAAC;;AAE1C,CAAC;;AAEDL,2BAA2B,CAAC6C,WAAW,GAAG,6BAA6B","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_useMemoObject","_useEffectWithoutInitCall","_fileUtils","_FileUploaderControlContext","_useControlLocale","_FileUploaderFileValidationResult","updateFile","files","fileId","getFileUpdatedProps","fileIndex","findIndex","file","id","newFiles","concat","updatedProps","_extends2","default","FileUploaderControlProvider","exports","React","memo","props","initialFiles","multiple","children","onValueChange","onRemove","onAttach","_useState","useState","length","attachedFiles","map","item","getAttachedFile","setFiles","_useState2","isMinLengthReached","setIsMinLengthReached","locale","useControlLocale","useEffectWithoutInitCall","setFileStatus","useCallback","status","validationResult","FileUploaderFileStatus","Error","Warning","FileUploaderFileValidationResult","error","requestErrorText","handleExternalSetFiles","state","removeFile","filter","setFileValidationResult","reset","createElement","FileUploaderControlContext","Provider","value","useMemoObject","displayName"],"sources":["FileUploaderControlProvider.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport React, { useCallback, useState } from 'react';\n\nimport { useMemoObject } from '../../hooks/useMemoObject';\nimport { useEffectWithoutInitCall } from '../../hooks/useEffectWithoutInitCall';\n\nimport type { FileUploaderAttachedFile } from './fileUtils';\nimport { FileUploaderFileStatus, getAttachedFile } from './fileUtils';\nimport { FileUploaderControlContext } from './FileUploaderControlContext';\nimport { useControlLocale } from './hooks/useControlLocale';\nimport { FileUploaderFileValidationResult } from './FileUploaderFileValidationResult';\n\nexport interface FileUploaderControlProviderProps {\n /** Начальное состояние загруженных файлов */\n initialFiles?: File[];\n /** Срабатывает при выборе файлов */\n onAttach?: (files: FileUploaderAttachedFile[]) => void;\n /** Срабатывает при удалении файла из контрола */\n onRemove?: (fileId: string) => void;\n /** Срабатывает при onAttach, onRemove и других изменениях файлов. В files передает текущее состояние всего списка файлов */\n onValueChange?: (files: FileUploaderAttachedFile[]) => void;\n}\n\nconst updateFile = (\n files: FileUploaderAttachedFile[],\n fileId: string,\n getFileUpdatedProps: (file: FileUploaderAttachedFile) => Partial<FileUploaderAttachedFile>,\n): FileUploaderAttachedFile[] => {\n const fileIndex = files.findIndex((file) => file.id === fileId);\n if (fileIndex === -1) {\n return files;\n }\n\n const newFiles = [...files];\n const file = files[fileIndex];\n\n const updatedProps = getFileUpdatedProps(file);\n\n newFiles[fileIndex] = {\n ...file,\n ...updatedProps,\n };\n\n return newFiles;\n};\n\nexport const FileUploaderControlProvider = React.memo(\n (\n props: PropsWithChildren<\n FileUploaderControlProviderProps & {\n multiple?: boolean;\n }\n >,\n ) => {\n const { initialFiles, multiple, children, onValueChange, onRemove, onAttach } = props;\n\n const [files, setFiles] = useState<FileUploaderAttachedFile[]>(() => {\n if (initialFiles && initialFiles.length > 0) {\n const attachedFiles = initialFiles.map((item: File) => getAttachedFile(item));\n\n return multiple ? attachedFiles : [attachedFiles[0]];\n }\n return [];\n });\n const [isMinLengthReached, setIsMinLengthReached] = useState<boolean>(false);\n const locale = useControlLocale();\n\n useEffectWithoutInitCall(() => {\n onValueChange?.(files);\n }, [files]);\n\n const setFileStatus = useCallback(\n (fileId: string, status: FileUploaderFileStatus) => {\n setFiles((files) =>\n updateFile(files, fileId, (file) => ({\n status,\n validationResult:\n status === FileUploaderFileStatus.Error || status === FileUploaderFileStatus.Warning\n ? FileUploaderFileValidationResult.error(locale.requestErrorText)\n : file.validationResult,\n })),\n );\n },\n [locale],\n );\n\n const handleExternalSetFiles = useCallback(\n (files: FileUploaderAttachedFile[]) => {\n onAttach?.(files);\n setFiles((state) => [...state, ...files]);\n },\n [onAttach],\n );\n\n const removeFile = useCallback(\n (fileId: string) => {\n onRemove?.(fileId);\n setFiles((state) => state.filter((file) => file.id !== fileId));\n },\n [onRemove],\n );\n\n const setFileValidationResult = useCallback(\n (fileId: string, validationResult: FileUploaderFileValidationResult, status?: FileUploaderFileStatus) => {\n setFiles((files) => updateFile(files, fileId, () => ({ validationResult, status })));\n },\n [],\n );\n\n const reset = React.useCallback(() => {\n setFiles(() => [] as FileUploaderAttachedFile[]);\n }, []);\n\n return (\n <FileUploaderControlContext.Provider\n value={useMemoObject({\n setFileStatus,\n files,\n setFiles: handleExternalSetFiles,\n removeFile,\n setFileValidationResult,\n reset,\n isMinLengthReached,\n setIsMinLengthReached,\n })}\n >\n {children}\n </FileUploaderControlContext.Provider>\n );\n },\n);\nFileUploaderControlProvider.displayName = 'FileUploaderControlProvider';\n"],"mappings":";AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA;;;AAGA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,2BAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AACA,IAAAM,iCAAA,GAAAN,OAAA;;;;;;;;;;;;;AAaA,IAAMO,UAAU,GAAG,SAAbA,UAAUA;AACdC,KAAiC;AACjCC,MAAc;AACdC,mBAA0F;AAC3D;EAC/B,IAAMC,SAAS,GAAGH,KAAK,CAACI,SAAS,CAAC,UAACC,IAAI,UAAKA,IAAI,CAACC,EAAE,KAAKL,MAAM,GAAC;EAC/D,IAAIE,SAAS,KAAK,CAAC,CAAC,EAAE;IACpB,OAAOH,KAAK;EACd;;EAEA,IAAMO,QAAQ,MAAAC,MAAA,CAAOR,KAAK,CAAC;EAC3B,IAAMK,IAAI,GAAGL,KAAK,CAACG,SAAS,C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B,EAAhBA,gBAAgB,EAAED,MAAM,EAANA,MAAM,CAAC,CAAC,EAAC,CAAC,GAAC;MACtF,CAAC;MACD;IACF,CAAC;;IAED,IAAMa,KAAK,GAAGtC,cAAK,CAACwB,WAAW,CAAC,YAAM;MACpCR,QAAQ,CAAC,oBAAM,EAAE,EAA8B,CAAC;IAClD,CAAC,EAAE,EAAE,CAAC;;IAEN;MACExC,MAAA,CAAAqB,OAAA,CAAA0C,aAAA,CAACzD,2BAAA,CAAA0D,0BAA0B,CAACC,QAAQ;QAClCC,KAAK,EAAE,IAAAC,4BAAa,EAAC;UACnBpB,aAAa,EAAbA,aAAa;UACbrC,KAAK,EAALA,KAAK;UACL8B,QAAQ,EAAEiB,sBAAsB;UAChCE,UAAU,EAAVA,UAAU;UACVE,uBAAuB,EAAvBA,uBAAuB;UACvBC,KAAK,EAALA,KAAK;UACLpB,kBAAkB,EAAlBA,kBAAkB;UAClBC,qBAAqB,EAArBA;QACF,CAAC,CAAE;;MAEFd;MACkC,CAAC;;EAE1C;AACF,CAAC;AACDP,2BAA2B,CAAC8C,WAAW,GAAG,6BAA6B","ignoreList":[]}
@@ -1,4 +1,4 @@
1
1
  import type { ComponentType } from 'react';
2
2
  import React from 'react';
3
3
  import type { FileUploaderControlProviderProps } from './FileUploaderControlProvider';
4
- export declare const withFileUploaderControlProvider: <TProps extends Record<string, any>, TRef extends Record<string, any>>(Component: ComponentType<Pick<TProps & FileUploaderControlProviderProps, Exclude<keyof TProps, keyof FileUploaderControlProviderProps>>>) => React.MemoExoticComponent<React.ForwardRefExoticComponent<React.PropsWithoutRef<TProps & FileUploaderControlProviderProps> & React.RefAttributes<TRef>>>;
4
+ export declare const withFileUploaderControlProvider: <TProps extends Record<string, any>, TRef extends Record<string, any>>(Component: ComponentType<Omit<React.PropsWithoutRef<TProps & FileUploaderControlProviderProps>, "onAttach" | "onRemove" | "onValueChange" | "initialFiles">>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<TProps & FileUploaderControlProviderProps> & React.RefAttributes<TRef>>;