@true-engineering/true-react-common-ui-kit 2.1.1 → 2.2.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.
Files changed (50) hide show
  1. package/dist/components/Button/Button.d.ts +3 -4
  2. package/dist/components/Input/Input.d.ts +3 -4
  3. package/dist/components/List/List.d.ts +3 -4
  4. package/dist/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.d.ts +4 -4
  5. package/dist/components/Select/Select.d.ts +2 -3
  6. package/dist/helpers/deprecated.d.ts +12 -0
  7. package/dist/helpers/index.d.ts +2 -2
  8. package/dist/helpers/misc.d.ts +19 -0
  9. package/dist/helpers/snippets.d.ts +3 -3
  10. package/dist/true-react-common-ui-kit.js +238 -308
  11. package/dist/true-react-common-ui-kit.js.map +1 -1
  12. package/dist/true-react-common-ui-kit.umd.cjs +238 -309
  13. package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
  14. package/dist/types.d.ts +3 -1
  15. package/package.json +2 -1
  16. package/src/components/Button/Button.tsx +9 -29
  17. package/src/components/Checkbox/Checkbox.tsx +7 -2
  18. package/src/components/DatePicker/DatePicker.tsx +6 -1
  19. package/src/components/DatePicker/helpers.ts +5 -1
  20. package/src/components/FiltersPane/FilterSelect/FilterSelect.tsx +3 -2
  21. package/src/components/FiltersPane/FilterWithDates/FilterWithDates.tsx +2 -1
  22. package/src/components/IncrementInput/IncrementInput.tsx +3 -2
  23. package/src/components/Input/Input.tsx +15 -10
  24. package/src/components/List/List.tsx +13 -10
  25. package/src/components/Modal/Modal.tsx +8 -3
  26. package/src/components/MoreMenu/MoreMenu.tsx +3 -2
  27. package/src/components/Notification/Notification.tsx +11 -7
  28. package/src/components/NumberInput/NumberInput.tsx +2 -2
  29. package/src/components/NumberInput/helpers.ts +3 -2
  30. package/src/components/RadioButton/RadioButton.tsx +3 -2
  31. package/src/components/ScrollIntoViewIfNeeded/ScrollIntoViewIfNeeded.ts +4 -4
  32. package/src/components/SearchInput/SearchInput.tsx +2 -1
  33. package/src/components/Select/MultiSelect.stories.tsx +2 -2
  34. package/src/components/Select/Select.stories.tsx +2 -2
  35. package/src/components/Select/Select.tsx +8 -8
  36. package/src/components/Select/SelectList/SelectList.tsx +11 -5
  37. package/src/components/Select/SelectListItem/SelectListItem.tsx +2 -1
  38. package/src/components/Select/helpers.ts +1 -1
  39. package/src/components/Switch/Switch.tsx +3 -2
  40. package/src/components/Toaster/Toaster.tsx +10 -5
  41. package/src/helpers/deprecated.ts +22 -0
  42. package/src/helpers/index.ts +2 -2
  43. package/src/helpers/{utils.ts → misc.ts} +11 -84
  44. package/src/helpers/phone.ts +5 -5
  45. package/src/helpers/snippets.tsx +4 -3
  46. package/src/types.ts +10 -1
  47. package/dist/helpers/colors.d.ts +0 -2
  48. package/dist/helpers/utils.d.ts +0 -43
  49. package/src/helpers/colors.ts +0 -3
  50. package/src/helpers/dateHelpers/date-helpers.ts +0 -9
@@ -1,6 +1,5 @@
1
- import { ReactElement, ReactNode, ButtonHTMLAttributes, MouseEvent } from 'react';
2
- import { ICommonProps } from '../../types';
3
- import { IIconType } from '../Icon';
1
+ import { ReactNode, ButtonHTMLAttributes, MouseEvent } from 'react';
2
+ import { ICommonProps, IIcon } from '../../types';
4
3
  import { IThemedPreloaderProps } from '../ThemedPreloader';
