@skbkontur/react-ui 5.1.4 → 5.1.5
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/CHANGELOG.md +13 -0
- package/cjs/components/Autocomplete/__docs__/Autocomplete.mdx +2 -1
- package/cjs/components/Button/__docs__/Button.mdx +6 -5
- package/cjs/components/Calendar/__docs__/Calendar.mdx +6 -5
- package/cjs/components/Calendar/__docs__/CalendarDay.mdx +2 -1
- package/cjs/components/Center/__docs__/Center.mdx +2 -1
- package/cjs/components/Checkbox/__docs__/Checkbox.mdx +6 -5
- package/cjs/components/ComboBox/__docs__/ComboBox.mdx +6 -5
- package/cjs/components/CurrencyInput/__docs__/CurrencyInput.mdx +6 -5
- package/cjs/components/CurrencyLabel/__docs__/CurrencyLabel.mdx +2 -1
- package/cjs/components/DateInput/__docs__/DateInput.mdx +2 -3
- package/cjs/components/DatePicker/__docs__/DatePicker.mdx +6 -5
- package/cjs/components/DateRangePicker/DateRangePicker.d.ts +2 -0
- package/cjs/components/DateRangePicker/DateRangePicker.js +42 -8
- package/cjs/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/cjs/components/DateRangePicker/DateRangePickerInput.js +4 -8
- package/cjs/components/DateRangePicker/DateRangePickerInput.js.map +1 -1
- package/cjs/components/DateRangePicker/__docs__/DateRangePicker.mdx +6 -8
- package/cjs/components/Dropdown/__docs__/Dropdown.mdx +6 -5
- package/cjs/components/DropdownMenu/__docs__/DropdownMenu.mdx +6 -5
- package/cjs/components/FileUploader/__docs__/FileUploader.mdx +6 -5
- package/cjs/components/FxInput/__docs__/FxInput.mdx +6 -5
- package/cjs/components/Gapped/__docs__/Gapped.mdx +2 -1
- package/cjs/components/GlobalLoader/__docs__/GlobalLoader.mdx +6 -5
- package/cjs/components/Group/__docs__/Group.mdx +2 -1
- package/cjs/components/Hint/__docs__/Hint.mdx +6 -5
- package/cjs/components/Input/__docs__/Input.mdx +6 -5
- package/cjs/components/Kebab/__docs__/Kebab.mdx +6 -5
- package/cjs/components/Link/__docs__/Link.mdx +6 -5
- package/cjs/components/Loader/__docs__/Loader.mdx +2 -3
- package/cjs/components/MaskedInput/__docs__/MaskedInput.mdx +6 -5
- package/cjs/components/MenuFooter/__docs__/MenuFooter.mdx +2 -1
- package/cjs/components/MenuHeader/__docs__/MenuHeader.mdx +2 -1
- package/cjs/components/MenuItem/__docs__/MenuItem.mdx +2 -1
- package/cjs/components/MenuSeparator/__docs__/MenuSeparator.mdx +2 -1
- package/cjs/components/MiniModal/__docs__/MiniModal.mdx +6 -5
- package/cjs/components/Modal/__docs__/Modal.mdx +6 -5
- package/cjs/components/Paging/__docs__/Paging.mdx +6 -5
- package/cjs/components/PasswordInput/__docs__/PasswordInput.mdx +6 -5
- package/cjs/components/Radio/__docs__/Radio.mdx +6 -5
- package/cjs/components/RadioGroup/__docs__/RadioGroup.mdx +6 -5
- package/cjs/components/ResponsiveLayout/__docs__/ResponsiveLayout.mdx +2 -1
- package/cjs/components/ScrollContainer/__docs__/ScrollContainer.mdx +2 -1
- package/cjs/components/Select/__docs__/Select.mdx +6 -5
- package/cjs/components/SidePage/__docs__/SidePage.mdx +6 -5
- package/cjs/components/SingleToast/__docs__/SingleToast.mdx +6 -5
- package/cjs/components/Spinner/__docs__/Spinner.mdx +6 -5
- package/cjs/components/Sticky/__docs__/Sticky.mdx +2 -1
- package/cjs/components/Switcher/__docs__/Switcher.mdx +6 -5
- package/cjs/components/Tabs/__docs__/Tab.mdx +6 -5
- package/cjs/components/Tabs/__docs__/Tabs.mdx +6 -5
- package/cjs/components/Textarea/__docs__/Textarea.mdx +6 -5
- package/cjs/components/Toast/__docs__/Toast.mdx +6 -5
- package/cjs/components/Toggle/__docs__/Toggle.mdx +6 -5
- package/cjs/components/Token/__docs__/Token.mdx +6 -5
- package/cjs/components/TokenInput/__docs__/TokenInput.mdx +6 -5
- package/cjs/components/Tooltip/__docs__/Tooltip.mdx +6 -5
- package/cjs/components/TooltipMenu/__docs__/TooltipMenu.mdx +2 -1
- package/cjs/lib/rootNode/getRootNode.js +5 -12
- package/cjs/lib/rootNode/getRootNode.js.map +1 -1
- package/cjs/lib/utils.d.ts +1 -0
- package/cjs/lib/utils.js +5 -1
- package/cjs/lib/utils.js.map +1 -1
- package/components/Autocomplete/__docs__/Autocomplete.mdx +2 -1
- package/components/Button/__docs__/Button.mdx +6 -5
- package/components/Calendar/__docs__/Calendar.mdx +6 -5
- package/components/Calendar/__docs__/CalendarDay.mdx +2 -1
- package/components/Center/__docs__/Center.mdx +2 -1
- package/components/Checkbox/__docs__/Checkbox.mdx +6 -5
- package/components/ComboBox/__docs__/ComboBox.mdx +6 -5
- package/components/CurrencyInput/__docs__/CurrencyInput.mdx +6 -5
- package/components/CurrencyLabel/__docs__/CurrencyLabel.mdx +2 -1
- package/components/DateInput/__docs__/DateInput.mdx +2 -3
- package/components/DatePicker/__docs__/DatePicker.mdx +6 -5
- package/components/DateRangePicker/DateRangePicker/DateRangePicker.js +31 -11
- package/components/DateRangePicker/DateRangePicker/DateRangePicker.js.map +1 -1
- package/components/DateRangePicker/DateRangePicker.d.ts +2 -0
- package/components/DateRangePicker/DateRangePickerInput/DateRangePickerInput.js +5 -8
- package/components/DateRangePicker/DateRangePickerInput/DateRangePickerInput.js.map +1 -1
- package/components/DateRangePicker/__docs__/DateRangePicker.mdx +6 -8
- package/components/Dropdown/__docs__/Dropdown.mdx +6 -5
- package/components/DropdownMenu/__docs__/DropdownMenu.mdx +6 -5
- package/components/FileUploader/__docs__/FileUploader.mdx +6 -5
- package/components/FxInput/__docs__/FxInput.mdx +6 -5
- package/components/Gapped/__docs__/Gapped.mdx +2 -1
- package/components/GlobalLoader/__docs__/GlobalLoader.mdx +6 -5
- package/components/Group/__docs__/Group.mdx +2 -1
- package/components/Hint/__docs__/Hint.mdx +6 -5
- package/components/Input/__docs__/Input.mdx +6 -5
- package/components/Kebab/__docs__/Kebab.mdx +6 -5
- package/components/Link/__docs__/Link.mdx +6 -5
- package/components/Loader/__docs__/Loader.mdx +2 -3
- package/components/MaskedInput/__docs__/MaskedInput.mdx +6 -5
- package/components/MenuFooter/__docs__/MenuFooter.mdx +2 -1
- package/components/MenuHeader/__docs__/MenuHeader.mdx +2 -1
- package/components/MenuItem/__docs__/MenuItem.mdx +2 -1
- package/components/MenuSeparator/__docs__/MenuSeparator.mdx +2 -1
- package/components/MiniModal/__docs__/MiniModal.mdx +6 -5
- package/components/Modal/__docs__/Modal.mdx +6 -5
- package/components/Paging/__docs__/Paging.mdx +6 -5
- package/components/PasswordInput/__docs__/PasswordInput.mdx +6 -5
- package/components/Radio/__docs__/Radio.mdx +6 -5
- package/components/RadioGroup/__docs__/RadioGroup.mdx +6 -5
- package/components/ResponsiveLayout/__docs__/ResponsiveLayout.mdx +2 -1
- package/components/ScrollContainer/__docs__/ScrollContainer.mdx +2 -1
- package/components/Select/__docs__/Select.mdx +6 -5
- package/components/SidePage/__docs__/SidePage.mdx +6 -5
- package/components/SingleToast/__docs__/SingleToast.mdx +6 -5
- package/components/Spinner/__docs__/Spinner.mdx +6 -5
- package/components/Sticky/__docs__/Sticky.mdx +2 -1
- package/components/Switcher/__docs__/Switcher.mdx +6 -5
- package/components/Tabs/__docs__/Tab.mdx +6 -5
- package/components/Tabs/__docs__/Tabs.mdx +6 -5
- package/components/Textarea/__docs__/Textarea.mdx +6 -5
- package/components/Toast/__docs__/Toast.mdx +6 -5
- package/components/Toggle/__docs__/Toggle.mdx +6 -5
- package/components/Token/__docs__/Token.mdx +6 -5
- package/components/TokenInput/__docs__/TokenInput.mdx +6 -5
- package/components/Tooltip/__docs__/Tooltip.mdx +6 -5
- package/components/TooltipMenu/__docs__/TooltipMenu.mdx +2 -1
- package/lib/rootNode/getRootNode/getRootNode.js +5 -12
- package/lib/rootNode/getRootNode/getRootNode.js.map +1 -1
- package/lib/utils/utils.js +3 -0
- package/lib/utils/utils.js.map +1 -1
- package/lib/utils.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as StickyStories from './Sticky.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={StickyStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
<Header component="Sticky" />
|
|
9
10
|
|
|
10
11
|
<Description />
|
|
11
12
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as SwitcherStories from './Switcher.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={SwitcherStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="Switcher"
|
|
11
|
+
guides="https://guides.kontur.ru/components/selection-elements/switcher/"
|
|
12
|
+
figma="https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=281%3A17973"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as TabStories from './Tab.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={TabStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="Tab"
|
|
11
|
+
guides="https://guides.kontur.ru/components/navigation/tabs/"
|
|
12
|
+
figma="https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=281%3A17620"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as TabsStories from './Tabs.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={TabsStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="Tabs"
|
|
11
|
+
guides="https://guides.kontur.ru/components/navigation/tabs/"
|
|
12
|
+
figma="https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=281%3A17620"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as TextareaStories from './Textarea.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={TextareaStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="Textarea"
|
|
11
|
+
guides="https://guides.kontur.ru/components/input-fields/textarea/"
|
|
12
|
+
figma="https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=203%3A2333"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as ToastStories from './Toast.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={ToastStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="Toast"
|
|
11
|
+
guides="https://guides.kontur.ru/components/popup-elements/toast/"
|
|
12
|
+
figma="https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=230%3A5203"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as ToggleStories from './Toggle.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={ToggleStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="Toggle"
|
|
11
|
+
guides="https://guides.kontur.ru/components/selection-elements/toggle/"
|
|
12
|
+
figma="https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=203%3A9888"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as TokenStories from './Token.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={TokenStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="Token"
|
|
11
|
+
guides="https://guides.kontur.ru/components/input-fields/tokens/"
|
|
12
|
+
figma="https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=230%3A2955"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as TokenInputStories from './TokenInput.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={TokenInputStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="TokenInput"
|
|
11
|
+
guides="https://guides.kontur.ru/components/input-fields/tokens/"
|
|
12
|
+
figma="https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=230%3A2955"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as TooltipStories from './Tooltip.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={TooltipStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="Tooltip"
|
|
11
|
+
guides="https://guides.kontur.ru/components/popup-elements/tooltip/"
|
|
12
|
+
figma="https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=230%3A5039"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as TooltipMenuStories from './TooltipMenu.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={TooltipMenuStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
<Header component="TooltipMenu" />
|
|
9
10
|
|
|
10
11
|
<Description />
|
|
11
12
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.getRootNode = void 0;var _reactDom = require("react-dom");
|
|
2
2
|
|
|
3
3
|
var _warning = _interopRequireDefault(require("warning"));
|
|
4
|
-
var _globalObject = require("@skbkontur/global-object");
|
|
5
4
|
|
|
6
|
-
var _isInstanceOf = require("../../lib/isInstanceOf");
|
|
7
5
|
|
|
6
|
+
var _utils = require("../utils");
|
|
8
7
|
|
|
9
8
|
var _rootNodeDecorator = require("./rootNodeDecorator");
|
|
10
9
|
|
|
@@ -27,13 +26,13 @@ var getRootNode = exports.getRootNode = function getRootNode(instance) {
|
|
|
27
26
|
* 4. literally anything, returned from useImperativeHandle
|
|
28
27
|
*/
|
|
29
28
|
|
|
30
|
-
if (!
|
|
29
|
+
if (!instance) {
|
|
31
30
|
// instance can be `null` if component was unmounted
|
|
32
31
|
// also checking undefined for convenient usage
|
|
33
32
|
return null;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
if ((0,
|
|
35
|
+
if ((0, _utils.isElement)(instance)) {
|
|
37
36
|
// instance can be an Element already if its coming
|
|
38
37
|
// from Refs of intrinsic elements (<div />, <button />, etc.)
|
|
39
38
|
return instance;
|
|
@@ -42,13 +41,7 @@ var getRootNode = exports.getRootNode = function getRootNode(instance) {
|
|
|
42
41
|
var rootNode;
|
|
43
42
|
|
|
44
43
|
if ((0, _rootNodeDecorator.isInstanceWithRootNode)(instance)) {
|
|
45
|
-
|
|
46
|
-
// the "getRootNode" method, but we can ignore it here
|
|
47
|
-
// because we'd already checked the instance on being an Element
|
|
48
|
-
// which is a subclass of Node, so, just fixing types here
|
|
49
|
-
if (!(0, _isInstanceOf.isInstanceOf)(instance, _globalObject.globalObject.Node)) {
|
|
50
|
-
rootNode = instance.getRootNode();
|
|
51
|
-
}
|
|
44
|
+
rootNode = instance.getRootNode();
|
|
52
45
|
}
|
|
53
46
|
|
|
54
47
|
if (rootNode !== undefined) {
|
|
@@ -79,5 +72,5 @@ var getRootNode = exports.getRootNode = function getRootNode(instance) {
|
|
|
79
72
|
}
|
|
80
73
|
|
|
81
74
|
// the findDOMNode can also return Text, but we are only interested in Elements, so just filter it
|
|
82
|
-
return (0,
|
|
75
|
+
return (0, _utils.isElement)(rootNode) ? rootNode : null;
|
|
83
76
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactDom","require","_warning","_interopRequireDefault","
|
|
1
|
+
{"version":3,"names":["_reactDom","require","_warning","_interopRequireDefault","_utils","_rootNodeDecorator","getRootNode","exports","instance","isElement","rootNode","isInstanceWithRootNode","undefined","findDOMNode","e","warning","message"],"sources":["getRootNode.ts"],"sourcesContent":["import { findDOMNode } from 'react-dom';\nimport type React from 'react';\nimport warning from 'warning';\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 try {\n // rootNode is undefined, which means that the getter doesn't exists or returns the undefined\n // anyway, it tell us that the convention is not respected,\n // so, we have to fall back to the deprecated findDOMNode, which breaks StrictMode\n // instance can still be a class component or an imperative handle (i.e., anything, except null/undefined/Element)\n rootNode = findDOMNode(instance);\n } catch (e) {\n // but findDOMNode doesn`t accept everything that instance can be at this point,\n // so we have to handle exceptions\n // see https://github.com/facebook/react/blob/cae63505/packages/react-dom/src/__tests__/findDOMNode-test.js#L66-L86\n warning(\n false,\n '[getRootNode]: can`t fallback to findDOMNode.' +\n '\\n' +\n 'See https://github.com/skbkontur/retail-ui/blob/master/packages/react-ui/README.md#strictmode' +\n '\\n\\n' +\n e.message,\n );\n return null;\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":"iKAAA,IAAAA,SAAA,GAAAC,OAAA;;AAEA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;;;AAGA,IAAAG,MAAA,GAAAH,OAAA;;AAEA,IAAAI,kBAAA,GAAAJ,OAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,IAAMK,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,SAAdA,WAAWA,CAAIE,QAAuC,EAAwB;EACzF;AACF;AACA;AACA;AACA;AACA;AACA;;EAEE,IAAI,CAACA,QAAQ,EAAE;IACb;IACA;IACA,OAAO,IAAI;EACb;;EAEA,IAAI,IAAAC,gBAAS,EAACD,QAAQ,CAAC,EAAE;IACvB;IACA;IACA,OAAOA,QAAQ;EACjB;;EAEA,IAAIE,QAAQ;;EAEZ,IAAI,IAAAC,yCAAsB,EAACH,QAAQ,CAAC,EAAE;IACpCE,QAAQ,GAAGF,QAAQ,CAACF,WAAW,CAAC,CAAC;EACnC;;EAEA,IAAII,QAAQ,KAAKE,SAAS,EAAE;IAC1B;IACA;IACA,OAAOF,QAAQ;EACjB;;EAEA,IAAI;IACF;IACA;IACA;IACA;IACAA,QAAQ,GAAG,IAAAG,qBAAW,EAACL,QAAQ,CAAC;EAClC,CAAC,CAAC,OAAOM,CAAC,EAAE;IACV;IACA;IACA;IACA,IAAAC,gBAAO;MACL,KAAK;MACL,+CAA+C;MAC7C,IAAI;MACJ,+FAA+F;MAC/F,MAAM;MACND,CAAC,CAACE;IACN,CAAC;IACD,OAAO,IAAI;EACb;;EAEA;EACA,OAAO,IAAAP,gBAAS,EAACC,QAAQ,CAAC,GAAGA,QAAQ,GAAG,IAAI;AAC9C,CAAC","ignoreList":[]}
|
package/cjs/lib/utils.d.ts
CHANGED
|
@@ -87,3 +87,4 @@ export declare const isDropdown: (child: React.ReactNode) => child is React.Reac
|
|
|
87
87
|
export declare const isDropdownMenu: (child: React.ReactNode) => child is React.ReactElement<DropdownMenuProps, string | React.JSXElementConstructor<any>>;
|
|
88
88
|
export declare const isKonturIcon: (icon: React.ReactElement) => boolean;
|
|
89
89
|
export declare function clickOutside(): void;
|
|
90
|
+
export declare function isElement(el: unknown): el is Element;
|
package/cjs/lib/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.CancelationError = void 0;exports.clickOutside = clickOutside;exports.emptyHandler = exports.delay = void 0;exports.escapeRegExpSpecChars = escapeRegExpSpecChars;exports.isButton = exports.isAutocomplete = exports.getRandomID = exports.formatBytes = exports.extractDataProps = void 0;exports.isClassComponent = isClassComponent;exports.
|
|
1
|
+
"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.CancelationError = void 0;exports.clickOutside = clickOutside;exports.emptyHandler = exports.delay = void 0;exports.escapeRegExpSpecChars = escapeRegExpSpecChars;exports.isButton = exports.isAutocomplete = exports.getRandomID = exports.formatBytes = exports.extractDataProps = void 0;exports.isClassComponent = isClassComponent;exports.isDropdownMenu = exports.isDropdown = exports.isCurrencyInput = void 0;exports.isElement = isElement;exports.isExternalLink = void 0;exports.isFunction = isFunction;exports.isFunctionalComponent = isFunctionalComponent;exports.isInput = exports.isFxInput = void 0;exports.isIntrinsicElement = isIntrinsicElement;exports.isReactUINode = exports.isReactUIComponent = exports.isPasswordInput = exports.isNullable = exports.isNonNullable = exports.isKonturIcon = void 0;exports.isRefableElement = isRefableElement;exports.isSelect = void 0;exports.mergeRefs = mergeRefs;exports.startsWithOneOf = void 0;exports.taskWithDelay = taskWithDelay;var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
2
2
|
var _react = require("react");
|
|
3
3
|
var _reactIs = require("react-is");
|
|
4
4
|
var _globalObject = require("@skbkontur/global-object");
|
|
@@ -228,4 +228,8 @@ function clickOutside() {
|
|
|
228
228
|
event.initEvent('mousedown', true, true);
|
|
229
229
|
|
|
230
230
|
document.body.dispatchEvent(event);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function isElement(el) {
|
|
234
|
+
return !!el && typeof el === 'object' && 'nodeType' in el && el.nodeType === Node.ELEMENT_NODE;
|
|
231
235
|
}
|
package/cjs/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactIs","_globalObject","_delay","exports","delay","emptyHandler","CancelationError","_Error","_this","_len","arguments","length","args","Array","_key","call","apply","concat","code","_inheritsLoose2","default","_wrapNativeSuper2","Error","taskWithDelay","task","ms","cancelationToken","Promise","resolve","reject","globalObject","setTimeout","then","catch","isFunction","x","isFunctionalComponent","Component","Boolean","prototype","isReactComponent","isClassComponent","isIntrinsicElement","element","type","isRefableElement","isForwardRef","escapeRegExpSpecChars","s","replace","getRandomID","Math","random","toString","slice","isExternalLink","link","isBrowser","RegExp","location","host","test","isReactUINode","componentName","node","isValidElement","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","mergeRefs","refs","forEach","ref","current","extractDataProps","props","dataProps","restWithoutDataProps","entries","map","_ref","startsWith","startsWithOneOf","searchKeys","inputString","keyIndex","findIndex","key","isButton","isInput","isFxInput","isAutocomplete","isPasswordInput","isCurrencyInput","isSelect","isDropdown","isDropdownMenu","isKonturIcon","icon","clickOutside","event","document","createEvent","initEvent","body","dispatchEvent"],"sources":["utils.ts"],"sourcesContent":["import type React from 'react';\nimport { isValidElement } from 'react';\nimport { isForwardRef } from 'react-is';\nimport { globalObject, isBrowser } from '@skbkontur/global-object';\n\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';\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 globalObject.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): 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/** @deprecated Переехал в `lib/mergeRefs.ts`. Со следующей мажорной версии от сюда будет удален*/\nexport function mergeRefs<T = any>(refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>): React.RefCallback<T> {\n return (value) => {\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 | null>).current = value);\n }\n });\n };\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');\n\nexport const isKonturIcon = (icon: React.ReactElement) => {\n return Object.prototype.hasOwnProperty.call(icon?.type, '__KONTUR_ICON__');\n};\n\nexport function clickOutside() {\n const event = document.createEvent('HTMLEvents');\n event.initEvent('mousedown', true, true);\n\n document.body.dispatchEvent(event);\n}\n"],"mappings":";AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;;;;;;;;;;;;AAYA,IAAAG,MAAA,GAAAH,OAAA,YAAgCI,OAAA,CAAAC,KAAA,GAAAF,MAAA,CAAAE,KAAA;;AAEhC;;;;;;;;;;;;;;;AAeO,IAAMC,YAAY,GAAAF,OAAA,CAAAE,YAAA,GAAG,SAAfA,YAAYA,CAAA,EAAS;;EAChC,WACD,CAAC;;AAEWC,gBAAgB,GAAAH,OAAA,CAAAG,gBAAA,0BAAAC,MAAA,YAAAD,iBAAA,OAAAE,KAAA,UAAAC,IAA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U,CAAC;AAChE,IAAM+B,cAAc,GAAAnH,OAAA,CAAAmH,cAAA,GAAG/B,kBAAkB,CAAoB,cAAc,CAAC;;AAE5E,IAAMgC,YAAY,GAAApH,OAAA,CAAAoH,YAAA,GAAG,SAAfA,YAAYA,CAAIC,IAAwB,EAAK;EACxD,OAAOtD,MAAM,CAAC3B,SAAS,CAAC4B,cAAc,CAACpD,IAAI,CAACyG,IAAI,oBAAJA,IAAI,CAAE5E,IAAI,EAAE,iBAAiB,CAAC;AAC5E,CAAC;;AAEM,SAAS6E,YAAYA,CAAA,EAAG;EAC7B,IAAMC,KAAK,GAAGC,QAAQ,CAACC,WAAW,CAAC,YAAY,CAAC;EAChDF,KAAK,CAACG,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC;;EAExCF,QAAQ,CAACG,IAAI,CAACC,aAAa,CAACL,KAAK,CAAC;AACpC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","require","_reactIs","_globalObject","_delay","exports","delay","emptyHandler","CancelationError","_Error","_this","_len","arguments","length","args","Array","_key","call","apply","concat","code","_inheritsLoose2","default","_wrapNativeSuper2","Error","taskWithDelay","task","ms","cancelationToken","Promise","resolve","reject","globalObject","setTimeout","then","catch","isFunction","x","isFunctionalComponent","Component","Boolean","prototype","isReactComponent","isClassComponent","isIntrinsicElement","element","type","isRefableElement","isForwardRef","escapeRegExpSpecChars","s","replace","getRandomID","Math","random","toString","slice","isExternalLink","link","isBrowser","RegExp","location","host","test","isReactUINode","componentName","node","isValidElement","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","mergeRefs","refs","forEach","ref","current","extractDataProps","props","dataProps","restWithoutDataProps","entries","map","_ref","startsWith","startsWithOneOf","searchKeys","inputString","keyIndex","findIndex","key","isButton","isInput","isFxInput","isAutocomplete","isPasswordInput","isCurrencyInput","isSelect","isDropdown","isDropdownMenu","isKonturIcon","icon","clickOutside","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';\nimport { globalObject, isBrowser } from '@skbkontur/global-object';\n\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';\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 globalObject.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): 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/** @deprecated Переехал в `lib/mergeRefs.ts`. Со следующей мажорной версии от сюда будет удален*/\nexport function mergeRefs<T = any>(refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>): React.RefCallback<T> {\n return (value) => {\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 | null>).current = value);\n }\n });\n };\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');\n\nexport const isKonturIcon = (icon: React.ReactElement) => {\n return Object.prototype.hasOwnProperty.call(icon?.type, '__KONTUR_ICON__');\n};\n\nexport function clickOutside() {\n const event = document.createEvent('HTMLEvents');\n event.initEvent('mousedown', true, true);\n\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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;;;;;;;;;;;;AAYA,IAAAG,MAAA,GAAAH,OAAA,YAAgCI,OAAA,CAAAC,KAAA,GAAAF,MAAA,CAAAE,KAAA;;AAEhC;;;;;;;;;;;;;;;AAeO,IAAMC,YAAY,GAAAF,OAAA,CAAAE,YAAA,GAAG,SAAfA,YAAYA,CAAA,EAAS;;EAChC,WACD,CAAC;;AAEWC,gBAAgB,GAAAH,OAAA,CAAAG,gBAAA,0BAAAC,MAAA,YAAAD,iBAAA,OAAAE,KAAA,UAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,I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OAAA,CAAAmH,cAAA,GAAG/B,kBAAkB,CAAoB,cAAc,CAAC;;AAE5E,IAAMgC,YAAY,GAAApH,OAAA,CAAAoH,YAAA,GAAG,SAAfA,YAAYA,CAAIC,IAAwB,EAAK;EACxD,OAAOtD,MAAM,CAAC3B,SAAS,CAAC4B,cAAc,CAACpD,IAAI,CAACyG,IAAI,oBAAJA,IAAI,CAAE5E,IAAI,EAAE,iBAAiB,CAAC;AAC5E,CAAC;;AAEM,SAAS6E,YAAYA,CAAA,EAAG;EAC7B,IAAMC,KAAK,GAAGC,QAAQ,CAACC,WAAW,CAAC,YAAY,CAAC;EAChDF,KAAK,CAACG,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC;;EAExCF,QAAQ,CAACG,IAAI,CAACC,aAAa,CAACL,KAAK,CAAC;AACpC;;AAEO,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,6 +1,7 @@
|
|
|
1
1
|
import * as AutocompleteStories from './Autocomplete.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
import { Autocomplete } from '../Autocomplete';
|
|
@@ -8,7 +9,7 @@ import { Button, Group, Gapped } from '@skbkontur/react-ui';
|
|
|
8
9
|
|
|
9
10
|
<Meta of={AutocompleteStories} />
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
<Header component="Autocomplete" />
|
|
12
13
|
|
|
13
14
|
<Description />
|
|
14
15
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as ButtonStories from './Button.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={ButtonStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="Button"
|
|
11
|
+
guides="https://guides.kontur.ru/components/button"
|
|
12
|
+
figma="https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=200%3A2498"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as CalendarStories from './Calendar.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={CalendarStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="Calendar"
|
|
11
|
+
guides="https://guides.kontur.ru/components/input-fields/calendar/#_Blok_kalendarya"
|
|
12
|
+
figma="https://www.figma.com/design/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI?node-id=200-979&t=DrNoIKKKInwy9gzX-0"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as CalendarDayStories from './CalendarDay.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={CalendarDayStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
<Header component="Calendar" />
|
|
9
10
|
|
|
10
11
|
<Description />
|
|
11
12
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as CenterStories from './Center.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={CenterStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
<Header component="Center" />
|
|
9
10
|
|
|
10
11
|
<Description />
|
|
11
12
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as CheckboxStories from './Checkbox.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={CheckboxStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="Checkbox"
|
|
11
|
+
guides="https://guides.kontur.ru/components/selection-elements/checkbox/"
|
|
12
|
+
figma="https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI?node-id=203%3A7278"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as ComboBoxStories from './ComboBox.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={ComboBoxStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="Combobox"
|
|
11
|
+
guides="https://guides.kontur.ru/components/input-fields/combobox/"
|
|
12
|
+
figma="https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=203%3A1602"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as CurrencyInputStories from './CurrencyInput.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={CurrencyInputStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
<Header
|
|
10
|
+
component="CurrencyInput"
|
|
11
|
+
guides="https://guides.kontur.ru/components/input-fields/currency/"
|
|
12
|
+
figma="https://www.figma.com/file/87ScqxPzJpF9DcVBNYWOjM/%E2%9A%A1-Kontur-UI-Modern-Layout?node-id=203%3A1602"
|
|
13
|
+
/>
|
|
13
14
|
|
|
14
15
|
<Description />
|
|
15
16
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as CurrencyLabelStories from './CurrencyLabel.docs.stories.tsx';
|
|
2
2
|
import { Primary, ArgTypes, Stories, Description } from '@storybook/blocks';
|
|
3
3
|
import { Meta } from '../../../.storybook/Meta';
|
|
4
|
+
import { Header } from '../../../.storybook/Header';
|
|
4
5
|
import { PropsTable } from '../../../.storybook/PropsTable';
|
|
5
6
|
|
|
6
7
|
<Meta of={CurrencyLabelStories} />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
<Header component="CurrencyLabel" />
|
|
9
10
|
|
|
10
11
|
<Description />
|
|
11
12
|
|