@true-engineering/true-react-common-ui-kit 4.0.0-alpha44 → 4.0.0-alpha46
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/dist/components/AccountInfo/AccountInfo.styles.d.ts +1 -1
- package/dist/components/AddButton/AddButton.styles.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.styles.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.styles.d.ts +1 -1
- package/dist/components/CloseButton/CloseButton.styles.d.ts +1 -1
- package/dist/components/ControlWrapper/ControlWrapper.d.ts +2 -2
- package/dist/components/ControlWrapper/ControlWrapper.styles.d.ts +1 -1
- package/dist/components/ControlWrapper/constants.d.ts +1 -0
- package/dist/components/ControlWrapper/index.d.ts +1 -0
- package/dist/components/ControlWrapper/types.d.ts +3 -1
- package/dist/components/CssBaseline/CssBaseline.styles.d.ts +1 -1
- package/dist/components/DateInput/DateInput.d.ts +1 -2
- package/dist/components/DateInput/DateInput.styles.d.ts +1 -1
- package/dist/components/DateInput/constants.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +2 -3
- package/dist/components/DatePicker/DatePicker.styles.d.ts +1 -1
- package/dist/components/DatePicker/components/DatePickerBase/DatePickerBase.d.ts +1 -1
- package/dist/components/DatePicker/components/DatePickerHeader/DatePickerHeader.styles.d.ts +1 -1
- package/dist/components/DatePicker/constants.d.ts +1 -1
- package/dist/components/DatePicker/types.d.ts +2 -2
- package/dist/components/Description/Description.styles.d.ts +1 -1
- package/dist/components/FileInput/FileInput.d.ts +1 -1
- package/dist/components/FileInput/FileInput.styles.d.ts +1 -1
- package/dist/components/FileItem/FileItem.styles.d.ts +1 -1
- package/dist/components/FiltersPane/FiltersPane.d.ts +0 -1
- package/dist/components/FiltersPane/FiltersPane.styles.d.ts +2 -2
- package/dist/components/FiltersPane/components/Filter/Filter.d.ts +1 -2
- package/dist/components/FiltersPane/components/FilterInterval/FilterInterval.styles.d.ts +3 -6
- package/dist/components/FiltersPane/components/FilterMultiSelect/FilterMultiSelect.d.ts +0 -1
- package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.styles.d.ts +3 -6
- package/dist/components/FiltersPane/components/FilterValueView/FilterValueView.d.ts +1 -2
- package/dist/components/FiltersPane/components/FilterValueView/FilterValueView.styles.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.d.ts +5 -11
- package/dist/components/FiltersPane/components/FilterWithPeriod/FilterWithPeriod.styles.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.d.ts +0 -1
- package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.d.ts +2 -2
- package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.d.ts +1 -1
- package/dist/components/FiltersPane/constants.d.ts +1 -1
- package/dist/components/FiltersPane/helpers.d.ts +1 -1
- package/dist/components/FiltersPane/types.d.ts +1 -1
- package/dist/components/Flag/Flag.styles.d.ts +1 -1
- package/dist/components/Flag/customFlags/customFlags.d.ts +2 -2
- package/dist/components/FlexibleTable/FlexibleTable.styles.d.ts +2 -2
- package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.d.ts +1 -1
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.d.ts +1 -1
- package/dist/components/FlexibleTable/helpers.d.ts +2 -2
- package/dist/components/FloatDocActions/FloatDocActions.styles.d.ts +1 -1
- package/dist/components/FloatDocActions/components/DocActions/DocActions.styles.d.ts +1 -1
- package/dist/components/Icon/Icon.styles.d.ts +1 -1
- package/dist/components/Icon/icons/index.d.ts +29 -29
- package/dist/components/IconButton/IconButton.d.ts +1 -2
- package/dist/components/IconButton/IconButton.styles.d.ts +1 -1
- package/dist/components/IncrementInput/IncrementInput.styles.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -2
- package/dist/components/Input/Input.styles.d.ts +1 -1
- package/dist/components/Input/InputBase.d.ts +1 -1
- package/dist/components/List/List.styles.d.ts +1 -1
- package/dist/components/List/components/ListItem/ListItem.styles.d.ts +1 -1
- package/dist/components/Modal/Modal.styles.d.ts +1 -1
- package/dist/components/MoreMenu/MoreMenu.styles.d.ts +1 -1
- package/dist/components/MultiSelect/MultiSelect.d.ts +0 -1
- package/dist/components/MultiSelect/MultiSelect.styles.d.ts +1 -1
- package/dist/components/MultiSelect/components/MultiSelectInput/MultiSelectInput.styles.d.ts +1 -1
- package/dist/components/MultiSelectList/MultiSelectList.styles.d.ts +1 -1
- package/dist/components/MultiSelectList/constants.d.ts +1 -1
- package/dist/components/MultiSelectList/helpers.d.ts +1 -1
- package/dist/components/NewMoreMenu/NewMoreMenu.styles.d.ts +1 -1
- package/dist/components/Notification/Notification.styles.d.ts +1 -1
- package/dist/components/NumberInput/NumberInput.d.ts +1 -2
- package/dist/components/NumberInput/helpers.d.ts +2 -2
- package/dist/components/PhoneInput/PhoneInput.styles.d.ts +1 -1
- package/dist/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.styles.d.ts +1 -1
- package/dist/components/RadioButton/RadioButton.styles.d.ts +1 -1
- package/dist/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.d.ts +3 -373
- package/dist/components/ScrollIntoViewIfNeeded/constants.d.ts +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +1 -2
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.styles.d.ts +12 -22
- package/dist/components/Select/components/SelectList/SelectList.d.ts +5 -5
- package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +1 -1
- package/dist/components/Select/components/SelectListItem/SelectListItem.d.ts +2 -2
- package/dist/components/Select/helpers.d.ts +1 -1
- package/dist/components/Selector/Selector.d.ts +0 -1
- package/dist/components/Selector/Selector.styles.d.ts +1 -1
- package/dist/components/Skeleton/Skeleton.styles.d.ts +1 -1
- package/dist/components/SmartInput/SmartInput.d.ts +1 -1
- package/dist/components/Status/Status.styles.d.ts +1 -1
- package/dist/components/Status/types.d.ts +1 -1
- package/dist/components/Switch/Switch.styles.d.ts +1 -1
- package/dist/components/TextArea/TextArea.d.ts +1 -1
- package/dist/components/TextArea/TextArea.styles.d.ts +1 -1
- package/dist/components/TextButton/TextButton.d.ts +1 -1
- package/dist/components/TextButton/TextButton.styles.d.ts +1 -1
- package/dist/components/TextWithInfo/TextWithInfo.styles.d.ts +1 -1
- package/dist/components/TextWithTooltip/TextWithTooltip.styles.d.ts +1 -1
- package/dist/components/ThemedPreloader/ThemedPreloader.styles.d.ts +1 -1
- package/dist/components/ThemedPreloader/components/DotsPreloader/DotsPreloader.styles.d.ts +1 -1
- package/dist/components/ThemedPreloader/components/SvgPreloader/SvgPreloader.styles.d.ts +1 -1
- package/dist/components/Toaster/Toaster.styles.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.styles.d.ts +1 -1
- package/dist/components/WithMessages/WithMessages.d.ts +1 -1
- package/dist/components/WithMessages/WithMessages.styles.d.ts +1 -1
- package/dist/components/WithPopup/WithPopup.styles.d.ts +1 -1
- package/dist/components/WithPopup/types.d.ts +4 -4
- package/dist/components/index.d.ts +0 -1
- package/dist/constants/phone-info.d.ts +1 -1
- package/dist/helpers/misc.d.ts +2 -1
- package/dist/helpers/phone.d.ts +1 -1
- package/dist/hooks/use-dropdown.d.ts +3 -3
- package/dist/hooks/use-merge.d.ts +1 -1
- package/dist/hooks/use-mixed-styles.d.ts +3 -3
- package/dist/hooks/use-tweak-styles.d.ts +5 -5
- package/dist/theme/Provider.d.ts +2 -2
- package/dist/theme/common.d.ts +1 -1
- package/dist/theme/helpers.d.ts +3 -3
- package/dist/theme/true-jss/ThemedStylesManager.d.ts +1 -1
- package/dist/theme/true-jss/TweakStylesManager.d.ts +1 -1
- package/dist/theme/types.d.ts +1 -1
- package/dist/true-react-common-ui-kit.js +881 -733
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +881 -733
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/dist/types.d.ts +4 -4
- package/package.json +14 -16
- package/src/components/AccountInfo/AccountInfo.stories.tsx +19 -27
- package/src/components/AddButton/AddButton.stories.tsx +14 -17
- package/src/components/Button/Button.stories.tsx +7 -24
- package/src/components/Checkbox/Checkbox.stories.tsx +24 -26
- package/src/components/Checkbox/types.ts +1 -1
- package/src/components/CloseButton/CloseButton.stories.tsx +5 -6
- package/src/components/Colors/Colors.stories.tsx +63 -3
- package/src/components/ControlWrapper/ControlWrapper.stories.tsx +43 -38
- package/src/components/ControlWrapper/ControlWrapper.tsx +2 -11
- package/src/components/ControlWrapper/constants.ts +11 -0
- package/src/components/ControlWrapper/index.ts +1 -0
- package/src/components/ControlWrapper/types.ts +4 -1
- package/src/components/DateInput/DateInput.stories.tsx +13 -30
- package/src/components/DatePicker/DatePicker.stories.tsx +15 -52
- package/src/components/Description/Description.stories.tsx +11 -16
- package/src/components/FileInput/FileInput.stories.tsx +59 -63
- package/src/components/FileItem/FileItem.stories.tsx +46 -45
- package/src/components/FiltersPane/FiltersPane.stories.tsx +27 -30
- package/src/components/FiltersPane/components/Filter/Filter.tsx +1 -1
- package/src/components/FiltersPane/components/Filter/helpers.ts +3 -3
- package/src/components/FiltersPane/types.ts +0 -2
- package/src/components/Flag/Flag.stories.tsx +15 -20
- package/src/components/Flag/Flag.tsx +2 -2
- package/src/components/FlexibleTable/FlexibleTable.stories.tsx +47 -50
- package/src/components/FloatDocActions/FloatDocActions.stories.tsx +18 -24
- package/src/components/Icon/Icon.stories.tsx +9 -5
- package/src/components/Icon/types.ts +1 -1
- package/src/components/IconButton/IconButton.stories.tsx +7 -11
- package/src/components/IncrementInput/IncrementInput.stories.tsx +25 -25
- package/src/components/Input/Input.stories.tsx +35 -61
- package/src/components/List/List.stories.tsx +22 -17
- package/src/components/List/List.styles.ts +2 -1
- package/src/components/Modal/Modal.stories.tsx +50 -59
- package/src/components/MoreMenu/MoreMenu.stories.tsx +24 -15
- package/src/components/MultiSelect/MultiSelect.stories.tsx +23 -20
- package/src/components/NewMoreMenu/NewMoreMenu.stories.tsx +42 -40
- package/src/components/Notification/Notification.stories.tsx +34 -32
- package/src/components/NumberInput/NumberInput.stories.tsx +27 -27
- package/src/components/PhoneInput/PhoneInput.stories.tsx +28 -54
- package/src/components/PhoneInput/PhoneInput.tsx +1 -1
- package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.stories.tsx +5 -11
- package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx +1 -4
- package/src/components/RadioButton/RadioButton.stories.tsx +28 -31
- package/src/components/RadioButton/types.ts +1 -1
- package/src/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.ts +15 -9
- package/src/components/SearchInput/SearchInput.stories.tsx +14 -14
- package/src/components/Select/CustomSelect.stories.tsx +29 -33
- package/src/components/Select/MultiSelect.stories.tsx +41 -46
- package/src/components/Select/Select.stories.tsx +41 -46
- package/src/components/Select/Select.tsx +27 -27
- package/src/components/Select/components/SelectList/SelectList.tsx +4 -4
- package/src/components/Selector/Selector.stories.tsx +25 -27
- package/src/components/Selector/Selector.tsx +1 -2
- package/src/components/Skeleton/Skeleton.stories.tsx +13 -12
- package/src/components/SmartInput/SmartInput.stories.tsx +23 -23
- package/src/components/Status/Status.stories.tsx +29 -30
- package/src/components/Status/types.ts +1 -1
- package/src/components/Switch/Switch.stories.tsx +19 -26
- package/src/components/TextArea/TextArea.stories.tsx +32 -35
- package/src/components/TextArea/types.ts +1 -1
- package/src/components/TextButton/TextButton.stories.tsx +6 -16
- package/src/components/TextWithInfo/TextWithInfo.stories.tsx +13 -21
- package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +26 -25
- package/src/components/TextWithTooltip/TextWithTooltip.tsx +1 -2
- package/src/components/ThemedPreloader/ThemedPreloader.stories.tsx +12 -23
- package/src/components/Toaster/Toaster.stories.tsx +16 -14
- package/src/components/Tooltip/Tooltip.stories.tsx +5 -4
- package/src/components/WithMessages/WithMessages.stories.tsx +16 -20
- package/src/components/WithPopup/WithPopup.stories.tsx +27 -26
- package/src/components/WithTooltip/WithTooltip.stories.tsx +28 -28
- package/src/components/index.ts +0 -1
- package/src/helpers/misc.ts +8 -5
- package/src/helpers/popper-helpers.ts +0 -1
- package/src/theme/helpers.ts +3 -1
- package/src/theme/true-jss/ThemedStylesManager.ts +2 -1
- package/src/theme/true-jss/TweakStylesManager.ts +1 -2
- package/src/theme/types.ts +0 -1
- package/src/types.ts +0 -2
- package/dist/components/Colors/Colors.d.ts +0 -2
- package/dist/components/Colors/Colors.styles.d.ts +0 -1
- package/dist/components/Colors/index.d.ts +0 -1
- package/src/components/Colors/Colors.styles.ts +0 -36
- package/src/components/Colors/Colors.tsx +0 -26
- package/src/components/Colors/index.ts +0 -1
- package/src/components/Flag/customFlags/augment.d.ts +0 -1
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
2
3
|
import { Button } from '../Button';
|
|
3
|
-
import { Toaster } from './Toaster';
|
|
4
|
+
import { IToasterProps, Toaster } from './Toaster';
|
|
5
|
+
import { IToasterType } from './types';
|
|
4
6
|
|
|
5
|
-
const types = ['error', 'info', 'warning', 'ok', 'not-ok'];
|
|
7
|
+
const types: IToasterType[] = ['error', 'info', 'warning', 'ok', 'not-ok'];
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
const Story: FC<IToasterProps> = (args) => (
|
|
10
|
+
<Toaster {...args} onTimeEnd={() => console.log(1)} onClose={() => alert('closed')}>
|
|
11
|
+
<Button size="m">Нажмите</Button>
|
|
12
|
+
</Toaster>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
const meta: Meta<typeof Story> = {
|
|
8
16
|
title: 'Feedback/Toaster',
|
|
9
|
-
component:
|
|
17
|
+
component: Story,
|
|
10
18
|
args: {
|
|
11
19
|
title: 'Произошла очень страшная ошибка',
|
|
12
20
|
text: 'Мы даже не знаем, чем вам помочь!',
|
|
@@ -18,13 +26,7 @@ export default {
|
|
|
18
26
|
argTypes: {
|
|
19
27
|
type: { control: 'inline-radio', options: types },
|
|
20
28
|
},
|
|
21
|
-
|
|
22
|
-
controls: { exclude: ['onTimeEnd', 'onClose', 'data', 'tweakStyles'] },
|
|
23
|
-
},
|
|
24
|
-
} as ComponentMeta<typeof Toaster>;
|
|
29
|
+
};
|
|
25
30
|
|
|
26
|
-
export
|
|
27
|
-
|
|
28
|
-
<Button size="m">Нажмите</Button>
|
|
29
|
-
</Toaster>
|
|
30
|
-
);
|
|
31
|
+
export default meta;
|
|
32
|
+
export const Default = {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Meta } from '@storybook/react';
|
|
2
2
|
import { Tooltip } from './Tooltip';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const meta: Meta<typeof Tooltip> = {
|
|
5
5
|
title: 'Data Display/Tooltip',
|
|
6
6
|
component: Tooltip,
|
|
7
7
|
args: {
|
|
@@ -14,6 +14,7 @@ export default {
|
|
|
14
14
|
view: { control: 'inline-radio', options: ['tooltip', 'hint'] },
|
|
15
15
|
type: { control: 'inline-radio', options: ['info', 'error'] },
|
|
16
16
|
},
|
|
17
|
-
}
|
|
17
|
+
};
|
|
18
18
|
|
|
19
|
-
export
|
|
19
|
+
export default meta;
|
|
20
|
+
export const Default = {};
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
1
2
|
import { doNothing } from '@true-engineering/true-react-platform-helpers';
|
|
2
|
-
import {
|
|
3
|
+
import { type Meta } from '@storybook/react';
|
|
3
4
|
import { IInputProps, Input } from '../Input';
|
|
4
|
-
import { WithMessages } from './WithMessages';
|
|
5
|
+
import { IWithMessagesProps, WithMessages } from './WithMessages';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
title: 'Data Display/WithMessages',
|
|
8
|
-
component: WithMessages,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const Template: ComponentStory<typeof WithMessages> = ({ controlsDirection, ...args }) => {
|
|
7
|
+
const Story: FC<IWithMessagesProps> = ({ controlsDirection, ...args }) => {
|
|
12
8
|
let groupPlacement: Array<IInputProps['groupPlacement']> = [];
|
|
9
|
+
|
|
13
10
|
if (controlsDirection === 'horizontal') {
|
|
14
11
|
groupPlacement = ['left', 'right'];
|
|
15
12
|
}
|
|
16
13
|
if (controlsDirection === 'vertical') {
|
|
17
14
|
groupPlacement = ['top', 'bottom'];
|
|
18
15
|
}
|
|
16
|
+
|
|
19
17
|
return (
|
|
20
18
|
<WithMessages {...args} controlsDirection={controlsDirection}>
|
|
21
19
|
<Input value="value" groupPlacement={groupPlacement[0]} onChange={doNothing} />
|
|
@@ -24,17 +22,15 @@ const Template: ComponentStory<typeof WithMessages> = ({ controlsDirection, ...a
|
|
|
24
22
|
);
|
|
25
23
|
};
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Default.argTypes = {
|
|
36
|
-
controlsDirection: {
|
|
37
|
-
options: [undefined, 'horizontal', 'vertical'],
|
|
38
|
-
control: 'radio',
|
|
25
|
+
const meta: Meta<typeof Story> = {
|
|
26
|
+
title: 'Data Display/WithMessages',
|
|
27
|
+
component: Story,
|
|
28
|
+
args: {
|
|
29
|
+
infoMessage: 'Message Info',
|
|
30
|
+
errorMessage: 'Error Text',
|
|
31
|
+
controlsDirection: undefined,
|
|
39
32
|
},
|
|
40
33
|
};
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
export const Default = {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
1
2
|
import { doNothing } from '@true-engineering/true-react-platform-helpers';
|
|
2
|
-
import {
|
|
3
|
+
import { type Meta } from '@storybook/react';
|
|
4
|
+
import { excludeStorybookParams } from '../../helpers';
|
|
3
5
|
import { Button } from '../Button';
|
|
4
6
|
import { IListItem, List } from '../List';
|
|
5
7
|
import { Tooltip } from '../Tooltip';
|
|
6
|
-
import { WithPopup } from './WithPopup';
|
|
8
|
+
import { IWithPopupProps, WithPopup } from './WithPopup';
|
|
7
9
|
|
|
8
10
|
const positions = [
|
|
9
11
|
undefined,
|
|
@@ -21,15 +23,6 @@ const positions = [
|
|
|
21
23
|
'left-end',
|
|
22
24
|
];
|
|
23
25
|
|
|
24
|
-
export default {
|
|
25
|
-
title: 'Data Display/WithPopup',
|
|
26
|
-
component: WithPopup,
|
|
27
|
-
argTypes: {
|
|
28
|
-
placement: { control: 'select', options: positions },
|
|
29
|
-
eventType: { control: 'inline-radio', options: ['hover', 'click'] },
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
26
|
const items: IListItem[] = [
|
|
34
27
|
{
|
|
35
28
|
item: 'Copy',
|
|
@@ -45,7 +38,7 @@ const items: IListItem[] = [
|
|
|
45
38
|
},
|
|
46
39
|
];
|
|
47
40
|
|
|
48
|
-
const
|
|
41
|
+
const Story: FC<IWithPopupProps> = (args) => (
|
|
49
42
|
<div
|
|
50
43
|
style={{
|
|
51
44
|
display: 'flex',
|
|
@@ -83,19 +76,27 @@ const Template: ComponentStory<typeof WithPopup> = (args) => (
|
|
|
83
76
|
</div>
|
|
84
77
|
);
|
|
85
78
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
79
|
+
const meta: Meta<typeof Story> = {
|
|
80
|
+
title: 'Data Display/WithPopup',
|
|
81
|
+
component: Story,
|
|
82
|
+
args: {
|
|
83
|
+
canBeFlipped: true,
|
|
84
|
+
isDisabled: false,
|
|
85
|
+
shouldRenderInBody: true,
|
|
86
|
+
shouldHideOnScroll: false,
|
|
87
|
+
shouldStopPropagation: true,
|
|
88
|
+
shouldShowArrow: false,
|
|
89
|
+
},
|
|
90
|
+
argTypes: {
|
|
91
|
+
placement: { control: 'select', options: positions },
|
|
92
|
+
eventType: { control: 'inline-radio', options: ['hover', 'click'] },
|
|
93
|
+
},
|
|
94
|
+
parameters: {
|
|
95
|
+
controls: {
|
|
96
|
+
exclude: excludeStorybookParams(['trigger', 'middlewares', 'children', 'eventType']),
|
|
97
|
+
},
|
|
100
98
|
},
|
|
101
99
|
};
|
|
100
|
+
|
|
101
|
+
export default meta;
|
|
102
|
+
export const Default = {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
3
|
+
import { IWithTooltipProps, WithTooltip } from './WithTooltip';
|
|
3
4
|
|
|
4
5
|
const positions = [
|
|
5
6
|
'top',
|
|
@@ -16,20 +17,23 @@ const positions = [
|
|
|
16
17
|
'left-end',
|
|
17
18
|
];
|
|
18
19
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
const Story: FC<IWithTooltipProps> = (args) => (
|
|
21
|
+
<div
|
|
22
|
+
style={{
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
width: 600,
|
|
27
|
+
height: 400,
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
<WithTooltip {...args} />
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
const meta: Meta<typeof Story> = {
|
|
35
|
+
title: 'Data Display/WithTooltip',
|
|
36
|
+
component: Story,
|
|
33
37
|
args: {
|
|
34
38
|
children: 'Наведи на меня - появится тултип',
|
|
35
39
|
tooltipText: 'Текст тултипа',
|
|
@@ -40,17 +44,13 @@ export const Default: IStory = {
|
|
|
40
44
|
isDisabled: false,
|
|
41
45
|
shouldRenderInBody: true,
|
|
42
46
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
width: 600,
|
|
50
|
-
height: 400,
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
<WithTooltip {...args} />
|
|
54
|
-
</div>
|
|
55
|
-
),
|
|
47
|
+
argTypes: {
|
|
48
|
+
placement: { control: 'select', options: positions },
|
|
49
|
+
tooltipView: { control: 'inline-radio', options: ['tooltip', 'hint'] },
|
|
50
|
+
tooltipType: { control: 'inline-radio', options: ['info', 'error'] },
|
|
51
|
+
eventType: { control: 'inline-radio', options: ['hover', 'click'] },
|
|
52
|
+
},
|
|
56
53
|
};
|
|
54
|
+
|
|
55
|
+
export default meta;
|
|
56
|
+
export const Default = {};
|
package/src/components/index.ts
CHANGED
package/src/helpers/misc.ts
CHANGED
|
@@ -21,6 +21,11 @@ export const transformToKebab = (string: string): string => {
|
|
|
21
21
|
return result;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
+
export const getParentNode = (element: Element | ShadowRoot | Document): Element =>
|
|
25
|
+
element.nodeName === 'HTML' || element === document
|
|
26
|
+
? (element as Element)
|
|
27
|
+
: (element.parentNode as Element) ?? (element as ShadowRoot).host;
|
|
28
|
+
|
|
24
29
|
export const hasExactParent = (element: Element, parent: Element): boolean => {
|
|
25
30
|
if (element === parent) {
|
|
26
31
|
return true; // Found the exact parent
|
|
@@ -35,11 +40,6 @@ export const hasExactParent = (element: Element, parent: Element): boolean => {
|
|
|
35
40
|
return hasExactParent(parentNode, parent);
|
|
36
41
|
};
|
|
37
42
|
|
|
38
|
-
export const getParentNode = (element: Element | ShadowRoot | Document): Element =>
|
|
39
|
-
element.nodeName === 'HTML' || element === document
|
|
40
|
-
? (element as Element)
|
|
41
|
-
: (element.parentNode as Element) ?? (element as ShadowRoot).host;
|
|
42
|
-
|
|
43
43
|
export const getStyleComputedProperty = (element: Element): Partial<CSSStyleDeclaration> =>
|
|
44
44
|
element.nodeType !== 1 ? {} : getComputedStyle(element, null);
|
|
45
45
|
|
|
@@ -157,3 +157,6 @@ export const addDataAttributes = (data: IDataAttributes = {}): IDataAttributes =
|
|
|
157
157
|
: [],
|
|
158
158
|
),
|
|
159
159
|
);
|
|
160
|
+
|
|
161
|
+
export const excludeStorybookParams = (params: string[]): RegExp =>
|
|
162
|
+
new RegExp(`^(on.*|${['tweakStyles', 'data', ...params].join('|')})$`);
|
package/src/theme/helpers.ts
CHANGED
|
@@ -58,7 +58,9 @@ export const getTweakStylesCache = (): TweakStylesCache => {
|
|
|
58
58
|
if (!cache.has(next)) {
|
|
59
59
|
cache.set(next, getTweakStylesCache());
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
63
|
+
return cache.get(next)!;
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
return (styles, prev = []) => {
|
|
@@ -87,6 +87,7 @@ export class ThemedStylesManager<C extends string> {
|
|
|
87
87
|
this.#styleSheetMap.set(theme, { sheet, manager, refs: 0 });
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
91
|
+
return this.#styleSheetMap.get(theme)!;
|
|
91
92
|
}
|
|
92
93
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Classes, Rule, StyleSheet } from 'jss';
|
|
2
2
|
import {
|
|
3
3
|
isArrayNotEmpty,
|
|
4
4
|
isNotEmpty,
|
|
@@ -142,7 +142,6 @@ declare module 'jss' {
|
|
|
142
142
|
export interface RuleList {
|
|
143
143
|
index: Rule[];
|
|
144
144
|
}
|
|
145
|
-
// eslint-disable-next-line no-shadow
|
|
146
145
|
export interface StyleSheet<RuleName> {
|
|
147
146
|
rules: RuleList;
|
|
148
147
|
// eslint-disable-next-line @typescript-eslint/method-signature-style
|
package/src/theme/types.ts
CHANGED
|
@@ -148,7 +148,6 @@ export interface IComponentStyles {
|
|
|
148
148
|
|
|
149
149
|
export type IComponentName = keyof IComponentStyles;
|
|
150
150
|
|
|
151
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
152
151
|
export type IUiKitAnimations = Record<string, any>;
|
|
153
152
|
export type IUiKitHelpers = Record<string, Styles | (() => Styles)>;
|
|
154
153
|
|
package/src/types.ts
CHANGED
|
@@ -36,11 +36,9 @@ export interface IDropdownWithPopperOptions {
|
|
|
36
36
|
|
|
37
37
|
shouldHideOnScroll?: boolean; // работает весьма условно без shouldUsePopper
|
|
38
38
|
canBeFlipped?: boolean; // только с shouldUsePopper
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
39
|
modifiers?: Array<Partial<Modifier<any, any>>>; // только с shouldUsePopper
|
|
41
40
|
placement?: Placement; // only with shouldUsePopper
|
|
42
41
|
// https://popper.js.org/docs/v2/modifiers/flip/
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
42
|
flipOptions?: Record<string, any>; // только с shouldUsePopper
|
|
45
43
|
}
|
|
46
44
|
export type IClickHandlerEvent = MouseEvent | KeyboardEvent;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useStyles: import("../../theme").IUseStyles<"color" | "root" | "colorCard" | "colorName" | "hex", unknown>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Colors';
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { createThemedStyles } from '../../theme';
|
|
2
|
-
|
|
3
|
-
export const useStyles = createThemedStyles({
|
|
4
|
-
root: {
|
|
5
|
-
display: 'flex',
|
|
6
|
-
flexWrap: 'wrap',
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
colorCard: {
|
|
10
|
-
width: 120,
|
|
11
|
-
border: 'solid 1px #dde3ed',
|
|
12
|
-
borderRadius: 8,
|
|
13
|
-
color: '#222a37',
|
|
14
|
-
fontSize: 14,
|
|
15
|
-
margin: 6,
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
color: {
|
|
19
|
-
height: 120,
|
|
20
|
-
borderTopLeftRadius: 8,
|
|
21
|
-
borderTopRightRadius: 8,
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
colorName: {
|
|
25
|
-
marginBottom: 6,
|
|
26
|
-
padding: 6,
|
|
27
|
-
overflow: 'hidden',
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
hex: {
|
|
31
|
-
marginTop: 6,
|
|
32
|
-
textTransform: 'uppercase',
|
|
33
|
-
fontWeight: 'bold',
|
|
34
|
-
padding: [0, 6, 6],
|
|
35
|
-
},
|
|
36
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { useTheme } from '../../theme';
|
|
3
|
-
import { useStyles } from './Colors.styles';
|
|
4
|
-
|
|
5
|
-
// TODO: А зачем нужен то этот компонент кроме как ради сторис?????? мб его толкьо в сторис оформить?
|
|
6
|
-
|
|
7
|
-
export const Colors: FC = () => {
|
|
8
|
-
const classes = useStyles();
|
|
9
|
-
const theme = useTheme();
|
|
10
|
-
const { colors = {} } = theme;
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<div className={classes.root}>
|
|
14
|
-
{Object.entries(colors as Record<string, string>).map(([colorName, color]) => {
|
|
15
|
-
const name = colorName.split('_').join(' ').toLowerCase();
|
|
16
|
-
return (
|
|
17
|
-
<div key={colorName} className={classes.colorCard}>
|
|
18
|
-
<div className={classes.color} style={{ backgroundColor: color }} />
|
|
19
|
-
<div className={classes.colorName}>{`${name[0].toUpperCase()}${name.slice(1)}`}</div>
|
|
20
|
-
<div className={classes.hex}>{color}</div>
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
})}
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Colors';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare module '*.svg?raw';
|