@livechat/design-system-react-components 1.0.0-beta.4 → 1.0.0-beta.6

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 (42) hide show
  1. package/dist/components/ActionBar/ActionBar.d.ts +25 -0
  2. package/dist/components/ActionBar/ActionBar.spec.d.ts +1 -0
  3. package/dist/components/ActionBar/ActionBar.stories.d.ts +10 -0
  4. package/dist/components/ActionBar/ActionBarItem.d.ts +14 -0
  5. package/dist/components/ActionBar/index.d.ts +2 -0
  6. package/dist/components/ActionMenu/ActionMenu.d.ts +9 -1
  7. package/dist/components/Button/Button.d.ts +2 -2
  8. package/dist/components/Button/Button.stories.d.ts +1 -1
  9. package/dist/components/Modal/ModalBase.d.ts +4 -0
  10. package/dist/components/Modal/ModalCloseButton.d.ts +2 -1
  11. package/dist/components/Picker/Picker.d.ts +1 -2
  12. package/dist/components/Picker/Picker.stories.d.ts +1 -0
  13. package/dist/components/Picker/PickerList.d.ts +1 -10
  14. package/dist/components/Picker/PickerListItem.d.ts +11 -0
  15. package/dist/components/Picker/TriggerBody.d.ts +3 -2
  16. package/dist/components/Picker/constants.d.ts +31 -3
  17. package/dist/components/Picker/helpers.d.ts +2 -0
  18. package/dist/components/Picker/index.d.ts +1 -1
  19. package/dist/components/Picker/types.d.ts +17 -0
  20. package/dist/components/Popover/Popover.d.ts +4 -0
  21. package/dist/components/PromoBanner/PromoBanner.d.ts +3 -0
  22. package/dist/components/PromoBannerV2/PromoBannerV2.d.ts +33 -0
  23. package/dist/components/PromoBannerV2/PromoBannerV2.spec.d.ts +1 -0
  24. package/dist/components/PromoBannerV2/PromoBannerV2.stories.d.ts +23 -0
  25. package/dist/components/PromoBannerV2/constants.d.ts +1 -0
  26. package/dist/components/PromoBannerV2/index.d.ts +2 -0
  27. package/dist/components/Tag/Tag.d.ts +1 -1
  28. package/dist/components/Tooltip/components/Info.d.ts +2 -1
  29. package/dist/components/Tooltip/components/Interactive.d.ts +4 -12
  30. package/dist/components/Tooltip/components/UserGuide/UserGuideStep.d.ts +2 -1
  31. package/dist/components/Tooltip/helpers.d.ts +2 -1
  32. package/dist/components/Tooltip/types.d.ts +8 -1
  33. package/dist/components/Typography/Display.d.ts +10 -0
  34. package/dist/components/Typography/index.d.ts +1 -0
  35. package/dist/dsrc.cjs.js +6 -6
  36. package/dist/dsrc.es.js +3346 -2942
  37. package/dist/dsrc.umd.js +6 -6
  38. package/dist/foundations/radius-token.d.ts +6 -0
  39. package/dist/index.d.ts +3 -0
  40. package/dist/preview-stats.json +708 -516
  41. package/dist/style.css +1 -1
  42. package/package.json +2 -2
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ import { IActionBarOption } from './ActionBarItem';
3
+ export interface IActionBarProps {
4
+ /**
5
+ * The CSS class for menu container
6
+ */
7
+ className?: string;
8
+ /**
9
+ * The unique id key
10
+ */
11
+ id?: string;
12
+ /**
13
+ * Array of action bar options
14
+ */
15
+ options: IActionBarOption[];
16
+ /**
17
+ * Set the key for active element
18
+ */
19
+ activeOptionKey?: string | null;
20
+ /**
21
+ * Set 'scroll' to disable menu and enable scroll
22
+ */
23
+ type?: 'menu' | 'scroll';
24
+ }
25
+ export declare const ActionBar: React.FC<IActionBarProps>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ declare const _default: {
3
+ title: string;
4
+ component: React.FC<import("./ActionBar").IActionBarProps>;
5
+ parameters: {
6
+ layout: string;
7
+ };
8
+ };
9
+ export default _default;
10
+ export declare const Default: () => React.ReactElement;
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ export type IActionBarOption = {
3
+ key: string;
4
+ element: React.ReactElement;
5
+ label?: string;
6
+ onClick: () => void;
7
+ };
8
+ interface ActionBarItem {
9
+ option: IActionBarOption;
10
+ menuItemsKeys: string[];
11
+ activeOptionKey?: string | null;
12
+ }
13
+ export declare const ActionBarItem: React.FC<ActionBarItem>;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ export { ActionBar } from './ActionBar';
2
+ export type { IActionBarProps } from './ActionBar';
@@ -5,6 +5,10 @@ export interface ActionMenuProps {
5
5
  * The CSS class for menu container
6
6
  */
7
7
  className?: string;
8
+ /**
9
+ * The CSS class for wrapper container
10
+ */
11
+ wrapperClassName?: string;
8
12
  /**
9
13
  * Array of menu options
10
14
  */
@@ -18,7 +22,7 @@ export interface ActionMenuProps {
18
22
  /**
19
23
  * Trigger element
20
24
  */
21
- triggerRenderer: React.ReactNode;
25
+ triggerRenderer: React.ReactElement;
22
26
  /**
23
27
  * The menu placement
24
28
  */
@@ -31,5 +35,9 @@ export interface ActionMenuProps {
31
35
  * Menu will stay open after option click
32
36
  */
33
37
  keepOpenOnClick?: boolean;
38
+ /**
39
+ * Set the keys array for active elements
40
+ */
41
+ activeOptionKeys?: string[];
34
42
  }
35
43
  export declare const ActionMenu: React.FC<ActionMenuProps>;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Size } from 'utils';
3
- export type ButtonKind = 'basic' | 'primary' | 'secondary' | 'destructive' | 'text' | 'plain' | 'plain-light' | 'subtle' | 'float' | 'dotted';
3
+ export type ButtonKind = 'basic' | 'primary' | 'secondary' | 'destructive' | 'destructive-outline' | 'text' | 'link' | 'link-light' | 'plain' | 'float' | 'dotted' | 'high-contrast';
4
4
  export type ButtonProps = {
5
5
  /**
6
6
  * Specify the button kind
@@ -59,5 +59,5 @@ export declare const Button: React.ForwardRefExoticComponent<{
59
59
  /**
60
60
  * Specify the place to render element given in `icon` prop
61
61
  */
62
- iconPosition?: "right" | "left" | undefined;
62
+ iconPosition?: "left" | "right" | undefined;
63
63
  } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLButtonElement & HTMLAnchorElement>>;
@@ -7,7 +7,7 @@ declare const _default: import("@storybook/types").ComponentAnnotations<import("
7
7
  fullWidth?: boolean | undefined;
8
8
  loaderLabel?: string | undefined;
9
9
  icon?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
10
- iconPosition?: "right" | "left" | undefined;
10
+ iconPosition?: "left" | "right" | undefined;
11
11
  } & React.ButtonHTMLAttributes<HTMLButtonElement> & React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLButtonElement & HTMLAnchorElement>>;
12
12
  export default _default;
13
13
  export declare const Default: {
@@ -12,5 +12,9 @@ export interface ModalBaseProps extends React.HTMLAttributes<HTMLDivElement> {
12
12
  * Triggers the onClose event on overlay click
13
13
  */
14
14
  closeOnOverlayPress?: boolean;
15
+ /**
16
+ * Removes the spacing inside the main container
17
+ */
18
+ fullSpaceContent?: boolean;
15
19
  }
16
20
  export declare const ModalBase: React.FC<React.PropsWithChildren<ModalBaseProps>>;
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- export interface ModalCloseButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
2
+ import { ButtonProps } from '../Button';
3
+ export interface ModalCloseButtonProps extends ButtonProps {
3
4
  labelType?: boolean;
4
5
  customColor?: string;
5
6
  }
@@ -1,8 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { Size } from 'utils';
3
3
  import { IconSize } from '../Icon';
4
- import { PickerType } from './constants';
5
- import { IPickerListItem } from './PickerList';
4
+ import { IPickerListItem, PickerType } from './types';
6
5
  export interface IPickerProps {
7
6
  /**
8
7
  * Specify the custom id
@@ -7,4 +7,5 @@ export default _default;
7
7
  export declare const Default: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, IPickerProps>;
8
8
  export declare const States: () => React.ReactElement;
9
9
  export declare const PickerWithGroupedOptions: () => React.ReactElement;
10
+ export declare const PickerWithMoreOptions: () => React.ReactElement;
10
11
  export declare const PickerWithOptionsAsCustomElements: () => React.ReactElement;
@@ -1,14 +1,5 @@
1
1
  import * as React from 'react';
2
- export interface IPickerListItem {
3
- key: string;
4
- name: string;
5
- customElement?: {
6
- listItemBody: React.ReactElement;
7
- selectedItemBody: React.ReactElement;
8
- };
9
- groupHeader?: boolean;
10
- disabled?: boolean;
11
- }
2
+ import { IPickerListItem } from './types';
12
3
  export interface IPickerListProps {
13
4
  isOpen: boolean;
14
5
  items: IPickerListItem[];
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import { IPickerListItem } from './types';
3
+ interface IProps {
4
+ item: IPickerListItem;
5
+ isItemSelected: boolean;
6
+ currentItemKey: string | null;
7
+ isAdjacentStyleApplied: 'top' | 'middle' | 'bottom';
8
+ onSelect: (item: IPickerListItem) => void;
9
+ }
10
+ export declare const PickerListItem: React.FC<IProps>;
11
+ export {};
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
+ import { Size } from 'utils';
2
3
  import { IconSize } from '../Icon';
3
- import { PickerType } from './constants';
4
- import { IPickerListItem } from './PickerList';
4
+ import { PickerType, IPickerListItem } from './types';
5
5
  export interface ITriggerBodyProps {
6
6
  isOpen: boolean;
7
7
  isSearchDisabled?: boolean;
@@ -11,6 +11,7 @@ export interface ITriggerBodyProps {
11
11
  type: PickerType;
12
12
  iconSize?: IconSize;
13
13
  clearSearchAfterSelection?: boolean;
14
+ size?: Size;
14
15
  onItemRemove: (item: IPickerListItem) => void;
15
16
  onFilter: (text: string) => void;
16
17
  }
@@ -1,8 +1,8 @@
1
- export declare const defaultPickerOptions: {
1
+ export declare const DEFAULT_PICKER_OPTIONS: {
2
2
  key: string;
3
3
  name: string;
4
4
  }[];
5
- export declare const defaultExtendedOptions: ({
5
+ export declare const DEFAULT_EXTENDED_OPTIONS: ({
6
6
  key: string;
7
7
  name: string;
8
8
  groupHeader: boolean;
@@ -18,5 +18,33 @@ export declare const defaultExtendedOptions: ({
18
18
  disabled: boolean;
19
19
  groupHeader?: undefined;
20
20
  })[];
21
+ export declare const DEFAULT_MORE_PICKER_OPTIONS: ({
22
+ key: string;
23
+ name: string;
24
+ secondaryText: string;
25
+ showCheckbox?: undefined;
26
+ icon?: undefined;
27
+ avatarSrc?: undefined;
28
+ } | {
29
+ key: string;
30
+ name: string;
31
+ showCheckbox: boolean;
32
+ secondaryText?: undefined;
33
+ icon?: undefined;
34
+ avatarSrc?: undefined;
35
+ } | {
36
+ key: string;
37
+ name: string;
38
+ icon: any;
39
+ secondaryText?: undefined;
40
+ showCheckbox?: undefined;
41
+ avatarSrc?: undefined;
42
+ } | {
43
+ key: string;
44
+ name: string;
45
+ avatarSrc: string;
46
+ secondaryText?: undefined;
47
+ showCheckbox?: undefined;
48
+ icon?: undefined;
49
+ })[];
21
50
  export declare const SELECT_ALL_OPTION_KEY = "select-all";
22
- export type PickerType = 'single' | 'multi';
@@ -0,0 +1,2 @@
1
+ import { IPickerListItem } from './types';
2
+ export declare function getAdjacentItemPositions(items: IPickerListItem[], selectedKeys: string[] | null): Record<string, 'top' | 'middle' | 'bottom'>;
@@ -1,3 +1,3 @@
1
1
  export * from './Picker';
2
2
  export * from './PickerList';
3
- export type { PickerType } from './constants';
3
+ export type { PickerType, IPickerListItem } from './types';
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { IconSource } from 'components/Icon';
3
+ export interface IPickerListItem {
4
+ key: string;
5
+ name: string;
6
+ customElement?: {
7
+ listItemBody: React.ReactElement;
8
+ selectedItemBody: React.ReactElement;
9
+ };
10
+ groupHeader?: boolean;
11
+ disabled?: boolean;
12
+ icon?: IconSource;
13
+ avatarSrc?: string;
14
+ secondaryText?: string;
15
+ showCheckbox?: boolean;
16
+ }
17
+ export type PickerType = 'single' | 'multi';
@@ -6,6 +6,10 @@ export interface IPopoverProps {
6
6
  * The CSS class for popover container
7
7
  */
8
8
  className?: string;
9
+ /**
10
+ * The CSS class for trigger container
11
+ */
12
+ triggerClassName?: string;
9
13
  /**
10
14
  * The popover placement related to the trigger element
11
15
  */
@@ -37,4 +37,7 @@ export interface PromoBannerProps {
37
37
  */
38
38
  onLinkClick?: () => void;
39
39
  }
40
+ /**
41
+ * @deprecated Since version 1.0.0. Will be deleted in future versions. Use {@link PromoBannerV2} instead.
42
+ */
40
43
  export declare const PromoBanner: React.FC<React.PropsWithChildren<PromoBannerProps>>;
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+ import { ButtonKind } from '../Button';
3
+ export interface IPromoBannerV2Props {
4
+ /**
5
+ * Specify an optional className to be applied to the main container node
6
+ */
7
+ className?: string;
8
+ /**
9
+ * Element with additional content for second column
10
+ */
11
+ additionalContent?: React.ReactNode;
12
+ /**
13
+ * Shows the primary CTA button
14
+ */
15
+ primaryButton?: {
16
+ handleClick: () => void;
17
+ label: string;
18
+ kind?: ButtonKind;
19
+ };
20
+ /**
21
+ * Shows the secondary CTA button
22
+ */
23
+ secondaryButton?: {
24
+ handleClick: () => void;
25
+ label: string;
26
+ kind?: ButtonKind;
27
+ };
28
+ /**
29
+ * Event handler for close button press
30
+ */
31
+ onClose?: () => void;
32
+ }
33
+ export declare const PromoBannerV2: React.FC<React.PropsWithChildren<IPromoBannerV2Props>>;
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ declare const _default: {
3
+ title: string;
4
+ component: React.FC<React.PropsWithChildren<import("./PromoBannerV2").IPromoBannerV2Props>>;
5
+ argTypes: {
6
+ primaryButton: {
7
+ control: boolean;
8
+ };
9
+ secondaryButton: {
10
+ control: boolean;
11
+ };
12
+ additionalContent: {
13
+ control: boolean;
14
+ };
15
+ onClose: {
16
+ action: string;
17
+ };
18
+ };
19
+ };
20
+ export default _default;
21
+ export declare const Default: () => React.ReactElement;
22
+ export declare const WithStyledAdditionalContent: () => React.ReactElement;
23
+ export declare const WithStyledMainContent: () => React.ReactElement;
@@ -0,0 +1 @@
1
+ export declare const SMALL_CONTAINER_WIDTH_TRESHOLD = 559;
@@ -0,0 +1,2 @@
1
+ export { PromoBannerV2 } from './PromoBannerV2';
2
+ export type { IPromoBannerV2Props } from './PromoBannerV2';
@@ -8,7 +8,7 @@ export interface TagProps extends React.HTMLAttributes<HTMLDivElement> {
8
8
  /**
9
9
  * Specify the tag size
10
10
  */
11
- size?: 'medium' | 'large';
11
+ size?: 'small' | 'medium' | 'large';
12
12
  /**
13
13
  * Specify the tag icon size if used
14
14
  */
@@ -1,8 +1,9 @@
1
1
  import * as React from 'react';
2
+ import { TooltipTheme } from '../types';
2
3
  export declare const Info: React.FC<{
3
4
  header?: string;
4
5
  text: string;
5
6
  closeWithX?: boolean;
6
- theme?: string;
7
+ theme?: TooltipTheme;
7
8
  handleCloseAction?: (ev: React.MouseEvent) => void;
8
9
  }>;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { ButtonKind } from '../../Button';
2
+ import { TooltipButton, TooltipTheme } from '../types';
3
3
  export declare const Interactive: React.FC<{
4
4
  header?: string;
5
5
  text: string;
@@ -8,16 +8,8 @@ export declare const Interactive: React.FC<{
8
8
  alt: string;
9
9
  };
10
10
  closeWithX?: boolean;
11
- theme?: 'invert' | 'important';
11
+ theme?: TooltipTheme;
12
12
  handleCloseAction?: (ev: React.MouseEvent) => void;
13
- primaryButton: {
14
- handleClick: () => void;
15
- label: string;
16
- kind?: ButtonKind;
17
- };
18
- secondaryButton: {
19
- handleClick: () => void;
20
- label: string;
21
- kind?: ButtonKind;
22
- };
13
+ primaryButton: TooltipButton;
14
+ secondaryButton: TooltipButton;
23
15
  }>;
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { TooltipTheme } from '../../types';
2
3
  export declare const UserGuideStep: React.FC<{
3
4
  header: string;
4
5
  text: string;
@@ -9,7 +10,7 @@ export declare const UserGuideStep: React.FC<{
9
10
  currentStep: number;
10
11
  stepMax: number;
11
12
  closeWithX?: boolean;
12
- theme?: string;
13
+ theme?: TooltipTheme;
13
14
  handleClickPrimary: () => void;
14
15
  handleCloseAction?: (ev: KeyboardEvent | React.MouseEvent) => void;
15
16
  }>;
@@ -1,3 +1,4 @@
1
1
  import { IconKind } from '../Icon';
2
- export declare function getIconType(theme: string): IconKind;
2
+ import { TooltipTheme } from './types';
3
+ export declare function getIconType(theme: TooltipTheme): IconKind;
3
4
  export declare const sleep: (milliseconds: number) => Promise<void>;
@@ -1,9 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import { Placement, VirtualElement } from '@floating-ui/react-dom';
3
+ import { ButtonKind } from '../Button';
4
+ export type TooltipTheme = 'invert' | 'important' | undefined;
5
+ export type TooltipButton = {
6
+ handleClick: () => void;
7
+ label: string;
8
+ kind?: ButtonKind;
9
+ };
3
10
  export interface ITooltipProps {
4
11
  children?: React.ReactNode;
5
12
  className?: string;
6
- theme?: 'invert' | 'important' | undefined;
13
+ theme?: TooltipTheme;
7
14
  placement?: Placement;
8
15
  isVisible?: boolean;
9
16
  withFadeAnimation?: boolean;
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ interface IProps {
3
+ size?: 'md' | 'sm';
4
+ /** DOM element name that will be rendered */
5
+ as?: string;
6
+ /** Optional custom className */
7
+ className?: string;
8
+ }
9
+ export declare const Display: React.FC<React.PropsWithChildren<IProps>>;
10
+ export {};
@@ -1,2 +1,3 @@
1
1
  export { Heading } from './Heading';
2
2
  export { Text } from './Text';
3
+ export { Display } from './Display';