@true-engineering/true-react-common-ui-kit 3.0.0-alpha.2 → 3.0.0-alpha.21
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/LICENSE +201 -201
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.d.ts +1 -5
- package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.d.ts +1 -3
- package/dist/components/Flag/augment.d.ts +1 -1
- package/dist/components/FlexibleTable/FlexibleTable.d.ts +6 -2
- package/dist/components/FlexibleTable/FlexibleTable.styles.d.ts +1 -1
- package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.d.ts +1 -1
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.d.ts +1 -1
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.d.ts +1 -1
- package/dist/components/FlexibleTable/helpers.d.ts +3 -0
- package/dist/components/FlexibleTable/types.d.ts +1 -1
- package/dist/components/Icon/complexIcons/augment.d.ts +1 -1
- package/dist/components/List/List.d.ts +2 -2
- package/dist/components/List/types.d.ts +2 -2
- package/dist/components/MultiSelectList/MultiSelectList.d.ts +1 -2
- package/dist/components/Skeleton/Skeleton.d.ts +7 -0
- package/dist/components/Skeleton/Skeleton.styles.d.ts +3 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Switch/Switch.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/helpers/phone.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-merged-refs.d.ts +2 -0
- package/dist/theme/types.d.ts +2 -1
- package/dist/true-react-common-ui-kit.js +1162 -819
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +1161 -818
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/dist/vite-env.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/AddButton/AddButton.stories.tsx +21 -21
- package/src/components/Checkbox/Checkbox.tsx +1 -1
- package/src/components/Colors/Colors.stories.tsx +7 -7
- package/src/components/DateInput/DateInput.tsx +1 -9
- package/src/components/DateInput/constants.ts +2 -2
- package/src/components/DatePicker/DatePicker.stories.tsx +1 -0
- package/src/components/DatePicker/DatePicker.tsx +1 -3
- package/src/components/FiltersPane/FiltersPane.stories.tsx +0 -8
- package/src/components/FiltersPane/components/FilterInterval/FilterInterval.styles.ts +2 -1
- package/src/components/FiltersPane/components/FilterSelect/FilterSelect.styles.ts +3 -1
- package/src/components/FiltersPane/components/FilterSelect/FilterSelect.tsx +1 -6
- package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.ts +2 -1
- package/src/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.ts +1 -0
- package/src/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.tsx +1 -4
- package/src/components/FiltersPane/types.ts +1 -1
- package/src/components/Flag/augment.d.ts +1 -1
- package/src/components/FlexibleTable/FlexibleTable.stories.tsx +15 -12
- package/src/components/FlexibleTable/FlexibleTable.styles.ts +9 -10
- package/src/components/FlexibleTable/FlexibleTable.tsx +124 -60
- package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.ts +4 -0
- package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.tsx +25 -27
- package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.ts +4 -0
- package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.tsx +12 -11
- package/src/components/FlexibleTable/helpers.ts +15 -0
- package/src/components/FlexibleTable/types.ts +1 -1
- package/src/components/Icon/complexIcons/augment.d.ts +1 -1
- package/src/components/Icon/complexIcons/avatarGreen.svg +57 -57
- package/src/components/Icon/complexIcons/index.ts +1 -1
- package/src/components/List/List.tsx +6 -6
- package/src/components/List/types.ts +2 -2
- package/src/components/MoreMenu/MoreMenu.stories.tsx +46 -46
- package/src/components/MultiSelectList/MultiSelectList.styles.ts +4 -0
- package/src/components/MultiSelectList/MultiSelectList.tsx +1 -3
- package/src/components/NumberInput/index.ts +1 -1
- package/src/components/PhoneInput/types.ts +16 -16
- package/src/components/ScrollIntoViewIfNeeded/index.ts +1 -1
- package/src/components/Select/constants.ts +2 -2
- package/src/components/Select/types.ts +1 -1
- package/src/components/Skeleton/Skeleton.stories.tsx +19 -0
- package/src/components/Skeleton/Skeleton.styles.ts +46 -0
- package/src/components/Skeleton/Skeleton.tsx +12 -0
- package/src/components/Skeleton/index.ts +2 -0
- package/src/components/Switch/Switch.tsx +2 -2
- package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +58 -58
- package/src/components/ThemedPreloader/components/DefaultPreloader/index.ts +1 -1
- package/src/components/Tooltip/types.ts +1 -1
- package/src/components/index.ts +1 -0
- package/src/helpers/phone.ts +1 -1
- package/src/helpers/popper-helpers.ts +17 -17
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-is-mounted.ts +15 -15
- package/src/hooks/use-merged-refs.ts +4 -0
- package/src/theme/types.ts +2 -0
- package/src/vite-env.d.ts +1 -1
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { ComponentStory } from '@storybook/react';
|
|
2
|
-
import { colors } from '../../theme';
|
|
3
|
-
import { MoreMenu } from './MoreMenu';
|
|
4
|
-
|
|
5
|
-
const menuItems = [
|
|
6
|
-
{ item: 'Печатать билет', onClick: console.log },
|
|
7
|
-
{ item: 'Выписать', onClick: console.log },
|
|
8
|
-
{ item: 'Аннулировать', onClick: console.log, shouldDrawSpacerBelow: true },
|
|
9
|
-
{
|
|
10
|
-
item: (() => <div style={{ color: colors.RED_ACTIVE }}>Удалить</div>)(),
|
|
11
|
-
onClick: console.log,
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
item: (() => <div style={{ color: colors.RED_ACTIVE }}>Удалить</div>)(),
|
|
15
|
-
onClick: console.log,
|
|
16
|
-
},
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
title: 'MoreMenu',
|
|
21
|
-
component: MoreMenu,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const Template: ComponentStory<typeof MoreMenu> = (args) => (
|
|
25
|
-
<div
|
|
26
|
-
style={{
|
|
27
|
-
display: 'flex',
|
|
28
|
-
alignItems: 'center',
|
|
29
|
-
justifyContent: 'center',
|
|
30
|
-
width: 600,
|
|
31
|
-
height: 400,
|
|
32
|
-
}}
|
|
33
|
-
>
|
|
34
|
-
<div style={{ display: 'flex', gap: 10, alignItems: 'center' }}>
|
|
35
|
-
<div style={{ flexShrink: 0 }}>Test subject</div>
|
|
36
|
-
<MoreMenu {...args} items={menuItems} />
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
export const Default = Template.bind({});
|
|
42
|
-
|
|
43
|
-
Default.args = {
|
|
44
|
-
isDisabled: false,
|
|
45
|
-
hasDefaultStateBackground: true,
|
|
46
|
-
};
|
|
1
|
+
import { ComponentStory } from '@storybook/react';
|
|
2
|
+
import { colors } from '../../theme';
|
|
3
|
+
import { MoreMenu } from './MoreMenu';
|
|
4
|
+
|
|
5
|
+
const menuItems = [
|
|
6
|
+
{ item: 'Печатать билет', onClick: console.log },
|
|
7
|
+
{ item: 'Выписать', onClick: console.log },
|
|
8
|
+
{ item: 'Аннулировать', onClick: console.log, shouldDrawSpacerBelow: true },
|
|
9
|
+
{
|
|
10
|
+
item: (() => <div style={{ color: colors.RED_ACTIVE }}>Удалить</div>)(),
|
|
11
|
+
onClick: console.log,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
item: (() => <div style={{ color: colors.RED_ACTIVE }}>Удалить</div>)(),
|
|
15
|
+
onClick: console.log,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
title: 'MoreMenu',
|
|
21
|
+
component: MoreMenu,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const Template: ComponentStory<typeof MoreMenu> = (args) => (
|
|
25
|
+
<div
|
|
26
|
+
style={{
|
|
27
|
+
display: 'flex',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
width: 600,
|
|
31
|
+
height: 400,
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<div style={{ display: 'flex', gap: 10, alignItems: 'center' }}>
|
|
35
|
+
<div style={{ flexShrink: 0 }}>Test subject</div>
|
|
36
|
+
<MoreMenu {...args} items={menuItems} />
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export const Default = Template.bind({});
|
|
42
|
+
|
|
43
|
+
Default.args = {
|
|
44
|
+
isDisabled: false,
|
|
45
|
+
hasDefaultStateBackground: true,
|
|
46
|
+
};
|
|
@@ -8,6 +8,7 @@ const TOP_GAP = 12;
|
|
|
8
8
|
|
|
9
9
|
export const useStyles = createThemedStyles('MultiSelectList', {
|
|
10
10
|
root: {
|
|
11
|
+
width: 220,
|
|
11
12
|
background: colors.CLASSIC_WHITE,
|
|
12
13
|
},
|
|
13
14
|
|
|
@@ -101,10 +102,13 @@ export const searchInputStyles: ISearchInputStyles = {
|
|
|
101
102
|
export const checkboxStyles: ICheckboxStyles = {
|
|
102
103
|
root: {
|
|
103
104
|
padding: [11, 16],
|
|
105
|
+
boxSizing: 'border-box',
|
|
106
|
+
width: '100%',
|
|
104
107
|
},
|
|
105
108
|
|
|
106
109
|
children: {
|
|
107
110
|
marginRight: 'auto',
|
|
111
|
+
overflow: 'hidden',
|
|
108
112
|
},
|
|
109
113
|
};
|
|
110
114
|
|
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
export interface IMultiSelectListProps<Value, Option> extends ICommonProps<IMultiSelectListStyles> {
|
|
23
23
|
value?: Value;
|
|
24
24
|
isSearchEnabled?: boolean;
|
|
25
|
-
width?: number | string;
|
|
26
25
|
localeKey?: IMultiSelectLocaleKey;
|
|
27
26
|
locale?: Partial<IMultiSelectLocale>;
|
|
28
27
|
onClose?: () => void;
|
|
@@ -43,7 +42,6 @@ export function MultiSelectList<Value extends IMultiSelectListValues<Option>, Op
|
|
|
43
42
|
tweakStyles,
|
|
44
43
|
data,
|
|
45
44
|
isSearchEnabled = false,
|
|
46
|
-
width = 220,
|
|
47
45
|
localeKey = DEFAULT_LOCALE,
|
|
48
46
|
locale = MultiSelectLocales[localeKey],
|
|
49
47
|
onChange,
|
|
@@ -329,7 +327,7 @@ export function MultiSelectList<Value extends IMultiSelectListValues<Option>, Op
|
|
|
329
327
|
const shouldShowOptionsList = !isLoading && allOptions.length !== 0;
|
|
330
328
|
|
|
331
329
|
return (
|
|
332
|
-
<div className={classes.root}
|
|
330
|
+
<div className={classes.root} {...addDataAttributes(data)}>
|
|
333
331
|
{isSearchEnabled && (
|
|
334
332
|
<div className={classes.dropdownInput}>
|
|
335
333
|
<SearchInput
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './NumberInput';
|
|
1
|
+
export * from './NumberInput';
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export interface IPhoneInfo {
|
|
2
|
-
countryEn: string;
|
|
3
|
-
countryRu: string;
|
|
4
|
-
countryCode: string;
|
|
5
|
-
dialCode: string;
|
|
6
|
-
phoneMask?: string;
|
|
7
|
-
dialCodePriority?: number;
|
|
8
|
-
areaCodes?: string[];
|
|
9
|
-
fullCodes: string[];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface IPhoneValue {
|
|
13
|
-
phoneNumber?: string;
|
|
14
|
-
dialCode?: string;
|
|
15
|
-
countryCode?: string;
|
|
16
|
-
}
|
|
1
|
+
export interface IPhoneInfo {
|
|
2
|
+
countryEn: string;
|
|
3
|
+
countryRu: string;
|
|
4
|
+
countryCode: string;
|
|
5
|
+
dialCode: string;
|
|
6
|
+
phoneMask?: string;
|
|
7
|
+
dialCodePriority?: number;
|
|
8
|
+
areaCodes?: string[];
|
|
9
|
+
fullCodes: string[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IPhoneValue {
|
|
13
|
+
phoneNumber?: string;
|
|
14
|
+
dialCode?: string;
|
|
15
|
+
countryCode?: string;
|
|
16
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './ScrollIntoViewIfNeeded';
|
|
1
|
+
export * from './ScrollIntoViewIfNeeded';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const DEFAULT_OPTION_INDEX = -2;
|
|
2
|
-
export const ALL_OPTION_INDEX = -1;
|
|
1
|
+
export const DEFAULT_OPTION_INDEX = -2;
|
|
2
|
+
export const ALL_OPTION_INDEX = -1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type IMultipleSelectValue<Value> = Array<NonNullable<Value>>;
|
|
1
|
+
export type IMultipleSelectValue<Value> = Array<NonNullable<Value>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentStory } from '@storybook/react';
|
|
2
|
+
import { Skeleton } from './Skeleton';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Skeleton',
|
|
6
|
+
component: Skeleton,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof Skeleton> = (args) => (
|
|
10
|
+
<div style={{ padding: 32, backgroundColor: '#fff', width: 200 }}>
|
|
11
|
+
<Skeleton {...args} />
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
export const Default = Template.bind({});
|
|
16
|
+
|
|
17
|
+
Default.args = {
|
|
18
|
+
height: '20px',
|
|
19
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { rgba } from '../../helpers';
|
|
2
|
+
import { colors, createThemedStyles, ITweakStyles } from '../../theme';
|
|
3
|
+
|
|
4
|
+
export const useStyles = createThemedStyles('Skeleton', {
|
|
5
|
+
root: {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
width: '100%',
|
|
8
|
+
height: '100%',
|
|
9
|
+
backgroundColor: rgba(colors.GREY_DISABLED, 0.8),
|
|
10
|
+
position: 'relative',
|
|
11
|
+
borderRadius: 4,
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
'-webkit-mask-image': '-webkit-radial-gradient(white, black)',
|
|
14
|
+
|
|
15
|
+
'&::after': {
|
|
16
|
+
content: '""',
|
|
17
|
+
animation: '$skeleton 1.6s linear 0.5s infinite',
|
|
18
|
+
background: `linear-gradient(90deg, transparent, ${rgba(
|
|
19
|
+
colors.GREY_BACKGROUND,
|
|
20
|
+
0.65,
|
|
21
|
+
)}, transparent)`,
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
transform: 'translateX(-100%)',
|
|
24
|
+
bottom: 0,
|
|
25
|
+
left: 0,
|
|
26
|
+
right: 0,
|
|
27
|
+
top: 0,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
'@keyframes skeleton': {
|
|
32
|
+
'0%': {
|
|
33
|
+
transform: 'translateX(-100%)',
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
'50%': {
|
|
37
|
+
transform: 'translateX(100%)',
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
'100%': {
|
|
41
|
+
transform: 'translateX(100%)',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export type ISkeletonStyles = ITweakStyles<typeof useStyles>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CSSProperties, FC } from 'react';
|
|
2
|
+
import { ICommonProps } from '../../types';
|
|
3
|
+
import { ISkeletonStyles, useStyles } from './Skeleton.styles';
|
|
4
|
+
|
|
5
|
+
export interface ISkeletonProps extends Pick<ICommonProps<ISkeletonStyles>, 'tweakStyles'> {
|
|
6
|
+
height?: CSSProperties['height'];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Skeleton: FC<ISkeletonProps> = ({ height, tweakStyles }) => {
|
|
10
|
+
const classes = useStyles({ theme: tweakStyles });
|
|
11
|
+
return <div className={classes.root} style={{ height }} />;
|
|
12
|
+
};
|
|
@@ -9,7 +9,7 @@ import { useStyles, ISwitchStyles } from './Switch.styles';
|
|
|
9
9
|
export interface ISwitchProps<V extends string> extends ICommonProps<ISwitchStyles> {
|
|
10
10
|
children?: ReactNode;
|
|
11
11
|
value: V;
|
|
12
|
-
isChecked: boolean;
|
|
12
|
+
isChecked: boolean | undefined;
|
|
13
13
|
isDisabled?: boolean;
|
|
14
14
|
isInvalid?: boolean;
|
|
15
15
|
/**
|
|
@@ -25,7 +25,7 @@ export interface ISwitchProps<V extends string> extends ICommonProps<ISwitchStyl
|
|
|
25
25
|
|
|
26
26
|
export const Switch = <V extends string>({
|
|
27
27
|
isDisabled,
|
|
28
|
-
isChecked,
|
|
28
|
+
isChecked = false,
|
|
29
29
|
isInvalid,
|
|
30
30
|
value,
|
|
31
31
|
children,
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { ComponentStory } from '@storybook/react';
|
|
2
|
-
import { TextWithTooltip } from './TextWithTooltip';
|
|
3
|
-
|
|
4
|
-
const positions = [
|
|
5
|
-
'top',
|
|
6
|
-
'bottom',
|
|
7
|
-
'right',
|
|
8
|
-
'left',
|
|
9
|
-
'top-start',
|
|
10
|
-
'top-end',
|
|
11
|
-
'bottom-start',
|
|
12
|
-
'bottom-end',
|
|
13
|
-
'right-start',
|
|
14
|
-
'right-end',
|
|
15
|
-
'left-start',
|
|
16
|
-
'left-end',
|
|
17
|
-
'auto',
|
|
18
|
-
'auto-start',
|
|
19
|
-
'auto-end',
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
export default {
|
|
23
|
-
title: 'TextWithTooltip',
|
|
24
|
-
component: TextWithTooltip,
|
|
25
|
-
argTypes: {
|
|
26
|
-
tooltipPosition: { control: 'select', options: positions },
|
|
27
|
-
tooltipView: { control: 'inline-radio', options: ['tooltip', 'hint'] },
|
|
28
|
-
tooltipType: { control: 'inline-radio', options: ['info', 'error'] },
|
|
29
|
-
mouseEventType: { control: 'inline-radio', options: ['hover', 'click'] },
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const Template: ComponentStory<typeof TextWithTooltip> = (args) => (
|
|
34
|
-
<div
|
|
35
|
-
style={{
|
|
36
|
-
display: 'flex',
|
|
37
|
-
alignItems: 'center',
|
|
38
|
-
justifyContent: 'center',
|
|
39
|
-
width: 600,
|
|
40
|
-
height: 400,
|
|
41
|
-
}}
|
|
42
|
-
>
|
|
43
|
-
<TextWithTooltip {...args} />
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
export const Default = Template.bind({});
|
|
48
|
-
|
|
49
|
-
Default.args = {
|
|
50
|
-
children: 'Наведи на меня - появится тултип',
|
|
51
|
-
tooltipText: 'Текст тултипа',
|
|
52
|
-
tooltipPosition: 'top',
|
|
53
|
-
tooltipView: 'tooltip',
|
|
54
|
-
tooltipType: 'info',
|
|
55
|
-
isDisabled: false,
|
|
56
|
-
mouseEventType: 'hover',
|
|
57
|
-
shouldRenderInBody: true,
|
|
58
|
-
};
|
|
1
|
+
import { ComponentStory } from '@storybook/react';
|
|
2
|
+
import { TextWithTooltip } from './TextWithTooltip';
|
|
3
|
+
|
|
4
|
+
const positions = [
|
|
5
|
+
'top',
|
|
6
|
+
'bottom',
|
|
7
|
+
'right',
|
|
8
|
+
'left',
|
|
9
|
+
'top-start',
|
|
10
|
+
'top-end',
|
|
11
|
+
'bottom-start',
|
|
12
|
+
'bottom-end',
|
|
13
|
+
'right-start',
|
|
14
|
+
'right-end',
|
|
15
|
+
'left-start',
|
|
16
|
+
'left-end',
|
|
17
|
+
'auto',
|
|
18
|
+
'auto-start',
|
|
19
|
+
'auto-end',
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
title: 'TextWithTooltip',
|
|
24
|
+
component: TextWithTooltip,
|
|
25
|
+
argTypes: {
|
|
26
|
+
tooltipPosition: { control: 'select', options: positions },
|
|
27
|
+
tooltipView: { control: 'inline-radio', options: ['tooltip', 'hint'] },
|
|
28
|
+
tooltipType: { control: 'inline-radio', options: ['info', 'error'] },
|
|
29
|
+
mouseEventType: { control: 'inline-radio', options: ['hover', 'click'] },
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const Template: ComponentStory<typeof TextWithTooltip> = (args) => (
|
|
34
|
+
<div
|
|
35
|
+
style={{
|
|
36
|
+
display: 'flex',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
justifyContent: 'center',
|
|
39
|
+
width: 600,
|
|
40
|
+
height: 400,
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
<TextWithTooltip {...args} />
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
export const Default = Template.bind({});
|
|
48
|
+
|
|
49
|
+
Default.args = {
|
|
50
|
+
children: 'Наведи на меня - появится тултип',
|
|
51
|
+
tooltipText: 'Текст тултипа',
|
|
52
|
+
tooltipPosition: 'top',
|
|
53
|
+
tooltipView: 'tooltip',
|
|
54
|
+
tooltipType: 'info',
|
|
55
|
+
isDisabled: false,
|
|
56
|
+
mouseEventType: 'hover',
|
|
57
|
+
shouldRenderInBody: true,
|
|
58
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './DefaultPreloader';
|
|
1
|
+
export * from './DefaultPreloader';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type ITooltipType = 'info' | 'warning';
|
|
1
|
+
export type ITooltipType = 'info' | 'warning';
|
package/src/components/index.ts
CHANGED
package/src/helpers/phone.ts
CHANGED
|
@@ -18,7 +18,7 @@ export const getCountryTextByLocale = (country: IPhoneInfo, locale: string): str
|
|
|
18
18
|
locale.toLowerCase() === 'ru' ? country.countryRu : country.countryEn;
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Мутирует countriesList!
|
|
22
22
|
*/
|
|
23
23
|
export const sortCountriesByLocale = (countriesList: IPhoneInfo[], locale: string): IPhoneInfo[] =>
|
|
24
24
|
countriesList.sort((countryA, countryB) =>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Modifier } from 'react-overlays/usePopper';
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
-
export const minWidthModifier: Partial<Modifier<any, any>> = {
|
|
5
|
-
name: 'minWidth',
|
|
6
|
-
enabled: true,
|
|
7
|
-
phase: 'beforeWrite',
|
|
8
|
-
requires: ['computeStyles'],
|
|
9
|
-
fn: ({ state }) => {
|
|
10
|
-
state.styles.popper.minWidth = `${state.rects.reference.width}px`;
|
|
11
|
-
},
|
|
12
|
-
effect: ({ state }) => {
|
|
13
|
-
state.elements.popper.style.minWidth = `${
|
|
14
|
-
(state.elements.reference as HTMLElement).offsetWidth
|
|
15
|
-
}px`;
|
|
16
|
-
},
|
|
17
|
-
};
|
|
1
|
+
import { Modifier } from 'react-overlays/usePopper';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
+
export const minWidthModifier: Partial<Modifier<any, any>> = {
|
|
5
|
+
name: 'minWidth',
|
|
6
|
+
enabled: true,
|
|
7
|
+
phase: 'beforeWrite',
|
|
8
|
+
requires: ['computeStyles'],
|
|
9
|
+
fn: ({ state }) => {
|
|
10
|
+
state.styles.popper.minWidth = `${state.rects.reference.width}px`;
|
|
11
|
+
},
|
|
12
|
+
effect: ({ state }) => {
|
|
13
|
+
state.elements.popper.style.minWidth = `${
|
|
14
|
+
(state.elements.reference as HTMLElement).offsetWidth
|
|
15
|
+
}px`;
|
|
16
|
+
},
|
|
17
|
+
};
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
-
|
|
3
|
-
export const useIsMounted = (): (() => boolean) => {
|
|
4
|
-
const isMounted = useRef(false);
|
|
5
|
-
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
isMounted.current = true;
|
|
8
|
-
|
|
9
|
-
return () => {
|
|
10
|
-
isMounted.current = false;
|
|
11
|
-
};
|
|
12
|
-
}, []);
|
|
13
|
-
|
|
14
|
-
return useCallback(() => isMounted.current, []);
|
|
15
|
-
};
|
|
1
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
export const useIsMounted = (): (() => boolean) => {
|
|
4
|
+
const isMounted = useRef(false);
|
|
5
|
+
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
isMounted.current = true;
|
|
8
|
+
|
|
9
|
+
return () => {
|
|
10
|
+
isMounted.current = false;
|
|
11
|
+
};
|
|
12
|
+
}, []);
|
|
13
|
+
|
|
14
|
+
return useCallback(() => isMounted.current, []);
|
|
15
|
+
};
|
package/src/theme/types.ts
CHANGED
|
@@ -52,6 +52,7 @@ import type {
|
|
|
52
52
|
IFlexibleTableCellStyles,
|
|
53
53
|
IFlexibleTableRowStyles,
|
|
54
54
|
IFilterValueViewStyles,
|
|
55
|
+
ISkeletonStyles,
|
|
55
56
|
} from '../components';
|
|
56
57
|
|
|
57
58
|
export type IStyles<C extends string, P> = Styles<C, P, Partial<Styles<C, P>>>;
|
|
@@ -108,6 +109,7 @@ export interface IComponentStyles {
|
|
|
108
109
|
SearchInput: ISearchInputStyles;
|
|
109
110
|
Select: ISelectStyles;
|
|
110
111
|
SelectList: ISelectListStyles;
|
|
112
|
+
Skeleton: ISkeletonStyles;
|
|
111
113
|
Switch: ISwitchStyles;
|
|
112
114
|
TextArea: ITextAreaStyles;
|
|
113
115
|
TextWithInfo: ITextWithInfoStyles;
|
package/src/vite-env.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
1
|
+
/// <reference types="vite/client" />
|