@true-engineering/true-react-common-ui-kit 1.3.1 → 1.4.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.
@@ -1,6 +1,6 @@
1
- import { FormEvent, FocusEvent, KeyboardEvent, ClipboardEvent } from 'react';
1
+ import { FormEvent, FocusEvent, KeyboardEvent, ClipboardEvent, ReactElement } from 'react';
2
2
  import { Props as ReactInputMaskProps } from 'react-input-mask';
3
- import { IIconProps } from '../Icon';
3
+ import { IIconType } from '../Icon';
4
4
  import { ICommonProps } from '../../types';
5
5
  import { InputStyles } from './Input.styles';
6
6
  export declare const DEFAULT_SIZE = 6;
@@ -25,7 +25,7 @@ export interface IInputProps extends ICommonProps {
25
25
  isLoading?: boolean;
26
26
  isAutoSizeable?: boolean;
27
27
  defaultSize?: number;
28
- iconType?: IIconProps['type'];
28
+ iconType?: IIconType | ReactElement;
29
29
  units?: string;
30
30
  name?: string;
31
31
  mask?: ReactInputMaskProps['mask'];
@@ -180,7 +180,7 @@ export declare class ScrollIntoViewIfNeeded extends PureComponent<IScrollIntoVie
180
180
  'aria-expanded'?: (boolean | "false" | "true") | undefined;
181
181
  'aria-flowto'?: string | undefined;
182
182
  'aria-grabbed'?: (boolean | "false" | "true") | undefined;
183
- 'aria-haspopup'?: boolean | "grid" | "menu" | "listbox" | "false" | "true" | "dialog" | "tree" | undefined;
183
+ 'aria-haspopup'?: boolean | "grid" | "menu" | "dialog" | "listbox" | "false" | "true" | "tree" | undefined;
184
184
  'aria-hidden'?: (boolean | "false" | "true") | undefined;
185
185
  'aria-invalid'?: boolean | "false" | "true" | "grammar" | "spelling" | undefined;
186
186
  'aria-keyshortcuts'?: string | undefined;
@@ -1,9 +1,10 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactNode, SyntheticEvent } from 'react';
2
2
  import { IInputProps } from '../Input';
3
3
  import { IIconType } from '../Icon';
4
4
  import { IDropdownWithPopperOptions } from '../../types';
5
5
  import { SelectStyles } from './Select.styles';
6
- export interface ISelectProps<Value> extends Omit<IInputProps, 'value' | 'onChange' | 'type'> {
6
+ import { ISearchInputProps } from '../SearchInput';
7
+ export interface ISelectProps<Value> extends Omit<IInputProps, 'value' | 'onChange' | 'onBlur' | 'type'> {
7
8
  tweakStyles?: SelectStyles;
8
9
  defaultOptionLabel?: string;
9
10
  noMatchesLabel?: string;
@@ -16,8 +17,12 @@ export interface ISelectProps<Value> extends Omit<IInputProps, 'value' | 'onChan
16
17
  options: Value[];
17
18
  value: Value | undefined;
18
19
  shouldScrollToList?: boolean;
20
+ searchInput?: {
21
+ shouldRenderInList: true;
22
+ } & Pick<ISearchInputProps, 'placeholder'>;
19
23
  isOptionDisabled?(option: Value): boolean;
20
24
  onChange(value: Value | undefined): void;
25
+ onBlur?(event: Event | SyntheticEvent): void;
21
26
  onType?(value: string): Promise<void>;
22
27
  optionsFilter?(options: Value[], query: string): Value[];
23
28
  onOpen?(): void;
@@ -26,4 +31,4 @@ export interface ISelectProps<Value> extends Omit<IInputProps, 'value' | 'onChan
26
31
  convertValueToReactNode?(value: Value, isDisabled: boolean): ReactNode;
27
32
  convertValueToId?(value: Value): string | undefined;
28
33
  }
29
- export declare function Select<Value>({ options, value, defaultOptionLabel, debounceTime, optionsMode, noMatchesLabel, loadingLabel, tweakStyles, testId, isDisabled, dropdownOptions, minSymbolsCountToOpenList, dropdownIcon, shouldScrollToList, onChange, onFocus, onBlur, onType, onOpen, isOptionDisabled, compareValuesOnChange, convertValueToString, convertValueToId, convertValueToReactNode, optionsFilter, ...inputProps }: ISelectProps<Value>): JSX.Element;
34
+ export declare function Select<Value>({ options, value, defaultOptionLabel, debounceTime, optionsMode, noMatchesLabel, loadingLabel, tweakStyles, testId, isDisabled, dropdownOptions, minSymbolsCountToOpenList, dropdownIcon, shouldScrollToList, searchInput, onChange, onFocus, onBlur, onType, onOpen, isOptionDisabled, compareValuesOnChange, convertValueToString, convertValueToId, convertValueToReactNode, optionsFilter, ...inputProps }: ISelectProps<Value>): JSX.Element;
@@ -57,5 +57,15 @@ export declare const styles: {
57
57
  };
58
58
  };
