import * as _angular_core from '@angular/core';
import { WritableSignal, OutputEmitterRef, OnDestroy } from '@angular/core';
import { AXStyleColorType, NXComponent, NXClickEvent, AXOrientation, NXEvent } from '@acorex/cdk/common';
import { AXPoint } from '@acorex/core/utils';
import { Subject } from 'rxjs';

type AXMenuOpenTrigger = 'click' | 'hover';
type AXMenuCloseTrigger = 'click' | 'leave';
declare abstract class AXRootMenu {
    orientation: WritableSignal<AXOrientation>;
    openOn: WritableSignal<AXMenuOpenTrigger>;
    closeOn: WritableSignal<AXMenuCloseTrigger>;
    onItemClick: OutputEmitterRef<AXMenuItemClickBaseEvent>;
    nativeElement: HTMLDivElement;
    hasArrow: WritableSignal<boolean>;
}
declare abstract class AXMenuItemComponentBase {
}
declare abstract class AXMenuItem {
    color?: AXStyleColorType;
    name?: string;
    text: string;
    data?: any;
    icon?: string;
    disabled?: boolean;
    items?: AXMenuItem[];
    suffix?: {
        text: string;
    };
    break?: boolean;
    group?: {
        name?: string;
        title?: string;
    };
}
declare class AXMenuItemClickBaseEvent<T extends NXComponent = NXComponent> extends NXClickEvent<T> {
    item: {
        name?: string;
        text: string;
        data?: any;
    };
    canceled: boolean;
}

declare class AXContextMenuOpeningEvent extends NXEvent<AXContextMenuComponent> {
    items: AXMenuItem[];
    canceled: boolean;
    targetElement: HTMLElement;
}
type AXContextMenuItemsClickEvent = AXMenuItemClickBaseEvent<AXContextMenuComponent>;
/**
 * Represents a menu component that displays context menu.
 * @category Components
 */
declare class AXContextMenuComponent extends NXComponent {
    readonly orientation: _angular_core.InputSignal<AXOrientation>;
    readonly openOn: _angular_core.InputSignal<AXMenuOpenTrigger>;
    readonly closeOn: _angular_core.InputSignal<AXMenuCloseTrigger>;
    readonly originalItems: _angular_core.InputSignal<AXMenuItem[]>;
    readonly target: _angular_core.InputSignal<string | HTMLElement | HTMLElement[]>;
    onItemClick: _angular_core.OutputEmitterRef<AXContextMenuItemsClickEvent>;
    onOpening: _angular_core.OutputEmitterRef<AXContextMenuOpeningEvent>;
    hasArrow: _angular_core.WritableSignal<boolean>;
    private service;
    private renderer;
    private document;
    private platformID;
    private zIndexService;
    private zToken;
    /** @ignore */
    constructor();
    ngOnDestroy(): void;
    /**
     * Refreshes the context menu by rebinding event listeners to target elements.
     */
    refresh(): void;
    /**
     * Shows the context menu at a specific point.
     * @param point - The coordinates where the menu should appear
     * @param targetElement - Optional target element for the context menu
     * @param event - Optional opening event with menu items
     */
    showAt(point: AXPoint, targetElement?: HTMLElement, event?: AXContextMenuOpeningEvent): void;
    /**
     * Closes the context menu and removes the backdrop.
     */
    close(): void;
    private backdropElement;
    private originalNextSibling;
    private originalParent;
    protected items: _angular_core.WritableSignal<AXMenuItem[]>;
    /** @ignore */
    private getTargetElements;
    /** @ignore */
    private bindContextEvent;
    /** @ignore */
    private removeContextEvent;
    /** @ignore */
    private handleContextMenu;
    /** @ignore */
    private internalShowAt;
    /** @ignore */
    private createBackdrop;
    /** @ignore */
    private removeBackdrop;
    private createEventListeners;
    /** @ignore */
    private onWindowEvent;
    /** @ignore */
    get __hostClass(): any;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXContextMenuComponent, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXContextMenuComponent, "ax-context-menu", never, { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "openOn": { "alias": "openOn"; "required": false; "isSignal": true; }; "closeOn": { "alias": "closeOn"; "required": false; "isSignal": true; }; "originalItems": { "alias": "items"; "required": false; "isSignal": true; }; "target": { "alias": "target"; "required": false; "isSignal": true; }; }, { "onItemClick": "onItemClick"; "onOpening": "onOpening"; }, never, ["ax-menu-item,ax-divider,ax-title,ng-container"], true, never>;
}

type AXMenuItemClickEvent = AXMenuItemClickBaseEvent<AXMenuItemComponent>;
/**
 * Represents a menu item component used within an `ax-menu`.
 * @category Components
 */
