@livechat/design-system-react-components 2.8.0 → 2.9.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.
@@ -1,3 +1,4 @@
1
- import { IAccordionProps } from './types';
1
+ import { IAccordionProps, IAccordionPromoProps } from './types';
2
2
  import * as React from 'react';
3
3
  export declare const Accordion: React.FC<IAccordionProps>;
4
+ export declare const AccordionPromo: React.FC<IAccordionPromoProps>;
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ interface UseAccordionProps {
3
+ isControlled: boolean;
4
+ isExpanded: boolean;
5
+ setShouldBeVisible: (isVisible: boolean) => void;
6
+ onOpen?: () => void;
7
+ onClose?: () => void;
8
+ }
9
+ interface IUseAccordion {
10
+ handleExpandChange: (isExpanded: boolean) => void;
11
+ handleKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;
12
+ }
13
+ export declare const useAccordion: ({ isControlled, isExpanded, setShouldBeVisible, onOpen, onClose, }: UseAccordionProps) => IUseAccordion;
14
+ export {};
@@ -1 +1 @@
1
- export { Accordion } from './Accordion';
1
+ export { Accordion, AccordionPromo } from './Accordion';
@@ -4,7 +4,7 @@ export type AccordionLabel = React.ReactNode | {
4
4
  open: React.ReactNode;
5
5
  closed: React.ReactNode;
6
6
  };
