@true-engineering/true-react-common-ui-kit 4.0.0-alpha54 → 4.0.0-alpha61
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 +1 -0
- package/dist/components/AddButton/AddButton.d.ts +1 -0
- package/dist/components/AddButton/AddButton.styles.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/ControlWrapper/ControlWrapper.d.ts +1 -1
- package/dist/components/ControlWrapper/ControlWrapper.styles.d.ts +1 -1
- package/dist/components/CssBaseline/CssBaseline.styles.d.ts +1 -1
- package/dist/components/DatePicker/components/DatePickerHeader/DatePickerHeader.styles.d.ts +1 -1
- package/dist/components/Description/Description.styles.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/components/FilterInterval/FilterInterval.styles.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterSelect/FilterSelect.styles.d.ts +2 -2
- package/dist/components/FiltersPane/components/FilterWithDates/FilterWithDates.styles.d.ts +2 -2
- package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.d.ts +1 -1
- package/dist/components/FiltersPane/components/FilterWrapper/FilterWrapper.styles.d.ts +1 -1
- package/dist/components/FiltersPane/components/FiltersPaneSearch/FiltersPaneSearch.styles.d.ts +1 -1
- package/dist/components/FiltersPane/types.d.ts +2 -1
- package/dist/components/FlexibleTable/FlexibleTable.styles.d.ts +1 -1
- package/dist/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.d.ts +1 -1
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.d.ts +1 -3
- package/dist/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.styles.d.ts +1 -1
- package/dist/components/FloatDocActions/components/DocActions/DocActions.styles.d.ts +1 -1
- package/dist/components/IconButton/IconButton.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.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/NewMoreMenu/NewMoreMenu.styles.d.ts +1 -1
- package/dist/components/Notification/Notification.styles.d.ts +1 -1
- 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/SearchInput/SearchInput.d.ts +1 -1
- package/dist/components/Select/Select.styles.d.ts +3 -3
- package/dist/components/Select/components/SelectList/SelectList.styles.d.ts +1 -1
- package/dist/components/Selector/Selector.styles.d.ts +1 -1
- package/dist/components/Status/Status.styles.d.ts +1 -1
- package/dist/components/Switch/Switch.d.ts +3 -2
- package/dist/components/Switch/Switch.styles.d.ts +3 -2
- package/dist/components/Switch/types.d.ts +3 -0
- package/dist/components/TextArea/TextArea.styles.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.d.ts +2 -0
- 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/Toaster/Toaster.styles.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +3 -0
- package/dist/components/Tooltip/Tooltip.styles.d.ts +2 -1
- package/dist/components/Tooltip/types.d.ts +3 -0
- package/dist/components/WithMessages/WithMessages.styles.d.ts +1 -1
- package/dist/components/WithPopup/WithPopup.styles.d.ts +1 -1
- package/dist/components/WithTooltip/WithTooltip.d.ts +2 -0
- package/dist/helpers/misc.d.ts +2 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-intersection-ref.d.ts +2 -1
- package/dist/hooks/use-resize-ref.d.ts +7 -0
- package/dist/hooks/use-tweak-styles.d.ts +3 -2
- package/dist/theme/Provider.d.ts +2 -12
- package/dist/theme/common.d.ts +34 -4
- package/dist/theme/helpers.d.ts +3 -16
- package/dist/theme/index.d.ts +0 -2
- package/dist/theme/types.d.ts +9 -8
- package/dist/true-react-common-ui-kit.js +12132 -10
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +2 -10
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/dist/types.d.ts +3 -3
- package/package.json +1 -3
- package/src/components/AccountInfo/AccountInfo.tsx +2 -3
- package/src/components/AddButton/AddButton.tsx +3 -5
- package/src/components/Button/Button.tsx +76 -77
- package/src/components/CloseButton/CloseButton.tsx +2 -4
- package/src/components/Colors/Colors.stories.tsx +3 -2
- package/src/components/ControlWrapper/ControlWrapper.tsx +2 -2
- package/src/components/CssBaseline/CssBaseline.styles.ts +2 -0
- package/src/components/CssBaseline/CssBaseline.tsx +2 -3
- package/src/components/DateInput/DateInput.tsx +59 -61
- package/src/components/DatePicker/DatePicker.tsx +259 -262
- package/src/components/Description/Description.tsx +2 -3
- package/src/components/FileInput/FileInput.tsx +87 -95
- package/src/components/FileItem/FileItem.tsx +2 -4
- package/src/components/FiltersPane/FiltersPane.stories.tsx +3 -0
- package/src/components/FiltersPane/components/FilterInterval/FilterInterval.tsx +2 -3
- package/src/components/FiltersPane/components/FilterWithDates/FilterWithDates.tsx +6 -3
- package/src/components/FiltersPane/components/FilterWrapper/FilterWrapper.tsx +3 -2
- package/src/components/FiltersPane/types.ts +2 -0
- package/src/components/FlexibleTable/FlexibleTable.styles.ts +1 -0
- package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.styles.ts +1 -0
- package/src/components/FlexibleTable/components/FlexibleTableCell/FlexibleTableCell.tsx +5 -2
- package/src/components/FlexibleTable/components/FlexibleTableRow/FlexibleTableRow.tsx +9 -7
- package/src/components/IconButton/IconButton.tsx +44 -48
- package/src/components/Input/Input.tsx +26 -24
- package/src/components/Input/InputBase.tsx +183 -187
- package/src/components/List/List.tsx +2 -3
- package/src/components/List/components/ListItem/ListItem.tsx +2 -4
- package/src/components/Modal/Modal.tsx +2 -4
- package/src/components/MoreMenu/MoreMenu.tsx +2 -4
- package/src/components/MultiSelect/MultiSelect.tsx +2 -4
- package/src/components/NewMoreMenu/NewMoreMenu.tsx +2 -4
- package/src/components/Notification/Notification.tsx +2 -3
- package/src/components/NumberInput/NumberInput.tsx +91 -93
- package/src/components/PhoneInput/PhoneInput.tsx +2 -3
- package/src/components/SearchInput/SearchInput.tsx +20 -19
- package/src/components/Select/Select.tsx +1 -1
- package/src/components/Selector/Selector.tsx +4 -6
- package/src/components/SmartInput/SmartInput.tsx +85 -87
- package/src/components/Status/Status.tsx +5 -4
- package/src/components/Switch/Switch.styles.ts +21 -13
- package/src/components/Switch/Switch.tsx +11 -6
- package/src/components/Switch/types.ts +5 -0
- package/src/components/TextArea/TextArea.tsx +128 -130
- package/src/components/TextButton/TextButton.tsx +68 -69
- package/src/components/TextWithInfo/TextWithInfo.tsx +2 -4
- package/src/components/TextWithTooltip/TextWithTooltip.tsx +6 -4
- package/src/components/ThemedPreloader/ThemedPreloader.tsx +2 -4
- package/src/components/Toaster/Toaster.tsx +2 -4
- package/src/components/Tooltip/Tooltip.stories.tsx +10 -0
- package/src/components/Tooltip/Tooltip.styles.ts +2 -1
- package/src/components/Tooltip/Tooltip.tsx +12 -5
- package/src/components/Tooltip/types.ts +5 -0
- package/src/components/WithMessages/WithMessages.tsx +41 -40
- package/src/components/WithTooltip/WithTooltip.tsx +4 -0
- package/src/helpers/misc.ts +6 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-intersection-ref.ts +24 -6
- package/src/hooks/use-latest-ref.ts +6 -2
- package/src/hooks/use-resize-ref.ts +35 -0
- package/src/hooks/use-tweak-styles.ts +14 -51
- package/src/theme/Provider.tsx +4 -21
- package/src/theme/common.ts +33 -36
- package/src/theme/helpers.ts +50 -42
- package/src/theme/index.ts +0 -2
- package/src/theme/types.ts +13 -10
- package/src/types.ts +3 -3
- package/dist/theme/create-themed-styles.d.ts +0 -2
- package/dist/theme/true-jss/ThemedStylesManager.d.ts +0 -18
- package/dist/theme/true-jss/TweakStylesManager.d.ts +0 -34
- package/dist/theme/true-jss/index.d.ts +0 -2
- package/dist/theme/true-jss/jss-context.d.ts +0 -9
- package/dist/true-react-common-ui-kit.css +0 -756
- package/src/theme/create-themed-styles.ts +0 -78
- package/src/theme/true-jss/ThemedStylesManager.ts +0 -93
- package/src/theme/true-jss/TweakStylesManager.ts +0 -156
- package/src/theme/true-jss/index.ts +0 -2
- package/src/theme/true-jss/jss-context.tsx +0 -34
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
} from 'react';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import {
|
|
11
|
+
addDataAttributes,
|
|
11
12
|
addDataTestId,
|
|
12
13
|
isEmpty,
|
|
13
14
|
isReactNodeNotEmpty,
|
|
14
15
|
} from '@true-engineering/true-react-platform-helpers';
|
|
15
|
-
import { addDataAttributes } from '../../helpers';
|
|
16
16
|
import { ICommonProps } from '../../types';
|
|
17
17
|
import { blockEvent } from './helpers';
|
|
18
18
|
import { IFileInputStyles, useStyles } from './FileInput.styles';
|
|
@@ -39,109 +39,101 @@ export interface IFileInputProps extends ICommonProps<IFileInputStyles> {
|
|
|
39
39
|
onAdd?: (files: File[]) => void;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export const FileInput = forwardRef<HTMLInputElement, IFileInputProps>(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const classes = useStyles({ theme: tweakStyles });
|
|
64
|
-
|
|
65
|
-
const [isDragOver, setIsDragOver] = useState(false);
|
|
42
|
+
export const FileInput = forwardRef<HTMLInputElement, IFileInputProps>(function FileInput(
|
|
43
|
+
{
|
|
44
|
+
fileList,
|
|
45
|
+
label,
|
|
46
|
+
text,
|
|
47
|
+
description,
|
|
48
|
+
isDragAndDropDisabled = false,
|
|
49
|
+
isRequired = false,
|
|
50
|
+
isReadOnly = false,
|
|
51
|
+
isMultipleDisabled = false,
|
|
52
|
+
isDisabled = false,
|
|
53
|
+
isActive = false,
|
|
54
|
+
accept,
|
|
55
|
+
onAdd,
|
|
56
|
+
testId,
|
|
57
|
+
tweakStyles,
|
|
58
|
+
data,
|
|
59
|
+
},
|
|
60
|
+
ref,
|
|
61
|
+
) {
|
|
62
|
+
const classes = useStyles({ theme: tweakStyles });
|
|
66
63
|
|
|
67
|
-
|
|
68
|
-
if (isDisabled || isEmpty(files) || files?.length === 0) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
64
|
+
const [isDragOver, setIsDragOver] = useState(false);
|
|
71
65
|
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
const handleAdd = (files: FileList | null) => {
|
|
67
|
+
if (isDisabled || isEmpty(files) || files?.length === 0) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
74
70
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
setIsDragOver(true);
|
|
78
|
-
};
|
|
71
|
+
onAdd?.([...files]);
|
|
72
|
+
};
|
|
79
73
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
const handleDragStart: DragEventHandler<HTMLDivElement> = (event) => {
|
|
75
|
+
blockEvent(event);
|
|
76
|
+
setIsDragOver(true);
|
|
77
|
+
};
|
|
84
78
|
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
const handleDragStop: DragEventHandler<HTMLDivElement> = (event) => {
|
|
80
|
+
blockEvent(event);
|
|
81
|
+
setIsDragOver(false);
|
|
82
|
+
};
|
|
87
83
|
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
const handleDrop: DragEventHandler<HTMLDivElement> = (event) => {
|
|
85
|
+
handleDragStop(event);
|
|
90
86
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
};
|
|
87
|
+
handleAdd(event.dataTransfer.files);
|
|
88
|
+
};
|
|
94
89
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
onDragOver: handleDragStart,
|
|
99
|
-
onDragEnter: handleDragStart,
|
|
100
|
-
onDragLeave: handleDragStop,
|
|
101
|
-
onDrop: handleDrop,
|
|
102
|
-
}
|
|
103
|
-
: undefined;
|
|
90
|
+
const handleFileChange: ChangeEventHandler<HTMLInputElement> = (event) => {
|
|
91
|
+
handleAdd(event.target.files);
|
|
92
|
+
};
|
|
104
93
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
className={clsx(classes.inputWrapper, {
|
|
115
|
-
[classes.dragged]: isDragOver,
|
|
116
|
-
[classes.disabled]: isDisabled,
|
|
117
|
-
[classes.active]: isActive,
|
|
118
|
-
})}
|
|
119
|
-
{...dndHandlers}
|
|
120
|
-
>
|
|
121
|
-
{isReactNodeNotEmpty(text) && <div className={classes.text}>{text}</div>}
|
|
122
|
-
<label className={classes.inputLabel}>
|
|
123
|
-
<input
|
|
124
|
-
ref={ref}
|
|
125
|
-
type="file"
|
|
126
|
-
value=""
|
|
127
|
-
onChange={handleFileChange}
|
|
128
|
-
multiple={!isMultipleDisabled}
|
|
129
|
-
disabled={isDisabled}
|
|
130
|
-
accept={accept}
|
|
131
|
-
{...addDataTestId(testId, 'input')}
|
|
132
|
-
/>
|
|
133
|
-
</label>
|
|
134
|
-
</div>
|
|
135
|
-
)}
|
|
94
|
+
const dndHandlers =
|
|
95
|
+
!isDragAndDropDisabled && !isDisabled
|
|
96
|
+
? {
|
|
97
|
+
onDragOver: handleDragStart,
|
|
98
|
+
onDragEnter: handleDragStart,
|
|
99
|
+
onDragLeave: handleDragStop,
|
|
100
|
+
onDrop: handleDrop,
|
|
101
|
+
}
|
|
102
|
+
: undefined;
|
|
136
103
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
104
|
+
return (
|
|
105
|
+
<div className={classes.root} {...addDataAttributes(data, testId)}>
|
|
106
|
+
{isReactNodeNotEmpty(label) && (
|
|
107
|
+
<div className={clsx(classes.label, { [classes.requiredLabel]: isRequired })}>{label}</div>
|
|
108
|
+
)}
|
|
109
|
+
{!isReadOnly && (
|
|
110
|
+
<div
|
|
111
|
+
className={clsx(classes.inputWrapper, {
|
|
112
|
+
[classes.dragged]: isDragOver,
|
|
113
|
+
[classes.disabled]: isDisabled,
|
|
114
|
+
[classes.active]: isActive,
|
|
115
|
+
})}
|
|
116
|
+
{...dndHandlers}
|
|
117
|
+
>
|
|
118
|
+
{isReactNodeNotEmpty(text) && <div className={classes.text}>{text}</div>}
|
|
119
|
+
<label className={classes.inputLabel}>
|
|
120
|
+
<input
|
|
121
|
+
ref={ref}
|
|
122
|
+
type="file"
|
|
123
|
+
value=""
|
|
124
|
+
onChange={handleFileChange}
|
|
125
|
+
multiple={!isMultipleDisabled}
|
|
126
|
+
disabled={isDisabled}
|
|
127
|
+
accept={accept}
|
|
128
|
+
{...addDataTestId(testId, 'input')}
|
|
129
|
+
/>
|
|
130
|
+
</label>
|
|
131
|
+
</div>
|
|
132
|
+
)}
|
|
140
133
|
|
|
141
|
-
|
|
142
|
-
</div>
|
|
143
|
-
);
|
|
144
|
-
},
|
|
145
|
-
);
|
|
134
|
+
{isReactNodeNotEmpty(description) && <div className={classes.description}>{description}</div>}
|
|
146
135
|
|
|
147
|
-
|
|
136
|
+
<div className={classes.fileList}>{fileList}</div>
|
|
137
|
+
</div>
|
|
138
|
+
);
|
|
139
|
+
});
|
|
@@ -3,12 +3,11 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { filesize } from 'filesize';
|
|
4
4
|
import {
|
|
5
5
|
addClickHandler,
|
|
6
|
-
|
|
6
|
+
addDataAttributes,
|
|
7
7
|
isFunction,
|
|
8
8
|
isNotEmpty,
|
|
9
9
|
isReactNodeNotEmpty,
|
|
10
10
|
} from '@true-engineering/true-react-platform-helpers';
|
|
11
|
-
import { addDataAttributes } from '../../helpers';
|
|
12
11
|
import { useTweakStyles } from '../../hooks';
|
|
13
12
|
import { ICommonProps } from '../../types';
|
|
14
13
|
import { IIcon, renderIcon } from '../Icon';
|
|
@@ -104,8 +103,7 @@ export const FileItem: FC<IFileItemProps> = ({
|
|
|
104
103
|
className={clsx(classes.fileItemWrapper, classes[itemSize], {
|
|
105
104
|
[classes.disabled]: isDisabled,
|
|
106
105
|
})}
|
|
107
|
-
{...
|
|
108
|
-
{...addDataAttributes(data)}
|
|
106
|
+
{...addDataAttributes(data, testId)}
|
|
109
107
|
{...addClickHandler(handleClick, !isDisabled)}
|
|
110
108
|
>
|
|
111
109
|
<div className={classes.fileIcon}>{renderIcon(icon)}</div>
|
|
@@ -83,6 +83,8 @@ interface IFiltersPaneCustomProps<Values extends Record<string, unknown>, Conten
|
|
|
83
83
|
isSearchAutoSized: boolean;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
const tweakWrapperStyles = { name: { color: 'tomato' } };
|
|
87
|
+
|
|
86
88
|
const Story: FC<IFiltersPaneCustomProps<ConfigValues, unknown>> = ({
|
|
87
89
|
containerWidth,
|
|
88
90
|
isSearchDisabled,
|
|
@@ -216,6 +218,7 @@ const Story: FC<IFiltersPaneCustomProps<ConfigValues, unknown>> = ({
|
|
|
216
218
|
isClearable: isClearableFields,
|
|
217
219
|
options: [LONG_STRING, '2', '3'],
|
|
218
220
|
component: ({ filter, ...props }) => <FilterSelect {...props} {...filter} />,
|
|
221
|
+
tweakWrapperStyles,
|
|
219
222
|
},
|
|
220
223
|
};
|
|
221
224
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FC, useMemo } from 'react';
|
|
2
|
-
import { getTestId } from '@true-engineering/true-react-platform-helpers';
|
|
3
|
-
import { addDataAttributes } from '../../../../helpers';
|
|
2
|
+
import { getTestId, addDataAttributes } from '@true-engineering/true-react-platform-helpers';
|
|
4
3
|
import { useTweakStyles } from '../../../../hooks';
|
|
5
4
|
import { ICommonProps } from '../../../../types';
|
|
6
5
|
import { Button } from '../../../Button';
|
|
@@ -79,7 +78,7 @@ export const FilterInterval: FC<IFilterIntervalProps> = ({
|
|
|
79
78
|
});
|
|
80
79
|
|
|
81
80
|
return (
|
|
82
|
-
<div className={classes.root} {...addDataAttributes(data)}>
|
|
81
|
+
<div className={classes.root} {...addDataAttributes(data, testId)}>
|
|
83
82
|
<div className={classes.inputWrapper}>
|
|
84
83
|
<div>
|
|
85
84
|
<NumberInput
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { FC, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { isAfter, isBefore } from 'date-fns';
|
|
3
3
|
import { enUS, ru } from 'date-fns/locale';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
getTestId,
|
|
6
|
+
isNotEmpty,
|
|
7
|
+
addDataAttributes,
|
|
8
|
+
} from '@true-engineering/true-react-platform-helpers';
|
|
6
9
|
import { useTweakStyles } from '../../../../hooks';
|
|
7
10
|
import { ICommonProps } from '../../../../types';
|
|
8
11
|
import { Button } from '../../../Button';
|
|
@@ -127,7 +130,7 @@ export const FilterWithDates: FC<IFilterWithDatesProps> = ({
|
|
|
127
130
|
};
|
|
128
131
|
|
|
129
132
|
return (
|
|
130
|
-
<div className={classes.root} {...addDataAttributes(data)}>
|
|
133
|
+
<div className={classes.root} {...addDataAttributes(data, testId)}>
|
|
131
134
|
<div className={classes.container}>
|
|
132
135
|
<div className={classes.containerItem}>
|
|
133
136
|
<DatePicker
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getTestId,
|
|
6
6
|
isNotEmpty,
|
|
7
7
|
} from '@true-engineering/true-react-platform-helpers';
|
|
8
|
-
import { useTweakStyles } from '../../../../hooks';
|
|
8
|
+
import { useMixedStyles, useTweakStyles } from '../../../../hooks';
|
|
9
9
|
import { ICommonProps } from '../../../../types';
|
|
10
10
|
import { Icon } from '../../../Icon';
|
|
11
11
|
import { WithPopup } from '../../../WithPopup';
|
|
@@ -35,9 +35,10 @@ export function FilterWrapper<Values extends Record<string, unknown>, Key extend
|
|
|
35
35
|
localeKey,
|
|
36
36
|
data,
|
|
37
37
|
testId,
|
|
38
|
-
tweakStyles,
|
|
38
|
+
tweakStyles: baseTweakStyles,
|
|
39
39
|
onChange,
|
|
40
40
|
}: IFilterWrapperProps<Values, Key>): JSX.Element {
|
|
41
|
+
const tweakStyles = useMixedStyles(baseTweakStyles, filter.tweakWrapperStyles);
|
|
41
42
|
const classes = useStyles({ theme: tweakStyles });
|
|
42
43
|
|
|
43
44
|
const tweakWithPopupStyles = useTweakStyles({
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
IFilterSelectProps,
|
|
10
10
|
IFilterWithDatesProps,
|
|
11
11
|
IFilterWithPeriodProps,
|
|
12
|
+
IFilterWrapperStyles,
|
|
12
13
|
} from './components';
|
|
13
14
|
import { FilterLocales, PERIODS, SelectLocales } from './constants';
|
|
14
15
|
|
|
@@ -56,6 +57,7 @@ export interface IConfigItemBasicBase<Value> {
|
|
|
56
57
|
localeKey?: IFilterLocaleKey;
|
|
57
58
|
locale?: IPartialFilterLocale;
|
|
58
59
|
getSelectedValueView?: (v: Value) => ReactNode;
|
|
60
|
+
tweakWrapperStyles?: IFilterWrapperStyles;
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
export type IIntervalConfigItem<Value> = IConfigItemBasicBase<Value> & {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ReactNode, useCallback } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
applyAction,
|
|
5
|
+
isNotEmpty,
|
|
6
|
+
addDataAttributes,
|
|
7
|
+
} from '@true-engineering/true-react-platform-helpers';
|
|
5
8
|
import { ICommonProps } from '../../../../types';
|
|
6
9
|
import { Skeleton } from '../../../Skeleton';
|
|
7
10
|
import { TableRenders } from '../../constants';
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { ReactNode, useState,
|
|
1
|
+
import { ReactNode, useState, MouseEvent, RefCallback, useCallback } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
isEmpty,
|
|
5
|
+
isNotEmpty,
|
|
6
|
+
addDataAttributes,
|
|
7
|
+
} from '@true-engineering/true-react-platform-helpers';
|
|
8
|
+
import { genericMemo } from '../../../../helpers';
|
|
5
9
|
import { useTweakStyles } from '../../../../hooks';
|
|
6
10
|
import { IDataAttributes, ITweakStylesProps } from '../../../../types';
|
|
7
11
|
import { TableRenders } from '../../constants';
|
|
@@ -44,7 +48,7 @@ export interface IFlexibleTableRowProps<
|
|
|
44
48
|
onRowClick?: (id: Row[UniqueField]) => void;
|
|
45
49
|
}
|
|
46
50
|
|
|
47
|
-
function
|
|
51
|
+
export const FlexibleTableRow = genericMemo(function FlexibleTableRow<
|
|
48
52
|
Row extends ITableRow,
|
|
49
53
|
HeaderContent extends IHeaderContent<Row>,
|
|
50
54
|
UniqueField extends keyof Row,
|
|
@@ -189,6 +193,4 @@ function FlexibleTableRowInner<
|
|
|
189
193
|
)}
|
|
190
194
|
</>
|
|
191
195
|
);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export const FlexibleTableRow = memo(FlexibleTableRowInner) as typeof FlexibleTableRowInner;
|
|
196
|
+
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import {
|
|
4
|
-
import { addDataAttributes } from '../../helpers';
|
|
3
|
+
import { addDataAttributes } from '@true-engineering/true-react-platform-helpers';
|
|
5
4
|
import { ICommonProps } from '../../types';
|
|
6
5
|
import { renderIcon, IIcon } from '../Icon';
|
|
7
6
|
import { ThemedPreloader } from '../ThemedPreloader';
|
|
@@ -24,51 +23,48 @@ export interface IIconButtonProps
|
|
|
24
23
|
isLoading?: boolean;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
export const IconButton = forwardRef<HTMLButtonElement, IIconButtonProps>(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const classes = useStyles({ theme: tweakStyles });
|
|
26
|
+
export const IconButton = forwardRef<HTMLButtonElement, IIconButtonProps>(function IconButton(
|
|
27
|
+
{
|
|
28
|
+
icon,
|
|
29
|
+
size = 'm',
|
|
30
|
+
view = 'cancel-light',
|
|
31
|
+
isDisabled = false,
|
|
32
|
+
isActive = false,
|
|
33
|
+
isLoading = false,
|
|
34
|
+
type = 'button',
|
|
35
|
+
testId,
|
|
36
|
+
tweakStyles,
|
|
37
|
+
data,
|
|
38
|
+
onClick,
|
|
39
|
+
...restProps
|
|
40
|
+
},
|
|
41
|
+
ref,
|
|
42
|
+
) {
|
|
43
|
+
const classes = useStyles({ theme: tweakStyles });
|
|
46
44
|
|
|
47
|
-
|
|
45
|
+
const hasNoAction = isDisabled || isLoading;
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
{
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
);
|
|
47
|
+
return (
|
|
48
|
+
<button
|
|
49
|
+
ref={ref}
|
|
50
|
+
className={clsx(classes.root, classes[view], classes[size], {
|
|
51
|
+
[classes.disabled]: isDisabled,
|
|
52
|
+
[classes.active]: isActive,
|
|
53
|
+
[classes.loading]: isLoading,
|
|
54
|
+
})}
|
|
55
|
+
type={type}
|
|
56
|
+
disabled={isDisabled}
|
|
57
|
+
onClick={hasNoAction ? undefined : onClick}
|
|
58
|
+
{...restProps}
|
|
59
|
+
{...addDataAttributes(data, testId)}
|
|
60
|
+
>
|
|
61
|
+
{isLoading ? (
|
|
62
|
+
<span className={classes.loader}>
|
|
63
|
+
<ThemedPreloader type="default" useCurrentColor />
|
|
64
|
+
</span>
|
|
65
|
+
) : (
|
|
66
|
+
<span className={classes.icon}>{renderIcon(icon)}</span>
|
|
67
|
+
)}
|
|
68
|
+
</button>
|
|
69
|
+
);
|
|
70
|
+
});
|
|
@@ -8,28 +8,30 @@ export interface IInputProps
|
|
|
8
8
|
extends IInputBaseProps,
|
|
9
9
|
Pick<IWithMessagesProps, 'infoMessage' | 'errorMessage'> {}
|
|
10
10
|
|
|
11
|
-
export const Input = forwardRef<HTMLInputElement, IInputProps>(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
export const Input = forwardRef<HTMLInputElement, IInputProps>(function Input(
|
|
12
|
+
{ infoMessage, errorMessage, isInvalid, testId, tweakStyles, ...inputProps },
|
|
13
|
+
ref,
|
|
14
|
+
) {
|
|
15
|
+
const tweakWithMessagesStyles = useTweakStyles({
|
|
16
|
+
tweakStyles,
|
|
17
|
+
className: 'tweakWithMessages',
|
|
18
|
+
currentComponentName: 'Input',
|
|
19
|
+
});
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
);
|
|
21
|
+
return (
|
|
22
|
+
<WithMessages
|
|
23
|
+
errorMessage={errorMessage}
|
|
24
|
+
infoMessage={infoMessage}
|
|
25
|
+
testId={getTestId(testId, 'wrapper')}
|
|
26
|
+
tweakStyles={tweakWithMessagesStyles}
|
|
27
|
+
>
|
|
28
|
+
<InputBase
|
|
29
|
+
{...inputProps}
|
|
30
|
+
ref={ref}
|
|
31
|
+
testId={testId}
|
|
32
|
+
tweakStyles={tweakStyles}
|
|
33
|
+
isInvalid={isInvalid}
|
|
34
|
+
/>
|
|
35
|
+
</WithMessages>
|
|
36
|
+
);
|
|
37
|
+
});
|