@livechat/design-system-react-components 1.35.0 → 1.37.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.
- package/dist/components/Accordion/Accordion.d.ts +3 -0
- package/dist/components/Accordion/components/AccordionAnimatedLabel.d.ts +3 -0
- package/dist/components/Accordion/components/AccordionMultilineElement.d.ts +6 -0
- package/dist/components/Accordion/helpers.d.ts +10 -0
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Accordion/stories-helpers.d.ts +3 -0
- package/dist/components/Accordion/types.d.ts +45 -0
- package/dist/components/AutoComplete/AutoComplete.d.ts +13 -0
- package/dist/components/AutoComplete/helpers.d.ts +6 -0
- package/dist/components/AutoComplete/index.d.ts +4 -0
- package/dist/components/AutoComplete/types.d.ts +27 -0
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/Picker/components/PickerList.d.ts +4 -0
- package/dist/components/Picker/components/PickerTriggerBody.d.ts +1 -0
- package/dist/components/Picker/types.d.ts +7 -3
- package/dist/hooks/index.d.ts +2 -0
- package/dist/{components/AppFrame/hooks/useAppFrameAnimations.d.ts → hooks/useAnimations.d.ts} +3 -3
- package/dist/hooks/useHeightResizer.d.ts +7 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +4630 -4279
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AccordionLabel } from './types';
|
|
3
|
+
export declare const isLabelObject: (label: React.ReactNode | {
|
|
4
|
+
open: React.ReactNode;
|
|
5
|
+
closed: React.ReactNode;
|
|
6
|
+
}) => label is {
|
|
7
|
+
open: React.ReactNode;
|
|
8
|
+
closed: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
export declare const getLabel: (label: AccordionLabel, currentlyOpen: boolean) => React.ReactNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Accordion } from './Accordion';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ComponentCoreProps } from '../../utils/types';
|
|
3
|
+
export type AccordionLabel = React.ReactNode | {
|
|
4
|
+
open: React.ReactNode;
|
|
5
|
+
closed: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export interface IAccordionProps extends ComponentCoreProps {
|
|
8
|
+
/**
|
|
9
|
+
* Specify the content of the accordion
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Specify the label of the accordion, single element or different for open and closed state
|
|
14
|
+
*/
|
|
15
|
+
label: AccordionLabel;
|
|
16
|
+
/**
|
|
17
|
+
* Specify the multiline element, which will be displayed under the label
|
|
18
|
+
*/
|
|
19
|
+
multilineElement?: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Specify the kind of the accordion
|
|
22
|
+
*/
|
|
23
|
+
kind?: 'default' | 'warning' | 'error';
|
|
24
|
+
/**
|
|
25
|
+
* Specify if the accordion should be open on init
|
|
26
|
+
*/
|
|
27
|
+
openOnInit?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Set to control accordion state
|
|
30
|
+
*/
|
|
31
|
+
isOpen?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Optional handler called on accordion close
|
|
34
|
+
*/
|
|
35
|
+
onClose?: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Optional handler called on accordion open
|
|
38
|
+
*/
|
|
39
|
+
onOpen?: () => void;
|
|
40
|
+
}
|
|
41
|
+
export interface IAccordionAnimatedLabelProps {
|
|
42
|
+
open: React.ReactNode;
|
|
43
|
+
closed: React.ReactNode;
|
|
44
|
+
isOpen: boolean;
|
|
45
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { AutoCompleteProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Text input with autocomplete functionality. The autocomplete list is displayed below the input and is accessible via the keyboard
|
|
5
|
+
* and mouse. The list is filtered based on the input value.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <AutoComplete
|
|
9
|
+
* options={['Paul', 'Adam', 'John']}
|
|
10
|
+
* placeholder="Type a name"
|
|
11
|
+
* />
|
|
12
|
+
*/
|
|
13
|
+
export declare const AutoComplete: React.ForwardRefExoticComponent<AutoCompleteProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IPickerListItem } from '../Picker';
|
|
2
|
+
import { AutoCompleteProps, IAutoCompleteListItem } from './types';
|
|
3
|
+
export declare const areAllOptionsStrings: (options: AutoCompleteProps['options']) => options is string[];
|
|
4
|
+
export declare const buildOptionsFromStrings: (options: string[]) => IPickerListItem[];
|
|
5
|
+
export declare const buildOptionsFromAutoCompleteListItems: (options: IAutoCompleteListItem[]) => IPickerListItem[];
|
|
6
|
+
export declare const getFilteredPickerItems: (items: IPickerListItem[], single: boolean, hideIfExactMatch: boolean, inputValue: string) => IPickerListItem[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Placement, Strategy } from '@floating-ui/react';
|
|
3
|
+
import { InputProps } from '../Input';
|
|
4
|
+
import { IPickerListItem } from '../Picker';
|
|
5
|
+
export type IAutoCompleteListItem = Omit<IPickerListItem, 'key' | 'customElement'> & {
|
|
6
|
+
customElement?: React.ReactElement;
|
|
7
|
+
};
|
|
8
|
+
export interface AutoCompleteProps extends Omit<InputProps, 'type'> {
|
|
9
|
+
/** Options that will be displayed in the picker. If they are strings, they will be converted to `IPickerListItem[]`*/
|
|
10
|
+
options?: string[] | IAutoCompleteListItem[];
|
|
11
|
+
/** If true, disables filtering of the options. Useful for getting options from an external source.*/
|
|
12
|
+
alwaysShowAllOptions?: boolean;
|
|
13
|
+
/** If true, the autocomplete list will be open when the component mounts.*/
|
|
14
|
+
autocompleteOpenOnInit?: boolean;
|
|
15
|
+
/** Minimum height of the list */
|
|
16
|
+
minListHeight?: number;
|
|
17
|
+
/** Maximum height of the list */
|
|
18
|
+
maxListHeight?: number;
|
|
19
|
+
/** Placement of the list */
|
|
20
|
+
placement?: Placement;
|
|
21
|
+
/** Floating strategy */
|
|
22
|
+
floatingStrategy?: Strategy;
|
|
23
|
+
/** Type of the input. If true, only shows one matching item. */
|
|
24
|
+
single?: boolean;
|
|
25
|
+
/** If true, the option list will be hidden if there is only one option and it is an exact match to the input value. */
|
|
26
|
+
hideIfExactMatch?: boolean;
|
|
27
|
+
}
|
|
@@ -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?: "
|
|
61
|
+
iconPosition?: "left" | "right" | undefined;
|
|
62
62
|
} & React.ButtonHTMLAttributes<HTMLButtonElement> & React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLButtonElement & HTMLAnchorElement>>;
|
|
@@ -12,11 +12,15 @@ export interface IPickerListProps {
|
|
|
12
12
|
listElementsRef: React.MutableRefObject<(HTMLElement | null)[]>;
|
|
13
13
|
activeIndex: number | null;
|
|
14
14
|
selectedKeys: string[];
|
|
15
|
+
isPositioned: boolean;
|
|
16
|
+
searchDisabled: boolean;
|
|
17
|
+
onItemRemove: (key: string) => void;
|
|
15
18
|
setPointer: (pointer: boolean) => void;
|
|
16
19
|
onSelect: (key: string) => void;
|
|
17
20
|
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
18
21
|
getItemProps: (userProps?: React.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
19
22
|
emptyStateText?: string;
|
|
23
|
+
hideWhenEmpty?: boolean;
|
|
20
24
|
listClassName?: string;
|
|
21
25
|
virtuosoProps?: VirtuosoProps<IPickerListItem, unknown>;
|
|
22
26
|
}
|
|
@@ -18,5 +18,6 @@ export interface ITriggerBodyProps {
|
|
|
18
18
|
virtualItemRef: React.MutableRefObject<HTMLElement | null>;
|
|
19
19
|
isTriggerFocused: boolean;
|
|
20
20
|
inputRef?: React.RefObject<HTMLInputElement>;
|
|
21
|
+
inputProps?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
21
22
|
}
|
|
22
23
|
export declare const PickerTriggerBody: React.FC<ITriggerBodyProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
1
|
+
import { InputHTMLAttributes, ReactElement } from 'react';
|
|
2
2
|
import { Placement, Strategy, UseClickProps, UseDismissProps } from '@floating-ui/react';
|
|
3
3
|
import { VirtuosoProps } from 'react-virtuoso';
|
|
4
4
|
import { Size } from '../../utils';
|
|
@@ -8,8 +8,8 @@ export interface IPickerListItem {
|
|
|
8
8
|
key: string;
|
|
9
9
|
name: string;
|
|
10
10
|
customElement?: {
|
|
11
|
-
listItemBody
|
|
12
|
-
selectedItemBody
|
|
11
|
+
listItemBody?: ReactElement;
|
|
12
|
+
selectedItemBody?: ReactElement;
|
|
13
13
|
};
|
|
14
14
|
groupHeader?: boolean;
|
|
15
15
|
disabled?: boolean;
|
|
@@ -135,4 +135,8 @@ export interface IPickerProps extends ComponentCoreProps {
|
|
|
135
135
|
* https://virtuoso.dev/virtuoso-api-reference/
|
|
136
136
|
*/
|
|
137
137
|
virtuosoProps?: VirtuosoProps<IPickerListItem, unknown>;
|
|
138
|
+
/**
|
|
139
|
+
* Additional props for the input element
|
|
140
|
+
*/
|
|
141
|
+
inputProps?: InputHTMLAttributes<HTMLInputElement> | Record<string, unknown>;
|
|
138
142
|
}
|
package/dist/{components/AppFrame/hooks/useAppFrameAnimations.d.ts → hooks/useAnimations.d.ts}
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface UseAnimationsProps {
|
|
3
3
|
isVisible: boolean;
|
|
4
4
|
elementRef: React.RefObject<HTMLDivElement>;
|
|
5
5
|
}
|
|
6
|
-
interface
|
|
6
|
+
interface IUseAnimations {
|
|
7
7
|
isOpen: boolean;
|
|
8
8
|
isMounted: boolean;
|
|
9
9
|
setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
10
10
|
}
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const useAnimations: ({ isVisible, elementRef, }: UseAnimationsProps) => IUseAnimations;
|
|
12
12
|
export {};
|