lucid-ui
Version:
A UI component library from AppNexus.
95 lines (94 loc) • 3.51 kB
TypeScript
import React from 'react';
import { StandardProps, Overwrite } from '../../util/component-types';
import { ITextFieldProps } from '../TextField/TextField';
import { ITextFieldState } from '../TextField/TextField.reducers';
interface ISearchFieldIcon extends StandardProps {
}
interface ISearchFieldTextField extends ITextFieldProps {
}
export interface ISearchFieldState extends ITextFieldState {
}
export interface ISearchFieldProps extends StandardProps {
/** Fires an event every time the user types text into the TextField. */
onChange: (value: string, { event, props }: {
event: React.FormEvent;
props: ITextFieldProps;
}) => void;
/** Fires an event, debounced by \`debounceLevel\`, when the user types text
into the TextField. */
onChangeDebounced?: (value: string, { event, props }: {
event: React.FormEvent;
props: ITextFieldProps;
}) => void;
/** Number of milliseconds to debounce the \`onChangeDebounced\` callback.
Only useful if you provide an \`onChangeDebounced\` handler. */
debounceLevel: number;
/** Fires an event when the user hits "enter" from the SearchField. */
onSubmit: (value: string, { event, props }: {
event: React.FormEvent;
props: ITextFieldProps;
}) => void;
/** Set the value of the input. */
value: string | number;
/** Controls the highlighting of the search icon. Should be passed \`true\`
when the search text is valid, e.g. contains enough characters to perform
a search. */
isValid?: boolean;
/** Disables the SearchField by greying it out. */
isDisabled: boolean;
/**n placeholder value */
placeholder?: string;
}
declare type ISearchFieldPropsWithPassThroughs = Overwrite<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, ISearchFieldProps>;
declare class SearchField extends React.Component<ISearchFieldPropsWithPassThroughs, ISearchFieldState> {
static displayName: string;
static TextField: {
(_props: ISearchFieldTextField): null;
peek: {
description: string;
};
displayName: string;
propName: string;
};
static Icon: {
(_props: ISearchFieldIcon): null;
peek: {
description: string;
};
displayName: string;
propName: string;
};
static peek: {
description: string;
categories: string[];
madeFrom: string[];
};
static reducers: {
onChange: typeof import("../TextField/TextField.reducers").onChange;
};
static propTypes: {
onChange: any;
onChangeDebounced: any;
debounceLevel: any;
onSubmit: any;
value: any;
isValid: any;
isDisabled: any;
placeholder: any;
className: any;
Icon: any;
TextField: any;
};
static defaultProps: {
isDisabled: boolean;
onChange: (...args: any[]) => void;
onChangeDebounced: (...args: any[]) => void;
debounceLevel: number;
onSubmit: (...args: any[]) => void;
value: string;
};
render(): JSX.Element;
}
declare const _default: typeof SearchField & import("../../util/state-management").IHybridComponent<Overwrite<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, ISearchFieldProps>, ISearchFieldState>;
export default _default;
export { SearchField as SearchFieldDumb };