declare class AXMenuItemComponent extends NXComponent implements OnDestroy {
    protected isOpen: _angular_core.WritableSignal<boolean>;
    protected hasSubItems: _angular_core.WritableSignal<boolean>;
    protected isFirstLevel: _angular_core.WritableSignal<boolean>;
    private mutationObserver;
    protected root: AXRootMenu;
    protected parent?: AXMenuItemComponent | null;
    protected isRoot: () => boolean;
    private service;
    private scrollableParents;
    private unsuscriber;
    private renderer;
    private zIndexService;
    private zToken;
    protected arrowIcon: _angular_core.Signal<string>;
    onClick: _angular_core.OutputEmitterRef<AXMenuItemClickEvent>;
    name: _angular_core.InputSignal<string>;
    data: _angular_core.InputSignal<any>;
    disabled: _angular_core.InputSignal<boolean>;
    color: _angular_core.InputSignal<AXStyleColorType>;
    constructor();
    private closeExcept;
    private observeMutations;
    private getText;
    /**
     * Manually detect all `ax-menu-item` elements and check if this menu item has sub-items.
     */
    private detectSubItems;
    /**
     * Opens the submenu of this menu item if it has sub-items and is not disabled.
     *
     * Inherited behavior: Uses the injected service to notify other items to close.
     *
     * @returns void - No return value. Triggers submenu opening side-effects.
     */
    open(): void;
    /**
     * Closes the submenu of this menu item if open.
     *
     * @returns void - No return value. Triggers submenu closing side-effects.
     */
    close(): void;
    /**
     * Calculate the position of the submenu to avoid it going out of the viewport.
     */
    private calculatePosition;
    private handleClick;
    private handleMouseEnter;
    private mouseLeaveTimeout;
    private handleMouseLeave;
    private onWindowEvent;
    /**
     * Close all menus if clicking outside the root menu and all sub-items.
     */
    private onClickOutside;
    ngOnDestroy(): void;
    private bindScrollEvents;
    private removeScrollEvents;
    /**
     * Handler for scroll events (window or scrollable parent containers)
     */
    private onContainerScroll;
    /** @ignore */
    get __hostClass(): string[];
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXMenuItemComponent, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXMenuItemComponent, "ax-menu-item", never, { "name": { "alias": "name"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; }, { "onClick": "onClick"; }, never, ["ax-prefix", "ax-text", "ax-suffix", "ax-menu-item,ax-title,ax-divider,ng-container"], true, never>;
}

declare class AXMenuService {
    closeAll$: Subject<void>;
    open$: Subject<AXMenuItemComponentBase>;
    close$: Subject<AXMenuItemComponentBase>;
    closeExcept$: Subject<AXMenuItemComponentBase>;
    openContextMenu$: Subject<{
        sender: AXRootMenu;
        point: AXPoint;
    }>;
    closeAllContextMenu$: Subject<{
        sender: AXRootMenu;
    }>;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXMenuService, never>;
    static ɵprov: _angular_core.ɵɵInjectableDeclaration<AXMenuService>;
}

type AXMenuItemsClickEvent = AXMenuItemClickBaseEvent<AXMenuComponent>;
/**
 * Represents a menu component that displays menu items.
 * @category Components
 */
declare class AXMenuComponent extends NXComponent {
    orientation: _angular_core.InputSignal<AXOrientation>;
    openOn: _angular_core.InputSignal<AXMenuOpenTrigger>;
    closeOn: _angular_core.InputSignal<AXMenuCloseTrigger>;
    service: AXMenuService;
    onItemClick: _angular_core.OutputEmitterRef<AXMenuItemsClickEvent>;
    items: _angular_core.InputSignal<AXMenuItem[]>;
    hasArrow: _angular_core.InputSignal<boolean>;
    /** @ignore */
    get __hostClass(): string[];
    /**
     * Closes all open menus and submenus for this root menu.
     *
     * @returns void - No return value. All open menu overlays are closed and hidden.
     */
    close(): void;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXMenuComponent, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXMenuComponent, "ax-menu", never, { "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "openOn": { "alias": "openOn"; "required": false; "isSignal": true; }; "closeOn": { "alias": "closeOn"; "required": false; "isSignal": true; }; "items": { "alias": "items"; "required": false; "isSignal": true; }; "hasArrow": { "alias": "hasArrow"; "required": false; "isSignal": true; }; }, { "onItemClick": "onItemClick"; }, never, ["ax-menu-item,ax-divider,ax-title,ng-container"], true, never>;
}

declare class AXMenuModule {
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXMenuModule, never>;
    static ɵmod: _angular_core.ɵɵNgModuleDeclaration<AXMenuModule, never, [typeof AXMenuItemComponent, typeof AXMenuComponent, typeof AXContextMenuComponent], [typeof AXMenuItemComponent, typeof AXMenuComponent, typeof AXContextMenuComponent]>;
    static ɵinj: _angular_core.ɵɵInjectorDeclaration<AXMenuModule>;
}

export { AXContextMenuComponent, AXContextMenuOpeningEvent, AXMenuComponent, AXMenuItem, AXMenuItemClickBaseEvent, AXMenuItemComponent, AXMenuItemComponentBase, AXMenuModule, AXMenuService, AXRootMenu };
export type { AXContextMenuItemsClickEvent, AXMenuCloseTrigger, AXMenuItemClickEvent, AXMenuItemsClickEvent, AXMenuOpenTrigger };
