import { TypedEmitter } from 'tiny-typed-emitter';
import { GetReferenceClientRect, Placement } from 'tippy.js';
export type CloseReason = 'click' | 'cancel' | 'byParent';
export interface Closeable {
    close: (reason: CloseReason) => void;
}
export type InitItemOptions = {
    tooltipId?: string;
};
export type CommandItemType = 'normal' | 'separator' | 'section';
export type CommandItemState = 'disabled' | 'checked' | 'selected';
export type CommandItemChildrenPlacement = 'auto' | 'top' | 'left' | 'right' | 'bottom' | 'auto-start' | 'auto-end' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'right-start' | 'right-end' | 'left-start' | 'left-end';
export type CommandItemNamePosition = 'auto' | 'right' | 'bottom';
export interface CommandItem {
    id: string;
    name: string;
    desc?: string;
    states?: CommandItemState[];
    value?: string;
    order?: number;
    type?: CommandItemType;
    element?: HTMLElement | ((item: CommandItem) => HTMLElement);
    icon?: string;
    childrenType?: 'menu' | 'toolbar';
    children?: CommandItem[];
    childrenMenuId?: string;
    data?: unknown;
    group?: string;
    groupOrder?: number;
    dropdown?: boolean;
    dropSplit?: boolean;
    hidden?: boolean;
    namePosition?: CommandItemNamePosition;
    manualShowChildren?: boolean;
    childrenPlacement?: CommandItemChildrenPlacement;
    childrenOffset?: [number, number];
    childArrow?: boolean;
    useItemRect?: boolean;
    subText?: string;
    defaultCheckedChildren?: string[];
    ellipsisTooltip?: string;
    disableTooltip?: boolean;
    forceTooltip?: boolean;
    disableReason?: string;
    setCloseable?: (closeable: Closeable) => void;
    beforePopup?: (childrenBar: AbstractCommandBar) => void;
    initItem?: (item: CommandItem, elem: CommandItemElement, options: InitItemOptions, bar: AbstractCommandBar) => void;
    classes?: string[];
}
export type { Placement, GetReferenceClientRect };
export interface CommandBarEvents {
    'show': (bar: AbstractCommandBar) => void;
    'click': (bar: AbstractCommandBar, item: CommandItem, elem: HTMLElement) => void;
    'close': (bar: AbstractCommandBar) => void;
    'selectionChange': (bar: AbstractCommandBar, id: string) => void;
    'closing': (bar: AbstractCommandBar, event: MouseEvent) => boolean | undefined;
}
export interface ManualShowCommandBarOptions {
    placement?: Placement;
    point?: {
        x: number;
        y: number;
    };
    theme?: string;
    getReferenceClientRect?: GetReferenceClientRect | null | undefined;
    offset?: [number, number];
    arrow?: boolean;
}
export interface AbstractCommandBar extends TypedEmitter<CommandBarEvents> {
    readonly isVisible: boolean;
    readonly parentItem: CommandItem | null;
    readonly content: HTMLElement;
    close: (reason: CloseReason) => void;
    requestClose: (reason: CloseReason) => void;
    destroy: () => void;
    isInCommandBar: (target: EventTarget | null) => boolean;
    handleDocumentKeydown: (event: KeyboardEvent) => boolean;
    getSubBarOptions: (item: CommandItem, target: HTMLElement) => ManualShowCommandBarOptions;
    updateItem: (item: CommandItem, options?: {
        statesOnly?: boolean;
    }) => void;
}
export interface ShowCommandBarOptions {
    placement?: Placement;
}
export interface AbstractManualCommandBar extends AbstractCommandBar {
    manualShow: (target: HTMLElement, options?: ShowCommandBarOptions) => void;
}
export interface AbstractHoveringCommandBar extends AbstractCommandBar {
    setTarget: (target: HTMLElement, options: ShowCommandBarOptions) => void;
}
export type CommandItemElement = HTMLElement & {
    __neverUse: 'CommandItemElement';
};
export type CommandBarContentElement = HTMLElement & {
    __neverUse: 'CommandBarContentElement';
};
export interface CommandBarOptions {
    id?: string;
    parentItem?: CommandItem;
    itemElementTag?: keyof HTMLElementTagNameMap;
    tippyArrow?: boolean;
    trigger?: string;
    tooltipId?: string;
    autoClose?: boolean;
    classes?: string[];
    disablePageScroll?: boolean;
    disableSelectedScroll?: boolean;
    refuseOverflow?: boolean;
    overflowBoundary?: Element;
    header?: HTMLElement | (() => HTMLElement | null);
    footer?: HTMLElement | (() => HTMLElement | null);
    padding?: number;
    menubar?: boolean;
}
export type CreateManualCommandBarFunction = (parentItem: CommandItem, closeable: Closeable, options?: CommandBarOptions) => AbstractManualCommandBar;
export type PopoverOptions = {
    overflowBoundary?: Element;
};