59
59
  tweakSelectList: {};
60
+ tweakSearchInput: {
61
+ tweakInput: {
62
+ inputWrapper: {
63
+ height: number;
64
+ borderRadius: number;
65
+ border: string;
66
+ backgroundColor: string;
67
+ };
68
+ };
69
+ };
60
70
  };
61
71
  export declare type SelectStyles = ComponentStyles<typeof styles>;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { ReactNode, MouseEvent } from 'react';
2
2
  import { ICommonProps } from '../../../types';
3
3
  import { SelectListStyles } from './SelectList.styles';
4
4
  export interface ISelectListProps<Value> extends ICommonProps {
@@ -12,10 +12,11 @@ export interface ISelectListProps<Value> extends ICommonProps {
12
12
  defaultOptionLabel?: string;
13
13
  testId?: string;
14
14
  shouldScrollToList?: boolean;
15
- onOptionClick(index: number): void;
15
+ customListHeader?: ReactNode;
16
+ onOptionClick(index: number, event: MouseEvent<HTMLElement>): void;
16
17
  isOptionDisabled(value: Value): boolean;
17
18
  convertValueToString(value: Value): string | undefined;
18
19
  convertValueToReactNode?(value: Value, isDisabled: boolean): ReactNode;
19
20
  convertValueToId?(value: Value): string | undefined;
20
21
  }
21
- export declare function SelectList<Value>({ options, focusedIndex, activeValue, defaultOptionLabel, noMatchesLabel, isLoading, loadingLabel, tweakStyles, testId, shouldScrollToList, isOptionDisabled, onOptionClick, convertValueToString, convertValueToReactNode, convertValueToId, }: ISelectListProps<Value>): JSX.Element;
22
+ export declare function SelectList<Value>({ options, focusedIndex, activeValue, defaultOptionLabel, noMatchesLabel, isLoading, loadingLabel, tweakStyles, testId, shouldScrollToList, customListHeader, isOptionDisabled, onOptionClick, convertValueToString, convertValueToReactNode, convertValueToId, }: ISelectListProps<Value>): JSX.Element;
@@ -7,6 +7,15 @@ export declare const styles: {
7
7
  boxSizing: string;
8
8
  padding: number[];
9
9
  fontSize: number;
10
+ overflow: string;
11
+ };
12
+ withListHeader: {
13
+ paddingTop: number;
14
+ };
15
+ listHeader: {
16
+ '& + $list': {
17
+ borderTop: (string | number)[];
18
+ };
10
19
  };
11
20
  list: {
12
21
  height: string;
@@ -0,0 +1,3 @@
1
+ import { IIconType } from '../components';
2
+ import { ReactElement, ReactNode } from 'react';
3
+ export declare const renderIcon: (icon: IIconType | ReactElement) => ReactNode;
@@ -1,4 +1,5 @@
1
1
  export declare const transformToKebab: (string: string) => string;
2
+ export declare const hasExactParent: (element: Element, parent: Element) => boolean;
2
3
  export declare const getParentNode: (element: Element | ShadowRoot) => Element;
3
4
  export declare const getStyleComputedProperty: (element: Element) => Partial<CSSStyleDeclaration>;
4
5
  export declare const getScrollParent: (element: Element | Document) => Element;
@@ -3,9 +3,9 @@ import usePopper, { VirtualElement } from 'react-overlays/usePopper';
3
3
  import { IDropdownWithPopperOptions } from '../types';
4
4
  export declare const useDropdown: ({ isOpen, onDropdownClose, referenceElement, dropdownElement, options, dependenciesForPositionUpdating, }: {
5
5
  isOpen: boolean;
6
- onDropdownClose: () => void;
7
6
  referenceElement: VirtualElement | null | undefined;
8
7
  dropdownElement: HTMLElement | null | undefined;
9
8
  options?: IDropdownWithPopperOptions | undefined;
10
9
  dependenciesForPositionUpdating?: DependencyList | undefined;
10
+ onDropdownClose(event: Event): void;
11
11
  }) => ReturnType<typeof usePopper> | undefined;
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from './components';
3
3
  export * from './hooks';
4
4
  export * from './types';
5
5
  export * from './helpers';
6
+ export * from './helpers/snippets';