@livechat/design-system-react-components 1.17.1 → 1.19.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 (28) hide show
  1. package/dist/components/ActionMenu/ActionMenu.d.ts +2 -55
  2. package/dist/components/ActionMenu/types.d.ts +57 -0
  3. package/dist/components/Button/Button.d.ts +1 -1
  4. package/dist/components/Search/Search.d.ts +4 -0
  5. package/dist/components/Skeleton/SkeletonAvatar.d.ts +16 -0
  6. package/dist/components/Skeleton/SkeletonText.d.ts +16 -0
  7. package/dist/components/Skeleton/SkeletonWrapper.d.ts +16 -0
  8. package/dist/components/Skeleton/index.d.ts +3 -0
  9. package/dist/components/Tag/Tag.d.ts +1 -48
  10. package/dist/components/Tag/index.d.ts +1 -1
  11. package/dist/components/Tag/types.d.ts +52 -0
  12. package/dist/components/TagInput/TagInput.d.ts +2 -39
  13. package/dist/components/TagInput/{EditableTag.d.ts → components/EditableTag.d.ts} +2 -0
  14. package/dist/components/TagInput/components/EmailTagInput.d.ts +5 -0
  15. package/dist/components/TagInput/index.d.ts +3 -3
  16. package/dist/components/TagInput/types.d.ts +41 -0
  17. package/dist/components/Typography/Display.d.ts +5 -1
  18. package/dist/components/Typography/Heading.d.ts +5 -1
  19. package/dist/components/Typography/Text.d.ts +5 -1
  20. package/dist/components/Typography/types.d.ts +1 -0
  21. package/dist/foundations/design-token.d.ts +69 -0
  22. package/dist/index.cjs.js +1 -1
  23. package/dist/index.es.js +1845 -1748
  24. package/dist/preview-stats.json +399 -396
  25. package/dist/style.css +1 -1
  26. package/package.json +5 -4
  27. package/dist/components/TagInput/EmailTagInput.d.ts +0 -5
  28. /package/dist/components/TagInput/{EditableTagContent.d.ts → components/EditableTagContent.d.ts} +0 -0
@@ -1,56 +1,3 @@
1
1
  import * as React from 'react';
2
- import { Placement, flip, Strategy } from '@floating-ui/react';
3
- import { ComponentCoreProps } from '../../utils/types';
4
- import { IActionMenuOption } from './types';
5
- export interface ActionMenuProps extends ComponentCoreProps {
6
- /**
7
- * The CSS class for trigger container
8
- */
9
- triggerClassName?: string;
10
- /**
11
- * Array of menu options
12
- */
13
- options: IActionMenuOption[];
14
- /**
15
- * Array of selected menu options keys
16
- */
17
- selectedOptions?: string[];
18
- /**
19
- * Trigger element
20
- */
21
- triggerRenderer: React.ReactElement;
22
- /**
23
- * The menu placement
24
- */
25
- placement?: Placement;
26
- /**
27
- * Will open menu on component initialization
28
- */
29
- openedOnInit?: boolean;
30
- /**
31
- * Menu will stay open after option click
32
- */
33
- keepOpenOnClick?: boolean;
34
- /**
35
- * Set the menu placement to keep it in view
36
- */
37
- flipOptions?: Parameters<typeof flip>[0];
38
- /**
39
- * Set to control the menu visibility
40
- */
41
- visible?: boolean;
42
- /**
43
- * Optional handler called on menu close
44
- */
45
- onClose?: () => void;
46
- /**
47
- * Optional handler called on menu open
48
- */
49
- onOpen?: () => void;
50
- /**
51
- * Set the type of CSS position property to use
52
- * https://floating-ui.com/docs/usefloating#strategy
53
- */
54
- floatingStrategy?: Strategy;
55
- }
56
- export declare const ActionMenu: React.FC<ActionMenuProps>;
2
+ import { IActionMenuProps } from './types';
3
+ export declare const ActionMenu: React.FC<IActionMenuProps>;
@@ -1,4 +1,6 @@
1
1
  import * as React from 'react';
