import * as _angular_core from '@angular/core';
import { TemplateRef, Type, OnInit, AfterViewInit, OnDestroy } from '@angular/core';
import { AXStyleColorType, AXComponentCloseEvent, MXBaseComponent } from '@acorex/cdk/common';
import { AXOverlayRef } from '@acorex/cdk/overlay';
import { AXComponentInputs, AXComponentType } from '@acorex/core/components';
import * as rxjs from 'rxjs';
import { Subject } from 'rxjs';

interface AXActionSheetItem {
    name?: string;
    text: string;
    icon?: string;
    disabled?: boolean;
    color?: AXStyleColorType;
    onClick?: () => void;
    suffix?: {
        text: string;
    };
    break?: boolean;
    group?: {
        name?: string;
        title?: string;
    };
}
type AXActionSheetContentType = TemplateRef<unknown> | Type<unknown>;
interface AXActionSheetConfig {
    title?: string;
    subTitle?: string;
    closeButton?: boolean;
    header?: boolean;
    /** @deprecated Use `inputs` instead to pass data to the action sheet content component. */
    data?: unknown;
    /** Input values to pass to the content component */
    inputs?: unknown;
    closeOnBackdropClick?: boolean;
    items?: AXActionSheetItem[];
    content?: AXActionSheetContentType;
    draggable?: boolean;
    dragUp?: boolean;
}
/**
 * Reference to an open action sheet, providing methods to interact with it.
 */
interface AXActionSheetRef<TResult = unknown> {
    /** Closes the action sheet with optional result data */
    close: (data?: TResult) => void;
    /** Sets input values on the content component */
    setInputs: (values: AXComponentInputs) => void;
    /** Observable that emits when the action sheet is closed */
    onClose: Subject<TResult>;
}
/**
 * Base class for components that are displayed inside an action sheet.
 * Extend this class to get access to the action sheet reference and helper methods.
 *
 * @example
 * ```typescript
 * @Component({...})
 * export class MyActionSheetContent extends AXActionSheetComponentBase {
 *   save() {
 *     this.close({ saved: true });
 *   }
 * }
 * ```
 */
