import * as H from 'history';
import * as React from 'react';
import * as GQL from '../backend/graphqlschema';
import { ExtensionsControllerProps, ExtensionsProps } from '../extensions/ExtensionsClientCommonContext';
import { ActionButtonDescriptor } from '../util/contributions';
import { ErrorLike } from '../util/errors';
import { ResolvedRev } from './backend';
/**
 * An item that is displayed in the RepoHeader and originates from outside the RepoHeader. The item is typically an
 * icon, button, or link.
 */
export interface RepoHeaderContribution {
    /** The position of this contribution in the RepoHeader. */
    position: 'nav' | 'left' | 'right';
    /**
     * Controls the relative order of header action items. The items are laid out from highest priority (at the
     * beginning) to lowest priority (at the end). The default is 0.
     */
    priority?: number;
    /**
     * The element to display in the RepoHeader. The element *must* have a React key that is a string and is unique
     * among all RepoHeaderContributions. If not, an exception will be thrown.
     */
    element: React.ReactElement<any>;
}
/** React props for components that store or display RepoHeaderContributions. */
export interface RepoHeaderContributionsProps {
    /** Contributed items to display in the RepoHeader. */
    repoHeaderContributions: RepoHeaderContribution[];
}
/**
 * React props for components that participate in the creation or lifecycle of RepoHeaderContributions.
 */
export interface RepoHeaderContributionsLifecycleProps {
    repoHeaderContributionsLifecycleProps?: {
        /**
         * Called when a new RepoHeader contribution is created (and should be shown in RepoHeader). If another
         * contribution with the same ID already exists, this new one overwrites the existing one.
         */
        onRepoHeaderContributionAdd: (item: RepoHeaderContribution) => void;
        /**
         * Called when a new RepoHeader contribution is removed (and should no longer be shown in RepoHeader). The key
         * is the same as that of the contribution's element (when it was added).
         */
        onRepoHeaderContributionRemove: (key: string) => void;
    };
}
/**
 * Context passed into action button render functions
 */
export interface RepoHeaderContext {
    /** The current repository name */
    repoName: string;
    /** The current URI-decoded revision (e.g., "my#branch" in "my/repo@my%23branch"). */
    encodedRev?: string;
}
export interface RepoHeaderActionButton extends ActionButtonDescriptor<RepoHeaderContext> {
}
interface Props extends ExtensionsProps, ExtensionsControllerProps {
    /**
     * An array of render functions for action buttons that can be configured *in addition* to action buttons
     * contributed through {@link RepoHeaderContributionsLifecycleProps} and through extensions.
     */
    actionButtons: ReadonlyArray<RepoHeaderActionButton>;
    /**
     * The repository that this header is for.
     */
    repo: GQL.IRepository | {
        /** The repository's GQL.ID, if it has one.
         */
        id?: GQL.ID;
        name: string;
        url: string;
        enabled: boolean;
        viewerCanAdminister: boolean;
    };
    /** Information about the revision of the repository. */
    resolvedRev: ResolvedRev | ErrorLike | undefined;
    /** The URI-decoded revision (e.g., "my#branch" in "my/repo@my%23branch"). */
    rev?: string;
    /**
     * Called in the constructor when the store is constructed. The parent component propagates these lifecycle
     * callbacks to its children for them to add and remove contributions.
     */
    onLifecyclePropsChange: (lifecycleProps: RepoHeaderContributionsLifecycleProps) => void;
    location: H.Location;
    history: H.History;
}
interface State extends RepoHeaderContributionsProps {
}
/**
 * The repository header with the breadcrumb, revision switcher, and other items.
 *
 * Other components can contribute items to the repository header using RepoHeaderContribution.
 */
export declare class RepoHeader extends React.PureComponent<Props, State> {
    state: State;
    constructor(props: Props);
    render(): JSX.Element | null;
    private repoHeaderContributionStore;
}
export {};
//# sourceMappingURL=RepoHeader.d.ts.map