welcome-ui
Version:
Customizable design system with react • styled-components • styled-system and ariakit.
30 lines (29 loc) • 1.61 kB
TypeScript
import { DownshiftProps } from 'downshift';
import { default as React } from 'react';
import { CreateWuiProps } from '../System';
import { createEvent } from '../../utils/create-event';
import { DefaultFieldStylesProps } from '../../utils/field-styles';
export type Item = SearchOption | SearchOptionGroup | string | unknown;
export type SearchOption = {
label: string;
value: string;
};
export type SearchOptionGroup = {
label: string;
options: SearchOption[];
};
export interface SearchOptions extends DefaultFieldStylesProps {
groupsEnabled?: boolean;
icon?: React.ReactElement;
itemToString: (item: Item) => string;
minChars?: number;
onChange?: (item: Item, event: ReturnType<typeof createEvent>) => void;
renderGroupHeader?: (result: SearchOptionGroup) => React.ReactElement;
renderItem: (item: Item) => React.ReactElement | string;
search: (query: string) => Promise<unknown>;
throttle?: number;
value?: Item;
}
export type SearchProps = CreateWuiProps<'input', Omit<DownshiftProps<SearchOption>, keyof SearchOptions> & SearchOptions>;
export declare const Search: import('../System').CreateWuiComponent<"input", SearchProps>;
export declare const StyledSearch: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('styled-components').FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('@xstyled/system').SystemProps<import('@xstyled/system').Theme>> & import('@xstyled/system').SystemProps<import('@xstyled/system').Theme>, never>> & string;