declare abstract class AXActionSheetComponentBase {
    /** Reference to the parent action sheet */
    __actionSheet__: _angular_core.InputSignal<AXActionSheetRef<unknown>>;
    /**
     * Closes the action sheet with optional result data.
     * @param data - Optional data to pass to the close handler
     */
    close(data?: any): void;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXActionSheetComponentBase, never>;
    static ɵdir: _angular_core.ɵɵDirectiveDeclaration<AXActionSheetComponentBase, never, never, { "__actionSheet__": { "alias": "__actionSheet__"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
}
interface AXActionSheetEvent {
    overlayRef?: AXOverlayRef<unknown>;
    nativeEvent?: Event;
    isUserInteraction: boolean;
    data: {
        state: 'open' | 'close' | 'dragStart' | 'dragEnd' | 'fullScreen' | 'normalSize';
    };
}
/**
 * @internal
 * Internal reference used by action sheet service to manage overlay instances
 */
interface AXActionSheetInternalRef {
    overlayRef: AXOverlayRef<unknown>;
    close: (result?: AXComponentCloseEvent) => void;
}

/**
 * A component for displaying an action sheet, which is a menu that slides up from the bottom of the screen.
 *
 * @category Components
 */
declare class AXActionSheetComponent extends MXBaseComponent implements OnInit, AfterViewInit, OnDestroy {
    /** Action sheet configuration data */
    data: _angular_core.InputSignal<AXActionSheetConfig>;
    /** @internal Callback function to close the action sheet */
    onClose: _angular_core.InputSignal<(result?: AXComponentCloseEvent) => void>;
    /** @internal Overlay reference for event tracking */
    overlayRef: _angular_core.InputSignal<AXOverlayRef<unknown>>;
    /** @internal Reference to the action sheet for content components */
    __actionSheetRef__: _angular_core.InputSignal<AXActionSheetRef<unknown>>;
    private contentContainerRef;
    private document;
    private platformID;
    private renderer;
    private actionSheetService;
    private onMouseMoveListenerFn;
    private onMouseUpListenerFn;
    private onTouchMoveListenerFn;
    private onTouchUpListenerFn;
    private isDragging;
    private isFullScreen;
    private curserOffset;
    private actionSheetHeight;
    private isActionSheetHeightSet;
    private transitionDuration;
    /**
     *  @ignore
     */
    private _componentRef;
    /** Template content if data.content is a TemplateRef */
    protected templateContent: _angular_core.Signal<TemplateRef<unknown>>;
    /** Component content if data.content is a component Type */
    protected componentContent: _angular_core.Signal<AXComponentType<unknown>>;
    /** Template context for ngTemplateOutlet */
    protected templateContext: _angular_core.Signal<{
        $implicit: AXActionSheetConfig;
        ref: AXActionSheetComponent;
    }>;
    /** Whether content has been rendered (for component content) */
    protected isContentRendered: _angular_core.WritableSignal<boolean>;
    /**
     *  @ignore
     */
    ngOnInit(): void;
    /**
     *  @ignore
     */
    ngAfterViewInit(): void;
    /**
     * Renders the component content if provided.
     * Uses ViewContainerRef to create the component and properly set inputs.
     */
    private renderComponentContent;
    /**
     * Sets input values on the content component.
     * @param values - Object containing input values to set
     */
    setContentInputs(values: AXComponentInputs): void;
    ngOnDestroy(): void;
    protected handleMouseDown(e: MouseEvent): void;
    protected handleTouchDown(e: TouchEvent): void;
    private handleDown;
    private snapToFinalPosition;
    private heightCalculator;
    /**
     * Handles click events on action sheet items.
     * This method is called when a user clicks on an action sheet item. It closes the action sheet
     * with the clicked item as the result data and executes the item's onClick callback if provided.
     *
     * @param item - The action sheet item that was clicked. Contains the item's data and optional onClick callback.
     * @returns void
     */
    onItemClick(item: AXActionSheetItem): void;
    /**
     * Closes the action sheet with optional result data.
     * This method initiates the closing animation of the action sheet and eventually closes the dialog.
     * The closing process includes a height animation and cleanup of event listeners.
     *
     * @param e - The result data to pass when closing the action sheet. Can be any value including null.
     *            If an AXActionSheetItem is passed, it represents the selected item.
     * @param isUserInteraction - Whether the close action was triggered by user interaction (default: true).
     *                           This affects how the action sheet handles accessibility and event tracking.
     * @returns void
     */
    close(e?: unknown, isUserInteraction?: boolean): void;
    /**
     *  @ignore
     */
    protected onKeydownHandler(): void;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXActionSheetComponent, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<AXActionSheetComponent, "ax-action-sheet", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "onClose": { "alias": "onClose"; "required": false; "isSignal": true; }; "overlayRef": { "alias": "overlayRef"; "required": false; "isSignal": true; }; "__actionSheetRef__": { "alias": "__actionSheetRef__"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
}

declare class AXActionSheetModule {
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXActionSheetModule, never>;
    static ɵmod: _angular_core.ɵɵNgModuleDeclaration<AXActionSheetModule, never, [typeof AXActionSheetComponent], [typeof AXActionSheetComponent]>;
    static ɵinj: _angular_core.ɵɵInjectorDeclaration<AXActionSheetModule>;
}

/**
 * @deprecated Use `AXActionSheetRef` instead
 */
interface AXActionSheetDialogRef<TResult = unknown> {
    close: (e?: TResult) => void;
    setInputs: (values: AXComponentInputs) => void;
    closed: Subject<{
        data?: TResult;
    }>;
}
declare class AXActionSheetService {
    private overlayService;
    private readonly actionSheetEvent;
    actionSheetEvent$: rxjs.Observable<AXActionSheetEvent>;
    /**
     * Opens an action sheet with the specified configuration.
     * This method creates and displays an action sheet component with the provided options.
     * The action sheet will slide up from the bottom of the screen and can be dismissed
     * by tapping outside, pressing escape, or calling the close method.
     *
     * @param config - The configuration object that defines the action sheet's appearance and behavior.
     *                 Must include at least a title or content property. Will be merged with default config.
     * @param isUserInteraction - Whether the action sheet is opened by user interaction (default: true).
     *                           This affects how the action sheet handles accessibility and focus management.
     * @returns A promise that resolves to a dialog reference containing methods to control the action sheet.
     *          The reference includes methods like close(), setInputs() and a closed observable for tracking dialog state.
     * @example
     * ```typescript
     * const dialogRef = await actionSheetService.open({
     *   title: 'Choose an option',
     *   content: MyCustomComponent,
     *   inputs: { userId: 123, userName: 'John' }
     * });
     *
     * // Update inputs dynamically
     * dialogRef.setInputs({ userName: 'Jane' });
     *
     * dialogRef.closed.subscribe(result => {
     *   console.log('Action sheet closed with:', result.data);
     * });
     * ```
     */
    open<TResult = any>(config: AXActionSheetConfig, isUserInteraction?: boolean): Promise<AXActionSheetRef<TResult>>;
    /**
     * Sets the current state of action sheet events.
     * This method is used internally to track action sheet lifecycle events such as open, close,
     * drag start, drag end, and full screen transitions. It emits events through the actionSheetEvent$
     * observable for external subscribers to monitor action sheet state changes.
     *
     * @param event - The action sheet event to emit. Contains information about the event type,
     *               associated data, user interaction status, and overlay reference.
     * @returns void
     */
    setActionSheetEventState(event: AXActionSheetEvent): void;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<AXActionSheetService, never>;
    static ɵprov: _angular_core.ɵɵInjectableDeclaration<AXActionSheetService>;
}

export { AXActionSheetComponent, AXActionSheetComponentBase, AXActionSheetModule, AXActionSheetService };
export type { AXActionSheetConfig, AXActionSheetContentType, AXActionSheetDialogRef, AXActionSheetEvent, AXActionSheetInternalRef, AXActionSheetItem, AXActionSheetRef };
