@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.
- package/cjs/components/Button/Button.d.ts +1 -0
- package/cjs/components/Button/Button.js.map +1 -1
- package/cjs/components/Calendar/Calendar.d.ts +1 -1
- package/cjs/components/Calendar/Calendar.js.map +1 -1
- package/cjs/components/DateInput/DateFragmentsView.d.ts +2 -2
- package/cjs/components/DateInput/DateFragmentsView.js.map +1 -1
- package/cjs/components/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/cjs/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/cjs/components/DateRangePicker/DateRangePickerContext.d.ts +3 -3
- package/cjs/components/DateRangePicker/DateRangePickerContext.js.map +1 -1
- package/cjs/components/DateRangePicker/DateRangePickerInput.js.map +1 -1
- package/cjs/components/Dropdown/Dropdown.d.ts +4 -4
- package/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/cjs/components/DropdownMenu/DropdownMenu.js +3 -1
- package/cjs/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/cjs/components/FileUploader/FileUploader.d.ts +1 -1
- package/cjs/components/FileUploader/FileUploaderFile.js.map +1 -1
- package/cjs/components/GlobalLoader/GlobalLoaderView.d.ts +3 -2
- package/cjs/components/GlobalLoader/GlobalLoaderView.js +49 -50
- package/cjs/components/GlobalLoader/GlobalLoaderView.js.map +1 -1
- package/cjs/components/Input/Input.d.ts +2 -2
- package/cjs/components/Input/Input.js.map +1 -1
- package/cjs/components/Input/InputLayout/InputLayout.d.ts +3 -1
- package/cjs/components/Input/InputLayout/InputLayout.js +2 -1
- package/cjs/components/Input/InputLayout/InputLayout.js.map +1 -1
- package/cjs/components/Input/InputLayout/InputLayoutAsideIcon.js +6 -4
- package/cjs/components/Input/InputLayout/InputLayoutAsideIcon.js.map +1 -1
- package/cjs/components/Kebab/Kebab.d.ts +1 -1
- package/cjs/components/Kebab/Kebab.js.map +1 -1
- package/cjs/components/Link/Link.d.ts +1 -1
- package/cjs/components/Link/Link.js.map +1 -1
- package/cjs/components/MaskedInput/ColorableInputElement/ColorableInputElement.d.ts +1 -1
- package/cjs/components/MaskedInput/ColorableInputElement/ColorableInputElement.js +1 -1
- package/cjs/components/MaskedInput/ColorableInputElement/ColorableInputElement.js.map +1 -1
- package/cjs/components/MaskedInput/FixedIMaskInput.js +3 -1
- package/cjs/components/MaskedInput/FixedIMaskInput.js.map +1 -1
- package/cjs/components/MaskedInput/MaskedInput.js +2 -2
- package/cjs/components/MaskedInput/MaskedInput.js.map +1 -1
- package/cjs/components/MenuItem/MenuItem.d.ts +1 -1
- package/cjs/components/MenuItem/MenuItem.js.map +1 -1
- package/cjs/components/Modal/Modal.d.ts +4 -1
- package/cjs/components/Modal/Modal.js +8 -3
- package/cjs/components/Modal/Modal.js.map +1 -1
- package/cjs/components/Modal/ModalBody.d.ts +2 -2
- package/cjs/components/Modal/ModalBody.js.map +1 -1
- package/cjs/components/Paging/Paging.d.ts +2 -2
- package/cjs/components/Paging/Paging.js.map +1 -1
- package/cjs/components/PasswordInput/PasswordInput.d.ts +1 -1
- package/cjs/components/PasswordInput/PasswordInput.js.map +1 -1
- package/cjs/components/RadioGroup/RadioGroup.d.ts +2 -2
- package/cjs/components/RadioGroup/RadioGroup.js.map +1 -1
- package/cjs/components/ResponsiveLayout/decorator.d.ts +0 -3
- package/cjs/components/ScrollContainer/ScrollContainer.d.ts +1 -1
- package/cjs/components/ScrollContainer/ScrollContainer.js.map +1 -1
- package/cjs/components/Select/Select.d.ts +1 -1
- package/cjs/components/Select/Select.js.map +1 -1
- package/cjs/components/SidePage/SidePage.d.ts +5 -2
- package/cjs/components/SidePage/SidePage.js +9 -3
- package/cjs/components/SidePage/SidePage.js.map +1 -1
- package/cjs/components/SidePage/SidePageFooter.d.ts +1 -1
- package/cjs/components/SidePage/SidePageFooter.js.map +1 -1
- package/cjs/components/SidePage/SidePageHeader.d.ts +1 -1
- package/cjs/components/SidePage/SidePageHeader.js.map +1 -1
- package/cjs/components/SingleToast/SingleToast.d.ts +1 -1
- package/cjs/components/Sticky/Sticky.js +6 -2
- package/cjs/components/Sticky/Sticky.js.map +1 -1
- package/cjs/components/Tabs/Tabs.d.ts +1 -1
- package/cjs/components/Tabs/Tabs.js.map +1 -1
- package/cjs/components/Token/TokenView.d.ts +2 -1
- package/cjs/components/Token/TokenView.js +4 -4
- package/cjs/components/Token/TokenView.js.map +1 -1
- package/cjs/components/TokenInput/TextWidthHelper.js +3 -1
- package/cjs/components/TokenInput/TextWidthHelper.js.map +1 -1
- package/cjs/components/TokenInput/TokenInput.js +14 -7
- package/cjs/components/TokenInput/TokenInput.js.map +1 -1
- package/cjs/components/Tooltip/Tooltip.d.ts +4 -4
- package/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/cjs/hooks/useDrop.js +1 -1
- package/cjs/hooks/useDrop.js.map +1 -1
- package/cjs/internal/CommonWrapper/CommonWrapper.js +3 -2
- package/cjs/internal/CommonWrapper/CommonWrapper.js.map +1 -1
- package/cjs/internal/FileUploaderControl/FileUploaderControlProvider.d.ts +3 -6
- package/cjs/internal/FileUploaderControl/FileUploaderControlProvider.js +84 -83
- package/cjs/internal/FileUploaderControl/FileUploaderControlProvider.js.map +1 -1
- package/cjs/internal/FileUploaderControl/withFileUploaderControlProvider.d.ts +1 -1
- package/cjs/internal/FileUploaderControl/withFileUploaderControlProvider.js +11 -12
- package/cjs/internal/FileUploaderControl/withFileUploaderControlProvider.js.map +1 -1
- package/cjs/internal/FocusControlWrapper/FocusControlWrapper.d.ts +5 -6
- package/cjs/internal/FocusControlWrapper/FocusControlWrapper.js +28 -23
- package/cjs/internal/FocusControlWrapper/FocusControlWrapper.js.map +1 -1
- package/cjs/internal/IgnoreLayerClick/IgnoreLayerClick.d.ts +1 -1
- package/cjs/internal/InputLikeText/InputLikeText.d.ts +2 -2
- package/cjs/internal/InputLikeText/InputLikeText.js.map +1 -1
- package/cjs/internal/Menu/Menu.js +6 -2
- package/cjs/internal/Menu/Menu.js.map +1 -1
- package/cjs/internal/Menu/MenuNavigation.d.ts +1 -1
- package/cjs/internal/Menu/MenuNavigation.js.map +1 -1
- package/cjs/internal/MobilePopup/MobilePopup.d.ts +1 -0
- package/cjs/internal/MobilePopup/MobilePopup.js +9 -1
- package/cjs/internal/MobilePopup/MobilePopup.js.map +1 -1
- package/cjs/internal/Popup/Popup.js +2 -4
- package/cjs/internal/Popup/Popup.js.map +1 -1
- package/cjs/internal/PopupMenu/PopupMenu.d.ts +1 -1
- package/cjs/internal/PopupMenu/PopupMenu.js +9 -3
- package/cjs/internal/PopupMenu/PopupMenu.js.map +1 -1
- package/cjs/internal/RenderLayer/RenderLayer.d.ts +2 -2
- package/cjs/internal/RenderLayer/RenderLayer.js.map +1 -1
- package/cjs/internal/TextWidthHelper/TextWidthHelper.js +3 -1
- package/cjs/internal/TextWidthHelper/TextWidthHelper.js.map +1 -1
- package/cjs/internal/ThemePlayground/FxInputPlayground.d.ts +1 -1
- package/cjs/internal/ThemePlayground/FxInputPlayground.js.map +1 -1
- package/cjs/lib/dom/getDOMRect.d.ts +1 -1
- package/cjs/lib/dom/getDOMRect.js +3 -1
- package/cjs/lib/dom/getDOMRect.js.map +1 -1
- package/cjs/lib/events/fixFirefoxModifiedClickOnLabel.d.ts +1 -1
- package/cjs/lib/events/fixFirefoxModifiedClickOnLabel.js.map +1 -1
- package/cjs/lib/forwardRefAndName.d.ts +3 -2
- package/cjs/lib/forwardRefAndName.js +2 -1
- package/cjs/lib/forwardRefAndName.js.map +1 -1
- package/cjs/lib/getElementRef.d.ts +5 -0
- package/cjs/lib/getElementRef.js +16 -0
- package/cjs/lib/getElementRef.js.map +1 -0
- package/cjs/lib/locale/decorators.d.ts +0 -3
- package/cjs/lib/mergeRefs.d.ts +2 -3
- package/cjs/lib/mergeRefs.js +1 -1
- package/cjs/lib/mergeRefs.js.map +1 -1
- package/cjs/lib/reactGetTextContent.js +6 -1
- package/cjs/lib/reactGetTextContent.js.map +1 -1
- package/cjs/lib/renderEnvironment/RenderEnvironmentDecorator.d.ts +0 -3
- package/cjs/lib/rootNode/getRootNode.js +1 -24
- package/cjs/lib/rootNode/getRootNode.js.map +1 -1
- package/cjs/lib/rootNode/rootNodeDecorator.d.ts +0 -3
- package/cjs/lib/size/SizeDecorator.d.ts +0 -3
- package/cjs/lib/types/polymorphic-component.d.ts +2 -1
- package/cjs/lib/types/polymorphic-component.js.map +1 -1
- package/cjs/lib/utils.d.ts +4 -3
- package/cjs/lib/utils.js +4 -3
- package/cjs/lib/utils.js.map +1 -1
- package/cjs/lib/withClassWrapper.d.ts +3 -8
- package/components/Button/Button/Button.js +1 -1
- package/components/Button/Button/Button.js.map +1 -1
- package/components/Button/Button.d.ts +1 -0
- package/components/Calendar/Calendar/Calendar.js.map +1 -1
- package/components/Calendar/Calendar.d.ts +1 -1
- package/components/DateInput/DateFragmentsView/DateFragmentsView.js.map +1 -1
- package/components/DateInput/DateFragmentsView.d.ts +2 -2
- package/components/DateRangePicker/DateRangePicker/DateRangePicker.js +1 -1
- package/components/DateRangePicker/DateRangePicker/DateRangePicker.js.map +1 -1
- package/components/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/components/DateRangePicker/DateRangePickerContext/DateRangePickerContext.js.map +1 -1
- package/components/DateRangePicker/DateRangePickerContext.d.ts +3 -3
- package/components/DateRangePicker/DateRangePickerInput/DateRangePickerInput.js.map +1 -1
- package/components/Dropdown/Dropdown/Dropdown.js.map +1 -1
- package/components/Dropdown/Dropdown.d.ts +4 -4
- package/components/DropdownMenu/DropdownMenu/DropdownMenu.js +1 -1
- package/components/DropdownMenu/DropdownMenu/DropdownMenu.js.map +1 -1
- package/components/FileUploader/FileUploader.d.ts +1 -1
- package/components/FileUploader/FileUploaderFile/FileUploaderFile.js +1 -1
- package/components/FileUploader/FileUploaderFile/FileUploaderFile.js.map +1 -1
- package/components/GlobalLoader/GlobalLoaderView/GlobalLoaderView.js +5 -4
- package/components/GlobalLoader/GlobalLoaderView/GlobalLoaderView.js.map +1 -1
- package/components/GlobalLoader/GlobalLoaderView.d.ts +3 -2
- package/components/Input/Input/Input.js.map +1 -1
- package/components/Input/Input.d.ts +2 -2
- package/components/Input/InputLayout/InputLayout/InputLayout.js +4 -2
- package/components/Input/InputLayout/InputLayout/InputLayout.js.map +1 -1
- package/components/Input/InputLayout/InputLayout.d.ts +3 -1
- package/components/Input/InputLayout/InputLayoutAsideIcon/InputLayoutAsideIcon.js +2 -2
- package/components/Input/InputLayout/InputLayoutAsideIcon/InputLayoutAsideIcon.js.map +1 -1
- package/components/Kebab/Kebab/Kebab.js.map +1 -1
- package/components/Kebab/Kebab.d.ts +1 -1
- package/components/Link/Link/Link.js.map +1 -1
- package/components/Link/Link.d.ts +1 -1
- package/components/MaskedInput/ColorableInputElement/ColorableInputElement/ColorableInputElement.js +1 -1
- package/components/MaskedInput/ColorableInputElement/ColorableInputElement/ColorableInputElement.js.map +1 -1
- package/components/MaskedInput/ColorableInputElement/ColorableInputElement.d.ts +1 -1
- package/components/MaskedInput/FixedIMaskInput/FixedIMaskInput.js +1 -1
- package/components/MaskedInput/FixedIMaskInput/FixedIMaskInput.js.map +1 -1
- package/components/MaskedInput/MaskedInput/MaskedInput.js +2 -2
- package/components/MaskedInput/MaskedInput/MaskedInput.js.map +1 -1
- package/components/MenuItem/MenuItem/MenuItem.js.map +1 -1
- package/components/MenuItem/MenuItem.d.ts +1 -1
- package/components/Modal/Modal/Modal.js +7 -3
- package/components/Modal/Modal/Modal.js.map +1 -1
- package/components/Modal/Modal.d.ts +4 -1
- package/components/Modal/ModalBody/ModalBody.js.map +1 -1
- package/components/Modal/ModalBody.d.ts +2 -2
- package/components/Paging/Paging/Paging.js.map +1 -1
- package/components/Paging/Paging.d.ts +2 -2
- package/components/PasswordInput/PasswordInput/PasswordInput.js.map +1 -1
- package/components/PasswordInput/PasswordInput.d.ts +1 -1
- package/components/RadioGroup/RadioGroup/RadioGroup.js.map +1 -1
- package/components/RadioGroup/RadioGroup.d.ts +2 -2
- package/components/ResponsiveLayout/decorator.d.ts +0 -3
- package/components/ScrollContainer/ScrollContainer/ScrollContainer.js +1 -1
- package/components/ScrollContainer/ScrollContainer/ScrollContainer.js.map +1 -1
- package/components/ScrollContainer/ScrollContainer.d.ts +1 -1
- package/components/Select/Select/Select.js.map +1 -1
- package/components/Select/Select.d.ts +1 -1
- package/components/SidePage/SidePage/SidePage.js +7 -3
- package/components/SidePage/SidePage/SidePage.js.map +1 -1
- package/components/SidePage/SidePage.d.ts +5 -2
- package/components/SidePage/SidePageFooter/SidePageFooter.js.map +1 -1
- package/components/SidePage/SidePageFooter.d.ts +1 -1
- package/components/SidePage/SidePageHeader/SidePageHeader.js.map +1 -1
- package/components/SidePage/SidePageHeader.d.ts +1 -1
- package/components/SingleToast/SingleToast.d.ts +1 -1
- package/components/Sticky/Sticky/Sticky.js +2 -2
- package/components/Sticky/Sticky/Sticky.js.map +1 -1
- package/components/Tabs/Tabs/Tabs.js.map +1 -1
- package/components/Tabs/Tabs.d.ts +1 -1
- package/components/Token/TokenView/TokenView.js +6 -4
- package/components/Token/TokenView/TokenView.js.map +1 -1
- package/components/Token/TokenView.d.ts +2 -1
- package/components/TokenInput/TextWidthHelper/TextWidthHelper.js +1 -1
- package/components/TokenInput/TextWidthHelper/TextWidthHelper.js.map +1 -1
- package/components/TokenInput/TokenInput/TokenInput.js +5 -5
- package/components/TokenInput/TokenInput/TokenInput.js.map +1 -1
- package/components/Tooltip/Tooltip/Tooltip.js.map +1 -1
- package/components/Tooltip/Tooltip.d.ts +4 -4
- package/hooks/useDrop/useDrop.js +1 -1
- package/hooks/useDrop/useDrop.js.map +1 -1
- package/internal/CommonWrapper/CommonWrapper/CommonWrapper.js +3 -2
- package/internal/CommonWrapper/CommonWrapper/CommonWrapper.js.map +1 -1
- package/internal/FileUploaderControl/FileUploaderControlProvider/FileUploaderControlProvider.js +2 -2
- package/internal/FileUploaderControl/FileUploaderControlProvider/FileUploaderControlProvider.js.map +1 -1
- package/internal/FileUploaderControl/FileUploaderControlProvider.d.ts +3 -6
- package/internal/FileUploaderControl/withFileUploaderControlProvider/withFileUploaderControlProvider.js +2 -3
- package/internal/FileUploaderControl/withFileUploaderControlProvider/withFileUploaderControlProvider.js.map +1 -1
- package/internal/FileUploaderControl/withFileUploaderControlProvider.d.ts +1 -1
- package/internal/FocusControlWrapper/FocusControlWrapper/FocusControlWrapper.js +7 -4
- package/internal/FocusControlWrapper/FocusControlWrapper/FocusControlWrapper.js.map +1 -1
- package/internal/FocusControlWrapper/FocusControlWrapper.d.ts +5 -6
- package/internal/IgnoreLayerClick/IgnoreLayerClick.d.ts +1 -1
- package/internal/InputLikeText/InputLikeText/InputLikeText.js.map +1 -1
- package/internal/InputLikeText/InputLikeText.d.ts +2 -2
- package/internal/Menu/Menu/Menu.js +2 -2
- package/internal/Menu/Menu/Menu.js.map +1 -1
- package/internal/Menu/MenuNavigation/MenuNavigation.js.map +1 -1
- package/internal/Menu/MenuNavigation.d.ts +1 -1
- package/internal/MobilePopup/MobilePopup/MobilePopup.js +5 -2
- package/internal/MobilePopup/MobilePopup/MobilePopup.js.map +1 -1
- package/internal/MobilePopup/MobilePopup.d.ts +1 -0
- package/internal/Popup/Popup/Popup.js +2 -2
- package/internal/Popup/Popup/Popup.js.map +1 -1
- package/internal/PopupMenu/PopupMenu/PopupMenu.js +3 -3
- package/internal/PopupMenu/PopupMenu/PopupMenu.js.map +1 -1
- package/internal/PopupMenu/PopupMenu.d.ts +1 -1
- package/internal/RenderLayer/RenderLayer/RenderLayer.js.map +1 -1
- package/internal/RenderLayer/RenderLayer.d.ts +2 -2
- package/internal/TextWidthHelper/TextWidthHelper/TextWidthHelper.js +1 -1
- package/internal/TextWidthHelper/TextWidthHelper/TextWidthHelper.js.map +1 -1
- package/internal/ThemePlayground/FxInputPlayground/FxInputPlayground.js.map +1 -1
- package/internal/ThemePlayground/FxInputPlayground.d.ts +1 -1
- package/lib/dom/getDOMRect/getDOMRect.js.map +1 -1
- package/lib/dom/getDOMRect.d.ts +1 -1
- package/lib/events/fixFirefoxModifiedClickOnLabel/fixFirefoxModifiedClickOnLabel.js.map +1 -1
- package/lib/events/fixFirefoxModifiedClickOnLabel.d.ts +1 -1
- package/lib/forwardRefAndName/forwardRefAndName.js.map +1 -1
- package/lib/forwardRefAndName.d.ts +3 -2
- package/lib/getElementRef/getElementRef.js +11 -0
- package/lib/getElementRef/getElementRef.js.map +1 -0
- package/lib/getElementRef/package.json +6 -0
- package/lib/getElementRef.d.ts +5 -0
- package/lib/locale/decorators.d.ts +0 -3
- package/lib/mergeRefs/mergeRefs.js.map +1 -1
- package/lib/mergeRefs.d.ts +2 -3
- package/lib/reactGetTextContent/reactGetTextContent.js +1 -1
- package/lib/reactGetTextContent/reactGetTextContent.js.map +1 -1
- package/lib/renderEnvironment/RenderEnvironmentDecorator.d.ts +0 -3
- package/lib/rootNode/getRootNode/getRootNode.js +0 -15
- package/lib/rootNode/getRootNode/getRootNode.js.map +1 -1
- package/lib/rootNode/rootNodeDecorator.d.ts +0 -3
- package/lib/size/SizeDecorator.d.ts +0 -3
- package/lib/types/polymorphic-component/polymorphic-component.js.map +1 -1
- package/lib/types/polymorphic-component.d.ts +2 -1
- package/lib/utils/utils.js +2 -2
- package/lib/utils/utils.js.map +1 -1
- package/lib/utils.d.ts +4 -3
- package/lib/withClassWrapper.d.ts +3 -8
- package/package.json +10 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getDOMRect","element","defaultValues","width","height","x","y","bottom","left","right","top","getRefRect","getElementRect","getBoundingClientRect","ref","current"],"sources":["getDOMRect.ts"],"sourcesContent":["import type { Nullable } from '../../typings/utility-types';\ntype DOMRectDefaultValues = Omit<DOMRect, 'toJSON'>;\n/**\n * Возвращает размер элемента и его позицию относительно viewport\n *\n * @param element - ref элемента или сам элемент\n * @returns - возвращает размер элемента и его позицию относительно viewport\n */\nexport const getDOMRect = <T extends Element>(element: Nullable<T> | React.RefObject<T
|
|
1
|
+
{"version":3,"names":["getDOMRect","element","defaultValues","width","height","x","y","bottom","left","right","top","getRefRect","getElementRect","getBoundingClientRect","ref","current"],"sources":["getDOMRect.ts"],"sourcesContent":["import type { Nullable } from '../../typings/utility-types';\ntype DOMRectDefaultValues = Omit<DOMRect, 'toJSON'>;\n/**\n * Возвращает размер элемента и его позицию относительно viewport\n *\n * @param element - ref элемента или сам элемент\n * @returns - возвращает размер элемента и его позицию относительно viewport\n */\nexport const getDOMRect = <T extends Element>(\n element: Nullable<T> | React.RefObject<T | null>,\n): DOMRectDefaultValues => {\n const defaultValues: DOMRectDefaultValues = {\n width: 0,\n height: 0,\n x: 0,\n y: 0,\n bottom: 0,\n left: 0,\n right: 0,\n top: 0,\n };\n if (element && 'current' in element) {\n return getRefRect(defaultValues, element);\n }\n return getElementRect(defaultValues, element);\n};\nconst getElementRect = (defaultValues: DOMRectDefaultValues, element: Nullable<Element>) => {\n if (element) {\n return element.getBoundingClientRect();\n }\n return defaultValues;\n};\nconst getRefRect = <T extends Element>(defaultValues: DOMRectDefaultValues, ref: React.RefObject<T | null>) => {\n if (ref?.current) {\n return ref.current.getBoundingClientRect();\n }\n return defaultValues;\n};\n"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMA,UAAU,GAAG,SAAbA,UAAUA;AACrBC,OAAgD;AACvB;EACzB,IAAMC,aAAmC,GAAG;IAC1CC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,CAAC,EAAE,CAAC;IACJC,CAAC,EAAE,CAAC;IACJC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,GAAG,EAAE;EACP,CAAC;EACD,IAAIT,OAAO,IAAI,SAAS,IAAIA,OAAO,EAAE;IACnC,OAAOU,UAAU,CAACT,aAAa,EAAED,OAAO,CAAC;EAC3C;EACA,OAAOW,cAAc,CAACV,aAAa,EAAED,OAAO,CAAC;AAC/C,CAAC;AACD,IAAMW,cAAc,GAAG,SAAjBA,cAAcA,CAAIV,aAAmC,EAAED,OAA0B,EAAK;EAC1F,IAAIA,OAAO,EAAE;IACX,OAAOA,OAAO,CAACY,qBAAqB,CAAC,CAAC;EACxC;EACA,OAAOX,aAAa;AACtB,CAAC;AACD,IAAMS,UAAU,GAAG,SAAbA,UAAUA,CAAuBT,aAAmC,EAAEY,GAA8B,EAAK;EAC7G,IAAIA,GAAG,YAAHA,GAAG,CAAEC,OAAO,EAAE;IAChB,OAAOD,GAAG,CAACC,OAAO,CAACF,qBAAqB,CAAC,CAAC;EAC5C;EACA,OAAOX,aAAa;AACtB,CAAC","ignoreList":[]}
|
package/lib/dom/getDOMRect.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ type DOMRectDefaultValues = Omit<DOMRect, 'toJSON'>;
|
|
|
6
6
|
* @param element - ref элемента или сам элемент
|
|
7
7
|
* @returns - возвращает размер элемента и его позицию относительно viewport
|
|
8
8
|
*/
|
|
9
|
-
export declare const getDOMRect: <T extends Element>(element: Nullable<T> | React.RefObject<T>) => DOMRectDefaultValues;
|
|
9
|
+
export declare const getDOMRect: <T extends Element>(element: Nullable<T> | React.RefObject<T | null>) => DOMRectDefaultValues;
|
|
10
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isBrowser","getOwnerGlobalObject","isFirefox","fixFirefoxModifiedClickOnLabel","ref","e","input","current","globalObject","disabled","shiftKey","ctrlKey","metaKey","checked","type","persist","MouseEvent","dispatchEvent","nativeEvent"],"sources":["fixFirefoxModifiedClickOnLabel.ts"],"sourcesContent":["import type React from 'react';\n\nimport { isBrowser, getOwnerGlobalObject } from '../../lib/globalObject';\nimport { isFirefox } from '../client';\n\n// Checkbox not checked in Firefox if key of modifier was active\n// shift+click, ctrl+click on Win and cmd+click on Mac\n// https://bugzilla.mozilla.org/show_bug.cgi?id=559506\nexport const fixFirefoxModifiedClickOnLabel =\n (ref: React.RefObject<HTMLInputElement>) => (e: React.MouseEvent<HTMLLabelElement>) => {\n const input = ref.current;\n if (!input) {\n return;\n }\n\n const globalObject = getOwnerGlobalObject(input);\n if (!input.disabled && isBrowser(globalObject) && isFirefox && (e.shiftKey || e.ctrlKey || e.metaKey)) {\n // Currently only valid for Radio and Checkbox\n input.checked = !input.checked;\n const type = input.type;\n input.type = 'text';\n e.persist();\n if (globalObject.MouseEvent) {\n input.dispatchEvent(new globalObject.MouseEvent('change', e.nativeEvent));\n }\n input.type = type;\n }\n };\n"],"mappings":";;AAEA,SAASA,SAAS,EAAEC,oBAAoB,QAAQ,wBAAwB;AACxE,SAASC,SAAS,QAAQ,WAAW;;AAErC;AACA;AACA;AACA,OAAO,IAAMC,8BAA8B;AACzC,SADWA,8BAA8BA,CACxCC,
|
|
1
|
+
{"version":3,"names":["isBrowser","getOwnerGlobalObject","isFirefox","fixFirefoxModifiedClickOnLabel","ref","e","input","current","globalObject","disabled","shiftKey","ctrlKey","metaKey","checked","type","persist","MouseEvent","dispatchEvent","nativeEvent"],"sources":["fixFirefoxModifiedClickOnLabel.ts"],"sourcesContent":["import type React from 'react';\n\nimport { isBrowser, getOwnerGlobalObject } from '../../lib/globalObject';\nimport { isFirefox } from '../client';\n\n// Checkbox not checked in Firefox if key of modifier was active\n// shift+click, ctrl+click on Win and cmd+click on Mac\n// https://bugzilla.mozilla.org/show_bug.cgi?id=559506\nexport const fixFirefoxModifiedClickOnLabel =\n (ref: React.RefObject<HTMLInputElement | null>) => (e: React.MouseEvent<HTMLLabelElement>) => {\n const input = ref.current;\n if (!input) {\n return;\n }\n\n const globalObject = getOwnerGlobalObject(input);\n if (!input.disabled && isBrowser(globalObject) && isFirefox && (e.shiftKey || e.ctrlKey || e.metaKey)) {\n // Currently only valid for Radio and Checkbox\n input.checked = !input.checked;\n const type = input.type;\n input.type = 'text';\n e.persist();\n if (globalObject.MouseEvent) {\n input.dispatchEvent(new globalObject.MouseEvent('change', e.nativeEvent));\n }\n input.type = type;\n }\n };\n"],"mappings":";;AAEA,SAASA,SAAS,EAAEC,oBAAoB,QAAQ,wBAAwB;AACxE,SAASC,SAAS,QAAQ,WAAW;;AAErC;AACA;AACA;AACA,OAAO,IAAMC,8BAA8B;AACzC,SADWA,8BAA8BA,CACxCC,GAA6C,UAAK,UAACC,CAAqC,EAAK;IAC5F,IAAMC,KAAK,GAAGF,GAAG,CAACG,OAAO;IACzB,IAAI,CAACD,KAAK,EAAE;MACV;IACF;;IAEA,IAAME,YAAY,GAAGP,oBAAoB,CAACK,KAAK,CAAC;IAChD,IAAI,CAACA,KAAK,CAACG,QAAQ,IAAIT,SAAS,CAACQ,YAAY,CAAC,IAAIN,SAAS,KAAKG,CAAC,CAACK,QAAQ,IAAIL,CAAC,CAACM,OAAO,IAAIN,CAAC,CAACO,OAAO,CAAC,EAAE;MACrG;MACAN,KAAK,CAACO,OAAO,GAAG,CAACP,KAAK,CAACO,OAAO;MAC9B,IAAMC,IAAI,GAAGR,KAAK,CAACQ,IAAI;MACvBR,KAAK,CAACQ,IAAI,GAAG,MAAM;MACnBT,CAAC,CAACU,OAAO,CAAC,CAAC;MACX,IAAIP,YAAY,CAACQ,UAAU,EAAE;QAC3BV,KAAK,CAACW,aAAa,CAAC,IAAIT,YAAY,CAACQ,UAAU,CAAC,QAAQ,EAAEX,CAAC,CAACa,WAAW,CAAC,CAAC;MAC3E;MACAZ,KAAK,CAACQ,IAAI,GAAGA,IAAI;IACnB;EACF,CAAC","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
-
export declare const fixFirefoxModifiedClickOnLabel: (ref: React.RefObject<HTMLInputElement>) => (e: React.MouseEvent<HTMLLabelElement>) => void;
|
|
2
|
+
export declare const fixFirefoxModifiedClickOnLabel: (ref: React.RefObject<HTMLInputElement | null>) => (e: React.MouseEvent<HTMLLabelElement>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","forwardName","name","render","displayName","__KONTUR_REACT_UI__","forwardRefAndName","forwardIconName","__KONTUR_ICON__","forwardRefAndIconName"],"sources":["forwardRefAndName.ts"],"sourcesContent":["import { forwardRef } from 'react';\n\nexport interface ReactUIComponentWithRef<T, P>\n extends React.NamedExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>> {\n __KONTUR_REACT_UI__: string;\n}\n\nfunction forwardName<ElementType, Props>(\n name: string,\n render: ReactUIComponentWithRef<ElementType, Props>,\n): ReactUIComponentWithRef<ElementType, Props> {\n render.displayName = name;\n render.__KONTUR_REACT_UI__ = name;\n return render;\n}\n\nexport function forwardRefAndName<ElementType, Props, Extra extends Record<string, unknown> = Record<never, never>>(\n name: string,\n render: React.ForwardRefRenderFunction<ElementType, Props
|
|
1
|
+
{"version":3,"names":["forwardRef","forwardName","name","render","displayName","__KONTUR_REACT_UI__","forwardRefAndName","forwardIconName","__KONTUR_ICON__","forwardRefAndIconName"],"sources":["forwardRefAndName.ts"],"sourcesContent":["import type { PropsWithoutRef } from 'react';\nimport { forwardRef } from 'react';\n\nexport interface ReactUIComponentWithRef<T, P>\n extends React.NamedExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>> {\n __KONTUR_REACT_UI__: string;\n}\n\nfunction forwardName<ElementType, Props>(\n name: string,\n render: ReactUIComponentWithRef<ElementType, Props>,\n): ReactUIComponentWithRef<ElementType, Props> {\n render.displayName = name;\n render.__KONTUR_REACT_UI__ = name;\n return render;\n}\n\nexport function forwardRefAndName<ElementType, Props, Extra extends Record<string, unknown> = Record<never, never>>(\n name: string,\n render: React.ForwardRefRenderFunction<ElementType, PropsWithoutRef<Props>>,\n): ReactUIComponentWithRef<ElementType, Props> & Extra {\n return forwardName<ElementType, Props>(\n name,\n forwardRef(render) as ReactUIComponentWithRef<ElementType, Props> & Extra,\n ) as ReactUIComponentWithRef<ElementType, Props> & Extra;\n}\n\nexport interface ReactUIIconWithRef<T, P> extends ReactUIComponentWithRef<T, P> {\n __KONTUR_ICON__: boolean;\n}\n\nfunction forwardIconName<ElementType, Props>(\n name: string,\n render: ReactUIIconWithRef<ElementType, Props>,\n): ReactUIIconWithRef<ElementType, Props> {\n render.displayName = name;\n render.__KONTUR_REACT_UI__ = name;\n render.__KONTUR_ICON__ = true;\n return render;\n}\n\nexport function forwardRefAndIconName<ElementType, Props>(\n name: string,\n render: React.ForwardRefRenderFunction<ElementType, PropsWithoutRef<Props>>,\n): ReactUIIconWithRef<ElementType, Props> {\n return forwardIconName<ElementType, Props>(name, forwardRef(render) as ReactUIIconWithRef<ElementType, Props>);\n}\n"],"mappings":";AACA,SAASA,UAAU,QAAQ,OAAO;;;;;;;AAOlC,SAASC,WAAWA;AAClBC,IAAY;AACZC,MAAmD;AACN;EAC7CA,MAAM,CAACC,WAAW,GAAGF,IAAI;EACzBC,MAAM,CAACE,mBAAmB,GAAGH,IAAI;EACjC,OAAOC,MAAM;AACf;;AAEA,OAAO,SAASG,iBAAiBA;AAC/BJ,IAAY;AACZC,MAA2E;AACtB;EACrD,OAAOF,WAAW;IAChBC,IAAI;IACJF,UAAU,CAACG,MAAM;EACnB,CAAC;AACH;;;;;;AAMA,SAASI,eAAeA;AACtBL,IAAY;AACZC,MAA8C;AACN;EACxCA,MAAM,CAACC,WAAW,GAAGF,IAAI;EACzBC,MAAM,CAACE,mBAAmB,GAAGH,IAAI;EACjCC,MAAM,CAACK,eAAe,GAAG,IAAI;EAC7B,OAAOL,MAAM;AACf;;AAEA,OAAO,SAASM,qBAAqBA;AACnCP,IAAY;AACZC,MAA2E;AACnC;EACxC,OAAOI,eAAe,CAAqBL,IAAI,eAAEF,UAAU,CAACG,MAAM,CAA2C,CAAC;AAChH","ignoreList":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { PropsWithoutRef } from 'react';
|
|
1
2
|
export interface ReactUIComponentWithRef<T, P> extends React.NamedExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>> {
|
|
2
3
|
__KONTUR_REACT_UI__: string;
|
|
3
4
|
}
|
|
4
|
-
export declare function forwardRefAndName<ElementType, Props, Extra extends Record<string, unknown> = Record<never, never>>(name: string, render: React.ForwardRefRenderFunction<ElementType, Props
|
|
5
|
+
export declare function forwardRefAndName<ElementType, Props, Extra extends Record<string, unknown> = Record<never, never>>(name: string, render: React.ForwardRefRenderFunction<ElementType, PropsWithoutRef<Props>>): ReactUIComponentWithRef<ElementType, Props> & Extra;
|
|
5
6
|
export interface ReactUIIconWithRef<T, P> extends ReactUIComponentWithRef<T, P> {
|
|
6
7
|
__KONTUR_ICON__: boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare function forwardRefAndIconName<ElementType, Props>(name: string, render: React.ForwardRefRenderFunction<ElementType, Props
|
|
9
|
+
export declare function forwardRefAndIconName<ElementType, Props>(name: string, render: React.ForwardRefRenderFunction<ElementType, PropsWithoutRef<Props>>): ReactUIIconWithRef<ElementType, Props>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Получает ссылку на элемент, учитывая разные версии React
|
|
5
|
+
*/
|
|
6
|
+
export function getElementRef(element) {
|
|
7
|
+
if (parseInt(React.version, 10) >= 19 && element.props && typeof element.props === 'object' && 'ref' in element.props) {
|
|
8
|
+
return element.props.ref;
|
|
9
|
+
}
|
|
10
|
+
return element.ref;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","getElementRef","element","parseInt","version","props","ref"],"sources":["getElementRef.ts"],"sourcesContent":["import React from 'react';\n\n/**\n * Получает ссылку на элемент, учитывая разные версии React\n */\nexport function getElementRef(element: React.ReactElement) {\n if (\n parseInt(React.version, 10) >= 19 &&\n element.props &&\n typeof element.props === 'object' &&\n 'ref' in element.props\n ) {\n return element.props.ref;\n }\n return (element as any).ref;\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;;AAEzB;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAACC,OAA2B,EAAE;EACzD;EACEC,QAAQ,CAACH,KAAK,CAACI,OAAO,EAAE,EAAE,CAAC,IAAI,EAAE;EACjCF,OAAO,CAACG,KAAK;EACb,OAAOH,OAAO,CAACG,KAAK,KAAK,QAAQ;EACjC,KAAK,IAAIH,OAAO,CAACG,KAAK;EACtB;IACA,OAAOH,OAAO,CAACG,KAAK,CAACC,GAAG;EAC1B;EACA,OAAQJ,OAAO,CAASI,GAAG;AAC7B","ignoreList":[]}
|
|
@@ -15,9 +15,6 @@ export declare function locale<C>(controlName: keyof LocaleControls, localeHelpe
|
|
|
15
15
|
render(): React.ReactNode;
|
|
16
16
|
readonly props: Readonly<{}>;
|
|
17
17
|
state: Readonly<{}>;
|
|
18
|
-
refs: {
|
|
19
|
-
[key: string]: React.ReactInstance;
|
|
20
|
-
};
|
|
21
18
|
componentDidMount?(): void;
|
|
22
19
|
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
23
20
|
componentWillUnmount?(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isNonNullable","isNullable","CALLBACK_AS_KEY","callbackAsKey","cache","WeakMap","mergeRefs","_len","arguments","length","refs","Array","_key","cacheLevel","getLeafRefInCache","apply","cachedCallback","get","newRefCallback","createRefCallback","set","applyRef","value","forEach","ref","current","_len2","_key2","_i","_refs","child","leaf"],"sources":["mergeRefs.ts"],"sourcesContent":["import type React from 'react';\n\nimport type { Nullable } from '../typings/utility-types';\n\nimport { isNonNullable, isNullable } from './utils';\n\ntype RefVariants<T> = Nullable<React.RefObject<T> | React.RefCallback<T>>;\
|
|
1
|
+
{"version":3,"names":["isNonNullable","isNullable","CALLBACK_AS_KEY","callbackAsKey","cache","WeakMap","mergeRefs","_len","arguments","length","refs","Array","_key","cacheLevel","getLeafRefInCache","apply","cachedCallback","get","newRefCallback","createRefCallback","set","applyRef","value","forEach","ref","current","_len2","_key2","_i","_refs","child","leaf"],"sources":["mergeRefs.ts"],"sourcesContent":["import type React from 'react';\nimport type { RefCallback } from 'react';\n\nimport type { Nullable } from '../typings/utility-types';\n\nimport { isNonNullable, isNullable } from './utils';\n\ntype RefVariants<T> = Nullable<React.RefObject<T | null> | React.RefCallback<T>>;\nconst CALLBACK_AS_KEY = { callbackAsKey: true };\n\ntype CacheKey<T> = NonNullable<RefVariants<T> | typeof CALLBACK_AS_KEY>;\ntype CacheValue<T> = RefCallback<T> | WeakMap<CacheKey<T>, CacheValue<T>>;\n\nconst cache = new WeakMap<CacheKey<any>, CacheValue<any>>();\n\n/**\n * Позволяет объединить несколько параметров ref в один вызов, в котором во все переданные параметры просетится ref.\n *\n * Кеширует результат возвращаемой функции, так что при одинаковых входных параметрах React-у будет возвращена одинаковая функция.\n * Это позволит не вызывать лишние commitAttachRef и commitDetachRef и не ловить сайдэффекты связанные со значением ref в моменте\n *\n * Не прокидывай в параметрах стрелочные функции, так результат не будет закеширован.\n *\n * @returns function that passed refs: (...refs) =>\n *\n * @example\n * const SomeComponent = forwardRef((props, ref) => {\n * const localRef = useRef();\n * return <div ref={mergeRefs(localRef, ref)} />;\n * });\n */\nexport function mergeRefs<T>(...refs: Array<RefVariants<T>>): RefCallback<T> {\n const cacheLevel = getLeafRefInCache(...refs);\n\n const cachedCallback = cacheLevel.get(CALLBACK_AS_KEY);\n if (cachedCallback && typeof cachedCallback === 'function') {\n return cachedCallback;\n }\n\n const newRefCallback = createRefCallback<T>(refs);\n cacheLevel.set(CALLBACK_AS_KEY, newRefCallback);\n\n return newRefCallback;\n}\n\nfunction createRefCallback<T>(refs: Array<RefVariants<T>>) {\n function applyRef(value: T) {\n refs.forEach((ref) => {\n if (typeof ref === 'function') {\n return ref(value);\n } else if (isNonNullable(ref)) {\n return ((ref as React.MutableRefObject<T>).current = value);\n }\n });\n }\n return applyRef;\n}\n\nfunction getLeafRefInCache<T>(...refs: Array<RefVariants<T>>) {\n let cacheLevel = cache;\n for (const ref of refs) {\n if (isNullable(ref)) {\n continue;\n }\n const child = cacheLevel.get(ref);\n\n if (child && typeof child !== 'function') {\n cacheLevel = child;\n } else {\n const leaf = new WeakMap();\n cacheLevel.set(ref, leaf);\n cacheLevel = leaf;\n }\n }\n return cacheLevel;\n}\n"],"mappings":";;;;;AAKA,SAASA,aAAa,EAAEC,UAAU,QAAQ,SAAS;;;AAGnD,IAAMC,eAAe,GAAG,EAAEC,aAAa,EAAE,IAAI,CAAC,CAAC;;;;;AAK/C,IAAMC,KAAK,GAAG,IAAIC,OAAO,CAAiC,CAAC;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAAA,EAAoD,UAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAA7CC,IAAI,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA,KAAJF,IAAI,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAClC,IAAMC,UAAU,GAAGC,iBAAiB,CAAAC,KAAA,SAAIL,IAAI,CAAC;;EAE7C,IAAMM,cAAc,GAAGH,UAAU,CAACI,GAAG,CAACf,eAAe,CAAC;EACtD,IAAIc,cAAc,IAAI,OAAOA,cAAc,KAAK,UAAU,EAAE;IAC1D,OAAOA,cAAc;EACvB;;EAEA,IAAME,cAAc,GAAGC,iBAAiB,CAAIT,IAAI,CAAC;EACjDG,UAAU,CAACO,GAAG,CAAClB,eAAe,EAAEgB,cAAc,CAAC;;EAE/C,OAAOA,cAAc;AACvB;;AAEA,SAASC,iBAAiBA,CAAIT,IAA2B,EAAE;EACzD,SAASW,QAAQA,CAACC,KAAQ,EAAE;IAC1BZ,IAAI,CAACa,OAAO,CAAC,UAACC,GAAG,EAAK;MACpB,IAAI,OAAOA,GAAG,KAAK,UAAU,EAAE;QAC7B,OAAOA,GAAG,CAACF,KAAK,CAAC;MACnB,CAAC,MAAM,IAAItB,aAAa,CAACwB,GAAG,CAAC,EAAE;QAC7B,OAASA,GAAG,CAA+BC,OAAO,GAAGH,KAAK;MAC5D;IACF,CAAC,CAAC;EACJ;EACA,OAAOD,QAAQ;AACjB;;AAEA,SAASP,iBAAiBA,CAAA,EAAoC;EAC5D,IAAID,UAAU,GAAGT,KAAK,CAAC,SAAAsB,KAAA,GAAAlB,SAAA,CAAAC,MAAA,EADQC,IAAI,OAAAC,KAAA,CAAAe,KAAA,GAAAC,KAAA,MAAAA,KAAA,GAAAD,KAAA,EAAAC,KAAA,KAAJjB,IAAI,CAAAiB,KAAA,IAAAnB,SAAA,CAAAmB,KAAA;EAEnC,SAAAC,EAAA,MAAAC,KAAA,GAAkBnB,IAAI,EAAAkB,EAAA,GAAAC,KAAA,CAAApB,MAAA,EAAAmB,EAAA,IAAE,CAAnB,IAAMJ,GAAG,GAAAK,KAAA,CAAAD,EAAA;IACZ,IAAI3B,UAAU,CAACuB,GAAG,CAAC,EAAE;MACnB;IACF;IACA,IAAMM,KAAK,GAAGjB,UAAU,CAACI,GAAG,CAACO,GAAG,CAAC;;IAEjC,IAAIM,KAAK,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MACxCjB,UAAU,GAAGiB,KAAK;IACpB,CAAC,MAAM;MACL,IAAMC,IAAI,GAAG,IAAI1B,OAAO,CAAC,CAAC;MAC1BQ,UAAU,CAACO,GAAG,CAACI,GAAG,EAAEO,IAAI,CAAC;MACzBlB,UAAU,GAAGkB,IAAI;IACnB;EACF;EACA,OAAOlB,UAAU;AACnB","ignoreList":[]}
|
package/lib/mergeRefs.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import type { RefCallback } from 'react';
|
|
2
3
|
import type { Nullable } from '../typings/utility-types';
|
|
3
|
-
type RefVariants<T> = Nullable<React.RefObject<T> | React.RefCallback<T>>;
|
|
4
|
-
type RefCallback<T> = ReturnType<typeof createRefCallback<T>>;
|
|
4
|
+
type RefVariants<T> = Nullable<React.RefObject<T | null> | React.RefCallback<T>>;
|
|
5
5
|
/**
|
|
6
6
|
* Позволяет объединить несколько параметров ref в один вызов, в котором во все переданные параметры просетится ref.
|
|
7
7
|
*
|
|
@@ -19,5 +19,4 @@ type RefCallback<T> = ReturnType<typeof createRefCallback<T>>;
|
|
|
19
19
|
* });
|
|
20
20
|
*/
|
|
21
21
|
export declare function mergeRefs<T>(...refs: Array<RefVariants<T>>): RefCallback<T>;
|
|
22
|
-
declare function createRefCallback<T>(refs: Array<RefVariants<T>>): (value: T) => void;
|
|
23
22
|
export {};
|
|
@@ -8,7 +8,7 @@ export function reactGetTextContent(rootReactNode) {
|
|
|
8
8
|
reactNode.forEach(function (node) {
|
|
9
9
|
return getText(node);
|
|
10
10
|
});
|
|
11
|
-
} else if ( /*#__PURE__*/React.isValidElement(reactNode) && reactNode.props) {
|
|
11
|
+
} else if ( /*#__PURE__*/React.isValidElement(reactNode) && reactNode.props && typeof reactNode.props === 'object' && 'children' in reactNode.props) {
|
|
12
12
|
var children = reactNode.props.children;
|
|
13
13
|
getText(children);
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","reactGetTextContent","rootReactNode","result","getText","reactNode","toString","Array","isArray","forEach","node","isValidElement","props","children"],"sources":["reactGetTextContent.ts"],"sourcesContent":["import React from 'react';\n\nexport function reactGetTextContent(rootReactNode: React.ReactNode) {\n let result = '';\n\n const getText = (reactNode: React.ReactNode) => {\n if (typeof reactNode === 'string' || typeof reactNode === 'number') {\n result += reactNode.toString();\n } else if (Array.isArray(reactNode)) {\n reactNode.forEach((node) => getText(node));\n } else if (React.isValidElement(reactNode)
|
|
1
|
+
{"version":3,"names":["React","reactGetTextContent","rootReactNode","result","getText","reactNode","toString","Array","isArray","forEach","node","isValidElement","props","children"],"sources":["reactGetTextContent.ts"],"sourcesContent":["import React from 'react';\n\nexport function reactGetTextContent(rootReactNode: React.ReactNode) {\n let result = '';\n\n const getText = (reactNode: React.ReactNode) => {\n if (typeof reactNode === 'string' || typeof reactNode === 'number') {\n result += reactNode.toString();\n } else if (Array.isArray(reactNode)) {\n reactNode.forEach((node) => getText(node));\n } else if (\n React.isValidElement(reactNode) &&\n reactNode.props &&\n typeof reactNode.props === 'object' &&\n 'children' in reactNode.props\n ) {\n const { children } = reactNode.props;\n\n getText(children as React.ReactNode);\n }\n };\n\n getText(rootReactNode);\n\n return result;\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;;AAEzB,OAAO,SAASC,mBAAmBA,CAACC,aAA8B,EAAE;EAClE,IAAIC,MAAM,GAAG,EAAE;;EAEf,IAAMC,OAAO,GAAG,SAAVA,OAAOA,CAAIC,SAA0B,EAAK;IAC9C,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,OAAOA,SAAS,KAAK,QAAQ,EAAE;MAClEF,MAAM,IAAIE,SAAS,CAACC,QAAQ,CAAC,CAAC;IAChC,CAAC,MAAM,IAAIC,KAAK,CAACC,OAAO,CAACH,SAAS,CAAC,EAAE;MACnCA,SAAS,CAACI,OAAO,CAAC,UAACC,IAAI,UAAKN,OAAO,CAACM,IAAI,CAAC,GAAC;IAC5C,CAAC,MAAM;IACL,aAAAV,KAAK,CAACW,cAAc,CAACN,SAAS,CAAC;IAC/BA,SAAS,CAACO,KAAK;IACf,OAAOP,SAAS,CAACO,KAAK,KAAK,QAAQ;IACnC,UAAU,IAAIP,SAAS,CAACO,KAAK;IAC7B;MACA,IAAQC,QAAQ,GAAKR,SAAS,CAACO,KAAK,CAA5BC,QAAQ;;MAEhBT,OAAO,CAACS,QAA2B,CAAC;IACtC;EACF,CAAC;;EAEDT,OAAO,CAACF,aAAa,CAAC;;EAEtB,OAAOC,MAAM;AACf","ignoreList":[]}
|
|
@@ -17,9 +17,6 @@ export declare function withRenderEnvironment<T extends Constructor<React.Compon
|
|
|
17
17
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
18
18
|
readonly props: Readonly<{}>;
|
|
19
19
|
state: Readonly<{}>;
|
|
20
|
-
refs: {
|
|
21
|
-
[key: string]: React.ReactInstance;
|
|
22
|
-
};
|
|
23
20
|
componentDidMount?(): void;
|
|
24
21
|
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
25
22
|
componentWillUnmount?(): void;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { findDOMNode } from 'react-dom';
|
|
2
|
-
import warning from 'warning';
|
|
3
1
|
import { isElement } from "../../utils";
|
|
4
2
|
import { isInstanceWithRootNode } from "../rootNodeDecorator";
|
|
5
3
|
|
|
@@ -41,19 +39,6 @@ export var getRootNode = function getRootNode(instance) {
|
|
|
41
39
|
// probably its an Element or null (which is also OK, e.g. Popup/Tooltip/Hint before opening)
|
|
42
40
|
return rootNode;
|
|
43
41
|
}
|
|
44
|
-
try {
|
|
45
|
-
// rootNode is undefined, which means that the getter doesn't exists or returns the undefined
|
|
46
|
-
// anyway, it tell us that the convention is not respected,
|
|
47
|
-
// so, we have to fall back to the deprecated findDOMNode, which breaks StrictMode
|
|
48
|
-
// instance can still be a class component or an imperative handle (i.e., anything, except null/undefined/Element)
|
|
49
|
-
rootNode = findDOMNode(instance);
|
|
50
|
-
} catch (e) {
|
|
51
|
-
// but findDOMNode doesn`t accept everything that instance can be at this point,
|
|
52
|
-
// so we have to handle exceptions
|
|
53
|
-
// see https://github.com/facebook/react/blob/cae63505/packages/react-dom/src/__tests__/findDOMNode-test.js#L66-L86
|
|
54
|
-
warning(false, '[getRootNode]: can`t fallback to findDOMNode.' + '\n' + 'See https://github.com/skbkontur/retail-ui/blob/master/packages/react-ui/README.md#strictmode' + '\n\n' + (e == null ? void 0 : e.message) || String(e));
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
42
|
|
|
58
43
|
// the findDOMNode can also return Text, but we are only interested in Elements, so just filter it
|
|
59
44
|
return isElement(rootNode) ? rootNode : null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["isElement","isInstanceWithRootNode","getRootNode","instance","rootNode","undefined"],"sources":["getRootNode.ts"],"sourcesContent":["import type React from 'react';\n\nimport type { Nullable } from '../../typings/utility-types';\nimport { isElement } from '../utils';\n\nimport { isInstanceWithRootNode } from './rootNodeDecorator';\n\n/**\n * Extracts component's root Element (HTMLElement/SVGElement) out of it's instance\n * following the \"StrictMode support convention\" (@see README.md#strictmode, #2518).\n *\n * Replaces findDOMNode but falls back to it if \"convention\" is not respected.\n *\n * @param instance Component's instance provided by React.Ref or `this` inside class-components.\n * @returns Component's root `Element` or null\n */\n\nexport const getRootNode = (instance: Nullable<React.ReactInstance>): Nullable<Element> => {\n /**\n * Options of what instance can be:\n * 1. null or undefined\n * 2. DOM Element\n * 3. class Component instance (object)\n * 4. literally anything, returned from useImperativeHandle\n */\n\n if (!instance) {\n // instance can be `null` if component was unmounted\n // also checking undefined for convenient usage\n return null;\n }\n\n if (isElement(instance)) {\n // instance can be an Element already if its coming\n // from Refs of intrinsic elements (<div />, <button />, etc.)\n return instance;\n }\n\n let rootNode;\n\n if (isInstanceWithRootNode(instance)) {\n rootNode = instance.getRootNode();\n }\n\n if (rootNode !== undefined) {\n // the getter exists and has returned something, it should be what we are looking for\n // probably its an Element or null (which is also OK, e.g. Popup/Tooltip/Hint before opening)\n return rootNode;\n }\n\n // the findDOMNode can also return Text, but we are only interested in Elements, so just filter it\n return isElement(rootNode) ? rootNode : null;\n};\n"],"mappings":";;;AAGA,SAASA,SAAS,QAAQ,UAAU;;AAEpC,SAASC,sBAAsB,QAAQ,qBAAqB;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,QAAuC,EAAwB;EACzF;AACF;AACA;AACA;AACA;AACA;AACA;;EAEE,IAAI,CAACA,QAAQ,EAAE;IACb;IACA;IACA,OAAO,IAAI;EACb;;EAEA,IAAIH,SAAS,CAACG,QAAQ,CAAC,EAAE;IACvB;IACA;IACA,OAAOA,QAAQ;EACjB;;EAEA,IAAIC,QAAQ;;EAEZ,IAAIH,sBAAsB,CAACE,QAAQ,CAAC,EAAE;IACpCC,QAAQ,GAAGD,QAAQ,CAACD,WAAW,CAAC,CAAC;EACnC;;EAEA,IAAIE,QAAQ,KAAKC,SAAS,EAAE;IAC1B;IACA;IACA,OAAOD,QAAQ;EACjB;;EAEA;EACA,OAAOJ,SAAS,CAACI,QAAQ,CAAC,GAAGA,QAAQ,GAAG,IAAI;AAC9C,CAAC","ignoreList":[]}
|
|
@@ -33,9 +33,6 @@ export declare function rootNode<T extends DecoratableClassComponent>(Component:
|
|
|
33
33
|
render(): React.ReactNode;
|
|
34
34
|
readonly props: Readonly<{}>;
|
|
35
35
|
state: Readonly<{}>;
|
|
36
|
-
refs: {
|
|
37
|
-
[key: string]: React.ReactInstance;
|
|
38
|
-
};
|
|
39
36
|
componentDidMount?(): void;
|
|
40
37
|
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
41
38
|
componentWillUnmount?(): void;
|
|
@@ -13,9 +13,6 @@ export declare function withSize<T extends Constructor<React.Component<WithSizeP
|
|
|
13
13
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
14
14
|
readonly props: Readonly<WithSizeProps>;
|
|
15
15
|
state: Readonly<{}>;
|
|
16
|
-
refs: {
|
|
17
|
-
[key: string]: React.ReactInstance;
|
|
18
|
-
};
|
|
19
16
|
componentDidMount?(): void;
|
|
20
17
|
shouldComponentUpdate?(nextProps: Readonly<WithSizeProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
21
18
|
componentWillUnmount?(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["polymorphic-component.ts"],"sourcesContent":["import type React from 'react';\n\nimport type { Merge } from '../../typings/utility-types';\n\ntype PropsWithComponent<P, T extends React.ElementType> = P & {\n /**\n * Компонент, используемый в качестве корневого узла.\n */\n component?: T;\n};\n\nexport type PolymorphicPropsWithoutRef<P, T extends React.ElementType> = Merge<\n T extends keyof JSX.IntrinsicElements\n ? React.PropsWithoutRef<JSX.IntrinsicElements[T]>\n : React.ComponentPropsWithoutRef<T>,\n PropsWithComponent<P, T>\n>;\n\nexport type PolymorphicPropsWithRef<P, T extends React.ElementType> = Merge<\n T extends keyof JSX.IntrinsicElements ? React.PropsWithRef<JSX.IntrinsicElements[T]> : React.ComponentPropsWithRef<T>,\n PropsWithComponent<P, T>\n>;\n\ntype PolymorphicExoticComponent<P = Record<string, unknown>, T extends React.ElementType = React.ElementType> = Merge<\n React.ExoticComponent<P & { [key: string]: unknown }>,\n {\n <InstanceT extends React.ElementType = T>(props: PolymorphicPropsWithRef<P, InstanceT
|
|
1
|
+
{"version":3,"names":[],"sources":["polymorphic-component.ts"],"sourcesContent":["import type React from 'react';\nimport type { JSX } from 'react';\n\nimport type { Merge } from '../../typings/utility-types';\n\ntype PropsWithComponent<P, T extends React.ElementType> = P & {\n /**\n * Компонент, используемый в качестве корневого узла.\n */\n component?: T;\n};\n\nexport type PolymorphicPropsWithoutRef<P, T extends React.ElementType> = Merge<\n T extends keyof JSX.IntrinsicElements\n ? React.PropsWithoutRef<JSX.IntrinsicElements[T]>\n : React.ComponentPropsWithoutRef<T>,\n PropsWithComponent<P, T>\n>;\n\nexport type PolymorphicPropsWithRef<P, T extends React.ElementType> = Merge<\n T extends keyof JSX.IntrinsicElements ? React.PropsWithRef<JSX.IntrinsicElements[T]> : React.ComponentPropsWithRef<T>,\n PropsWithComponent<P, T>\n>;\n\ntype PolymorphicExoticComponent<P = Record<string, unknown>, T extends React.ElementType = React.ElementType> = Merge<\n React.ExoticComponent<P & { [key: string]: unknown }>,\n {\n <InstanceT extends React.ElementType = T>(\n props: PolymorphicPropsWithRef<P, InstanceT>,\n ): React.ReactElement<any> | null;\n }\n>;\n\nexport type PolymorphicForwardRefExoticComponent<P, T extends React.ElementType> = Merge<\n React.ForwardRefExoticComponent<P & { [key: string]: unknown }>,\n PolymorphicExoticComponent<P, T>\n>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
|
+
import type { JSX } from 'react';
|
|
2
3
|
import type { Merge } from '../../typings/utility-types';
|
|
3
4
|
type PropsWithComponent<P, T extends React.ElementType> = P & {
|
|
4
5
|
/**
|
|
@@ -11,7 +12,7 @@ export type PolymorphicPropsWithRef<P, T extends React.ElementType> = Merge<T ex
|
|
|
11
12
|
type PolymorphicExoticComponent<P = Record<string, unknown>, T extends React.ElementType = React.ElementType> = Merge<React.ExoticComponent<P & {
|
|
12
13
|
[key: string]: unknown;
|
|
13
14
|
}>, {
|
|
14
|
-
<InstanceT extends React.ElementType = T>(props: PolymorphicPropsWithRef<P, InstanceT>): React.ReactElement | null;
|
|
15
|
+
<InstanceT extends React.ElementType = T>(props: PolymorphicPropsWithRef<P, InstanceT>): React.ReactElement<any> | null;
|
|
15
16
|
}>;
|
|
16
17
|
export type PolymorphicForwardRefExoticComponent<P, T extends React.ElementType> = Merge<React.ForwardRefExoticComponent<P & {
|
|
17
18
|
[key: string]: unknown;
|
package/lib/utils/utils.js
CHANGED
|
@@ -190,9 +190,9 @@ export var isDropdown = isReactUIComponent('Dropdown');
|
|
|
190
190
|
export var isDropdownMenu = isReactUIComponent('DropdownMenu');
|
|
191
191
|
export var isHint = isReactUIComponent('Hint');
|
|
192
192
|
export var isTooltip = isReactUIComponent('Tooltip');
|
|
193
|
-
export
|
|
193
|
+
export function isKonturIcon(icon) {
|
|
194
194
|
return Object.prototype.hasOwnProperty.call(icon == null ? void 0 : icon.type, '__KONTUR_ICON__');
|
|
195
|
-
}
|
|
195
|
+
}
|
|
196
196
|
export function clickOutside(eventType) {
|
|
197
197
|
if (eventType === void 0) {
|
|
198
198
|
eventType = 'mousedown';
|
package/lib/utils/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isValidElement","isForwardRef","isBrowser","delay","emptyHandler","CancelationError","_Error","_this","_len","arguments","length","args","Array","_key","call","apply","concat","code","_inheritsLoose","_wrapNativeSuper","Error","taskWithDelay","task","ms","cancelationToken","Promise","resolve","reject","setTimeout","then","isFunction","x","isFunctionalComponent","Component","Boolean","prototype","isReactComponent","isClassComponent","isIntrinsicElement","element","type","isRefableElement","escapeRegExpSpecChars","s","replace","getRandomID","Math","random","toString","slice","isExternalLink","link","globalObject","RegExp","location","host","test","isReactUINode","componentName","node","Object","hasOwnProperty","__KONTUR_REACT_UI__","KB","UNITS","calculateDecimals","decimals","formatBytes","bytes","calculatedDecimals","i","floor","log2","formattedBytes","parseFloat","pow","toFixed","isNonNullable","value","undefined","isNullable","isReactUIComponent","name","child","_child$type","isReactUIInstance","instance","constructor","extractDataProps","props","dataProps","restWithoutDataProps","entries","map","_ref","startsWith","startsWithOneOf","searchKeys","inputString","keyIndex","findIndex","key","isButton","isInput","isFxInput","isAutocomplete","isPasswordInput","isCurrencyInput","isSelect","isDropdown","isDropdownMenu","isHint","isTooltip","isKonturIcon","icon","clickOutside","eventType","event","document","createEvent","initEvent","body","dispatchEvent","isElement","el","nodeType","Node","ELEMENT_NODE"],"sources":["utils.ts"],"sourcesContent":["import type React from 'react';\nimport { isValidElement } from 'react';\nimport { isForwardRef } from 'react-is';\n\nimport type { GlobalObject } from '../lib/globalObject';\nimport { isBrowser } from '../lib/globalObject';\nimport type { CurrencyInputProps } from '../components/CurrencyInput';\nimport type { PasswordInputProps } from '../components/PasswordInput';\nimport type { InputProps } from '../components/Input';\nimport type { AutocompleteProps } from '../components/Autocomplete';\nimport type { FxInputProps } from '../components/FxInput';\nimport type { SelectProps } from '../components/Select';\nimport type { DropdownProps } from '../components/Dropdown';\nimport type { DropdownMenuProps } from '../components/DropdownMenu';\nimport type { ButtonProps } from '../components/Button';\nimport type { TooltipProps } from '../components/Tooltip';\nimport type { HintProps } from '../components/Hint';\n\nexport { delay } from './delay';\n\n// NOTE: Copy-paste from @types/react\nexport type Defaultize<P, D> = P extends any\n ? string extends keyof P\n ? P\n : Pick<P, Exclude<keyof P, keyof D>> &\n Partial<Pick<P, Extract<keyof P, keyof D>>> &\n Partial<Pick<D, Exclude<keyof D, keyof P>>>\n : never;\n\nexport type DefaultizeProps<C, P> = C extends { defaultProps: infer D } ? Defaultize<P, D> : P;\n\nexport type AnyObject = Record<string, unknown>;\n\nexport type NoInfer<T> = T extends infer U ? U : never;\n\nexport const emptyHandler = () => {\n /* noop */\n};\n\nexport class CancelationError extends Error {\n public code = 'CancelationError';\n}\n\nexport function taskWithDelay(task: () => void, ms: number) {\n let cancelationToken: () => void = () => null;\n\n new Promise((resolve, reject) => {\n cancelationToken = reject;\n setTimeout(resolve, ms);\n })\n .then(task)\n .catch(() => null);\n\n return cancelationToken;\n}\n\nexport type FunctionWithParams<R = any> = (...args: any[]) => R;\n\nexport function isFunction<T>(x: T | FunctionWithParams): x is FunctionWithParams {\n return typeof x === 'function';\n}\n\nexport function isFunctionalComponent(Component: unknown): Component is React.ComponentType {\n return Boolean(typeof Component === 'function' && !(Component.prototype && Component.prototype.isReactComponent));\n}\n\nexport function isClassComponent(Component: unknown): Component is React.ComponentType {\n return Boolean(typeof Component === 'function' && Component.prototype && Component.prototype.isReactComponent);\n}\n\nexport function isIntrinsicElement(element: React.ReactElement): boolean {\n return typeof element.type === 'string';\n}\n\nexport function isRefableElement(element: React.ReactElement): boolean {\n return Boolean(isIntrinsicElement(element) || isClassComponent(element.type) || isForwardRef(element));\n}\n\nexport function escapeRegExpSpecChars(s: string): string {\n return s.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}\n\nexport const getRandomID = (): string => Math.random().toString(16).slice(2);\n\nexport const isExternalLink = (link: string, globalObject: GlobalObject): boolean => {\n return isBrowser(globalObject) && new RegExp(`^(https?:)?//(?!${globalObject.location.host})\\\\S+`, 'gi').test(link);\n};\n\n/**\n * Check if the given ReactNode is an element of the specified ReactUI component\n */\nexport const isReactUINode = (componentName: string, node: React.ReactNode): boolean => {\n if (isValidElement(node)) {\n return (\n Object.prototype.hasOwnProperty.call(node.type, '__KONTUR_REACT_UI__') &&\n // @ts-expect-error: React doesn't know about existence of __KONTUR_REACT_UI__.\n node.type.__KONTUR_REACT_UI__ === componentName\n );\n }\n\n return false;\n};\n\nconst KB = 1024;\nconst UNITS = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\nconst calculateDecimals = (decimals: number) => {\n if (decimals < 0) {\n return 0;\n }\n\n return 0;\n};\n\nexport const formatBytes = (bytes: number, decimals = 2): string | null => {\n if (bytes === 0) {\n return '0 Bytes';\n }\n\n if (!bytes) {\n return null;\n }\n\n const calculatedDecimals = calculateDecimals(decimals);\n\n const i = Math.floor(Math.log2(bytes) / Math.log2(KB));\n const formattedBytes = parseFloat((bytes / Math.pow(KB, i)).toFixed(calculatedDecimals));\n\n return `${formattedBytes} ${UNITS[i]}`;\n};\n\n/**\n * Проверяет, не является ли переданный аргумент null или undefined и исключает типы null и undefined из типа аргумента\n *\n * @param value Значение, которое нужно проверить и исключить из него типы\n * @returns Возвращает true, если переданный аргумент не является null или undefined иначе false\n */\nexport const isNonNullable = <T>(value: T): value is NonNullable<T> => {\n return value !== null && value !== undefined;\n};\n\n/**\n * Checks if the value `null` or `undefined`.\n *\n * @param value Value to check for `null` and `undefined`.\n * @returns Returns `true` if `value` is `null` or `undefined`, else `false`.\n */\nexport const isNullable = (value: unknown): value is null | undefined => {\n return value === null || value === undefined;\n};\n\n/**\n * Creates a function that checks if the given `child`\n * is an instance of some component specified by `name`.\n *\n * @param name Component name for which function will be created.\n * @returns A function that checks if the given `child` is an instance of the component specified by `name`.\n */\nexport const isReactUIComponent = <P = any>(name: string) => {\n return (child: React.ReactNode): child is React.ReactElement<P> => {\n // @ts-expect-error: Property `type` doesn't exist on type `React.ReactNode`, but exists on type `React.ReactElement` meanwhile `React.ReactElement` is not compatible with `React` `children` type.\n return child?.type?.__KONTUR_REACT_UI__ === name;\n };\n};\n\n/**\n * Checks if a component instance is a ReactUI component with the given name.\n *\n * @typeParam T Expected ReactUI component type.\n * @param instance Component instance.\n * @param componentName ReactUI component name.\n * @returns `true` if it matches, otherwise `false`.\n */\nexport const isReactUIInstance = <T extends React.Component>(\n instance: React.Component,\n componentName: string,\n): instance is T => {\n const constructor = instance?.constructor;\n return '__KONTUR_REACT_UI__' in constructor && constructor.__KONTUR_REACT_UI__ === componentName;\n};\n\n/**\n * Extracts all data attributes from props and returns them as well as props.\n *\n * @param props Props object to extract data attributes from.\n * @returns Separated data attributes and all other props.\n */\nexport const extractDataProps = <T extends Record<string, any>>(props: T) => {\n const dataProps: Record<string, any> = {};\n const restWithoutDataProps: Record<string, any> = {};\n\n Object.entries(props).map(([name, value]) => {\n if (name.startsWith('data-')) {\n return (dataProps[name] = value);\n }\n\n return (restWithoutDataProps[name] = value);\n });\n\n return { dataProps, restWithoutDataProps };\n};\n\n/**\n * Basically `.startsWith` for arrays.\n *\n * @param searchKeys Array of strings to test against `inputString`.\n * @param inputString String on which search will be performed.\n * @returns `true` if `inputString` starts with one of keys, else `false`.\n */\nexport const startsWithOneOf = (searchKeys: string[], inputString: string) => {\n const keyIndex = searchKeys.findIndex((key) => {\n return inputString.startsWith(key);\n });\n\n return keyIndex >= 0;\n};\n\nexport const isButton = isReactUIComponent<ButtonProps>('Button');\nexport const isInput = isReactUIComponent<InputProps>('Input');\nexport const isFxInput = isReactUIComponent<FxInputProps>('FxInput');\nexport const isAutocomplete = isReactUIComponent<AutocompleteProps>('Autocomplete');\nexport const isPasswordInput = isReactUIComponent<PasswordInputProps>('PasswordInput');\nexport const isCurrencyInput = isReactUIComponent<CurrencyInputProps>('CurrencyInput');\nexport const isSelect = isReactUIComponent<SelectProps<unknown, unknown>>('Select');\nexport const isDropdown = isReactUIComponent<DropdownProps>('Dropdown');\nexport const isDropdownMenu = isReactUIComponent<DropdownMenuProps>('DropdownMenu');\nexport const isHint = isReactUIComponent<HintProps>('Hint');\nexport const isTooltip = isReactUIComponent<TooltipProps>('Tooltip');\n\nexport const isKonturIcon = (icon: React.ReactElement) => {\n return Object.prototype.hasOwnProperty.call(icon?.type, '__KONTUR_ICON__');\n};\n\nexport function clickOutside(eventType: 'touchstart' | 'mousedown' | 'pointerup' = 'mousedown') {\n const event = document.createEvent('HTMLEvents');\n event.initEvent(eventType, true, true);\n document.body.dispatchEvent(event);\n}\n\nexport function isElement(el: unknown): el is Element {\n return !!el && typeof el === 'object' && 'nodeType' in el && el.nodeType === Node.ELEMENT_NODE;\n}\n"],"mappings":";AACA,SAASA,cAAc,QAAQ,OAAO;AACtC,SAASC,YAAY,QAAQ,UAAU;;;AAGvC,SAASC,SAAS,QAAQ,qBAAqB;;;;;;;;;;;;;AAa/C,SAASC,KAAK,QAAQ,SAAS;;AAE/B;;;;;;;;;;;;;;;AAeA,OAAO,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAA,EAAS;;EAChC,WACD;;AAED,WAAaC,gBAAgB,0BAAAC,MAAA,YAAAD,iBAAA,OAAAE,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,MAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,MAAA,SAAAU,MAAA,CAAAL,IAAA,WAAAJ,KAAA;IACpBU,IAAI,GAAG,kBAAkB,QAAAV,KAAA,EAAAW,cAAA,CAAAb,gBAAA,EAAAC,MAAA,SAAAD,gBAAA,iBAAAc,gBAAA,CADIC,KAAK;;;AAI3C,OAAO,SAASC,aAAaA,CAACC,IAAgB,EAAEC,EAAU,EAAE;EAC1D,IAAIC,gBAA4B,GAAG,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,cAAc,CAAC;AACnF,OAAO,IAAMyB,eAAe,GAAGzB,kBAAkB,CAAqB,eAAe,CAAC;AACtF,OAAO,IAAM0B,eAAe,GAAG1B,kBAAkB,CAAqB,eAAe,CAAC;AACtF,OAAO,IAAM2B,QAAQ,GAAG3B,kBAAkB,CAAgC,QAAQ,CAAC;AACnF,OAAO,IAAM4B,UAAU,GAAG5B,kBAAkB,CAAgB,UAAU,CAAC;AACvE,OAAO,IAAM6B,cAAc,GAAG7B,kBAAkB,CAAoB,cAAc,CAAC;AACnF,OAAO,IAAM8B,MAAM,GAAG9B,kBAAkB,CAAY,MAAM,CAAC;AAC3D,OAAO,IAAM+B,SAAS,GAAG/B,kBAAkB,CAAe,SAAS,CAAC;;AAEpE,OAAO,IAAMgC,YAAY,GAAG,SAAfA,YAAYA,CAAIC,IAAwB,EAAK;EACxD,OAAOtD,MAAM,CAACzB,SAAS,CAAC0B,cAAc,CAAC/C,IAAI,CAACoG,IAAI,oBAAJA,IAAI,CAAE1E,IAAI,EAAE,iBAAiB,CAAC;AAC5E,CAAC;;AAED,OAAO,SAAS2E,YAAYA,CAACC,SAAmD,EAAgB,KAAnEA,SAAmD,cAAnDA,SAAmD,GAAG,WAAW;EAC5F,IAAMC,KAAK,GAAGC,QAAQ,CAACC,WAAW,CAAC,YAAY,CAAC;EAChDF,KAAK,CAACG,SAAS,CAACJ,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC;EACtCE,QAAQ,CAACG,IAAI,CAACC,aAAa,CAACL,KAAK,CAAC;AACpC;;AAEA,OAAO,SAASM,SAASA,CAACC,EAAW,EAAiB;EACpD,OAAO,CAAC,CAACA,EAAE,IAAI,OAAOA,EAAE,KAAK,QAAQ,IAAI,UAAU,IAAIA,EAAE,IAAIA,EAAE,CAACC,QAAQ,KAAKC,IAAI,CAACC,YAAY;AAChG","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["isValidElement","isForwardRef","isBrowser","delay","emptyHandler","CancelationError","_Error","_this","_len","arguments","length","args","Array","_key","call","apply","concat","code","_inheritsLoose","_wrapNativeSuper","Error","taskWithDelay","task","ms","cancelationToken","Promise","resolve","reject","setTimeout","then","isFunction","x","isFunctionalComponent","Component","Boolean","prototype","isReactComponent","isClassComponent","isIntrinsicElement","element","type","isRefableElement","escapeRegExpSpecChars","s","replace","getRandomID","Math","random","toString","slice","isExternalLink","link","globalObject","RegExp","location","host","test","isReactUINode","componentName","node","Object","hasOwnProperty","__KONTUR_REACT_UI__","KB","UNITS","calculateDecimals","decimals","formatBytes","bytes","calculatedDecimals","i","floor","log2","formattedBytes","parseFloat","pow","toFixed","isNonNullable","value","undefined","isNullable","isReactUIComponent","name","child","_child$type","isReactUIInstance","instance","constructor","extractDataProps","props","dataProps","restWithoutDataProps","entries","map","_ref","startsWith","startsWithOneOf","searchKeys","inputString","keyIndex","findIndex","key","isButton","isInput","isFxInput","isAutocomplete","isPasswordInput","isCurrencyInput","isSelect","isDropdown","isDropdownMenu","isHint","isTooltip","isKonturIcon","icon","clickOutside","eventType","event","document","createEvent","initEvent","body","dispatchEvent","isElement","el","nodeType","Node","ELEMENT_NODE"],"sources":["utils.ts"],"sourcesContent":["import type React from 'react';\nimport { isValidElement } from 'react';\nimport { isForwardRef } from 'react-is';\n\nimport type { GlobalObject } from '../lib/globalObject';\nimport { isBrowser } from '../lib/globalObject';\nimport type { CurrencyInputProps } from '../components/CurrencyInput';\nimport type { PasswordInputProps } from '../components/PasswordInput';\nimport type { InputProps } from '../components/Input';\nimport type { AutocompleteProps } from '../components/Autocomplete';\nimport type { FxInputProps } from '../components/FxInput';\nimport type { SelectProps } from '../components/Select';\nimport type { DropdownProps } from '../components/Dropdown';\nimport type { DropdownMenuProps } from '../components/DropdownMenu';\nimport type { ButtonProps } from '../components/Button';\nimport type { TooltipProps } from '../components/Tooltip';\nimport type { HintProps } from '../components/Hint';\nimport type { IconProps } from '../internal/icons2022/BaseIcon';\n\nexport { delay } from './delay';\n\n// NOTE: Copy-paste from @types/react\nexport type Defaultize<P, D> = P extends any\n ? string extends keyof P\n ? P\n : Pick<P, Exclude<keyof P, keyof D>> &\n Partial<Pick<P, Extract<keyof P, keyof D>>> &\n Partial<Pick<D, Exclude<keyof D, keyof P>>>\n : never;\n\nexport type DefaultizeProps<C, P> = C extends { defaultProps: infer D } ? Defaultize<P, D> : P;\n\nexport type AnyObject = Record<string, unknown>;\n\nexport type NoInfer<T> = T extends infer U ? U : never;\n\nexport const emptyHandler = () => {\n /* noop */\n};\n\nexport class CancelationError extends Error {\n public code = 'CancelationError';\n}\n\nexport function taskWithDelay(task: () => void, ms: number) {\n let cancelationToken: () => void = () => null;\n\n new Promise((resolve, reject) => {\n cancelationToken = reject;\n setTimeout(resolve, ms);\n })\n .then(task)\n .catch(() => null);\n\n return cancelationToken;\n}\n\nexport type FunctionWithParams<R = any> = (...args: any[]) => R;\n\nexport function isFunction<T>(x: T | FunctionWithParams): x is FunctionWithParams {\n return typeof x === 'function';\n}\n\nexport function isFunctionalComponent(Component: unknown): Component is React.ComponentType {\n return Boolean(typeof Component === 'function' && !(Component.prototype && Component.prototype.isReactComponent));\n}\n\nexport function isClassComponent(Component: unknown): Component is React.ComponentType {\n return Boolean(typeof Component === 'function' && Component.prototype && Component.prototype.isReactComponent);\n}\n\nexport function isIntrinsicElement(element: React.ReactElement<unknown>): boolean {\n return typeof element.type === 'string';\n}\n\nexport function isRefableElement(element: React.ReactElement<unknown>): boolean {\n return Boolean(isIntrinsicElement(element) || isClassComponent(element.type) || isForwardRef(element));\n}\n\nexport function escapeRegExpSpecChars(s: string): string {\n return s.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}\n\nexport const getRandomID = (): string => Math.random().toString(16).slice(2);\n\nexport const isExternalLink = (link: string, globalObject: GlobalObject): boolean => {\n return isBrowser(globalObject) && new RegExp(`^(https?:)?//(?!${globalObject.location.host})\\\\S+`, 'gi').test(link);\n};\n\n/**\n * Check if the given ReactNode is an element of the specified ReactUI component\n */\nexport const isReactUINode = (componentName: string, node: React.ReactNode): boolean => {\n if (isValidElement(node)) {\n return (\n Object.prototype.hasOwnProperty.call(node.type, '__KONTUR_REACT_UI__') &&\n // @ts-expect-error: React doesn't know about existence of __KONTUR_REACT_UI__.\n node.type.__KONTUR_REACT_UI__ === componentName\n );\n }\n\n return false;\n};\n\nconst KB = 1024;\nconst UNITS = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\nconst calculateDecimals = (decimals: number) => {\n if (decimals < 0) {\n return 0;\n }\n\n return 0;\n};\n\nexport const formatBytes = (bytes: number, decimals = 2): string | null => {\n if (bytes === 0) {\n return '0 Bytes';\n }\n\n if (!bytes) {\n return null;\n }\n\n const calculatedDecimals = calculateDecimals(decimals);\n\n const i = Math.floor(Math.log2(bytes) / Math.log2(KB));\n const formattedBytes = parseFloat((bytes / Math.pow(KB, i)).toFixed(calculatedDecimals));\n\n return `${formattedBytes} ${UNITS[i]}`;\n};\n\n/**\n * Проверяет, не является ли переданный аргумент null или undefined и исключает типы null и undefined из типа аргумента\n *\n * @param value Значение, которое нужно проверить и исключить из него типы\n * @returns Возвращает true, если переданный аргумент не является null или undefined иначе false\n */\nexport const isNonNullable = <T>(value: T): value is NonNullable<T> => {\n return value !== null && value !== undefined;\n};\n\n/**\n * Checks if the value `null` or `undefined`.\n *\n * @param value Value to check for `null` and `undefined`.\n * @returns Returns `true` if `value` is `null` or `undefined`, else `false`.\n */\nexport const isNullable = (value: unknown): value is null | undefined => {\n return value === null || value === undefined;\n};\n\n/**\n * Creates a function that checks if the given `child`\n * is an instance of some component specified by `name`.\n *\n * @param name Component name for which function will be created.\n * @returns A function that checks if the given `child` is an instance of the component specified by `name`.\n */\nexport const isReactUIComponent = <P = any>(name: string) => {\n return (child: React.ReactNode): child is React.ReactElement<P> => {\n // @ts-expect-error: Property `type` doesn't exist on type `React.ReactNode`, but exists on type `React.ReactElement` meanwhile `React.ReactElement` is not compatible with `React` `children` type.\n return child?.type?.__KONTUR_REACT_UI__ === name;\n };\n};\n\n/**\n * Checks if a component instance is a ReactUI component with the given name.\n *\n * @typeParam T Expected ReactUI component type.\n * @param instance Component instance.\n * @param componentName ReactUI component name.\n * @returns `true` if it matches, otherwise `false`.\n */\nexport const isReactUIInstance = <T extends React.Component>(\n instance: React.Component,\n componentName: string,\n): instance is T => {\n const constructor = instance?.constructor;\n return '__KONTUR_REACT_UI__' in constructor && constructor.__KONTUR_REACT_UI__ === componentName;\n};\n\n/**\n * Extracts all data attributes from props and returns them as well as props.\n *\n * @param props Props object to extract data attributes from.\n * @returns Separated data attributes and all other props.\n */\nexport const extractDataProps = <T extends Record<string, any>>(props: T) => {\n const dataProps: Record<string, any> = {};\n const restWithoutDataProps: Record<string, any> = {};\n\n Object.entries(props).map(([name, value]) => {\n if (name.startsWith('data-')) {\n return (dataProps[name] = value);\n }\n\n return (restWithoutDataProps[name] = value);\n });\n\n return { dataProps, restWithoutDataProps };\n};\n\n/**\n * Basically `.startsWith` for arrays.\n *\n * @param searchKeys Array of strings to test against `inputString`.\n * @param inputString String on which search will be performed.\n * @returns `true` if `inputString` starts with one of keys, else `false`.\n */\nexport const startsWithOneOf = (searchKeys: string[], inputString: string) => {\n const keyIndex = searchKeys.findIndex((key) => {\n return inputString.startsWith(key);\n });\n\n return keyIndex >= 0;\n};\n\nexport const isButton = isReactUIComponent<ButtonProps>('Button');\nexport const isInput = isReactUIComponent<InputProps>('Input');\nexport const isFxInput = isReactUIComponent<FxInputProps>('FxInput');\nexport const isAutocomplete = isReactUIComponent<AutocompleteProps>('Autocomplete');\nexport const isPasswordInput = isReactUIComponent<PasswordInputProps>('PasswordInput');\nexport const isCurrencyInput = isReactUIComponent<CurrencyInputProps>('CurrencyInput');\nexport const isSelect = isReactUIComponent<SelectProps<unknown, unknown>>('Select');\nexport const isDropdown = isReactUIComponent<DropdownProps>('Dropdown');\nexport const isDropdownMenu = isReactUIComponent<DropdownMenuProps>('DropdownMenu');\nexport const isHint = isReactUIComponent<HintProps>('Hint');\nexport const isTooltip = isReactUIComponent<TooltipProps>('Tooltip');\n\nexport function isKonturIcon(icon: React.ReactElement<unknown>): icon is React.ReactElement<IconProps> {\n return Object.prototype.hasOwnProperty.call(icon?.type, '__KONTUR_ICON__');\n}\n\nexport function clickOutside(eventType: 'touchstart' | 'mousedown' | 'pointerup' = 'mousedown') {\n const event = document.createEvent('HTMLEvents');\n event.initEvent(eventType, true, true);\n document.body.dispatchEvent(event);\n}\n\nexport function isElement(el: unknown): el is Element {\n return !!el && typeof el === 'object' && 'nodeType' in el && el.nodeType === Node.ELEMENT_NODE;\n}\n"],"mappings":";AACA,SAASA,cAAc,QAAQ,OAAO;AACtC,SAASC,YAAY,QAAQ,UAAU;;;AAGvC,SAASC,SAAS,QAAQ,qBAAqB;;;;;;;;;;;;;;AAc/C,SAASC,KAAK,QAAQ,SAAS;;AAE/B;;;;;;;;;;;;;;;AAeA,OAAO,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAA,EAAS;;EAChC,WACD;;AAED,WAAaC,gBAAgB,0BAAAC,MAAA,YAAAD,iBAAA,OAAAE,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,MAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,MAAA,SAAAU,MAAA,CAAAL,IAAA,WAAAJ,KAAA;IACpBU,IAAI,GAAG,kBAAkB,QAAAV,KAAA,EAAAW,cAAA,CAAAb,gBAAA,EAAAC,MAAA,SAAAD,gBAAA,iBAAAc,gBAAA,CADIC,KAAK;;;AAI3C,OAAO,SAASC,aAAaA,CAACC,IAAgB,EAAEC,EAAU,EAAE;EAC1D,IAAIC,gBAA4B,GAAG,SAAAA,iBAAA,UAAM,IAAI;;EAE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yB,eAAe,GAAGzB,kBAAkB,CAAqB,eAAe,CAAC;AACtF,OAAO,IAAM0B,eAAe,GAAG1B,kBAAkB,CAAqB,eAAe,CAAC;AACtF,OAAO,IAAM2B,QAAQ,GAAG3B,kBAAkB,CAAgC,QAAQ,CAAC;AACnF,OAAO,IAAM4B,UAAU,GAAG5B,kBAAkB,CAAgB,UAAU,CAAC;AACvE,OAAO,IAAM6B,cAAc,GAAG7B,kBAAkB,CAAoB,cAAc,CAAC;AACnF,OAAO,IAAM8B,MAAM,GAAG9B,kBAAkB,CAAY,MAAM,CAAC;AAC3D,OAAO,IAAM+B,SAAS,GAAG/B,kBAAkB,CAAe,SAAS,CAAC;;AAEpE,OAAO,SAASgC,YAAYA,CAACC,IAAiC,EAAyC;EACrG,OAAOtD,MAAM,CAACzB,SAAS,CAAC0B,cAAc,CAAC/C,IAAI,CAACoG,IAAI,oBAAJA,IAAI,CAAE1E,IAAI,EAAE,iBAAiB,CAAC;AAC5E;;AAEA,OAAO,SAAS2E,YAAYA,CAACC,SAAmD,EAAgB,KAAnEA,SAAmD,cAAnDA,SAAmD,GAAG,WAAW;EAC5F,IAAMC,KAAK,GAAGC,QAAQ,CAACC,WAAW,CAAC,YAAY,CAAC;EAChDF,KAAK,CAACG,SAAS,CAACJ,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC;EACtCE,QAAQ,CAACG,IAAI,CAACC,aAAa,CAACL,KAAK,CAAC;AACpC;;AAEA,OAAO,SAASM,SAASA,CAACC,EAAW,EAAiB;EACpD,OAAO,CAAC,CAACA,EAAE,IAAI,OAAOA,EAAE,KAAK,QAAQ,IAAI,UAAU,IAAIA,EAAE,IAAIA,EAAE,CAACC,QAAQ,KAAKC,IAAI,CAACC,YAAY;AAChG","ignoreList":[]}
|
package/lib/utils.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type { DropdownMenuProps } from '../components/DropdownMenu';
|
|
|
11
11
|
import type { ButtonProps } from '../components/Button';
|
|
12
12
|
import type { TooltipProps } from '../components/Tooltip';
|
|
13
13
|
import type { HintProps } from '../components/Hint';
|
|
14
|
+
import type { IconProps } from '../internal/icons2022/BaseIcon';
|
|
14
15
|
export { delay } from './delay';
|
|
15
16
|
export type Defaultize<P, D> = P extends any ? string extends keyof P ? P : Pick<P, Exclude<keyof P, keyof D>> & Partial<Pick<P, Extract<keyof P, keyof D>>> & Partial<Pick<D, Exclude<keyof D, keyof P>>> : never;
|
|
16
17
|
export type DefaultizeProps<C, P> = C extends {
|
|
@@ -27,8 +28,8 @@ export type FunctionWithParams<R = any> = (...args: any[]) => R;
|
|
|
27
28
|
export declare function isFunction<T>(x: T | FunctionWithParams): x is FunctionWithParams;
|
|
28
29
|
export declare function isFunctionalComponent(Component: unknown): Component is React.ComponentType;
|
|
29
30
|
export declare function isClassComponent(Component: unknown): Component is React.ComponentType;
|
|
30
|
-
export declare function isIntrinsicElement(element: React.ReactElement): boolean;
|
|
31
|
-
export declare function isRefableElement(element: React.ReactElement): boolean;
|
|
31
|
+
export declare function isIntrinsicElement(element: React.ReactElement<unknown>): boolean;
|
|
32
|
+
export declare function isRefableElement(element: React.ReactElement<unknown>): boolean;
|
|
32
33
|
export declare function escapeRegExpSpecChars(s: string): string;
|
|
33
34
|
export declare const getRandomID: () => string;
|
|
34
35
|
export declare const isExternalLink: (link: string, globalObject: GlobalObject) => boolean;
|
|
@@ -97,6 +98,6 @@ export declare const isDropdown: (child: React.ReactNode) => child is React.Reac
|
|
|
97
98
|
export declare const isDropdownMenu: (child: React.ReactNode) => child is React.ReactElement<DropdownMenuProps, string | React.JSXElementConstructor<any>>;
|
|
98
99
|
export declare const isHint: (child: React.ReactNode) => child is React.ReactElement<HintProps, string | React.JSXElementConstructor<any>>;
|
|
99
100
|
export declare const isTooltip: (child: React.ReactNode) => child is React.ReactElement<TooltipProps, string | React.JSXElementConstructor<any>>;
|
|
100
|
-
export declare
|
|
101
|
+
export declare function isKonturIcon(icon: React.ReactElement<unknown>): icon is React.ReactElement<IconProps>;
|
|
101
102
|
export declare function clickOutside(eventType?: 'touchstart' | 'mousedown' | 'pointerup'): void;
|
|
102
103
|
export declare function isElement(el: unknown): el is Element;
|
|
@@ -10,7 +10,7 @@ import type { ReactUIComponentWithRef } from './forwardRefAndName';
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function withClassWrapper<T, P>(RFC: ReactUIComponentWithRef<T, P>): {
|
|
12
12
|
new (props: P): {
|
|
13
|
-
instancePropertiesRef: React.RefObject<T>;
|
|
13
|
+
instancePropertiesRef: React.RefObject<T | null>;
|
|
14
14
|
componentDidMount(): void;
|
|
15
15
|
render(): React.JSX.Element;
|
|
16
16
|
context: unknown;
|
|
@@ -18,9 +18,6 @@ export declare function withClassWrapper<T, P>(RFC: ReactUIComponentWithRef<T, P
|
|
|
18
18
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
19
19
|
readonly props: Readonly<P>;
|
|
20
20
|
state: Readonly<{}>;
|
|
21
|
-
refs: {
|
|
22
|
-
[key: string]: React.ReactInstance;
|
|
23
|
-
};
|
|
24
21
|
shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
25
22
|
componentWillUnmount?(): void;
|
|
26
23
|
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
@@ -34,7 +31,7 @@ export declare function withClassWrapper<T, P>(RFC: ReactUIComponentWithRef<T, P
|
|
|
34
31
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): void;
|
|
35
32
|
};
|
|
36
33
|
new (props: P, context: any): {
|
|
37
|
-
instancePropertiesRef: React.RefObject<T>;
|
|
34
|
+
instancePropertiesRef: React.RefObject<T | null>;
|
|
38
35
|
componentDidMount(): void;
|
|
39
36
|
render(): React.JSX.Element;
|
|
40
37
|
context: unknown;
|
|
@@ -42,9 +39,6 @@ export declare function withClassWrapper<T, P>(RFC: ReactUIComponentWithRef<T, P
|
|
|
42
39
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
43
40
|
readonly props: Readonly<P>;
|
|
44
41
|
state: Readonly<{}>;
|
|
45
|
-
refs: {
|
|
46
|
-
[key: string]: React.ReactInstance;
|
|
47
|
-
};
|
|
48
42
|
shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
49
43
|
componentWillUnmount?(): void;
|
|
50
44
|
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
@@ -61,6 +55,7 @@ export declare function withClassWrapper<T, P>(RFC: ReactUIComponentWithRef<T, P
|
|
|
61
55
|
displayName: string;
|
|
62
56
|
FC: ReactUIComponentWithRef<T, P>;
|
|
63
57
|
contextType?: React.Context<any> | undefined;
|
|
58
|
+
propTypes?: any;
|
|
64
59
|
};
|
|
65
60
|
export interface InstanceRefType<T> {
|
|
66
61
|
instanceRef: React.MutableRefObject<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skbkontur/react-ui",
|
|
3
|
-
"version": "5.4.7-
|
|
3
|
+
"version": "5.4.7-a27a4.0",
|
|
4
4
|
"description": "UI Components",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"normalize-wheel": "^1.0.1",
|
|
58
58
|
"react-docgen": "7.0.0",
|
|
59
59
|
"react-focus-lock": "2.11.3",
|
|
60
|
-
"react-is": "
|
|
60
|
+
"react-is": ">=17.0.2",
|
|
61
61
|
"react-transition-group": "^4.4.5",
|
|
62
62
|
"shallowequal": "^1.1.0",
|
|
63
63
|
"stylis-plugin-extra-scope": "^0.3.0",
|
|
@@ -91,9 +91,9 @@
|
|
|
91
91
|
"@types/lodash.debounce": "^4.0.6",
|
|
92
92
|
"@types/lodash.isequal": "^4.5.5",
|
|
93
93
|
"@types/lodash.throttle": "^4.1.6",
|
|
94
|
-
"@types/react": "
|
|
95
|
-
"@types/react-dom": "
|
|
96
|
-
"@types/react-is": "^
|
|
94
|
+
"@types/react": "19.2.7",
|
|
95
|
+
"@types/react-dom": "19.2.3",
|
|
96
|
+
"@types/react-is": "^19.2.0",
|
|
97
97
|
"@types/react-transition-group": "^4.4.4",
|
|
98
98
|
"@types/shallowequal": "^1.1.1",
|
|
99
99
|
"@types/warning": "^3.0.0",
|
|
@@ -122,9 +122,9 @@
|
|
|
122
122
|
"npm-run-all": "^4.1.5",
|
|
123
123
|
"output-file-sync": "^2.0.1",
|
|
124
124
|
"playwright-core": "^1.54.2",
|
|
125
|
-
"react": "
|
|
125
|
+
"react": "19.2.1",
|
|
126
|
+
"react-dom": "19.2.1",
|
|
126
127
|
"react-docgen-typescript": "^2.2.2",
|
|
127
|
-
"react-dom": "^18.3.1",
|
|
128
128
|
"rimraf": "^5.0.7",
|
|
129
129
|
"selenium-webdriver": "^4.27.0",
|
|
130
130
|
"semver": "^7.6.2",
|
|
@@ -138,11 +138,12 @@
|
|
|
138
138
|
"typescript": "5.9.3",
|
|
139
139
|
"upath": "^2.0.1",
|
|
140
140
|
"url-loader": "^4.1.1",
|
|
141
|
+
"vitest": "^3.2.4",
|
|
141
142
|
"wait-on": "^7.2.0",
|
|
142
143
|
"webpack": "^5.91.0"
|
|
143
144
|
},
|
|
144
145
|
"peerDependencies": {
|
|
145
|
-
"react": ">=16.9
|
|
146
|
-
"react-dom": ">=16.9
|
|
146
|
+
"react": ">=16.9 <=19",
|
|
147
|
+
"react-dom": ">=16.9 <=19"
|
|
147
148
|
}
|
|
148
149
|
}
|