@true-engineering/true-react-common-ui-kit 3.44.1 → 3.45.1

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.44.1",
3
+ "version": "3.45.1",
4
4
  "description": "True Engineering React UI Kit with theming support",
5
5
  "author": "True Engineering (https://trueengineering.ru)",
6
6
  "keywords": [
@@ -13,6 +13,7 @@ export type IInputHTMLBaseProps = Pick<
13
13
  | 'tabIndex'
14
14
  | 'placeholder'
15
15
  | 'type'
16
+ | 'inputMode'
16
17
  | 'onBlur'
17
18
  | 'onFocus'
18
19
  | 'onInput'
@@ -1,5 +1,5 @@
1
1
  import { rgba } from '../../helpers';
2
- import { colors, ITweakStyles, createThemedStyles } from '../../theme';
2
+ import { colors, createThemedStyles, ITweakStyles } from '../../theme';
3
3
  import { IInputStyles } from '../Input';
4
4
 
5
5
  const LEFT_PADDING = 44;
@@ -19,6 +19,10 @@ export const useStyles = createThemedStyles('SearchInput', {
19
19
  zIndex: 2,
20
20
  color: colors.GREY_ACTIVE,
21
21
  },
22
+
23
+ iconClickable: {
24
+ cursor: 'pointer',
25
+ },
22
26
  });
23
27
 
24
28
  export const inputStyles: IInputStyles = {
@@ -1,31 +1,41 @@
1
1
  import { FC } from 'react';
2
- import { addDataTestId, getTestId } from '@true-engineering/true-react-platform-helpers';
3
- import { addDataAttributes } from '../../helpers';
2
+ import clsx from 'clsx';
3
+ import {
4
+ addClickHandler,
5
+ addDataAttributes,
6
+ getTestId,
7
+ isNotEmpty,
8
+ } from '@true-engineering/true-react-platform-helpers';
4
9
  import { useTweakStyles } from '../../hooks';
5
10
  import { ICommonProps } from '../../types';
6
11
  import { Icon } from '../Icon';
7
12
  import { IInputProps, Input } from '../Input';
8
- import { useStyles, inputStyles, ISearchInputStyles } from './SearchInput.styles';
13
+ import { inputStyles, ISearchInputStyles, useStyles } from './SearchInput.styles';
9
14
 
10
- export type ISearchInputProps = Omit<
11
- IInputProps,
12
- | 'type'
13
- | 'isInvalid'
14
- | 'errorMessage'
15
- | 'label'
16
- | 'isActive'
17
- | 'errorPosition'
18
- | 'hasFloatingLabel'
19
- | 'border'
20
- | 'tweakStyles'
21
- > &
22
- ICommonProps<ISearchInputStyles>;
15
+ export interface ISearchInputProps
16
+ extends ICommonProps<ISearchInputStyles>,
17
+ Omit<
18
+ IInputProps,
19
+ | 'type'
20
+ | 'isInvalid'
21
+ | 'errorMessage'
22
+ | 'label'
23
+ | 'isActive'
24
+ | 'errorPosition'
25
+ | 'hasFloatingLabel'
26
+ | 'border'
27
+ | 'tweakStyles'
28
+ > {
29
+ // TODO: Можно будет удалить в 4й версии
30
+ onSearchIconClick?: () => void;
31
+ }
23
32
 
24
33
  export const SearchInput: FC<ISearchInputProps> = ({
25
34
  isClearable = true,
26
35
  tweakStyles,
27
36
  testId,
28
37
  data,
38
+ onSearchIconClick,
29
39
  ...props
30
40
  }) => {
31
41
  const classes = useStyles({ theme: tweakStyles });
@@ -38,11 +48,15 @@ export const SearchInput: FC<ISearchInputProps> = ({
38
48
  });
39
49
 
40
50
  return (
41
- <div className={classes.root} {...addDataTestId(testId)} {...addDataAttributes(data)}>
42
- <div className={classes.icon}>
51
+ <div className={classes.root} {...addDataAttributes(data, testId)}>
52
+ <div
53
+ className={clsx(classes.icon, { [classes.iconClickable]: isNotEmpty(onSearchIconClick) })}
54
+ {...addClickHandler(onSearchIconClick)}
55
+ >
43
56
  <Icon type="search" />
44
57
  </div>
45
58
  <Input
59
+ inputMode="search"
46
60
  isClearable={isClearable}
47
61
  isActive={props.value !== '' && props.value !== undefined}
48
62
  testId={getTestId(testId, 'input')}