@true-engineering/true-react-common-ui-kit 3.45.1 → 4.0.0-alpha0
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/README.md +0 -40
- package/dist/components/CloseButton/CloseButton.d.ts +1 -1
- package/dist/components/ControlGroup/ControlGroup.d.ts +10 -0
- package/dist/components/ControlGroup/ControlGroup.stories.d.ts +7 -0
- package/dist/components/ControlGroup/ControlGroup.styles.d.ts +3 -0
- package/dist/components/ControlGroup/index.d.ts +2 -0
- package/dist/components/ControlWrapper/ControlWrapper.d.ts +27 -0
- package/dist/components/ControlWrapper/ControlWrapper.stories.d.ts +6 -0
- package/dist/components/ControlWrapper/ControlWrapper.styles.d.ts +6 -0
- package/dist/components/ControlWrapper/index.d.ts +2 -0
- package/dist/components/DateInput/DateInput.d.ts +3 -3
- package/dist/components/DatePicker/components/DatePickerHeader/DatePickerHeader.styles.d.ts +1 -1
- package/dist/components/DatePicker/types.d.ts +1 -1
- package/dist/components/FiltersPane/FiltersPane.stories.d.ts +1 -2
- package/dist/components/FiltersPane/components/FilterWithDates/FilterWithDates.d.ts +1 -1
- package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.d.ts +1 -2
- package/dist/components/Input/Input.d.ts +5 -52
- package/dist/components/Input/Input.stories.d.ts +4 -13
- package/dist/components/Input/Input.styles.d.ts +5 -4
- package/dist/components/Input/InputBase.d.ts +24 -0
- package/dist/components/Input/index.d.ts +1 -0
- package/dist/components/Input/types.d.ts +3 -4
- package/dist/components/NumberInput/NumberInput.d.ts +3 -3
- package/dist/components/PhoneInput/PhoneInput.d.ts +3 -3
- package/dist/components/PhoneInput/PhoneInput.stories.d.ts +2 -2
- package/dist/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.d.ts +3 -2
- package/dist/components/PhoneInput/types.d.ts +2 -0
- package/dist/components/SearchInput/SearchInput.d.ts +1 -3
- package/dist/components/SearchInput/SearchInput.stories.d.ts +11 -1
- package/dist/components/SearchInput/SearchInput.styles.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +5 -5
- package/dist/components/Select/Select.styles.d.ts +17 -16
- package/dist/components/Select/types.d.ts +3 -0
- package/dist/components/SmartInput/SmartInput.d.ts +3 -3
- package/dist/components/TextArea/TextArea.d.ts +5 -14
- package/dist/components/TextArea/TextArea.styles.d.ts +8 -2
- package/dist/components/WithPopup/WithPopup.d.ts +3 -10
- package/dist/components/WithPopup/WithPopup.styles.d.ts +1 -1
- package/dist/components/WithPopup/types.d.ts +0 -3
- package/dist/components/WithTooltip/WithTooltip.styles.d.ts +0 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/theme/common.d.ts +13 -5
- package/dist/theme/types.d.ts +4 -2
- package/dist/true-react-common-ui-kit.js +1184 -1029
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +1164 -1009
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/dist/types.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/Button/Button.stories.tsx +4 -8
- package/src/components/CloseButton/CloseButton.tsx +4 -4
- package/src/components/ControlGroup/ControlGroup.stories.tsx +40 -0
- package/src/components/ControlGroup/ControlGroup.styles.ts +46 -0
- package/src/components/ControlGroup/ControlGroup.tsx +55 -0
- package/src/components/ControlGroup/index.ts +2 -0
- package/src/components/ControlWrapper/ControlWrapper.stories.tsx +45 -0
- package/src/components/ControlWrapper/ControlWrapper.styles.ts +185 -0
- package/src/components/ControlWrapper/ControlWrapper.tsx +151 -0
- package/src/components/ControlWrapper/index.ts +2 -0
- package/src/components/DateInput/DateInput.styles.ts +2 -7
- package/src/components/DateInput/DateInput.tsx +4 -4
- package/src/components/DatePicker/DatePicker.tsx +3 -3
- package/src/components/DatePicker/components/DatePickerHeader/DatePickerHeader.styles.ts +7 -41
- package/src/components/DatePicker/components/DatePickerHeader/DatePickerHeader.tsx +18 -26
- package/src/components/DatePicker/types.ts +1 -1
- package/src/components/FileItem/FileItem.stories.tsx +4 -8
- package/src/components/FiltersPane/FiltersPane.stories.tsx +0 -4
- package/src/components/FiltersPane/components/FilterInterval/FilterInterval.styles.ts +9 -7
- package/src/components/FiltersPane/components/FilterInterval/FilterInterval.tsx +1 -8
- package/src/components/FiltersPane/components/FilterSelect/FilterSelect.styles.ts +7 -5
- package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.tsx +7 -9
- package/src/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.ts +12 -17
- package/src/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.tsx +2 -5
- package/src/components/IconButton/IconButton.stories.tsx +5 -5
- package/src/components/IncrementInput/IncrementInput.stories.tsx +0 -2
- package/src/components/IncrementInput/IncrementInput.styles.ts +9 -9
- package/src/components/Input/Input.stories.tsx +17 -25
- package/src/components/Input/Input.styles.ts +50 -260
- package/src/components/Input/Input.tsx +22 -285
- package/src/components/Input/InputBase.tsx +250 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/Input/types.ts +3 -32
- package/src/components/MultiSelectList/MultiSelectList.styles.ts +7 -5
- package/src/components/Notification/Notification.stories.tsx +2 -6
- package/src/components/NumberInput/NumberInput.stories.tsx +0 -2
- package/src/components/NumberInput/NumberInput.tsx +4 -7
- package/src/components/PhoneInput/PhoneInput.stories.tsx +6 -10
- package/src/components/PhoneInput/PhoneInput.styles.ts +13 -10
- package/src/components/PhoneInput/PhoneInput.tsx +9 -12
- package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.styles.ts +6 -4
- package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.tsx +6 -6
- package/src/components/PhoneInput/types.ts +4 -0
- package/src/components/SearchInput/SearchInput.stories.tsx +1 -0
- package/src/components/SearchInput/SearchInput.styles.ts +17 -27
- package/src/components/SearchInput/SearchInput.tsx +13 -34
- package/src/components/Select/CustomSelect.stories.tsx +6 -9
- package/src/components/Select/MultiSelect.stories.tsx +4 -12
- package/src/components/Select/Select.stories.tsx +3 -11
- package/src/components/Select/Select.styles.ts +28 -42
- package/src/components/Select/Select.tsx +73 -81
- package/src/components/Select/types.ts +5 -0
- package/src/components/SmartInput/SmartInput.stories.tsx +0 -1
- package/src/components/SmartInput/SmartInput.tsx +4 -4
- package/src/components/Status/Status.stories.tsx +3 -7
- package/src/components/TextArea/TextArea.stories.tsx +1 -3
- package/src/components/TextArea/TextArea.styles.ts +27 -126
- package/src/components/TextArea/TextArea.tsx +86 -112
- package/src/components/TextButton/TextButton.stories.tsx +4 -8
- package/src/components/WithPopup/WithPopup.stories.tsx +0 -1
- package/src/components/WithPopup/WithPopup.styles.ts +0 -2
- package/src/components/WithPopup/WithPopup.tsx +10 -36
- package/src/components/WithPopup/types.ts +0 -7
- package/src/components/WithTooltip/WithTooltip.styles.ts +0 -6
- package/src/components/WithTooltip/WithTooltip.tsx +2 -7
- package/src/components/index.ts +2 -0
- package/src/theme/common.ts +15 -6
- package/src/theme/types.ts +8 -4
- package/src/types.ts +3 -0
- package/dist/components/Input/constants.d.ts +0 -1
- package/dist/components/WithPopup/helpers.d.ts +0 -2
- package/src/components/Input/constants.ts +0 -1
- package/src/components/WithPopup/helpers.ts +0 -9
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createThemedStyles, ITweakStyles } from '../../../../theme';
|
|
2
2
|
import { ISelectStyles } from '../../../Select';
|
|
3
3
|
|
|
4
|
-
const SELECT_PADDING_LEFT = 12;
|
|
5
|
-
const SELECT_PADDING_RIGHT = 24;
|
|
6
|
-
|
|
7
4
|
export const useStyles = createThemedStyles('DatePickerHeader', {
|
|
8
5
|
btn: {
|
|
9
6
|
width: 36,
|
|
@@ -12,34 +9,10 @@ export const useStyles = createThemedStyles('DatePickerHeader', {
|
|
|
12
9
|
boxSizing: 'border-box',
|
|
13
10
|
border: 'none',
|
|
14
11
|
outline: 'none',
|
|
15
|
-
|
|
16
12
|
cursor: 'pointer',
|
|
17
13
|
marginLeft: 8,
|
|
18
14
|
},
|
|
19
15
|
|
|
20
|
-
select: {
|
|
21
|
-
height: 35,
|
|
22
|
-
fontSize: 16,
|
|
23
|
-
position: 'relative',
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
selectValue: {
|
|
27
|
-
fontSize: 16,
|
|
28
|
-
fontWeight: 'bold',
|
|
29
|
-
color: 'transparent',
|
|
30
|
-
pointerEvents: 'none',
|
|
31
|
-
paddingLeft: SELECT_PADDING_LEFT,
|
|
32
|
-
paddingRight: SELECT_PADDING_RIGHT,
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
selectControl: {
|
|
36
|
-
position: 'absolute',
|
|
37
|
-
top: 0,
|
|
38
|
-
left: 0,
|
|
39
|
-
width: '100%',
|
|
40
|
-
height: '100%',
|
|
41
|
-
},
|
|
42
|
-
|
|
43
16
|
header: {
|
|
44
17
|
margin: 6,
|
|
45
18
|
display: 'flex',
|
|
@@ -60,24 +33,17 @@ export const selectStyles: ISelectStyles = {
|
|
|
60
33
|
},
|
|
61
34
|
},
|
|
62
35
|
|
|
63
|
-
arrow: {
|
|
64
|
-
right: 0,
|
|
65
|
-
top: 9,
|
|
66
|
-
width: 16,
|
|
67
|
-
height: 16,
|
|
68
|
-
},
|
|
69
|
-
|
|
70
36
|
tweakInput: {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
37
|
+
tweakControlWrapper: {
|
|
38
|
+
root: {
|
|
39
|
+
'--control-height': '35px',
|
|
40
|
+
border: 'none',
|
|
41
|
+
},
|
|
74
42
|
},
|
|
75
43
|
|
|
76
|
-
|
|
44
|
+
inputContent: {
|
|
77
45
|
fontSize: 16,
|
|
78
46
|
fontWeight: 'bold',
|
|
79
|
-
paddingRight: SELECT_PADDING_RIGHT - 8,
|
|
80
|
-
paddingLeft: SELECT_PADDING_LEFT,
|
|
81
47
|
},
|
|
82
48
|
},
|
|
83
49
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { FC, useMemo } from 'react';
|
|
2
2
|
import { ReactDatePickerCustomHeaderProps as BaseProps } from 'react-datepicker';
|
|
3
|
-
import {
|
|
3
|
+
import { getMonth, getYear } from 'date-fns';
|
|
4
4
|
import { useTweakStyles } from '../../../../hooks';
|
|
5
5
|
import { ICommonProps } from '../../../../types';
|
|
6
6
|
import { Icon } from '../../../Icon';
|
|
7
7
|
import { Select } from '../../../Select';
|
|
8
|
-
import {
|
|
8
|
+
import { IDatePickerHeaderStyles, selectStyles, useStyles } from './DatePickerHeader.styles';
|
|
9
9
|
|
|
10
10
|
export interface IDatePickerHeaderProps
|
|
11
11
|
extends BaseProps,
|
|
@@ -40,30 +40,22 @@ export const DatePickerHeader: FC<IDatePickerHeaderProps> = ({
|
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<div className={classes.header}>
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
value={getYear(date)}
|
|
60
|
-
options={years}
|
|
61
|
-
dropdownIcon="chevron-down-small"
|
|
62
|
-
tweakStyles={tweakSelectStyles}
|
|
63
|
-
onChange={(value) => changeYear(value as number)}
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
43
|
+
<Select
|
|
44
|
+
value={months[getMonth(date)]}
|
|
45
|
+
options={months}
|
|
46
|
+
dropdownIcon="chevron-down-small"
|
|
47
|
+
isAutoSized
|
|
48
|
+
tweakStyles={tweakSelectStyles}
|
|
49
|
+
onChange={(value) => changeMonth(months.indexOf(value as string))}
|
|
50
|
+
/>
|
|
51
|
+
<Select
|
|
52
|
+
value={getYear(date)}
|
|
53
|
+
options={years}
|
|
54
|
+
dropdownIcon="chevron-down-small"
|
|
55
|
+
isAutoSized
|
|
56
|
+
tweakStyles={tweakSelectStyles}
|
|
57
|
+
onChange={(value) => changeYear(value as number)}
|
|
58
|
+
/>
|
|
67
59
|
|
|
68
60
|
<div className={classes.buttons}>
|
|
69
61
|
<button
|
|
@@ -2,7 +2,7 @@ import { format } from 'date-fns';
|
|
|
2
2
|
import { ru } from 'date-fns/locale';
|
|
3
3
|
import { ComponentStory } from '@storybook/react';
|
|
4
4
|
import { FILE_ITEM_SIZES } from '../FileItem/constants';
|
|
5
|
-
import {
|
|
5
|
+
import { iconsList, IIconType } from '../Icon';
|
|
6
6
|
import { complexIcons } from '../Icon/complexIcons';
|
|
7
7
|
import { FileItem, IFileItemProps } from './FileItem';
|
|
8
8
|
|
|
@@ -11,11 +11,7 @@ export default {
|
|
|
11
11
|
component: FileItem,
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
undefined,
|
|
16
|
-
...Object.keys(iconsList),
|
|
17
|
-
...Object.keys(complexIcons),
|
|
18
|
-
] as IIconType[];
|
|
14
|
+
const icons = [undefined, ...Object.keys(iconsList), ...Object.keys(complexIcons)] as IIconType[];
|
|
19
15
|
|
|
20
16
|
const preloaderTypes: Array<IFileItemProps['preloaderType']> = ['dots', 'default', 'logo'];
|
|
21
17
|
|
|
@@ -50,8 +46,8 @@ Default.args = {
|
|
|
50
46
|
};
|
|
51
47
|
|
|
52
48
|
Default.argTypes = {
|
|
53
|
-
icon: { options:
|
|
54
|
-
removeIcon: { options:
|
|
49
|
+
icon: { options: icons, control: 'select' },
|
|
50
|
+
removeIcon: { options: icons, control: 'select' },
|
|
55
51
|
itemSize: { options: FILE_ITEM_SIZES, control: 'inline-radio' },
|
|
56
52
|
preloaderType: { options: preloaderTypes, control: 'inline-radio' },
|
|
57
53
|
};
|
|
@@ -73,7 +73,6 @@ type ConfigValues = {
|
|
|
73
73
|
interface IFiltersPaneWithCustomProps<Values, Content> extends IFiltersPaneProps<Values, Content> {
|
|
74
74
|
containerWidth: number;
|
|
75
75
|
isSearchDisabled: boolean;
|
|
76
|
-
isSearchAutosizeable: boolean;
|
|
77
76
|
shouldShowSettingsButton: boolean;
|
|
78
77
|
withFieldNameInLabel: boolean;
|
|
79
78
|
isGroupingEnabled: boolean;
|
|
@@ -84,7 +83,6 @@ interface IFiltersPaneWithCustomProps<Values, Content> extends IFiltersPaneProps
|
|
|
84
83
|
function FiltersPaneWithCustomProps<Values, Content>({
|
|
85
84
|
containerWidth,
|
|
86
85
|
isSearchDisabled,
|
|
87
|
-
isSearchAutosizeable,
|
|
88
86
|
shouldShowSettingsButton,
|
|
89
87
|
withFieldNameInLabel,
|
|
90
88
|
isGroupingEnabled,
|
|
@@ -239,7 +237,6 @@ function FiltersPaneWithCustomProps<Values, Content>({
|
|
|
239
237
|
fields: ['interval', 'name'] as Array<keyof ConfigValues>,
|
|
240
238
|
getValueView: convertFieldToString,
|
|
241
239
|
onChange: setSearchValue,
|
|
242
|
-
isAutoSizeable: isSearchAutosizeable,
|
|
243
240
|
isDisabled: isSearchDisabled,
|
|
244
241
|
}}
|
|
245
242
|
enabledFilters={[
|
|
@@ -287,7 +284,6 @@ export const Default = Template.bind({});
|
|
|
287
284
|
|
|
288
285
|
Default.args = {
|
|
289
286
|
shouldShowSettingsButton: false,
|
|
290
|
-
isSearchAutosizeable: true,
|
|
291
287
|
isSearchDisabled: false,
|
|
292
288
|
hasClearButton: true,
|
|
293
289
|
isClearableFields: false,
|
|
@@ -40,14 +40,16 @@ export const inputStyles: IInputStyles = {
|
|
|
40
40
|
minWidth: 120,
|
|
41
41
|
},
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
tweakControlWrapper: {
|
|
44
|
+
icon: {
|
|
45
|
+
padding: 0,
|
|
46
|
+
width: 24,
|
|
47
|
+
|
|
48
|
+
'&:last-child': {
|
|
49
|
+
paddingRight: 0,
|
|
50
|
+
},
|
|
49
51
|
},
|
|
50
|
-
}
|
|
52
|
+
}
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
export const clearButtonStyles = cloneDeep(innerTextButtonStyles);
|
|
@@ -7,12 +7,7 @@ import { Button } from '../../../Button';
|
|
|
7
7
|
import { NumberInput } from '../../../NumberInput';
|
|
8
8
|
import { getLocale, sortValues } from '../../helpers';
|
|
9
9
|
import { IFilterLocaleKey, IPartialFilterLocale } from '../../types';
|
|
10
|
-
import {
|
|
11
|
-
useStyles,
|
|
12
|
-
IFilterIntervalStyles,
|
|
13
|
-
inputStyles,
|
|
14
|
-
clearButtonStyles,
|
|
15
|
-
} from './FilterInterval.styles';
|
|
10
|
+
import { clearButtonStyles, IFilterIntervalStyles, inputStyles, useStyles } from './FilterInterval.styles';
|
|
16
11
|
|
|
17
12
|
export interface IFilterIntervalProps extends ICommonProps<IFilterIntervalStyles> {
|
|
18
13
|
value?: Array<number | undefined>;
|
|
@@ -98,7 +93,6 @@ export const FilterInterval: FC<IFilterIntervalProps> = ({
|
|
|
98
93
|
? `${labelName} ${translates.from.toLocaleLowerCase()}`
|
|
99
94
|
: translates.from
|
|
100
95
|
}
|
|
101
|
-
border="bottom"
|
|
102
96
|
canBeFloat={canBeFloat}
|
|
103
97
|
isClearable
|
|
104
98
|
min={fromInput?.min}
|
|
@@ -122,7 +116,6 @@ export const FilterInterval: FC<IFilterIntervalProps> = ({
|
|
|
122
116
|
? `${labelName} ${translates.to.toLocaleLowerCase()}`
|
|
123
117
|
: translates.to
|
|
124
118
|
}
|
|
125
|
-
border="bottom"
|
|
126
119
|
canBeFloat={canBeFloat}
|
|
127
120
|
isClearable
|
|
128
121
|
min={toInput?.min}
|
|
@@ -122,11 +122,13 @@ export const useStyles = createThemedStyles('FilterSelect', {
|
|
|
122
122
|
|
|
123
123
|
export const searchInputStyles: ISearchInputStyles = {
|
|
124
124
|
tweakInput: {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
tweakControlWrapper: {
|
|
126
|
+
root: {
|
|
127
|
+
'--control-height': '40px',
|
|
128
|
+
backgroundColor: 'transparent',
|
|
129
|
+
border: 'none',
|
|
130
|
+
},
|
|
131
|
+
}
|
|
130
132
|
},
|
|
131
133
|
};
|
|
132
134
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { isAfter, isBefore } from 'date-fns';
|
|
3
3
|
import enUS from 'date-fns/locale/en-US';
|
|
4
4
|
import ru from 'date-fns/locale/ru';
|
|
@@ -11,20 +11,20 @@ import { DatePicker } from '../../../DatePicker';
|
|
|
11
11
|
import { DEFAULT_PICKER_PROPS } from '../../constants';
|
|
12
12
|
import { getLocale } from '../../helpers';
|
|
13
13
|
import {
|
|
14
|
-
IFilterWithDateDatePickerProps,
|
|
15
14
|
IFilterLocaleKey,
|
|
15
|
+
IFilterWithDateDatePickerProps,
|
|
16
16
|
IFilterWithDatesValue,
|
|
17
17
|
IPartialFilterLocale,
|
|
18
18
|
} from '../../types';
|
|
19
19
|
import {
|
|
20
|
-
useStyles,
|
|
21
|
-
IFilterWithDatesStyles,
|
|
22
|
-
clearButtonStyles,
|
|
23
20
|
backButtonStyles,
|
|
24
|
-
|
|
25
|
-
startDatePickerStyles,
|
|
21
|
+
clearButtonStyles,
|
|
26
22
|
endDatePickerStyles,
|
|
27
23
|
endDatePickerWithButtonStyles,
|
|
24
|
+
IFilterWithDatesStyles,
|
|
25
|
+
startDatePickerStyles,
|
|
26
|
+
startDatePickerWithButtonStyles,
|
|
27
|
+
useStyles,
|
|
28
28
|
} from './FilterWithDates.styles';
|
|
29
29
|
|
|
30
30
|
export interface IFilterWithDatesProps extends ICommonProps<IFilterWithDatesStyles> {
|
|
@@ -139,7 +139,6 @@ export const FilterWithDates: FC<IFilterWithDatesProps> = ({
|
|
|
139
139
|
locale={dateLocale}
|
|
140
140
|
onChangeDate={handleChangeFrom}
|
|
141
141
|
tweakStyles={tweakStartDatePickerStyles}
|
|
142
|
-
border="bottom"
|
|
143
142
|
testId={getTestId(testId, 'from')}
|
|
144
143
|
isClearable={isClearable}
|
|
145
144
|
{...startPickerProps}
|
|
@@ -154,7 +153,6 @@ export const FilterWithDates: FC<IFilterWithDatesProps> = ({
|
|
|
154
153
|
locale={dateLocale}
|
|
155
154
|
onChangeDate={handleChangeTo}
|
|
156
155
|
tweakStyles={tweakEndDatePickerStyles}
|
|
157
|
-
border="bottom"
|
|
158
156
|
testId={getTestId(testId, 'to')}
|
|
159
157
|
isClearable={isClearable}
|
|
160
158
|
{...endPickerProps}
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { rgba } from '../../../../helpers';
|
|
2
|
-
import {
|
|
3
|
-
animations,
|
|
4
|
-
colors,
|
|
5
|
-
createThemedStyles,
|
|
6
|
-
dimensions,
|
|
7
|
-
ITweakStyles,
|
|
8
|
-
} from '../../../../theme';
|
|
2
|
+
import { animations, colors, createThemedStyles, dimensions, ITweakStyles } from '../../../../theme';
|
|
9
3
|
import { ISearchInputStyles } from '../../../SearchInput';
|
|
10
4
|
import { ISelectStyles } from '../../../Select';
|
|
11
5
|
import { FILTER_HEIGHT } from '../../FiltersPane.styles';
|
|
@@ -89,17 +83,18 @@ export const useStyles = createThemedStyles('FiltersPaneSearch', {
|
|
|
89
83
|
|
|
90
84
|
export const searchInputStyles: ISearchInputStyles = {
|
|
91
85
|
tweakInput: {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
86
|
+
tweakControlWrapper: {
|
|
87
|
+
root: {
|
|
88
|
+
'--control-height': `${FILTER_HEIGHT - 2}px`,
|
|
89
|
+
backgroundColor: 'transparent',
|
|
90
|
+
border: 'none',
|
|
91
|
+
minWidth: 140,
|
|
92
|
+
},
|
|
99
93
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
94
|
+
focused: {
|
|
95
|
+
backgroundColor: 'transparent',
|
|
96
|
+
border: 'none',
|
|
97
|
+
},
|
|
103
98
|
},
|
|
104
99
|
},
|
|
105
100
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { addDataAttributes } from '../../../../helpers';
|
|
4
4
|
import { useOnClickOutside, useTweakStyles } from '../../../../hooks';
|
|
@@ -9,10 +9,10 @@ import { getLocale } from '../../helpers';
|
|
|
9
9
|
import { IFilterLocaleKey, IFiltersPaneSearchPayload, IPartialFilterLocale } from '../../types';
|
|
10
10
|
import { FilterSelect } from '../FilterSelect';
|
|
11
11
|
import {
|
|
12
|
-
useStyles,
|
|
13
12
|
IFiltersPaneSearchStyles,
|
|
14
13
|
searchInputStyles,
|
|
15
14
|
selectStyles,
|
|
15
|
+
useStyles,
|
|
16
16
|
} from './FiltersPaneSearch.styles';
|
|
17
17
|
|
|
18
18
|
export interface IFiltersPaneSearchProps<Value> extends ICommonProps<IFiltersPaneSearchStyles> {
|
|
@@ -29,7 +29,6 @@ export interface IFiltersPaneSearchProps<Value> extends ICommonProps<IFiltersPan
|
|
|
29
29
|
hasClearSelectButton?: boolean;
|
|
30
30
|
isDisabled?: boolean;
|
|
31
31
|
isSelectSearchEnabled?: boolean;
|
|
32
|
-
isAutoSizeable?: boolean;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
export function FiltersPaneSearch<Value>({
|
|
@@ -45,7 +44,6 @@ export function FiltersPaneSearch<Value>({
|
|
|
45
44
|
hasClearSelectButton,
|
|
46
45
|
isDisabled = false,
|
|
47
46
|
isSelectSearchEnabled = true,
|
|
48
|
-
isAutoSizeable = true,
|
|
49
47
|
maxLength,
|
|
50
48
|
data,
|
|
51
49
|
tweakStyles,
|
|
@@ -115,7 +113,6 @@ export function FiltersPaneSearch<Value>({
|
|
|
115
113
|
onBlur={() => setIsInputFocused(false)}
|
|
116
114
|
testId={testId !== undefined ? `${testId}-input` : undefined}
|
|
117
115
|
maxLength={maxLength}
|
|
118
|
-
isAutoSizeable={isAutoSizeable}
|
|
119
116
|
isDisabled={isDisabled}
|
|
120
117
|
/>
|
|
121
118
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
2
|
+
import { iconsList, IIconType } from '../Icon';
|
|
3
3
|
import { complexIcons } from '../Icon/complexIcons';
|
|
4
4
|
import { IconButton } from './IconButton';
|
|
5
5
|
import { ICON_BUTTON_SIZES, ICON_BUTTON_VIEWS } from './constants';
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const icons = [...Object.keys(iconsList), ...Object.keys(complexIcons)] as IIconType[];
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
10
|
title: 'Buttons/IconButton',
|
|
11
11
|
component: IconButton,
|
|
12
12
|
args: {
|
|
13
|
-
icon:
|
|
13
|
+
icon: icons[0],
|
|
14
14
|
view: 'main',
|
|
15
15
|
size: 'm',
|
|
16
16
|
isDisabled: false,
|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
isActive: false,
|
|
19
19
|
},
|
|
20
20
|
argTypes: {
|
|
21
|
-
icon: { options:
|
|
21
|
+
icon: { options: icons, control: 'select' },
|
|
22
22
|
size: { options: ICON_BUTTON_SIZES, control: 'inline-radio' },
|
|
23
23
|
view: { options: ICON_BUTTON_VIEWS, control: 'inline-radio' },
|
|
24
24
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { animations, colors, createThemedStyles, dimensions, ITweakStyles } from '../../theme';
|
|
2
2
|
import { IInputStyles } from '../Input';
|
|
3
3
|
|
|
4
4
|
export const BUTTONS_WIDTH = 36;
|
|
@@ -19,12 +19,12 @@ export const useStyles = createThemedStyles('IncrementInput', {
|
|
|
19
19
|
right: BUTTONS_GAP,
|
|
20
20
|
top: BUTTONS_GAP,
|
|
21
21
|
bottom: BUTTONS_GAP,
|
|
22
|
-
zIndex: 1,
|
|
22
|
+
zIndex: dimensions.Z_INDEX.CONTROL_FOCUS + 1,
|
|
23
23
|
},
|
|
24
24
|
|
|
25
25
|
button: {
|
|
26
26
|
width: '100%',
|
|
27
|
-
height: (dimensions.
|
|
27
|
+
height: (dimensions.CONTROL.HEIGHT - 5) / 2,
|
|
28
28
|
border: 'none',
|
|
29
29
|
outline: 'none',
|
|
30
30
|
backgroundColor: colors.GREY_BACKGROUND,
|
|
@@ -65,14 +65,14 @@ export const useStyles = createThemedStyles('IncrementInput', {
|
|
|
65
65
|
|
|
66
66
|
export const inputStyles: IInputStyles = {
|
|
67
67
|
input: {
|
|
68
|
-
'&:not($withControls)': {
|
|
69
|
-
paddingRight: BUTTONS_WIDTH + BUTTONS_GAP,
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
controls: {
|
|
74
68
|
paddingRight: BUTTONS_WIDTH + BUTTONS_GAP,
|
|
75
69
|
},
|
|
70
|
+
|
|
71
|
+
tweakControlWrapper: {
|
|
72
|
+
controls: {
|
|
73
|
+
paddingRight: BUTTONS_WIDTH + BUTTONS_GAP,
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
export type IIncrementInputStyles = ITweakStyles<typeof useStyles, { tweakInput: IInputStyles }>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { ComponentStory } from '@storybook/react';
|
|
3
3
|
import { iconsList } from '../Icon';
|
|
4
|
-
import {
|
|
4
|
+
import { IInputProps, Input } from './Input';
|
|
5
5
|
|
|
6
6
|
const types: Array<IInputProps['type']> = ['text', 'password', 'email', 'number'];
|
|
7
|
-
const
|
|
7
|
+
const groupPositions = [
|
|
8
8
|
undefined,
|
|
9
9
|
'top',
|
|
10
10
|
'bottom',
|
|
@@ -17,20 +17,16 @@ const inlineStyles = [
|
|
|
17
17
|
'middle',
|
|
18
18
|
];
|
|
19
19
|
const masks = [undefined, '99/99', 'aaa-aaa', '***+***'];
|
|
20
|
-
const
|
|
21
|
-
const borders = [undefined, 'left', 'top', 'right', 'bottom'];
|
|
22
|
-
const errorPositions = ['bottom', 'top'];
|
|
20
|
+
const icons = [undefined, ...Object.keys(iconsList)];
|
|
23
21
|
|
|
24
22
|
export default {
|
|
25
23
|
title: 'Inputs/Input',
|
|
26
24
|
component: Input,
|
|
27
25
|
argTypes: {
|
|
28
26
|
type: { control: 'radio', options: types },
|
|
29
|
-
|
|
30
|
-
iconType: { control: 'select', options: iconTypes },
|
|
31
|
-
errorPosition: { control: 'inline-radio', options: errorPositions },
|
|
27
|
+
icon: { control: 'select', options: icons },
|
|
32
28
|
mask: { control: 'select', options: masks },
|
|
33
|
-
|
|
29
|
+
groupPositions: { control: 'select', options: groupPositions },
|
|
34
30
|
},
|
|
35
31
|
};
|
|
36
32
|
|
|
@@ -38,12 +34,14 @@ const Template: ComponentStory<typeof Input> = (args) => {
|
|
|
38
34
|
const [value, setValue] = useState('');
|
|
39
35
|
|
|
40
36
|
return (
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
<div style={{ width: 300 }}>
|
|
38
|
+
<Input
|
|
39
|
+
{...args}
|
|
40
|
+
value={value}
|
|
41
|
+
onChange={setValue}
|
|
42
|
+
onIconClick={() => console.log('icon click')}
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
47
45
|
);
|
|
48
46
|
};
|
|
49
47
|
|
|
@@ -53,24 +51,19 @@ Default.args = {
|
|
|
53
51
|
label: 'Label',
|
|
54
52
|
placeholder: 'Placeholder',
|
|
55
53
|
infoMessage: 'Message Info',
|
|
56
|
-
units: 'RUB',
|
|
57
54
|
type: 'text',
|
|
58
|
-
border: undefined,
|
|
59
|
-
hasFloatingLabel: true,
|
|
60
|
-
hasRequiredLabel: true,
|
|
61
55
|
isInvalid: false,
|
|
56
|
+
units: '',
|
|
62
57
|
errorMessage: 'Error Text',
|
|
63
|
-
errorPosition: 'bottom',
|
|
64
|
-
isAutoSizeable: false,
|
|
65
|
-
shouldFocusOnMount: false,
|
|
66
|
-
shouldAlwaysShowPlaceholder: false,
|
|
67
58
|
isActive: false,
|
|
68
59
|
isDisabled: false,
|
|
69
60
|
isRequired: false,
|
|
70
61
|
isReadonly: false,
|
|
71
62
|
isClearable: false,
|
|
72
63
|
isLoading: false,
|
|
73
|
-
|
|
64
|
+
isAutoSized: false,
|
|
65
|
+
shouldAlwaysShowPlaceholder: false,
|
|
66
|
+
groupPlacement: undefined,
|
|
74
67
|
};
|
|
75
68
|
|
|
76
69
|
Default.parameters = {
|
|
@@ -85,7 +78,6 @@ Default.parameters = {
|
|
|
85
78
|
'onPaste',
|
|
86
79
|
'onKeyDown',
|
|
87
80
|
'onIconClick',
|
|
88
|
-
'tweakStyles',
|
|
89
81
|
],
|
|
90
82
|
},
|
|
91
83
|
};
|