@true-engineering/true-react-common-ui-kit 3.45.6 → 3.46.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "3.45.6",
3
+ "version": "3.46.0",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import { forwardRef } from 'react';
2
2
  import clsx from 'clsx';
3
3
  import {
4
4
  addClickHandler,
@@ -30,41 +30,39 @@ export interface ISearchInputProps
30
30
  onSearchIconClick?: () => void;
31
31
  }
32
32
 
33
- export const SearchInput: FC<ISearchInputProps> = ({
34
- isClearable = true,
35
- tweakStyles,
36
- testId,
37
- data,
38
- onSearchIconClick,
39
- ...props
40
- }) => {
41
- const classes = useStyles({ theme: tweakStyles });
33
+ export const SearchInput = forwardRef<HTMLInputElement, ISearchInputProps>(
34
+ ({ isClearable = true, tweakStyles, testId, data, onSearchIconClick, ...props }, ref) => {
35
+ const classes = useStyles({ theme: tweakStyles });
42
36
 
43
- const tweakInputStyles = useTweakStyles({
44
- innerStyles: inputStyles,
45
- tweakStyles,
46
- className: 'tweakInput',
47
- currentComponentName: 'SearchInput',
48
- });
37
+ const tweakInputStyles = useTweakStyles({
38
+ innerStyles: inputStyles,
39
+ tweakStyles,
40
+ className: 'tweakInput',
41
+ currentComponentName: 'SearchInput',
42
+ });
49
43
 
50
- return (
51
- <div className={classes.root} {...addDataAttributes(data, testId)}>
52
- <div
53
- className={clsx(classes.icon, { [classes.iconClickable]: isNotEmpty(onSearchIconClick) })}
54
- {...addClickHandler(onSearchIconClick)}
55
- >
56
- <Icon type="search" />
44
+ return (
45
+ <div className={classes.root} {...addDataAttributes(data, testId)}>
46
+ <div
47
+ className={clsx(classes.icon, { [classes.iconClickable]: isNotEmpty(onSearchIconClick) })}
48
+ {...addClickHandler(onSearchIconClick)}
49
+ >
50
+ <Icon type="search" />
51
+ </div>
52
+ <Input
53
+ ref={ref}
54
+ inputMode="search"
55
+ isClearable={isClearable}
56
+ isActive={props.value !== '' && props.value !== undefined}
57
+ testId={getTestId(testId, 'input')}
58
+ tweakStyles={tweakInputStyles}
59
+ hasFloatingLabel={false}
60
+ label={props.placeholder}
61
+ {...props}
62
+ />
57
63
  </div>
58
- <Input
59
- inputMode="search"
60
- isClearable={isClearable}
61
- isActive={props.value !== '' && props.value !== undefined}
62
- testId={getTestId(testId, 'input')}
63
- tweakStyles={tweakInputStyles}
64
- hasFloatingLabel={false}
65
- label={props.placeholder}
66
- {...props}
67
- />
68
- </div>
69
- );
70
- };
64
+ );
65
+ },
66
+ );
67
+
68
+ SearchInput.displayName = 'SearchInput';