@true-engineering/true-react-common-ui-kit 3.44.0 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@true-engineering/true-react-common-ui-kit",
3
- "version": "3.44.0",
3
+ "version": "3.45.0",
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,31 +1,39 @@
1
1
  import { FC } from 'react';
2
- import { addDataTestId, getTestId } from '@true-engineering/true-react-platform-helpers';
3
- import { addDataAttributes } from '../../helpers';
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 { useStyles, inputStyles, ISearchInputStyles } from './SearchInput.styles';
11
+ import { inputStyles, ISearchInputStyles, useStyles } from './SearchInput.styles';
9
12
 
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>;
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} {...addDataTestId(testId)} {...addDataAttributes(data)}>
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')}
@@ -182,7 +182,7 @@ export const WithPopup: FC<IWithPopupProps> = ({
182
182
  )}
183
183
  {isMounted && (
184
184
  <FloatingPortal
185
- root={!shouldRenderInBody ? (refs.reference.current as HTMLElement) : undefined}
185
+ root={shouldRenderInBody ? document.body : (refs.reference.current as HTMLElement)}
186
186
  >
187
187
  <div
188
188
  ref={refs.setFloating}