///
import { ReactNode, RefObject, FocusEvent, SyntheticEvent, ChangeEvent, KeyboardEvent, FC } from 'react';
import { Menu, MenuItemId, MenuPopperProps, MenuProps } from '@befe/brick-comp-menu';
import { Input, InputProps } from '@befe/brick-comp-input';
import { ConfiguredComponent } from '@befe/brick-core';
import { DelayHandler } from '@befe/brick-utils';
type SuggestPropsFromInput = Pick;
export declare const SUGGEST_SIZES: readonly ["sm", "md", "lg", "xl"];
type SuggestSize = (typeof SUGGEST_SIZES)[number];
/**
* @public
*/
export interface SuggestOption {
/**
* 唯一标识
*/
id: MenuItemId;
/**
* 显示文字,用于已选择
*/
label: string;
/**
* 显示内容,用于选项,如不指定则使用 label
*/
content?: ReactNode;
/**
* 是否禁用
*/
disabled?: boolean;
/**
* 子选项,只支持一层,用于 group
*/
children?: SuggestOption[];
}
export type SuggestValue = SuggestOption | null;
export type SuggestOnChange = {
bivarianceHack(value: Val): void;
}['bivarianceHack'];
export interface BaseSuggestProps extends SuggestPropsFromInput {
/**
* 自定义 class
*/
className?: string;
/**
* 选中控制值
* @type SuggestValue
*/
value?: Val;
/**
* 选中默认值
* @type SuggestValue
*/
defaultValue?: Val;
/**
* 是否禁用
*/
disabled?: boolean;
/**
* 未选择占位提示
*/
placeholder?: string;
/**
* 尺寸
*/
size?: SuggestSize;
/**
* 选项列表弹出位置
*/
placement?: MenuPopperProps['placement'];
/**
* 值变化时的回调
* @type (value: SuggestValue) => void
*/
onChange?: SuggestOnChange;
/**
* 查询回调
*/
onSearch?: (query: string) => Promise;
/**
* 键盘按下回调
*/
onKeyDown?: (e: KeyboardEvent) => void;
/**
* loading 图标的延迟响应时间
* 单位 ms
* 0 为立即显示
*/
loadingDelay?: number;
/**
* 是否使用 trimmed 过的 inputValue 作为 fetch 的 query 参数
*/
trim?: boolean;
/**
* 空字符串是是否进行 search
* 设为 true 则空字符串在 focus 状态下亦会触发 search
*/
shouldEmptySearch?: boolean;
/**
* 控件框状态
*/
status?: 'normal' | 'error';
/**
* 将选项列表的宽度固定为 selection 宽度
*/
fixDropdownWidth?: MenuPopperProps['matchWidthToTarget'];
/**
* 后缀图标,
*
* 如果为 falsy 则显示为下拉箭头
*
* @default SvgSearch
*/
suffixIcon?: FC | null;
/**
* 无选项提示内容
*/
noOptionsHint?: ReactNode | ((input: string) => ReactNode);
}
export interface SuggestState {
selected: SuggestOption[];
popperVisible: boolean;
loading: boolean;
fetched: boolean;
inputValue: string;
options: SuggestOption[];
}
/**
* @docgen-skip
*/
export declare class BaseSuggest extends ConfiguredComponent {
static displayName: string;
static defaultProps: BaseSuggestProps;
static getDerivedStateFromProps(nextProps: BaseSuggestProps): {
selected: SuggestOption[];
} | null;
componentLocale: import("@befe/brick-core").ComponentLocale<{
en_us: {
no_data: string;
};
zh_cn: {
no_data: string;
};
}>;
multiple: boolean;
state: State;
fetchId: number;
focused: boolean;
inCompositing: boolean;
refSuggest: RefObject;
refInput: RefObject;
refOptionsPopperWrap: RefObject;
refMenu: RefObject