7
- export interface IAccordionProps extends ComponentCoreProps {
7
+ export interface IAccordionGlobalProps extends ComponentCoreProps {
8
8
  /**
9
9
  * Specify the content of the accordion
10
10
  */
@@ -18,9 +18,9 @@ export interface IAccordionProps extends ComponentCoreProps {
18
18
  */
19
19
  multilineElement?: React.ReactNode;
20
20
  /**
21
- * Specify the kind of the accordion
21
+ * Specify the footer element, which will be displayed at the bottom
22
22
  */
23
- kind?: 'default' | 'warning' | 'error';
23
+ footer?: React.ReactNode;
24
24
  /**
25
25
  * Specify if the accordion should be open on init
26
26
  */
@@ -38,6 +38,24 @@ export interface IAccordionProps extends ComponentCoreProps {
38
38
  */
39
39
  onOpen?: () => void;
40
40
  }
41
+ export interface IAccordionProps extends IAccordionGlobalProps {
42
+ /**
43
+ * Specify the kind of the accordion
44
+ */
45
+ kind?: 'default' | 'warning' | 'error';
46
+ }
47
+ export interface IAccordionPromoProps extends IAccordionGlobalProps {
48
+ }
49
+ export interface IAccordionComponentProps extends IAccordionGlobalProps {
50
+ /**
51
+ * CSS class name for the main accordion wrapper
52
+ */
53
+ mainClassName: string;
54
+ /**
55
+ * Set to display promo accordion
56
+ */
57
+ isPromo?: boolean;
58
+ }
41
59
  export interface IAccordionAnimatedLabelProps {
42
60
  open: React.ReactNode;
43
61
  closed: React.ReactNode;
@@ -1,11 +1,11 @@
1
1
  import { Placement, Strategy } from '@floating-ui/react';
2
- import { InputProps } from '../Input';
2
+ import { IInputProps } from '../Input/types';
3
3
  import { IPickerListItem } from '../Picker';
4
4
  import * as React from 'react';
5
5
  export type IAutoCompleteListItem = Omit<IPickerListItem, 'key' | 'customElement'> & {
6
6
  customElement?: React.ReactElement;
7
7
  };
8
- export interface AutoCompleteProps extends Omit<InputProps, 'type'> {
8
+ export interface AutoCompleteProps extends Omit<IInputProps, 'type'> {
9
9
  /** Options that will be displayed in the picker. If they are strings, they will be converted to `IPickerListItem[]`*/
10
10
  options?: string[] | IAutoCompleteListItem[];
11
11
  /** If true, disables filtering of the options. Useful for getting options from an external source.*/
@@ -1,29 +1,5 @@
1
+ import { IInputComponentProps, IInputPromoProps, IInputProps } from './types';
1
2
  import * as React from 'react';
2
- interface InputIcon {
3
- source: React.ReactElement;
4
- place: 'left' | 'right';
5
- }
6
- export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
7
- /**
8
- * Specify the input size
9
- */
10
- inputSize?: 'xsmall' | 'compact' | 'medium' | 'large';
11
- /**
12
- * Specify whether the input should be in error state
13
- */
14
- error?: boolean;
15
- /**
16
- * Specify whether the input should be disabled
17
- */
18
- disabled?: boolean;
19
- /**
20
- * Set the icon and its position
21
- */
22
- icon?: InputIcon;
23
- /**
24
- * Set to enable ellipsis
25
- */
26
- cropOnBlur?: boolean;
27
- }
28
- export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
29
- export {};
3
+ export declare const InputComponent: React.ForwardRefExoticComponent<IInputComponentProps & React.RefAttributes<HTMLInputElement>>;
4
+ export declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<HTMLInputElement>>;
5
+ export declare const InputPromo: React.ForwardRefExoticComponent<IInputPromoProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,41 @@
1
+ import * as React from 'react';
2
+ export interface IInputIcon {
3
+ source: React.ReactElement;
4
+ place: 'left' | 'right';
5
+ }
6
+ export interface IInputGlobalProps extends React.InputHTMLAttributes<HTMLInputElement> {
7
+ /**
8
+ * Specify whether the input should be in error state
9
+ */
10
+ error?: boolean;
11
+ /**
12
+ * Specify whether the input should be disabled
13
+ */
14
+ disabled?: boolean;
15
+ /**
16
+ * Set the icon and its position
17
+ */
18
+ icon?: IInputIcon;
19
+ /**
20
+ * Set to enable ellipsis
21
+ */
22
+ cropOnBlur?: boolean;
23
+ }
24
+ export interface IInputProps extends IInputGlobalProps {
25
+ /**
26
+ * Specify the input size
27
+ */
28
+ inputSize?: 'xsmall' | 'compact' | 'medium' | 'large';
29
+ }
30
+ export interface IInputPromoProps extends IInputGlobalProps {
31
+ }
32
+ export interface IInputComponentProps extends IInputGlobalProps {
33
+ /**
34
+ * CSS class name for the main input wrapper
35
+ */
36
+ mainClassName: string;
37
+ /**
38
+ * Set to display promo input
39
+ */
40
+ isPromo?: boolean;
41
+ }
@@ -1,5 +1,5 @@
1
1
  import { InputHTMLAttributes, ReactElement } from 'react';
2
- import { Placement, Strategy, UseClickProps, UseDismissProps } from '@floating-ui/react';
2
+ import { FloatingPortalProps, Placement, Strategy, UseClickProps, UseDismissProps } from '@floating-ui/react';
3
3
  import { VirtuosoProps } from 'react-virtuoso';
4
4
  import { Size } from '../../utils';
5
5
  import { ComponentCoreProps } from '../../utils/types';
@@ -123,6 +123,10 @@ export interface IPickerProps extends ComponentCoreProps {
123
123
  * Floating strategy for the picker component from @floating-ui/react
124
124
  */
125
125
  floatingStrategy?: Strategy;
126
+ /**
127
+ * Root node the portal container from @floating-ui/react will be appended to
128
+ */
129
+ root?: FloatingPortalProps['root'];
126
130
  /**
127
131
  * Set the `floating-ui` useDismiss hook params if you need more control
128
132
  * https://floating-ui.com/docs/usedismiss
@@ -16,6 +16,8 @@ interface IProps extends React.HTMLAttributes<HTMLElement> {
16
16
  uppercase?: boolean;
17
17
  /** Optional prop to set the bold */
18
18
  bold?: boolean;
19
+ /** Optional prop to set the semi-bold */
20
+ semiBold?: boolean;
19
21
  /** Optional prop to set the underline */
20
22
  underline?: boolean;
21
23
  /** Optional prop to set the strike */
@@ -370,5 +370,7 @@ export declare const DesignToken: {
370
370
  SurfaceCheckListItemOpenBackground: string;
371
371
  SurfaceCheckListBackground: string;
372
372
  ContentBasicPlaceholder: string;
373
+ InputPromoBorderDefault: string;
374
+ InputPromoBorderHover: string;
373
375
  };
374
376
  export type DesignTokenKey = keyof typeof DesignToken;