@true-engineering/true-react-common-ui-kit 4.0.0-alpha43 → 4.0.0-alpha45
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/Checkbox/index.d.ts +1 -0
- package/dist/components/ControlWrapper/ControlWrapper.d.ts +2 -2
- 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 +2 -0
- package/dist/components/RadioButton/index.d.ts +1 -0
- package/dist/components/index.d.ts +0 -1
- package/dist/helpers/misc.d.ts +1 -0
- package/dist/true-react-common-ui-kit.js +169 -259
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +169 -259
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +3 -6
- 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/index.ts +1 -0
- 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 +3 -0
- 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/Flag/Flag.stories.tsx +15 -20
- 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/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/components/PhoneInputCountryList/PhoneInputCountryList.stories.tsx +5 -11
- package/src/components/RadioButton/RadioButton.stories.tsx +27 -30
- package/src/components/RadioButton/index.ts +1 -0
- 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 +40 -45
- package/src/components/Select/Select.stories.tsx +40 -45
- package/src/components/Selector/Selector.stories.tsx +25 -27
- 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 +28 -29
- package/src/components/Switch/Switch.stories.tsx +19 -26
- package/src/components/TextArea/TextArea.stories.tsx +31 -34
- 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/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 +3 -0
- 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
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Meta } from '@storybook/react';
|
|
2
2
|
import { iconsMap } from '../Icon';
|
|
3
3
|
import { TextButton } from './TextButton';
|
|
4
4
|
import { TEXT_BUTTON_SIZES, TEXT_BUTTON_VIEWS } from './constants';
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
export default {
|
|
6
|
+
const meta: Meta<typeof TextButton> = {
|
|
9
7
|
title: 'Buttons/TextButton',
|
|
10
8
|
component: TextButton,
|
|
11
9
|
args: {
|
|
@@ -21,22 +19,14 @@ export default {
|
|
|
21
19
|
iconPosition: 'left',
|
|
22
20
|
preloaderType: 'dots',
|
|
23
21
|
},
|
|
24
|
-
|
|
25
22
|
argTypes: {
|
|
26
|
-
icon: { control: 'select', options:
|
|
23
|
+
icon: { control: 'select', options: [undefined, Object.keys(iconsMap)] },
|
|
27
24
|
size: { options: TEXT_BUTTON_SIZES, control: 'inline-radio' },
|
|
28
25
|
view: { options: TEXT_BUTTON_VIEWS, control: 'inline-radio' },
|
|
29
26
|
iconPosition: { control: 'inline-radio' },
|
|
30
27
|
preloaderType: { control: 'inline-radio' },
|
|
31
28
|
},
|
|
29
|
+
};
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
exclude: ['testId', 'tweakStyles', 'data', 'onClick'],
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
} as ComponentMeta<typeof TextButton>;
|
|
39
|
-
|
|
40
|
-
export const Default: ComponentStory<typeof TextButton> = (args) => (
|
|
41
|
-
<TextButton {...args} key={args.size} />
|
|
42
|
-
);
|
|
31
|
+
export default meta;
|
|
32
|
+
export const Default = {};
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { FC, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
3
3
|
import { ITextWithInfoProps, TextWithInfo } from './TextWithInfo';
|
|
4
4
|
|
|
5
|
-
interface
|
|
5
|
+
interface ITextWithInfoCustomProps extends ITextWithInfoProps {
|
|
6
6
|
infoTooltip: string;
|
|
7
7
|
link: string;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
infoTooltip,
|
|
12
|
-
link,
|
|
13
|
-
...args
|
|
14
|
-
}) => {
|
|
10
|
+
const Story: FC<ITextWithInfoCustomProps> = ({ infoTooltip, link, ...args }) => {
|
|
15
11
|
const [isSelected, setIsSelected] = useState(false);
|
|
16
12
|
|
|
17
13
|
return (
|
|
@@ -34,20 +30,16 @@ const TextWithInfoWithCustomProps: FC<ITextWithInfoWithCustomProps> = ({
|
|
|
34
30
|
);
|
|
35
31
|
};
|
|
36
32
|
|
|
37
|
-
|
|
33
|
+
const meta: Meta<typeof Story> = {
|
|
38
34
|
title: 'Data Display/TextWithInfo',
|
|
39
|
-
component:
|
|
35
|
+
component: Story,
|
|
36
|
+
args: {
|
|
37
|
+
text: 'Обычная перевозка',
|
|
38
|
+
textTooltip: 'Tултип для самой обычной перевозки',
|
|
39
|
+
infoTooltip: 'Читать подробную информацию',
|
|
40
|
+
link: 'https://ya.ru/',
|
|
41
|
+
},
|
|
40
42
|
};
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
export const Default = Template.bind({});
|
|
47
|
-
|
|
48
|
-
Default.args = {
|
|
49
|
-
text: 'Обычная перевозка',
|
|
50
|
-
textTooltip: 'Tултип для самой обычной перевозки',
|
|
51
|
-
infoTooltip: 'Читать подробную информацию',
|
|
52
|
-
link: 'https://ya.ru/',
|
|
53
|
-
};
|
|
44
|
+
export default meta;
|
|
45
|
+
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 { ITextWithTooltipProps, TextWithTooltip } from './TextWithTooltip';
|
|
3
4
|
|
|
4
5
|
const positions = [
|
|
5
6
|
'top',
|
|
@@ -19,18 +20,7 @@ const positions = [
|
|
|
19
20
|
'auto-end',
|
|
20
21
|
];
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
title: 'Data Display/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) => (
|
|
23
|
+
const Story: FC<ITextWithTooltipProps> = (args) => (
|
|
34
24
|
<div
|
|
35
25
|
style={{
|
|
36
26
|
display: 'flex',
|
|
@@ -44,15 +34,26 @@ const Template: ComponentStory<typeof TextWithTooltip> = (args) => (
|
|
|
44
34
|
</div>
|
|
45
35
|
);
|
|
46
36
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
37
|
+
const meta: Meta<typeof Story> = {
|
|
38
|
+
title: 'Data Display/TextWithTooltip',
|
|
39
|
+
component: Story,
|
|
40
|
+
args: {
|
|
41
|
+
children: 'Наведи на меня - появится тултип',
|
|
42
|
+
tooltipText: 'Текст тултипа',
|
|
43
|
+
tooltipPosition: 'top',
|
|
44
|
+
tooltipView: 'tooltip',
|
|
45
|
+
tooltipType: 'info',
|
|
46
|
+
isDisabled: false,
|
|
47
|
+
mouseEventType: 'hover',
|
|
48
|
+
shouldRenderInBody: true,
|
|
49
|
+
},
|
|
50
|
+
argTypes: {
|
|
51
|
+
tooltipPosition: { control: 'select', options: positions },
|
|
52
|
+
tooltipView: { control: 'inline-radio', options: ['tooltip', 'hint'] },
|
|
53
|
+
tooltipType: { control: 'inline-radio', options: ['info', 'error'] },
|
|
54
|
+
mouseEventType: { control: 'inline-radio', options: ['hover', 'click'] },
|
|
55
|
+
},
|
|
58
56
|
};
|
|
57
|
+
|
|
58
|
+
export default meta;
|
|
59
|
+
export const Default = {};
|
|
@@ -1,41 +1,30 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
3
3
|
import { colors } from '../../theme';
|
|
4
4
|
import { IThemedPreloaderProps, ThemedPreloader } from './ThemedPreloader';
|
|
5
5
|
|
|
6
|
-
interface
|
|
6
|
+
interface IThemedPreloaderCustomProps extends IThemedPreloaderProps {
|
|
7
7
|
currentColor: string;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
currentColor,
|
|
12
|
-
...args
|
|
13
|
-
}) => (
|
|
10
|
+
const Story: FC<IThemedPreloaderCustomProps> = ({ currentColor, ...args }) => (
|
|
14
11
|
<div style={{ color: currentColor }}>
|
|
15
12
|
<ThemedPreloader {...args} />
|
|
16
13
|
</div>
|
|
17
14
|
);
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
const meta: Meta<typeof Story> = {
|
|
20
17
|
title: 'Feedback/ThemedPreloader',
|
|
21
|
-
component:
|
|
18
|
+
component: Story,
|
|
19
|
+
args: {
|
|
20
|
+
type: 'dots',
|
|
21
|
+
useCurrentColor: false,
|
|
22
|
+
currentColor: colors.GREEN_FOCUS,
|
|
23
|
+
},
|
|
22
24
|
argTypes: {
|
|
23
25
|
type: { options: ['default', 'logo', 'dots'], control: 'inline-radio' },
|
|
24
26
|
},
|
|
25
27
|
};
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
export const Default = Template.bind({});
|
|
32
|
-
Default.args = {
|
|
33
|
-
type: 'dots',
|
|
34
|
-
useCurrentColor: false,
|
|
35
|
-
currentColor: colors.GREEN_FOCUS,
|
|
36
|
-
};
|
|
37
|
-
Default.parameters = {
|
|
38
|
-
controls: {
|
|
39
|
-
exclude: ['data'],
|
|
40
|
-
},
|
|
41
|
-
};
|
|
29
|
+
export default meta;
|
|
30
|
+
export const Default = {};
|
|
@@ -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
|
@@ -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';
|