tango-ui-cw
Version:
A lightweight ui library with ClayW
43 lines (36 loc) • 1.21 kB
TypeScript
import type { CSSProperties, HTMLAttributes } from "react";
import type { SxValue } from "../CSSFab";
export type SearchSize = "small" | "medium" | "large" | "huge";
export type SearchI18nKey = "placeholder" | "btnText" | (string & {});
export type SearchLocaleText = Partial<{
placeholder: string;
btnText: string;
}>;
export interface SearchProps
extends Omit<HTMLAttributes<HTMLInputElement>, "style" | "className" | "onSearch" | "placeholder"> {
/** 尺寸 */
size?: SearchSize;
/** Style extension via CSSFab sx */
sx?: SxValue;
style?: CSSProperties;
className?: string;
/** 搜索回调,参数为输入框当前值 */
onSearch?: (value: string) => void;
/** 受控值 */
value?: string;
/** 非受控默认值 */
defaultValue?: string;
/** 是否禁用 */
disabled?: boolean;
/** 占位文案,优先级高于 i18n */
placeholder?: string;
/** 搜索按钮文案,优先级高于 i18n */
btnText?: string;
/** 搜索按钮图标路径,传入后替代 btnText */
path?: string;
/** 覆盖 locale 文案 */
localeText?: SearchLocaleText;
}
declare function Search(props: SearchProps): JSX.Element;
export { Search };
export default Search;