@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,7 +1,7 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
1
|
+
import { FC, useState } from 'react';
|
|
2
2
|
import { ru } from 'date-fns/locale';
|
|
3
|
-
import {
|
|
4
|
-
import { DatePicker } from './DatePicker';
|
|
3
|
+
import { type Meta } from '@storybook/react';
|
|
4
|
+
import { DatePicker, IDatePickerProps } from './DatePicker';
|
|
5
5
|
|
|
6
6
|
const months = [
|
|
7
7
|
'Январь',
|
|
@@ -18,19 +18,9 @@ const months = [
|
|
|
18
18
|
'Декабрь',
|
|
19
19
|
];
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
title: 'Inputs/DatePicker',
|
|
23
|
-
component: DatePicker,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const Template: ComponentStory<typeof DatePicker> = (args) => {
|
|
21
|
+
const Story: FC<IDatePickerProps> = (args) => {
|
|
27
22
|
const [date, setDate] = useState<Date | null>(null);
|
|
28
23
|
|
|
29
|
-
const [startDate, setStartDate] = useState<Date | null>(
|
|
30
|
-
args.startDate ? new Date(args.startDate) : null,
|
|
31
|
-
);
|
|
32
|
-
const [endDate, setEndDate] = useState<Date | null>(args.endDate ? new Date(args.endDate) : null);
|
|
33
|
-
|
|
34
24
|
return (
|
|
35
25
|
<div
|
|
36
26
|
style={{
|
|
@@ -50,52 +40,25 @@ const Template: ComponentStory<typeof DatePicker> = (args) => {
|
|
|
50
40
|
testId="datepicker"
|
|
51
41
|
months={months}
|
|
52
42
|
selectedDate={date}
|
|
53
|
-
startDate={startDate}
|
|
54
|
-
endDate={endDate}
|
|
55
43
|
minDate={new Date()}
|
|
56
44
|
onChangeDate={setDate}
|
|
57
|
-
onChangeRange={(dates) => {
|
|
58
|
-
setStartDate(dates?.[0] ?? null);
|
|
59
|
-
setEndDate(dates?.[1] ?? null);
|
|
60
|
-
}}
|
|
61
45
|
/>
|
|
62
46
|
</div>
|
|
63
47
|
</div>
|
|
64
48
|
);
|
|
65
49
|
};
|
|
66
50
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Default.argTypes = {
|
|
78
|
-
popperPlacement: {
|
|
79
|
-
options: [
|
|
80
|
-
'bottom-start',
|
|
81
|
-
'bottom',
|
|
82
|
-
'bottom-end',
|
|
83
|
-
'top-start',
|
|
84
|
-
'top',
|
|
85
|
-
'top-end',
|
|
86
|
-
'right-start',
|
|
87
|
-
'right',
|
|
88
|
-
'right-end',
|
|
89
|
-
'left-start',
|
|
90
|
-
'left',
|
|
91
|
-
'left-end',
|
|
92
|
-
],
|
|
93
|
-
control: 'select',
|
|
51
|
+
const meta: Meta<typeof Story> = {
|
|
52
|
+
title: 'Inputs/DatePicker',
|
|
53
|
+
component: Story,
|
|
54
|
+
args: {
|
|
55
|
+
label: 'Дата',
|
|
56
|
+
isRange: false,
|
|
57
|
+
isClearable: true,
|
|
58
|
+
shouldRenderPopperInBody: false,
|
|
59
|
+
popperPlacement: 'bottom-start',
|
|
94
60
|
},
|
|
95
61
|
};
|
|
96
62
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
exclude: ['data', 'testId', 'tabIndex', 'onFocus', 'onBlur', 'onPaste', 'onKeyDown'],
|
|
100
|
-
},
|
|
101
|
-
};
|
|
63
|
+
export default meta;
|
|
64
|
+
export const Default = {};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Meta } from '@storybook/react';
|
|
2
2
|
import { Description } from './Description';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const meta: Meta<typeof Description> = {
|
|
5
5
|
title: 'Data Display/Description',
|
|
6
6
|
component: Description,
|
|
7
|
+
args: {
|
|
8
|
+
text: 'Lorem ipsum dolor, sit amet consectetur adipisicing. Alias necessitatibus quidem nobis molestiae dolor sed at, voluptatum nulla qui enim maiores consectetur dolorum atque odit id ratione pariatur ut nihil. http://google.com',
|
|
9
|
+
moreTitle: 'подробнее',
|
|
10
|
+
lessTitle: 'скрыть',
|
|
11
|
+
truncateIndex: 150,
|
|
12
|
+
isAlwaysOpen: false,
|
|
13
|
+
},
|
|
7
14
|
argTypes: {
|
|
8
15
|
truncateIndex: {
|
|
9
16
|
control: { type: 'range', min: 20, max: 600, step: 10 },
|
|
@@ -11,17 +18,5 @@ export default {
|
|
|
11
18
|
},
|
|
12
19
|
};
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const Template: ComponentStory<typeof Description> = (args) => <Description {...args} />;
|
|
18
|
-
|
|
19
|
-
export const Default = Template.bind({});
|
|
20
|
-
|
|
21
|
-
Default.args = {
|
|
22
|
-
text: lorem,
|
|
23
|
-
moreTitle: 'подробнее',
|
|
24
|
-
lessTitle: 'скрыть',
|
|
25
|
-
truncateIndex: 150,
|
|
26
|
-
isAlwaysOpen: false,
|
|
27
|
-
};
|
|
21
|
+
export default meta;
|
|
22
|
+
export const Default = {};
|
|
@@ -1,75 +1,71 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
1
2
|
import { format } from 'date-fns';
|
|
2
3
|
import { ru } from 'date-fns/locale';
|
|
3
|
-
import {
|
|
4
|
+
import { type Meta } from '@storybook/react';
|
|
4
5
|
import { mimeTypes } from '../../constants';
|
|
6
|
+
import { excludeStorybookParams } from '../../helpers';
|
|
5
7
|
import { FileItem } from '../FileItem';
|
|
6
|
-
import {
|
|
7
|
-
import { FileInput } from './FileInput';
|
|
8
|
+
import { FileInput, IFileInputProps } from './FileInput';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const Story: FC<IFileInputProps> = (args) => {
|
|
11
|
+
const handleAdd = (newFiles: File[]) =>
|
|
12
|
+
console.log(
|
|
13
|
+
'added:',
|
|
14
|
+
newFiles.map(({ name }) => name),
|
|
15
|
+
);
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
return (
|
|
18
|
+
<div style={{ width: 652 }}>
|
|
19
|
+
<FileInput
|
|
20
|
+
{...args}
|
|
21
|
+
tweakStyles={{
|
|
22
|
+
fileList: {
|
|
23
|
+
'& > div': {
|
|
24
|
+
width: '270px',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}}
|
|
28
|
+
text={
|
|
29
|
+
<div style={{ display: 'flex', alignItems: 'center' }}>Перетащите или выберите файл</div>
|
|
30
|
+
}
|
|
31
|
+
fileList={
|
|
32
|
+
<>
|
|
33
|
+
<FileItem
|
|
34
|
+
fileInfo={{ name: 'file1', type: mimeTypes.jpeg, size: 10000 }}
|
|
35
|
+
metadata={<span>Обновлен {format(new Date(), 'dd MMM, HH:mm', { locale: ru })}</span>}
|
|
36
|
+
/>
|
|
37
|
+
<FileItem
|
|
38
|
+
fileInfo={{ name: 'file 2', type: mimeTypes.xls }}
|
|
39
|
+
metadata={<span>Обновлен {format(new Date(), 'dd MMM, HH:mm', { locale: ru })}</span>}
|
|
40
|
+
isDisabled
|
|
41
|
+
/>
|
|
42
|
+
</>
|
|
43
|
+
}
|
|
44
|
+
onAdd={handleAdd}
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
28
47
|
);
|
|
48
|
+
};
|
|
29
49
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
onAdd: handleAdd,
|
|
47
|
-
tweakStyles: {
|
|
48
|
-
fileList: {
|
|
49
|
-
'& > div': {
|
|
50
|
-
width: '270px',
|
|
51
|
-
},
|
|
50
|
+
const meta: Meta<typeof Story> = {
|
|
51
|
+
title: 'Inputs/FileInput',
|
|
52
|
+
component: Story,
|
|
53
|
+
args: {
|
|
54
|
+
label: 'Скан документа',
|
|
55
|
+
isDragAndDropDisabled: false,
|
|
56
|
+
isRequired: true,
|
|
57
|
+
isReadOnly: false,
|
|
58
|
+
isMultipleDisabled: false,
|
|
59
|
+
isDisabled: false,
|
|
60
|
+
isActive: false,
|
|
61
|
+
description: 'Форматы файла: xlsx, xlsm. Размер — до 1 МБ',
|
|
62
|
+
},
|
|
63
|
+
parameters: {
|
|
64
|
+
controls: {
|
|
65
|
+
exclude: excludeStorybookParams(['text', 'fileList', 'accept']),
|
|
52
66
|
},
|
|
53
67
|
},
|
|
54
|
-
description,
|
|
55
|
-
text,
|
|
56
|
-
fileList: (
|
|
57
|
-
<>
|
|
58
|
-
<FileItem
|
|
59
|
-
fileInfo={{ name: 'file1', type: mimeTypes.jpeg, size: 10000 }}
|
|
60
|
-
metadata={<span>Обновлен {format(new Date(), 'dd MMM, HH:mm', { locale: ru })}</span>}
|
|
61
|
-
/>
|
|
62
|
-
<FileItem
|
|
63
|
-
fileInfo={{ name: 'file 2', type: mimeTypes.xls }}
|
|
64
|
-
metadata={<span>Обновлен {format(new Date(), 'dd MMM, HH:mm', { locale: ru })}</span>}
|
|
65
|
-
isDisabled
|
|
66
|
-
/>
|
|
67
|
-
</>
|
|
68
|
-
),
|
|
69
68
|
};
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
exclude: ['onAdd', 'tweakStyles'],
|
|
74
|
-
},
|
|
75
|
-
};
|
|
70
|
+
export default meta;
|
|
71
|
+
export const Default = {};
|
|
@@ -1,58 +1,59 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
1
2
|
import { format } from 'date-fns';
|
|
2
3
|
import { ru } from 'date-fns/locale';
|
|
3
|
-
import {
|
|
4
|
+
import { type Meta } from '@storybook/react';
|
|
5
|
+
import { excludeStorybookParams } from '../../helpers';
|
|
4
6
|
import { FILE_ITEM_SIZES } from '../FileItem/constants';
|
|
5
7
|
import { iconsMap } from '../Icon';
|
|
6
8
|
import { FileItem, IFileItemProps } from './FileItem';
|
|
7
9
|
|
|
8
|
-
export default {
|
|
9
|
-
title: 'Data Display/FileItem',
|
|
10
|
-
component: FileItem,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
10
|
const icons = [undefined, ...Object.keys(iconsMap)];
|
|
14
11
|
|
|
15
12
|
const preloaderTypes: Array<IFileItemProps['preloaderType']> = ['dots', 'default', 'logo'];
|
|
16
13
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
14
|
+
const Story: FC<IFileItemProps> = (args) => (
|
|
15
|
+
<FileItem
|
|
16
|
+
{...args}
|
|
17
|
+
metadata={
|
|
18
|
+
<span>Обновлен {format(new Date(1712298796990), 'dd MMM, HH:mm', { locale: ru })}</span>
|
|
19
|
+
}
|
|
20
|
+
fileInfo={{
|
|
21
|
+
name: 'Document_Filename.docx',
|
|
22
|
+
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
23
|
+
size: 1000000,
|
|
24
|
+
}}
|
|
25
|
+
onRemove={() => console.log('remove file')}
|
|
26
|
+
onClick={() => new Promise(() => console.log('download file'))}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const meta: Meta<typeof Story> = {
|
|
31
|
+
title: 'Data Display/FileItem',
|
|
32
|
+
component: Story,
|
|
33
|
+
args: {
|
|
34
|
+
icon: undefined,
|
|
35
|
+
error: 'Страшная ошибка',
|
|
36
|
+
itemSize: 'm',
|
|
37
|
+
preloaderType: 'default',
|
|
38
|
+
removeIcon: 'trash-can',
|
|
39
|
+
isDisabled: false,
|
|
40
|
+
areActionsDisabled: false,
|
|
41
|
+
isLoading: false,
|
|
42
|
+
shouldShowSize: true,
|
|
43
|
+
info: 'Нет, Вы это видели вообще?',
|
|
40
44
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
preloaderType: { options: preloaderTypes, control: 'inline-radio' },
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
Default.parameters = {
|
|
55
|
-
controls: {
|
|
56
|
-
exclude: ['data', 'testId', 'tweakStyles', 'onRemove', 'onClick'],
|
|
45
|
+
parameters: {
|
|
46
|
+
controls: {
|
|
47
|
+
exclude: excludeStorybookParams(['fileInfo', 'metadata']),
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
argTypes: {
|
|
51
|
+
icon: { options: icons, control: 'select' },
|
|
52
|
+
removeIcon: { options: icons, control: 'select' },
|
|
53
|
+
itemSize: { options: FILE_ITEM_SIZES, control: 'inline-radio' },
|
|
54
|
+
preloaderType: { options: preloaderTypes, control: 'inline-radio' },
|
|
57
55
|
},
|
|
58
56
|
};
|
|
57
|
+
|
|
58
|
+
export default meta;
|
|
59
|
+
export const Default = {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode, useState } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { FC, ReactNode, useState } from 'react';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
3
3
|
import { IMultiSelectListValues } from '../MultiSelectList';
|
|
4
4
|
import { FiltersPane, IFiltersPaneProps } from './FiltersPane';
|
|
5
5
|
import { FilterSelect } from './components';
|
|
@@ -8,11 +8,13 @@ import { ConfigType, IDatePeriod, IFiltersPaneSearchPayload, IPeriod } from './t
|
|
|
8
8
|
const LONG_STRING = 'or veeeeeeeeery looooooooooooooooooooooooooooooooooooooooong';
|
|
9
9
|
|
|
10
10
|
const convertVToString = (val: { v: string }): string => val.v;
|
|
11
|
+
|
|
11
12
|
const convertVToNode = (val: { v: string }): ReactNode => (
|
|
12
13
|
<b>
|
|
13
14
|
<i>{val.v}</i>
|
|
14
15
|
</b>
|
|
15
16
|
);
|
|
17
|
+
|
|
16
18
|
const fieldTranslates = {
|
|
17
19
|
interval: 'Interval',
|
|
18
20
|
name: 'Name',
|
|
@@ -57,8 +59,7 @@ const fetchOptionsMock = [
|
|
|
57
59
|
'or vee444ee',
|
|
58
60
|
];
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
type ConfigValues = {
|
|
62
|
+
interface ConfigValues extends Record<string, unknown> {
|
|
62
63
|
name: string;
|
|
63
64
|
date: IPeriod;
|
|
64
65
|
select: string;
|
|
@@ -68,9 +69,9 @@ type ConfigValues = {
|
|
|
68
69
|
isActive: boolean;
|
|
69
70
|
selectSearch: string;
|
|
70
71
|
custom: string;
|
|
71
|
-
}
|
|
72
|
+
}
|
|
72
73
|
|
|
73
|
-
interface
|
|
74
|
+
interface IFiltersPaneCustomProps<Values extends Record<string, unknown>, Content>
|
|
74
75
|
extends IFiltersPaneProps<Values, Content> {
|
|
75
76
|
containerWidth: number;
|
|
76
77
|
isSearchDisabled: boolean;
|
|
@@ -82,7 +83,7 @@ interface IFiltersPaneWithCustomProps<Values extends Record<string, unknown>, Co
|
|
|
82
83
|
isSearchAutoSized: boolean;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
|
|
86
|
+
const Story: FC<IFiltersPaneCustomProps<ConfigValues, unknown>> = ({
|
|
86
87
|
containerWidth,
|
|
87
88
|
isSearchDisabled,
|
|
88
89
|
shouldShowSettingsButton,
|
|
@@ -92,7 +93,7 @@ function FiltersPaneWithCustomProps<Values extends Record<string, unknown>, Cont
|
|
|
92
93
|
isClearableFields,
|
|
93
94
|
isSearchAutoSized,
|
|
94
95
|
...args
|
|
95
|
-
}
|
|
96
|
+
}) => {
|
|
96
97
|
const config: ConfigType<ConfigValues> = {
|
|
97
98
|
name: {
|
|
98
99
|
name: 'name',
|
|
@@ -264,11 +265,24 @@ function FiltersPaneWithCustomProps<Values extends Record<string, unknown>, Cont
|
|
|
264
265
|
/>
|
|
265
266
|
</div>
|
|
266
267
|
);
|
|
267
|
-
}
|
|
268
|
+
};
|
|
268
269
|
|
|
269
|
-
|
|
270
|
+
const meta: Meta<typeof Story> = {
|
|
270
271
|
title: 'Table/FiltersPane',
|
|
271
|
-
component:
|
|
272
|
+
component: Story,
|
|
273
|
+
args: {
|
|
274
|
+
shouldShowSettingsButton: false,
|
|
275
|
+
isSearchDisabled: false,
|
|
276
|
+
hasClearButton: true,
|
|
277
|
+
isClearableFields: false,
|
|
278
|
+
isDisabled: false,
|
|
279
|
+
shouldRenderDataId: false,
|
|
280
|
+
containerWidth: 400,
|
|
281
|
+
withFieldNameInLabel: true,
|
|
282
|
+
isGroupingEnabled: true,
|
|
283
|
+
checkboxPosition: 'left',
|
|
284
|
+
isSearchAutoSized: false,
|
|
285
|
+
},
|
|
272
286
|
argTypes: {
|
|
273
287
|
containerWidth: {
|
|
274
288
|
control: { type: 'range', min: 100, max: 1000, step: 100 },
|
|
@@ -280,22 +294,5 @@ export default {
|
|
|
280
294
|
},
|
|
281
295
|
};
|
|
282
296
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
);
|
|
286
|
-
|
|
287
|
-
export const Default = Template.bind({});
|
|
288
|
-
|
|
289
|
-
Default.args = {
|
|
290
|
-
shouldShowSettingsButton: false,
|
|
291
|
-
isSearchDisabled: false,
|
|
292
|
-
hasClearButton: true,
|
|
293
|
-
isClearableFields: false,
|
|
294
|
-
isDisabled: false,
|
|
295
|
-
shouldRenderDataId: false,
|
|
296
|
-
containerWidth: 400,
|
|
297
|
-
withFieldNameInLabel: true,
|
|
298
|
-
isGroupingEnabled: true,
|
|
299
|
-
checkboxPosition: 'left',
|
|
300
|
-
isSearchAutoSized: false,
|
|
301
|
-
};
|
|
297
|
+
export default meta;
|
|
298
|
+
export const Default = {};
|
|
@@ -72,7 +72,7 @@ export function Filter<Values extends Record<string, unknown>, Key extends keyof
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
if (filter.type === 'multiSelect') {
|
|
75
|
-
const preparedValue = isMultiSelectValue<any>(value) ? value : undefined;
|
|
75
|
+
const preparedValue = isMultiSelectValue<any>(value) ? value : undefined;
|
|
76
76
|
|
|
77
77
|
return (
|
|
78
78
|
<FilterMultiSelect
|
|
@@ -4,15 +4,15 @@ import { IDatePeriod, IFilterMultiSelectValues, IPeriod } from '../../types';
|
|
|
4
4
|
const isDateOrEmpty = (value: unknown): value is Date | null | undefined =>
|
|
5
5
|
isEmpty(value) || value instanceof Date;
|
|
6
6
|
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
8
8
|
export const isDatePeriodValue = (value: any): value is IDatePeriod =>
|
|
9
9
|
isDateOrEmpty(value?.from) && isDateOrEmpty(value?.to);
|
|
10
10
|
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
12
12
|
export const isPeriodValue = (value: any): value is IPeriod =>
|
|
13
13
|
isString(value?.periodType) && isDatePeriodValue(value);
|
|
14
14
|
|
|
15
15
|
export const isMultiSelectValue = <T extends string>(
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
17
17
|
value: any,
|
|
18
18
|
): value is IFilterMultiSelectValues<T> => Array.isArray(value?.include);
|
|
@@ -101,7 +101,6 @@ export type CustomComponent<Value> = FC<ICustomComponentProps<Value>>;
|
|
|
101
101
|
export type ICustomValue<V> = V extends Array<infer T> ? T : never;
|
|
102
102
|
|
|
103
103
|
export interface ICustomRangeConfigItem<Value> extends IConfigItemBasicBase<Value> {
|
|
104
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
105
104
|
[key: string & {}]: any;
|
|
106
105
|
type: 'custom';
|
|
107
106
|
component: CustomComponent<Value>;
|
|
@@ -109,7 +108,6 @@ export interface ICustomRangeConfigItem<Value> extends IConfigItemBasicBase<Valu
|
|
|
109
108
|
}
|
|
110
109
|
|
|
111
110
|
export interface ICustomMultipleConfigItem<Value> extends IConfigItemBasicBase<Value> {
|
|
112
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
113
111
|
[key: string & {}]: any;
|
|
114
112
|
type: 'custom';
|
|
115
113
|
component: CustomComponent<Value>;
|
|
@@ -1,30 +1,25 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
1
2
|
import { countries } from 'country-flag-icons';
|
|
2
|
-
import {
|
|
3
|
-
import { Flag } from './Flag';
|
|
3
|
+
import { type Meta } from '@storybook/react';
|
|
4
|
+
import { Flag, IFlagProps } from './Flag';
|
|
4
5
|
import { customFlags } from './customFlags';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
title: 'Data Display/Flag',
|
|
8
|
-
component: Flag,
|
|
9
|
-
argTypes: {
|
|
10
|
-
countryCode: { control: 'select', options: [...countries, ...Object.keys(customFlags)] },
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const Template: ComponentStory<typeof Flag> = (args) => (
|
|
7
|
+
const Story: FC<IFlagProps> = (args) => (
|
|
15
8
|
<div style={{ width: 60, height: 40 }}>
|
|
16
9
|
<Flag {...args} />
|
|
17
10
|
</div>
|
|
18
11
|
);
|
|
19
12
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
exclude: ['data'],
|
|
13
|
+
const meta: Meta<typeof Story> = {
|
|
14
|
+
title: 'Data Display/Flag',
|
|
15
|
+
component: Story,
|
|
16
|
+
args: {
|
|
17
|
+
countryCode: 'ug',
|
|
18
|
+
},
|
|
19
|
+
argTypes: {
|
|
20
|
+
countryCode: { control: 'select', options: [...countries, ...Object.keys(customFlags)] },
|
|
29
21
|
},
|
|
30
22
|
};
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
export const Default = {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { hasFlag } from 'country-flag-icons';
|
|
3
|
-
import Flags from 'country-flag-icons/react/3x2';
|
|
3
|
+
import * as Flags from 'country-flag-icons/react/3x2';
|
|
4
4
|
import { ICommonProps } from '../../types';
|
|
5
5
|
import { Icon } from '../Icon';
|
|
6
6
|
import { customFlags } from './customFlags';
|
|
7
|
-
import {
|
|
7
|
+
import { IFlagStyles, useStyles } from './Flag.styles';
|
|
8
8
|
|
|
9
9
|
export interface IFlagProps extends Pick<ICommonProps<IFlagStyles>, 'tweakStyles'> {
|
|
10
10
|
/** @default '' */
|