@true-engineering/true-react-common-ui-kit 3.44.1 → 3.45.0
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 +7 -0
- package/dist/components/Input/types.d.ts +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +3 -1
- package/dist/components/SearchInput/SearchInput.stories.d.ts +1 -8
- package/dist/true-react-common-ui-kit.js +9 -6
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +9 -6
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/Input/types.ts +1 -0
- package/src/components/SearchInput/SearchInput.tsx +27 -18
package/package.json
CHANGED
|
@@ -1,31 +1,39 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
addClickHandler,
|
|
4
|
+
addDataAttributes,
|
|
5
|
+
getTestId,
|
|
6
|
+
} from '@true-engineering/true-react-platform-helpers';
|
|
4
7
|
import { useTweakStyles } from '../../hooks';
|
|
5
8
|
import { ICommonProps } from '../../types';
|
|
6
9
|
import { Icon } from '../Icon';
|
|
7
10
|
import { IInputProps, Input } from '../Input';
|
|
8
|
-
import {
|
|
11
|
+
import { inputStyles, ISearchInputStyles, useStyles } from './SearchInput.styles';
|
|
9
12
|
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
export interface ISearchInputProps
|
|
14
|
+
extends ICommonProps<ISearchInputStyles>,
|
|
15
|
+
Omit<
|
|
16
|
+
IInputProps,
|
|
17
|
+
| 'type'
|
|
18
|
+
| 'isInvalid'
|
|
19
|
+
| 'errorMessage'
|
|
20
|
+
| 'label'
|
|
21
|
+
| 'isActive'
|
|
22
|
+
| 'errorPosition'
|
|
23
|
+
| 'hasFloatingLabel'
|
|
24
|
+
| 'border'
|
|
25
|
+
| 'tweakStyles'
|
|
26
|
+
> {
|
|
27
|
+
// TODO: Можно будет удалить в 4й версии
|
|
28
|
+
onSearchIconClick?: () => void;
|
|
29
|
+
}
|
|
23
30
|
|
|
24
31
|
export const SearchInput: FC<ISearchInputProps> = ({
|
|
25
32
|
isClearable = true,
|
|
26
33
|
tweakStyles,
|
|
27
34
|
testId,
|
|
28
35
|
data,
|
|
36
|
+
onSearchIconClick,
|
|
29
37
|
...props
|
|
30
38
|
}) => {
|
|
31
39
|
const classes = useStyles({ theme: tweakStyles });
|
|
@@ -38,11 +46,12 @@ export const SearchInput: FC<ISearchInputProps> = ({
|
|
|
38
46
|
});
|
|
39
47
|
|
|
40
48
|
return (
|
|
41
|
-
<div className={classes.root} {...
|
|
42
|
-
<div className={classes.icon}>
|
|
49
|
+
<div className={classes.root} {...addDataAttributes(data, testId)}>
|
|
50
|
+
<div className={classes.icon} {...addClickHandler(onSearchIconClick)}>
|
|
43
51
|
<Icon type="search" />
|
|
44
52
|
</div>
|
|
45
53
|
<Input
|
|
54
|
+
inputMode="search"
|
|
46
55
|
isClearable={isClearable}
|
|
47
56
|
isActive={props.value !== '' && props.value !== undefined}
|
|
48
57
|
testId={getTestId(testId, 'input')}
|