import * as H from 'history';
import * as React from 'react';
import * as GQL from '../../../backend/graphqlschema';
export declare type OnBlurHandler = () => void;
export declare type OnKeyDownFilter = (e: React.KeyboardEvent<HTMLTextAreaElement>) => boolean;
/**
 * Represents a selection in a list of items.
 */
declare class ListSelectionState {
    index: number;
    length: number;
    /**
     * Creates a new ListSelectionState.
     * @param index The item in the list that is currently selected. Out of bounds selections wrap around.
     * @param length The length of the list.
     */
    constructor(index: number, length: number);
    /** Returns a new ListSelectionState representing the user's wishes to move down in the list by one item. */
    static down(a: ListSelectionState): ListSelectionState;
    /** Returns a new ListSelectionState representing the user's wishes to move up in the list by one item. */
    static up(a: ListSelectionState): ListSelectionState;
}
interface Props {
    location: H.Location;
    history: H.History;
    /** The current input text area value. */
    textAreaValue: string;
    /** The starting index of the selection (i.e. the cursor position) in the text area. */
    selectionStart: number;
    /** Called to set the value of the text area. */
    setTextAreaValue(v: {
        newValue: string;
        newSelectionStart: number;
    }): void;
    /** The actual text area element. */
    textAreaElement: HTMLElement;
    /** Called to set the handler that should be invoked when the textarea's onblur event fires. */
    setOnBlurHandler: (h: OnBlurHandler) => void;
    /** Called to set the filter that should be invoked when the textarea's onkeydown event fires. */
    setOnKeyDownFilter: (h: OnKeyDownFilter) => void;
}
interface State {
    /** Which user is being searched for, or none. This also effectively determines if the overlay is visible. */
    userSearch?: string;
    /**
     * The relative position in pixels where the overlay should be displayed.
     */
    position: {
        top: number;
        left: number;
    };
    /**
     * Whether or not the list of users is being loaded. While loading, the old
     * list may still be displayed.
     */
    loading: boolean;
    /** Whether or not there was an error loading the list of users. */
    error?: Error;
    /** The list of users to render. */
    connection?: GQL.IUserConnection;
    /** The selection state of the list of possible mentions. */
    selectionState: ListSelectionState;
    /**
     * The last text area value that we are aware of. This is needed in order
     * to prevent setTextAreaValue from re-opening the mention overlay.
     */
    lastTextAreaValue: string;
}
export declare class DiscussionsInputMentionOverlay extends React.PureComponent<Props> {
    private componentUpdates;
    private subscriptions;
    /** Fired when the user to search for has changed. */
    private userSearches;
    state: State;
    componentDidMount(): void;
    componentDidUpdate(): void;
    componentWillUnmount(): void;
    render(): JSX.Element | null;
    private select;
    private dismiss;
    private onKeyDownFilter;
}
export {};
//# sourceMappingURL=DiscussionsInputMentionOverlay.d.ts.map