import * as H from 'history'; import * as React from 'react'; import { Subject } from 'rxjs'; import { Suggestion } from './Suggestion'; /** * The query input field is clobbered and updated to contain this subject's values, as * they are received. This is used to trigger an update; the source of truth is still the URL. */ export declare const queryUpdates: Subject; interface Props { location: H.Location; history: H.History; /** The value of the query input */ value: string; /** Called when the value changes */ onChange: (newValue: string) => void; /** * A string that is appended to the query input's query before * fetching suggestions. */ prependQueryForSuggestions?: string; /** Whether the input should be autofocused (and the behavior thereof) */ autoFocus?: true | 'cursor-at-end'; /** The input placeholder, if different from the default is desired. */ placeholder?: string; /** * Whether this input should behave like the global query input: (1) * pressing the '/' key focuses it and (2) other components contribute a * query to it with their context (such as the repository area contributing * 'repo:foo@bar' for the current repository and revision). * * At most one query input per page should have this behavior. */ hasGlobalQueryBehavior?: boolean; } interface State { /** Whether the query input is focused */ inputFocused: boolean; /** Whether suggestions are shown or not */ hideSuggestions: boolean; /** The suggestions shown to the user */ suggestions: Suggestion[]; /** Index of the currently selected suggestion (-1 if none selected) */ selectedSuggestion: number; /** Whether suggestions are currently being fetched */ loading: boolean; } export declare class QueryInput extends React.Component { private static SUGGESTIONS_QUERY_MIN_LENGTH; private componentUpdates; /** Subscriptions to unsubscribe from on component unmount */ private subscriptions; /** Emits on keydown events in the input field */ private inputKeyDowns; /** Emits new input values */ private inputValues; /** Emits when the input field is clicked */ private inputFocuses; /** Emits when the suggestions are hidden */ private suggestionsHidden; /** Only used for selection and focus management */ private inputElement?; /** Only used for scroll state management */ private suggestionListElement?; /** Only used for scroll state management */ private selectedSuggestionElement?; /** Only used to keep track if the user has typed a single character into the input field so we can log an event once. */ private hasLoggedFirstInput; constructor(props: Props); componentDidMount(): void; componentWillReceiveProps(newProps: Props): void; componentWillUnmount(): void; componentDidUpdate(prevProps: Props, prevState: State): void; render(): JSX.Element | null; private setSuggestionListElement; private selectSuggestion; private focusInputAndPositionCursorAtEnd; private onInputChange; private onInputFocus; private onInputBlur; private onInputKeyDown; private moveSelection; } export {}; //# sourceMappingURL=QueryInput.d.ts.map