5
4
  import { ButtonStyles } from './Button.styles';
6
5
  export declare type IButtonSize = 's' | 'm' | 'l' | 'xl';
@@ -47,7 +46,7 @@ export interface IButtonProps extends ICommonProps {
47
46
  * @default false
48
47
  */
49
48
  isActive?: boolean;
50
- icon?: IIconType | ReactElement;
49
+ icon?: IIcon;
51
50
  /**
52
51
  * @default `left`
53
52
  */
@@ -1,7 +1,6 @@
1
- import { FormEvent, FocusEvent, KeyboardEvent, ClipboardEvent, ReactElement } from 'react';
1
+ import { FormEvent, FocusEvent, KeyboardEvent, ClipboardEvent } from 'react';
2
2
  import { Props as ReactInputMaskBaseProps } from 'react-input-mask';
3
- import { ICommonProps } from '../../types';
4
- import { IIconType } from '../Icon';
3
+ import { ICommonProps, IIcon } from '../../types';
5
4
  import { InputStyles } from './Input.styles';
6
5
  export declare const DEFAULT_SIZE = 6;
7
6
  declare type IReactInputMaskProps = Pick<Partial<ReactInputMaskBaseProps>, 'mask' | 'maskPlaceholder' | 'alwaysShowMask' | 'beforeMaskedStateChange'>;
@@ -43,7 +42,7 @@ export interface IInputProps extends ICommonProps, IReactInputMaskProps {
43
42
  * @default 6
44
43
  */
45
44
  defaultSize?: number;
46
- iconType?: IIconType | ReactElement;
45
+ iconType?: IIcon;
47
46
  units?: string;
48
47
  name?: string;
49
48
  hasRequiredLabel?: boolean;
@@ -1,10 +1,9 @@
1
- import { FC, ReactElement, ReactNode } from 'react';
2
- import { ICommonProps } from '../../types';
3
- import { IIconType } from '../Icon';
1
+ import { FC, ReactNode } from 'react';
2
+ import { ICommonProps, IIcon } from '../../types';
4
3
  import { ListStyles } from './List.styles';
5
4
  export interface IListItem {
6
5
  item: ReactNode;
7
- icon?: IIconType | ReactElement;
6
+ icon?: IIcon;
8
7
  disabled?: boolean;
9
8
  shouldDrawSpacerAbove?: boolean;
10
9
  shouldDrawSpacerBelow?: boolean;
@@ -1,13 +1,13 @@
1
- import { PureComponent } from 'react';
1
+ import { HTMLProps, PureComponent, ReactNode, RefObject } from 'react';
2
2
  import { StandardBehaviorOptions } from 'scroll-into-view-if-needed';
3
- interface IScrollIntoViewIfNeededProps extends React.HTMLProps<HTMLElement> {
3
+ interface IScrollIntoViewIfNeededProps extends HTMLProps<HTMLElement> {
4
4
  active?: boolean;
5
- children?: React.ReactNode;
5
+ children?: ReactNode;
6
6
  elementType?: string;
7
7
  options?: StandardBehaviorOptions;
8
8
  }
9
9
  export declare class ScrollIntoViewIfNeeded extends PureComponent<IScrollIntoViewIfNeededProps> {
10
- node: React.RefObject<HTMLElement>;
10
+ node: RefObject<HTMLElement>;
11
11
  static defaultProps: IScrollIntoViewIfNeededProps;
12
12
  componentDidMount(): void;
13
13
  componentDidUpdate({ active }: IScrollIntoViewIfNeededProps): void;
@@ -1,6 +1,5 @@
1
1
  import { ReactNode, SyntheticEvent } from 'react';
2
- import { IDropdownWithPopperOptions } from '../../types';
3
- import { IIconType } from '../Icon';
2
+ import { IDropdownWithPopperOptions, IIcon } from '../../types';
4
3
  import { IInputProps } from '../Input';
5
4
  import { ISearchInputProps } from '../SearchInput';
6
5
  import { SelectStyles } from './Select.styles';
@@ -15,7 +14,7 @@ export interface ISelectProps<Value> extends Omit<IInputProps, 'value' | 'onChan
15
14
  debounceTime?: number;
16
15
  minSymbolsCountToOpenList?: number;
17
16
  dropdownOptions?: IDropdownWithPopperOptions;
18
- dropdownIcon?: IIconType;
17
+ dropdownIcon?: IIcon;
19
18
  options: Value[];
20
19
  value: Value | undefined;
21
20
  shouldScrollToList?: boolean;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ export declare const isInt: (value: number) => boolean;
3
+ export declare const addClickHandler: (cb?: ((e: import("react").MouseEvent<Element, MouseEvent> | import("react").KeyboardEvent<Element>) => void) | undefined, hasAction?: boolean | undefined) => import("react").HTMLAttributes<unknown>;
4
+ export declare const addDataTestId: (testId: string | undefined, postfix?: string | number | undefined) => {
5
+ 'data-testid': string;
6
+ } | undefined;
7
+ export declare const createFilter: <T>(getter: (item: T) => (string | undefined)[], compareFn?: ((item: string, query: string) => boolean) | undefined) => (items: T[], query: string) => T[];
8
+ export declare const getSelectKeyHandler: (cb: (e: import("react").KeyboardEvent<Element>) => void) => (e: import("react").KeyboardEvent<Element>) => void;
9
+ export declare const getTestId: (testId: string | undefined, postfix?: string | number | undefined) => string | undefined;
10
+ export declare const isStringNotEmpty: <T extends string>(value: T | null | undefined) => value is T;
11
+ export declare const isEmpty: <T>(value: T | null | undefined) => value is null | undefined;
12
+ export declare const isNotEmpty: <T>(val: T | null | undefined) => val is T;
@@ -1,4 +1,4 @@
1
- export * from './colors';
2
- export * from './utils';
3
1
  export * from './popper-helpers';
4
2
  export * from './phone';
3
+ export * from './misc';
4
+ export * from './deprecated';
@@ -0,0 +1,19 @@
1
+ import hexToRgba from 'hex-to-rgba';
2
+ import { IDataAttributes } from '../types';
3
+ export declare const rgba: typeof hexToRgba;
4
+ export declare const transformToKebab: (string: string) => string;
5
+ export declare const hasExactParent: (element: Element, parent: Element) => boolean;
6
+ export declare const getParentNode: (element: Element | ShadowRoot | Document) => Element;
7
+ export declare const getStyleComputedProperty: (element: Element) => Partial<CSSStyleDeclaration>;
8
+ export declare const getScrollParent: (element: Element | Document) => Element;
9
+ export declare const isElementOffScreen: (element: HTMLElement, input?: HTMLElement) => boolean;
10
+ export declare const getNumberInRange: (value: number, min?: number, max?: number) => number;
11
+ export declare const formatStringNumber: (val?: string, separator?: string) => string;
12
+ export declare const formatNumber: (val?: number, separator?: string) => string;
13
+ export declare const removeStringFormat: (val?: string) => string;
14
+ export declare const stringToNumber: (val?: string) => number | undefined;
15
+ export declare const setCaretPosition: (elem: HTMLInputElement, caretPos: number | null) => void;
16
+ export declare const isSpaceChar: (char?: string) => boolean;
17
+ export declare const getNumberLength: (n?: number) => number;
18
+ export declare const trimStringToMaxLength: (val: string, maxLength: number) => string;
19
+ export declare const addDataAttributes: (data?: IDataAttributes) => IDataAttributes;
@@ -1,3 +1,3 @@
1
- import { ReactElement, ReactNode } from 'react';
2
- import { IIconType } from '../components';
3
- export declare const renderIcon: (icon: IIconType | ReactElement) => ReactNode;
1
+ import { ReactNode } from 'react';
2
+ import { IIcon } from '../types';
3
+ export declare const renderIcon: (icon: IIcon) => ReactNode;