react-elegant-ui
Version:
Elegant UI components, made by BEM best practices for react
37 lines (36 loc) • 1.28 kB
TypeScript
import { SimplyHOC } from '../../../lib/compose';
import { ITextinputControl } from '../../Textinput/Control/Textinput-Control';
import { IMenuProps, MenuMixedItem } from '../Menu';
import '../Search/Menu-Search.css';
export type Predicate = (text: string, search: string) => boolean;
export declare const defaultPredicate: (text: string, search: string) => boolean;
/**
* Return deep copy of `items` object where hidden a not match items
*/
export declare const applySearchFilter: (searchText: string, predicate: Predicate, items: MenuMixedItem[]) => MenuMixedItem[];
export interface IModMenuSearchable {
/**
* Enable search input for menu
*/
searchable?: boolean;
/**
* Placeholder for search input
*/
searchPlaceholder?: string;
/**
* Predicate which test text from search input with items text
* and decide should be item show
*/
searchPredicate?: Predicate;
/**
* Ref to input
*/
searchRef?: ITextinputControl['innerRef'];
}
/**
* Mod to add search input
*
* WARNING: if you use it with `withInlineSearch`, this modifier should wrap `withInlineSearch`
* to prevent inline search while search here
*/
export declare const withModMenuSearchable: SimplyHOC<IModMenuSearchable, IMenuProps>;