react-lightning-design-system
Version:
Salesforce Lightning Design System components built with React
72 lines (71 loc) • 2.04 kB
TypeScript
import React, { InputHTMLAttributes, Ref, ReactNode } from 'react';
import { FormElementProps } from './FormElement';
import { IconCategory } from './Icon';
import { Bivariant } from './typeUtils';
/**
*
*/
export type LookupEntry = {
label: string;
value: string;
icon?: string;
scope?: string;
category?: IconCategory;
meta?: string;
};
/**
*
*/
export type LookupScope = {
label: string;
value: string;
icon: string;
category?: IconCategory;
};
/**
*
*/
export type LookupProps = {
label?: string;
disabled?: boolean;
required?: boolean;
error?: FormElementProps['error'];
iconAlign?: 'left' | 'right';
value?: string | null;
defaultValue?: string | null;
selected?: LookupEntry | null;
defaultSelected?: LookupEntry | null;
opened?: boolean;
defaultOpened?: boolean;
searchText?: string;
defaultSearchText?: string;
loading?: boolean;
data?: LookupEntry[];
lookupFilter?: Bivariant<(entry: LookupEntry, searchText?: string, scope?: string) => boolean>;
listHeader?: JSX.Element;
listFooter?: JSX.Element;
tooltip?: ReactNode;
tooltipIcon?: string;
scopes?: LookupScope[];
targetScope?: string;
defaultTargetScope?: string;
cols?: number;
elementRef?: Ref<HTMLDivElement>;
inputRef?: Ref<HTMLInputElement>;
dropdownRef?: Ref<HTMLDivElement>;
onSearchTextChange?: (searchText: string) => void;
onScopeMenuClick?: () => void;
onScopeSelect?: (scope: string) => void;
onLookupRequest?: (searchText: string) => void;
onBlur?: () => void;
onFocus?: () => void;
onSelect?: Bivariant<(entry: LookupEntry | null) => void>;
onValueChange?: (value: string | null, prevValue?: string | null) => void;
onComplete?: (cancel?: boolean) => void;
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onBlur' | 'onFocus' | 'onSelect' | 'value' | 'defaultValue'>;
/**
*
*/
export declare const Lookup: React.FC<LookupProps> & {
isFormElement: boolean;
};