@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,14 +1,15 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { FC, useState } from 'react';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
3
|
+
import { excludeStorybookParams } from '../../helpers';
|
|
3
4
|
import { Status } from '../Status';
|
|
4
|
-
import { Selector } from './Selector';
|
|
5
|
+
import { ISelectorProps, Selector } from './Selector';
|
|
5
6
|
import { ISelectorOption } from './types';
|
|
6
7
|
|
|
7
8
|
const options: Array<ISelectorOption<string>> = [
|
|
8
9
|
{
|
|
9
10
|
label: 'Label 1',
|
|
10
11
|
value: '1',
|
|
11
|
-
icon: '
|
|
12
|
+
icon: 'filter',
|
|
12
13
|
},
|
|
13
14
|
{
|
|
14
15
|
label: 'My label 2',
|
|
@@ -32,31 +33,28 @@ const options: Array<ISelectorOption<string>> = [
|
|
|
32
33
|
},
|
|
33
34
|
];
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
title: 'Controls/Selector',
|
|
37
|
-
component: Selector,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const Template: ComponentStory<typeof Selector> = (args) => {
|
|
36
|
+
const Story: FC<ISelectorProps<string>> = (args) => {
|
|
41
37
|
const [value, setValue] = useState(options[0].value);
|
|
42
|
-
return <Selector {...args} value={value} options={options} onChange={setValue} />;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const Default = Template.bind({});
|
|
46
|
-
|
|
47
|
-
Default.args = {
|
|
48
|
-
size: 'l',
|
|
49
|
-
iconPosition: 'left',
|
|
50
|
-
hasSameOptionsWidth: true,
|
|
51
|
-
isDisabled: false,
|
|
52
|
-
isInvalid: false,
|
|
53
|
-
isRequired: false,
|
|
38
|
+
return <Selector<string> {...args} value={value} options={options} onChange={setValue} />;
|
|
54
39
|
};
|
|
55
40
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
const meta: Meta<typeof Story> = {
|
|
42
|
+
title: 'Controls/Selector',
|
|
43
|
+
component: Story,
|
|
44
|
+
args: {
|
|
45
|
+
size: 'l',
|
|
46
|
+
iconPosition: 'left',
|
|
47
|
+
hasSameOptionsWidth: true,
|
|
48
|
+
isDisabled: false,
|
|
49
|
+
isInvalid: false,
|
|
50
|
+
isRequired: false,
|
|
51
|
+
},
|
|
52
|
+
parameters: {
|
|
53
|
+
controls: {
|
|
54
|
+
exclude: excludeStorybookParams(['options', 'value']),
|
|
55
|
+
},
|
|
61
56
|
},
|
|
62
57
|
};
|
|
58
|
+
|
|
59
|
+
export default meta;
|
|
60
|
+
export const Default = {};
|
|
@@ -11,7 +11,7 @@ import { addDataAttributes } from '../../helpers';
|
|
|
11
11
|
import { ICommonProps } from '../../types';
|
|
12
12
|
import { renderIcon } from '../Icon';
|
|
13
13
|
import { ISelectorOption, ISelectorValue } from './types';
|
|
14
|
-
import { getSelectorLineStyle,
|
|
14
|
+
import { getSelectorLineStyle, ISelectorStyles, useStyles } from './Selector.styles';
|
|
15
15
|
|
|
16
16
|
export interface ISelectorProps<V extends ISelectorValue> extends ICommonProps<ISelectorStyles> {
|
|
17
17
|
options: Array<ISelectorOption<V>>;
|
|
@@ -52,7 +52,6 @@ export function Selector<V extends ISelectorValue>({
|
|
|
52
52
|
const listRef = useRef<HTMLDivElement>(null);
|
|
53
53
|
|
|
54
54
|
if (hasDuplicates(optionsValues)) {
|
|
55
|
-
// eslint-disable-next-line no-console
|
|
56
55
|
console.error('Selector: Значения options.value должны быть уникальными');
|
|
57
56
|
}
|
|
58
57
|
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
3
|
+
import { ISkeletonProps, Skeleton } from './Skeleton';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
title: 'Feedback/Skeleton',
|
|
6
|
-
component: Skeleton,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const Template: ComponentStory<typeof Skeleton> = (args) => (
|
|
5
|
+
const Story: FC<ISkeletonProps> = (args) => (
|
|
10
6
|
<div style={{ padding: 32, backgroundColor: '#fff', width: 200 }}>
|
|
11
7
|
<Skeleton {...args} />
|
|
12
8
|
</div>
|
|
13
9
|
);
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
const meta: Meta<typeof Story> = {
|
|
12
|
+
title: 'Feedback/Skeleton',
|
|
13
|
+
component: Story,
|
|
14
|
+
args: {
|
|
15
|
+
height: '20px',
|
|
16
|
+
},
|
|
19
17
|
};
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
export const Default = {};
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { FC, useState } from 'react';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
3
3
|
import { IInputProps } from '../Input';
|
|
4
|
-
import { SmartInput } from './SmartInput';
|
|
4
|
+
import { ISmartInputProps, SmartInput } from './SmartInput';
|
|
5
5
|
import { ISmartType } from './types';
|
|
6
6
|
|
|
7
7
|
const types: Array<IInputProps['type']> = ['text', 'password', 'email', 'number'];
|
|
8
8
|
const smartTypes: ISmartType[] = ['default', 'agencyName', 'surname', 'name', 'email'];
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
title: 'Inputs/SmartInput',
|
|
12
|
-
component: SmartInput,
|
|
13
|
-
argTypes: {
|
|
14
|
-
type: { control: 'inline-radio', options: types },
|
|
15
|
-
smartType: { control: 'inline-radio', options: smartTypes },
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const Template: ComponentStory<typeof SmartInput> = (args) => {
|
|
10
|
+
const Story: FC<ISmartInputProps> = (args) => {
|
|
20
11
|
const [value, setValue] = useState('');
|
|
21
12
|
|
|
22
13
|
return (
|
|
@@ -38,14 +29,23 @@ const Template: ComponentStory<typeof SmartInput> = (args) => {
|
|
|
38
29
|
);
|
|
39
30
|
};
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
32
|
+
const meta: Meta<typeof Story> = {
|
|
33
|
+
title: 'Inputs/SmartInput',
|
|
34
|
+
component: Story,
|
|
35
|
+
args: {
|
|
36
|
+
label: 'Label',
|
|
37
|
+
placeholder: 'Placeholder',
|
|
38
|
+
type: 'text',
|
|
39
|
+
smartType: 'default',
|
|
40
|
+
isUpperCase: false,
|
|
41
|
+
isDisabled: false,
|
|
42
|
+
isTransliterationEnabled: true,
|
|
43
|
+
},
|
|
44
|
+
argTypes: {
|
|
45
|
+
type: { control: 'inline-radio', options: types },
|
|
46
|
+
smartType: { control: 'inline-radio', options: smartTypes },
|
|
47
|
+
},
|
|
51
48
|
};
|
|
49
|
+
|
|
50
|
+
export default meta;
|
|
51
|
+
export const Default = {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
3
|
+
import { excludeStorybookParams, rgba } from '../../helpers';
|
|
3
4
|
import { IExtendableProps } from '../../types';
|
|
4
5
|
import { iconsMap } from '../Icon';
|
|
5
|
-
import { Status } from './Status';
|
|
6
|
+
import { IStatusProps, Status } from './Status';
|
|
6
7
|
import { STATUS_SIZES } from './constants';
|
|
7
8
|
import { IStatusStyles } from './Status.styles';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
const STATUS_COLORS = [
|
|
10
11
|
'green',
|
|
11
12
|
'teal',
|
|
12
13
|
'blue',
|
|
@@ -17,18 +18,11 @@ export const STATUS_COLORS = [
|
|
|
17
18
|
'custom',
|
|
18
19
|
] as const;
|
|
19
20
|
|
|
20
|
-
export default {
|
|
21
|
-
title: 'Data Display/Status',
|
|
22
|
-
component: Status,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
21
|
declare module './types' {
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
27
23
|
export interface IStatusColors extends IExtendableProps<typeof STATUS_COLORS> {}
|
|
28
24
|
}
|
|
29
25
|
|
|
30
|
-
const icons = [undefined, ...Object.keys(iconsMap)];
|
|
31
|
-
|
|
32
26
|
const customTweakStyles: IStatusStyles = {
|
|
33
27
|
green: {
|
|
34
28
|
'--status-background': rgba('#D4E3AC', 0.5),
|
|
@@ -71,7 +65,7 @@ const customTweakStyles: IStatusStyles = {
|
|
|
71
65
|
},
|
|
72
66
|
};
|
|
73
67
|
|
|
74
|
-
const
|
|
68
|
+
const Story: FC<IStatusProps> = (args) => (
|
|
75
69
|
<div
|
|
76
70
|
style={{
|
|
77
71
|
display: 'grid',
|
|
@@ -100,22 +94,27 @@ const Template: ComponentStory<typeof Status> = (args) => (
|
|
|
100
94
|
</div>
|
|
101
95
|
);
|
|
102
96
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
97
|
+
const meta: Meta<typeof Story> = {
|
|
98
|
+
title: 'Data Display/Status',
|
|
99
|
+
component: Story,
|
|
100
|
+
args: {
|
|
101
|
+
children: 'Status',
|
|
102
|
+
badge: '+ Badge',
|
|
103
|
+
icon: 'information',
|
|
104
|
+
iconPosition: 'left',
|
|
105
|
+
color: 'blue',
|
|
106
|
+
size: 's',
|
|
107
|
+
},
|
|
108
|
+
argTypes: {
|
|
109
|
+
icon: { options: [undefined, ...Object.keys(iconsMap)], control: 'select' },
|
|
110
|
+
iconPosition: { options: ['left', 'right'], control: 'inline-radio' },
|
|
111
|
+
},
|
|
112
|
+
parameters: {
|
|
113
|
+
controls: {
|
|
114
|
+
exclude: excludeStorybookParams(['color', 'size']),
|
|
115
|
+
},
|
|
120
116
|
},
|
|
121
117
|
};
|
|
118
|
+
|
|
119
|
+
export default meta;
|
|
120
|
+
export const Default = {};
|
|
@@ -3,7 +3,7 @@ import type { STATUS_SIZES } from './constants';
|
|
|
3
3
|
|
|
4
4
|
export type IStatusSize = (typeof STATUS_SIZES)[number];
|
|
5
5
|
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
7
7
|
export interface IStatusColors extends IDefaultExtendableProps {}
|
|
8
8
|
|
|
9
9
|
export type IStatusColor = keyof IStatusColors;
|
|
@@ -1,19 +1,9 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Switch } from './Switch';
|
|
1
|
+
import { FC, useState } from 'react';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
3
|
+
import { ISwitchProps, Switch } from './Switch';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
title: 'Controls/Switch',
|
|
7
|
-
component: Switch,
|
|
8
|
-
argTypes: {
|
|
9
|
-
labelPosition: { control: 'inline-radio', options: ['left', 'right'] },
|
|
10
|
-
color: { control: 'inline-radio', options: ['primary', 'secondary'] },
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const Template: ComponentStory<typeof Switch> = (args) => {
|
|
5
|
+
const Story: FC<ISwitchProps<string>> = (args) => {
|
|
15
6
|
const [isChecked, setIsChecked] = useState(true);
|
|
16
|
-
|
|
17
7
|
return (
|
|
18
8
|
<Switch
|
|
19
9
|
{...args}
|
|
@@ -24,17 +14,20 @@ const Template: ComponentStory<typeof Switch> = (args) => {
|
|
|
24
14
|
);
|
|
25
15
|
};
|
|
26
16
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
const meta: Meta<typeof Story> = {
|
|
18
|
+
title: 'Controls/Switch',
|
|
19
|
+
component: Story,
|
|
20
|
+
args: {
|
|
21
|
+
children: 'Label',
|
|
22
|
+
labelPosition: 'right',
|
|
23
|
+
isDisabled: false,
|
|
24
|
+
color: 'primary',
|
|
25
|
+
},
|
|
26
|
+
argTypes: {
|
|
27
|
+
labelPosition: { control: 'inline-radio', options: ['left', 'right'] },
|
|
28
|
+
color: { control: 'inline-radio', options: ['primary', 'secondary'] },
|
|
39
29
|
},
|
|
40
30
|
};
|
|
31
|
+
|
|
32
|
+
export default meta;
|
|
33
|
+
export const Default = {};
|
|
@@ -1,49 +1,46 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { FC, useState } from 'react';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
3
3
|
import { IExtendableProps } from '../../types';
|
|
4
|
-
import { TextArea } from './TextArea';
|
|
4
|
+
import { ITextAreaProps, TextArea } from './TextArea';
|
|
5
5
|
|
|
6
6
|
const COUNTER_POSITIONS = ['default', 'top'] as const;
|
|
7
7
|
|
|
8
|
-
export default {
|
|
9
|
-
title: 'Inputs/TextArea',
|
|
10
|
-
component: TextArea,
|
|
11
|
-
argTypes: {
|
|
12
|
-
maxLength: {
|
|
13
|
-
control: { type: 'range', min: 10, max: 500, step: 10 },
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
8
|
declare module './types' {
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
20
10
|
export interface ITextAreaCounterPositions extends IExtendableProps<typeof COUNTER_POSITIONS> {}
|
|
21
11
|
}
|
|
22
12
|
|
|
23
|
-
const
|
|
13
|
+
const Story: FC<ITextAreaProps> = (args) => {
|
|
24
14
|
const [value, setValue] = useState('');
|
|
25
15
|
return <TextArea {...args} value={value} onChange={setValue} />;
|
|
26
16
|
};
|
|
27
17
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
18
|
+
const meta: Meta<typeof Story> = {
|
|
19
|
+
title: 'Inputs/TextArea',
|
|
20
|
+
component: Story,
|
|
21
|
+
args: {
|
|
22
|
+
label: 'Label',
|
|
23
|
+
placeholder: 'Placeholder',
|
|
24
|
+
infoMessage: 'Message Info',
|
|
25
|
+
rows: 5,
|
|
26
|
+
maxLength: 500,
|
|
27
|
+
isInvalid: false,
|
|
28
|
+
counterPosition: 'default',
|
|
29
|
+
errorMessage: 'Error Text',
|
|
30
|
+
isActive: false,
|
|
31
|
+
isDisabled: false,
|
|
32
|
+
isRequired: false,
|
|
33
|
+
isAutoSized: true,
|
|
34
|
+
shouldAlwaysShowPlaceholder: false,
|
|
35
|
+
size: undefined,
|
|
36
|
+
},
|
|
37
|
+
argTypes: {
|
|
38
|
+
counterPosition: { options: [undefined, ...COUNTER_POSITIONS], control: 'select' },
|
|
39
|
+
maxLength: {
|
|
40
|
+
control: { type: 'range', min: 10, max: 500, step: 10 },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
45
43
|
};
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
45
|
+
export default meta;
|
|
46
|
+
export const Default = {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IExtendableProps } from '../../types';
|
|
2
2
|
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
4
4
|
export interface ITextAreaCounterPositions extends IExtendableProps<'default'> {}
|
|
5
5
|
|
|
6
6
|
export type ITextAreaCounterPosition = keyof ITextAreaCounterPositions;
|
|
@@ -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 = {};
|
|
@@ -7,7 +7,7 @@ import { addDataAttributes } from '../../helpers';
|
|
|
7
7
|
import { useOnClickOutsideWithRef, useTweakStyles } from '../../hooks';
|
|
8
8
|
import { ICommonProps } from '../../types';
|
|
9
9
|
import { ITooltipProps, Tooltip } from '../Tooltip';
|
|
10
|
-
import {
|
|
10
|
+
import { ITextWithTooltipStyles, useStyles } from './TextWithTooltip.styles';
|
|
11
11
|
|
|
12
12
|
export interface ITextWithTooltipProps extends ICommonProps<ITextWithTooltipStyles> {
|
|
13
13
|
children: ReactNode;
|
|
@@ -18,7 +18,6 @@ export interface ITextWithTooltipProps extends ICommonProps<ITextWithTooltipStyl
|
|
|
18
18
|
tooltipType?: ITooltipProps['type'];
|
|
19
19
|
/** @default 'top' */
|
|
20
20
|
tooltipPosition?: Placement;
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
21
|
/** @default [] */
|
|
23
22
|
tooltipModifiers?: Array<Partial<Modifier<any, any>>>;
|
|
24
23
|
tooltipOffsetOptions?: Record<string, unknown>;
|
|
@@ -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 = {};
|