@livechat/design-system-react-components 1.35.0 → 1.36.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/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/Picker/components/PickerList.d.ts +1 -0
- package/dist/components/Picker/types.d.ts +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +3858 -3722
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -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
|
+
}
|
|
@@ -17,6 +17,7 @@ export interface IPickerListProps {
|
|
|
17
17
|
getFloatingProps: (userProps?: React.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
18
18
|
getItemProps: (userProps?: React.HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
19
19
|
emptyStateText?: string;
|
|
20
|
+
hideWhenEmpty?: boolean;
|
|
20
21
|
listClassName?: string;
|
|
21
22
|
virtuosoProps?: VirtuosoProps<IPickerListItem, unknown>;
|
|
22
23
|
}
|
|
@@ -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;
|