2
+ import { Placement, flip, Strategy } from '@floating-ui/react';
3
+ import { ComponentCoreProps } from '../../utils/types';
2
4
  export interface IActionMenuOption {
3
5
  key: string;
4
6
  element: React.ReactNode;
@@ -7,3 +9,58 @@ export interface IActionMenuOption {
7
9
  withDivider?: boolean;
8
10
  onClick?: () => void;
9
11
  }
12
+ export interface IActionMenuProps extends ComponentCoreProps {
13
+ /**
14
+ * The CSS class for trigger container
15
+ */
16
+ triggerClassName?: string;
17
+ /**
18
+ * Array of menu options
19
+ */
20
+ options: IActionMenuOption[];
21
+ /**
22
+ * Array of selected menu options keys
23
+ */
24
+ selectedOptions?: string[];
25
+ /**
26
+ * Trigger element
27
+ */
28
+ triggerRenderer: React.ReactElement;
29
+ /**
30
+ * The menu placement
31
+ */
32
+ placement?: Placement;
33
+ /**
34
+ * Will open menu on component initialization
35
+ */
36
+ openedOnInit?: boolean;
37
+ /**
38
+ * Menu will stay open after option click
39
+ */
40
+ keepOpenOnClick?: boolean;
41
+ /**
42
+ * Set the menu placement to keep it in view
43
+ */
44
+ flipOptions?: Parameters<typeof flip>[0];
45
+ /**
46
+ * Set to control the menu visibility
47
+ */
48
+ visible?: boolean;
49
+ /**
50
+ * Optional handler called on menu close
51
+ */
52
+ onClose?: () => void;
53
+ /**
54
+ * Optional handler called on menu open
55
+ */
56
+ onOpen?: () => void;
57
+ /**
58
+ * Set the type of CSS position property to use
59
+ * https://floating-ui.com/docs/usefloating#strategy
60
+ */
61
+ floatingStrategy?: Strategy;
62
+ /**
63
+ * Optional footer element
64
+ */
65
+ footer?: React.ReactNode;
66
+ }
@@ -58,5 +58,5 @@ export declare const Button: React.ForwardRefExoticComponent<{
58
58
  /**
59
59
  * Specify the place to render element given in `icon` prop
60
60
  */
61
- iconPosition?: "right" | "left" | undefined;
61
+ iconPosition?: "left" | "right" | undefined;
62
62
  } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLButtonElement & HTMLAnchorElement>>;
@@ -32,5 +32,9 @@ export interface ISearchInputProps {
32
32
  * The event handler for onChange
33
33
  */
34
34
  onChange: (value: string) => void;
35
+ /**
36
+ * Set to enable ellipsis
37
+ */
38
+ cropOnBlur?: boolean;
35
39
  }
36
40
  export declare const SearchInput: React.FC<ISearchInputProps>;
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ export interface ISkeletonAvatar {
3
+ /**
4
+ * Specify if the element is square shape
5
+ */
6
+ square?: boolean;
7
+ /**
8
+ * Specify the size of the element (wdith and height in px)
9
+ */
10
+ size?: number;
11
+ /**
12
+ * Specify if the animation is enabled
13
+ */
14
+ animated?: boolean;
15
+ }
16
+ export declare const SkeletonAvatar: React.FC<ISkeletonAvatar>;
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ export interface ISkeletonText {
3
+ /**
4
+ * Specify the height of the element
5
+ */
6
+ height?: number;
7
+ /**
8
+ * Specify the width of the element
9
+ */
10
+ width?: number;
11
+ /**
12
+ * Specify if the animation is enabled
13
+ */
14
+ animated?: boolean;
15
+ }
16
+ export declare const SkeletonText: React.FC<ISkeletonText>;
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ export interface ISkeletonWrapper extends React.HTMLAttributes<HTMLDivElement> {
3
+ /**
4
+ * The children elements to be wrapped by the skeleton wrapper
5
+ */
6
+ children: React.ReactNode;
7
+ /**
8
+ * Specify if the skeleton wrapper should display children elements vertically
9
+ */
10
+ vertical?: boolean;
11
+ /**
12
+ * Specify if the animation is enabled, it will be passed to the children skeleton components
13
+ */
14
+ animated?: boolean;
15
+ }
16
+ export declare const SkeletonWrapper: React.FC<ISkeletonWrapper>;
@@ -0,0 +1,3 @@
1
+ export { SkeletonWrapper } from './SkeletonWrapper';
2
+ export { SkeletonAvatar } from './SkeletonAvatar';
3
+ export { SkeletonText } from './SkeletonText';
@@ -1,50 +1,3 @@
1
1
  import * as React from 'react';
2
- import { TagKind, TagSize } from './types';
3
- export interface TagProps extends React.HTMLAttributes<HTMLDivElement> {
4
- /**
5
- * Specify the tag kind
6
- */
7
- kind?: TagKind;
8
- /**
9
- * Specify the tag size
10
- */
11
- size?: TagSize;
12
- /**
13
- * Set the tag custom color
14
- */
15
- customColor?: string;
16
- /**
17
- * Set to show close icon
18
- * @deprecated The close icon will be visible by providing the `onRemove` prop and this flag will no longer be needed
19
- */
20
- dismissible?: boolean;
21
- /**
22
- * Set to show close icon on hover only if the `onRemove` prop is provided
23
- */
24
- dismissibleOnHover?: boolean;
25
- /**
26
- * Set to hide close icon if the `onRemove` prop is provided
27
- */
28
- disabled?: boolean;
29
- /**
30
- * Outlined version of tag
31
- */
32
- outline?: boolean;
33
- /**
34
- * The event handler for close icon click, if provided the close icon will be visible
35
- */
36
- onRemove?(e: React.MouseEvent): void;
37
- /**
38
- * React node element to show on the left
39
- */
40
- leftNode?: React.ReactElement;
41
- /**
42
- * React node element to show on the right
43
- */
44
- rightNode?: React.ReactElement;
45
- /**
46
- * Set to show the tag as square (only if you want use icon without text)
47
- */
48
- iconOnly?: boolean;
49
- }
2
+ import { TagProps } from './types';
50
3
  export declare const Tag: React.FC<React.PropsWithChildren<TagProps>>;
@@ -1,3 +1,3 @@
1
1
  export { Tag } from './Tag';
2
- export type { TagProps } from './Tag';
3
2
  export type { TagKind, TagSize } from './types';
3
+ export type { TagProps } from './types';
@@ -1,3 +1,55 @@
1
+ import * as React from 'react';
1
2
  import { kinds, sizes } from './constants';
2
3
  export type TagKind = (typeof kinds)[number];
3
4
  export type TagSize = (typeof sizes)[number];
5
+ export interface TagProps extends React.HTMLAttributes<HTMLDivElement> {
6
+ /**
7
+ * Specify the tag kind
8
+ */
9
+ kind?: TagKind;
10
+ /**
11
+ * Specify the tag size
12
+ */
13
+ size?: TagSize;
14
+ /**
15
+ * Set the tag custom color
16
+ */
17
+ customColor?: string;
18
+ /**
19
+ * Set to show close icon
20
+ * @deprecated The close icon will be visible by providing the `onRemove` prop and this flag will no longer be needed
21
+ */
22
+ dismissible?: boolean;
23
+ /**
24
+ * Set to show close icon on hover only if the `onRemove` prop is provided
25
+ */
26
+ dismissibleOnHover?: boolean;
27
+ /**
28
+ * Set to hide close icon if the `onRemove` prop is provided
29
+ */
30
+ disabled?: boolean;
31
+ /**
32
+ * Outlined version of tag
33
+ */
34
+ outline?: boolean;
35
+ /**
36
+ * The event handler for close icon click, if provided the close icon will be visible
37
+ */
38
+ onRemove?(e: React.MouseEvent): void;
39
+ /**
40
+ * React node element to show on the left
41
+ */
42
+ leftNode?: React.ReactElement;
43
+ /**
44
+ * React node element to show on the right
45
+ */
46
+ rightNode?: React.ReactElement;
47
+ /**
48
+ * Set to show the tag as square (only if you want use icon without text)
49
+ */
50
+ iconOnly?: boolean;
51
+ /**
52
+ * Set text value for the tag. You can use this or `children` prop. If both are provided, `value` prop will be used.
53
+ */
54
+ value?: string;
55
+ }
@@ -1,40 +1,3 @@
1
1
  import * as React from 'react';
2
- export interface TagInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'onChange'> {
3
- /**
4
- * Set the id for input
5
- */
6
- id?: string;
7
- /**
8
- * Set the error message
9
- */
10
- error?: string;
11
- /**
12
- * Array of defined tags
13
- */
14
- tags?: string[];
15
- /**
16
- * The event handler for modify tags array
17
- */
18
- onChange: (tags: string[]) => void;
19
- /**
20
- * Set the input placeholder
21
- */
22
- placeholder?: string;
23
- /**
24
- * Set the custom validation for provided items
25
- */
26
- validator?: (val: string) => boolean;
27
- /**
28
- * Specify the input size
29
- */
30
- size?: 'medium' | 'large';
31
- /**
32
- * Set the input custom class
33
- */
34
- inputClassName?: string;
35
- /**
36
- * Add Tag on blur
37
- */
38
- addOnBlur?: boolean;
39
- }
40
- export declare const TagInput: React.FC<TagInputProps>;
2
+ import { TagInputProps, TagInputValues } from './types';
3
+ export declare const TagInput: <T extends TagInputValues>({ id, tags, onChange, validator, error, placeholder, size, className, inputClassName, onBlur, addOnBlur, ...props }: TagInputProps<T>) => React.ReactElement;
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { TagProps } from '../../Tag';
2
3
  export interface EditableTagProps extends React.HTMLAttributes<HTMLDivElement> {
3
4
  inputRef: React.RefObject<HTMLInputElement>;
4
5
  index: number;
@@ -7,5 +8,6 @@ export interface EditableTagProps extends React.HTMLAttributes<HTMLDivElement> {
7
8
  validator?: (val: string) => boolean;
8
9
  children: string;
9
10
  size: 'medium' | 'large';
11
+ tagProps?: TagProps;
10
12
  }
11
13
  export declare const EditableTag: React.FC<EditableTagProps>;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import { TagInputProps, TagInputValues } from '../types';
3
+ export type EmailTagInputProps<T> = Omit<TagInputProps<T>, 'validator'>;
4
+ export declare const emailRegex: RegExp;
5
+ export declare const EmailTagInput: <T extends TagInputValues>({ placeholder, ...props }: EmailTagInputProps<T>) => React.ReactElement;
@@ -1,4 +1,4 @@
1
1
  export { TagInput } from './TagInput';
2
- export type { TagInputProps } from './TagInput';
3
- export { EmailTagInput } from './EmailTagInput';
4
- export type { EmailTagInputProps } from './EmailTagInput';
2
+ export { EmailTagInput } from './components/EmailTagInput';
3
+ export type { EmailTagInputProps } from './components/EmailTagInput';
4
+ export type { TagInputProps } from './types';
@@ -0,0 +1,41 @@
1
+ import * as React from 'react';
2
+ import { TagProps } from '../Tag';
3
+ export interface TagInputProps<T> extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'onChange'> {
4
+ /**
5
+ * Set the id for input
6
+ */
7
+ id?: string;
8
+ /**
9
+ * Set the error message
10
+ */
11
+ error?: string;
12
+ /**
13
+ * Array of defined tags
14
+ */
15
+ tags?: T[];
16
+ /**
17
+ * The event handler for modify tags array
18
+ */
19
+ onChange: (tags: T[]) => void;
20
+ /**
21
+ * Set the input placeholder
22
+ */
23
+ placeholder?: string;
24
+ /**
25
+ * Set the custom validation for provided items
26
+ */
27
+ validator?: (val: string) => boolean;
28
+ /**
29
+ * Specify the input size
30
+ */
31
+ size?: 'medium' | 'large';
32
+ /**
33
+ * Set the input custom class
34
+ */
35
+ inputClassName?: string;
36
+ /**
37
+ * Add Tag on blur
38
+ */
39
+ addOnBlur?: boolean;
40
+ }
41
+ export type TagInputValues = string | Omit<TagProps, 'onRemove' | 'dismissible'>;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { TDisplaySize } from './types';
2
+ import { TDisplaySize, TTextAlign } from './types';
3
3
  interface IProps {
4
4
  /** Size of the text */
5
5
  size?: TDisplaySize;
@@ -7,6 +7,10 @@ interface IProps {
7
7
  as?: string;
8
8
  /** Optional custom className */
9
9
  className?: string;
10
+ /** Optional prop to set the custom color */
11
+ customColor?: string;
12
+ /** Optional prop to set the text align */
13
+ textAlign?: TTextAlign;
10
14
  }
11
15
  export declare const Display: React.FC<React.PropsWithChildren<IProps>>;
12
16
  export {};
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { THeadingSize } from './types';
2
+ import { THeadingSize, TTextAlign } from './types';
3
3
  interface IProps extends React.HTMLAttributes<HTMLElement> {
4
4
  size?: THeadingSize;
5
5
  /** DOM element name that will be rendered */
@@ -10,6 +10,10 @@ interface IProps extends React.HTMLAttributes<HTMLElement> {
10
10
  uppercase?: boolean;
11
11
  /** Optional prop to set the bold */
12
12
  bold?: boolean;
13
+ /** Optional prop to set the custom color */
14
+ customColor?: string;
15
+ /** Optional prop to set the text align */
16
+ textAlign?: TTextAlign;
13
17
  }
14
18
  export declare const Heading: React.FC<React.PropsWithChildren<IProps>>;
15
19
  export {};
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { TTextSize } from './types';
2
+ import { TTextAlign, TTextSize } from './types';
3
3
  interface IProps extends React.HTMLAttributes<HTMLElement> {
4
4
  /** DOM element name that will be rendered */
5
5
  as?: string;
@@ -20,6 +20,10 @@ interface IProps extends React.HTMLAttributes<HTMLElement> {
20
20
  underline?: boolean;
21
21
  /** Optional prop to set the strike */
22
22
  strike?: boolean;
23
+ /** Optional prop to set the custom color */
24
+ customColor?: string;
25
+ /** Optional prop to set the text align */
26
+ textAlign?: TTextAlign;
23
27
  }
24
28
  export declare const Text: React.FC<React.PropsWithChildren<IProps>>;
25
29
  export {};
@@ -1,3 +1,4 @@
1
1
  export type TTextSize = 'xs' | 'sm' | 'md';
2
2
  export type THeadingSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
3
3
  export type TDisplaySize = 'sm' | 'md' | 'max';
4
+ export type TTextAlign = 'left' | 'right' | 'center' | 'justify';