import { default as React } from 'react';
import { TUseValues } from '../../AHooks/useValues';
import { IAProgressBarProps } from '../AProgressBar/AProgressBar';
import { Resources } from '../AResource/AResource';
import { IAEvent, TPromisable } from '../ATypes/ATypes';
/**
 * onOk와 ok의 네이밍 차이 : 해당 function이 Action임을 정의하는 기준을 고찰.
 * onAction은 callback으로 action이 수행될 때 호출된다. 따라서 기본적으로 onAction을 호출하는 곳은 action 한 곳 뿐이다.
 * 이와 다르게 action은 여러 곳에서 해당 action을 수행하고 싶을 때 호출할 수 있다. 만약 한 곳에서만 action을 호출하는 상황이라면 onAction을 사용하도록 한다.
 */
export interface IADialogActions {
    /**
     * cancel : () => void
     *
     * Description : run cancel of the dialog
     */
    cancel: () => void;
    /**
     * close : () => void
     *
     * Description : close dialog
     */
    close: () => void;
    /**
     * ok : () => void
     *
     * Description : run ok of the dialog
     */
    ok: () => void;
    /**
     * open : () => void
     *
     * Description : open dialog
     */
    open: () => void;
}
export interface IADialogChildren {
    children?: React.ReactNode;
}
export declare const ADialogTypes: readonly ["okCancel", "cancelOk", "ok", "cancel", "none"];
export type TADialogTypes = (typeof ADialogTypes)[number];
export type TADialogContext<P> = (props: P) => {
    children: React.ReactElement;
    isOkDisabled: boolean;
};
export interface IADialogProps {
    /**
     * ProgressRenderer? : React.ComponentType<IAProgressBarProps>
     *
     * Description : component for rendering progress bar
     */
    ProgressRenderer?: React.ComponentType<IAProgressBarProps>;
    /**
     * actionStyle? : React.CSSProperties
     *
     * Description : actionStyle of the dialog
     */
    actionStyle?: React.CSSProperties;
    /**
     * bodyStyle? : React.CSSProperties
     *
     * Description : bodyStyle of the dialog
     */
    bodyStyle?: React.CSSProperties;
    /**
     * buttonNoInteractive? : boolean
     *
     * Description : if true, action buttons are not interactive
     */
    buttonNoInteractive?: boolean;
    /**
     * cancelButtonClassName? : string
     *
     * Description : className of the cancel button
     */
    cancelButtonClassName?: string;
    /**
     * cancelButtonStyle? : React.CSSProperties
     *
     * Description : cancelButtonStyle of the dialog
     */
    cancelButtonStyle?: React.CSSProperties;
    /**
     * children? : React.ReactNode
     *
     * Description : children of the dialog
     */
    children?: React.ReactNode;
    /**
     * contentStyle? : React.CSSProperties
     *
     * Description : contentStyle of the dialog
     */
    contentStyle?: React.CSSProperties;
    /**
     * dlgCore : IADialogCore
     *
     * Description : core of the dialog
     */
    dlgCore: IADialogCore;
    /**
     * isCancelDisabled? : boolean | string
     *
     * Description : if truthy, cancel button is disabled
     */
    isCancelDisabled?: boolean | string;
    /**
     * isCancelLoading? : boolean
     *
     * Description : if truthy, cancel button is loading
     */
    isCancelLoading?: boolean;
    /**
     * isChanged? : boolean
     *
     * Description : if true, cancel will be disabled
     */
    isChanged?: boolean;
    /**
     * isLoading? : boolean
     *
     * Description : if truthy, dialog is loading
     */
    isLoading?: boolean;
    /**
     * isOkDisabled? : boolean | string
     *
     * Description : if truthy, ok button is disabled
     */
    isOkDisabled?: boolean | string;
    /**
     * isOkLoading? : boolean
     *
     * Description : if truthy, ok button is loading
     */
    isOkLoading?: boolean;
    /**
     * noDim? : boolean = false
     *
     * Description : decides whether the dialog has dim or not
     */
    noDim?: boolean;
    /**
     * okButtonClassName? : string
     *
     * Description : className of the ok button
     */
    okButtonClassName?: string;
    /**
     * okButtonStyle? : React.CSSProperties
     *
     * Description : okButtonStyle of the dialog
     */
    okButtonStyle?: React.CSSProperties;
    /**
     * onCancel : (e: IAEvent) => void;
     *
     * Description : onCancel of the dialog. it runs close by default
     */
    onCancel?: (e: IAEvent) => TPromisable<void>;
    /**
     * onClose : () => void;
     *
     * Description : onClose of the dialog. it runs dlgState.onClose by default
     */
    onClose?: () => void;
    /**
     * onEnterPress : (e: IAEvent) => void;
     *
     * Description : onEnterPress of the dialog. it runs ok by default.
     * Notice : This keyboard event ONLY reacts if the 'onEnterPress' prop is explicitly provided.
     */
    onEnterPress?: (e: IAEvent) => TPromisable<void>;
    /**
     * onEscPress : (e: IAEvent) => void;
     *
     * Description : onEscPress of the dialog. it runs cancel by default (eventually triggers onClose).
     * Notice : This keyboard event ONLY reacts if the 'onEscPress' prop is explicitly provided.
     */
    onEscPress?: (e: IAEvent) => TPromisable<void>;
    /**
     * onOk : (e: IAEvent) => void;
     *
     * Description : onOk of the dialog. it runs close by default
     */
    onOk?: (e: IAEvent) => TPromisable<void>;
    /**
     * onPaperClick : (e: IAEvent) => void;
     *
     * Description : onPaperClick of the dialog. it runs cancel by default
     */
    onPaperClick?: (e: IAEvent) => TPromisable<void>;
    /**
     * onSpacePress : (e: IAEvent) => void;
     *
     * Description : onSpacePress of the dialog. it runs ok by default.
     * Notice : This keyboard event ONLY reacts if the 'onSpacePress' prop is explicitly provided.
     */
    onSpacePress?: (e: IAEvent) => TPromisable<void>;
    /**
     * progress? : number
     *
     * Description : if provided, shows a progress bar with the given percentage
     */
    progress?: number;
    /**
     * progressProps? : Omit<IAProgressBarProps, 'progress'>;
     *
     * Description : props of the progress bar
     */
    progressProps?: Omit<IAProgressBarProps, 'progress'>;
    /**
     * resources? : Partial<typeof Resources.ADialog>
     *
     * Description : language resources of the dialog
     */
    resources?: Partial<typeof Resources.ADialog>;
    /**
     * style? : React.CSSProperties
     *
     * Description : style of the dialog
     */
    style?: React.CSSProperties;
    /**
     * title? : React.ReactNode
     *
     * Description : title of the dialog
     */
    title?: React.ReactNode;
    /**
     * titleStyle? : React.CSSProperties
     *
     * Description : titleStyle of the dialog
     */
    titleStyle?: React.CSSProperties;
    /**
     * type? : TADialogTypes = 'okCancel'
     *
     * Description : type of dialog. decides the type of action buttons
     */
    type?: TADialogTypes;
}
/**
 * AComponent : ADialog
 *
 * Description : ADialog is a dialog component.
 *
 *
 * Basic Usage : You should use 'createADialog' and 'ADialog' to make dialog component,
 * and manage it with 'useADialogCore(s)'.
 *
 *      const DTest = createADialog((props: { dlgCore: IADialogCore }) => {
 *         const { dlgCore } = props;
 *         const onOk = () => console.log('ok')
 *         const onCancel = () => console.log('cancel')
 *
 *         return (
 *           <ADialog dlgCore={dlgCore}
 *             title='Dialog Title'
 *             onOk={onOk}
 *             onCancel={onCancel}>
 *             <div>Content</div>
 *             <AButton onClick={dlgCore.action.close}>close</AButton>
 *           </ADialog>
 *         );
 *       });
 *
 *     if (case 1)
 *       const CallerComponent = () => {
 *         const dlgCore = useADialogCore();
 *         return (
 *           <div>
 *            <AButton onClick={dlgCore.action.open}>Open Dialog</AButton>
 *            <DTest dlgCore={dlgCore}/>
 *          </div>
 *         )
 *
 *     if (case 2)
 *       const CallerComponent = () => {
 *         const dlgCores = useADialogCores('dlg1');
 *         return (
 *           <div>
 *             some contents
 *             <AButton onClick={dlgCores.dlg1.action.open}>Open Dialog</AButton>
 *             <DTest dlgState={dlgCores.dlg1}/>
 *           </div>
 *         );
 *       }
 *
 */
export declare const ADialog: (props: IADialogProps) => React.ReactPortal;
export interface IADialogState {
    /**
     * setAction : (action: Partial<IADialogActions>) => void
     *
     * Description : set action of the dialog
     */
    setAction: (action: Partial<IADialogActions>) => void;
    /**
     * useIsOpen : [boolean, (isOpen: boolean) => void]
     *
     * Description : [ASystem] use should not modify this property.
     */
    useIsOpen: TUseValues<boolean>;
}
export type TADialogCores<T extends string> = {
    [key in T]: IADialogCore;
};
export interface IADialogCore {
    /**
     * action : IADialogAction
     *
     * Description : action of the dialog
     */
    action: IADialogActions;
    /**
     * state : IADialogState
     *
     * Description : [ASystem] use should not modify this property.
     */
    state: IADialogState;
}
export type TADialogActions<T extends string> = {
    [key in T]: IADialogActions;
};
export type TADialogStates<T extends string> = {
    [key in T]: IADialogState;
};
/**
 * useADialogCores
 *
 * Description : useADialogCores is a hook that creates dialog cores.
 *
 * Basic Usage : You should use 'useADialogCores' or 'useADialogCore' to make dialog core,
 *
 *     if (case 1)
 *       const dlgCores = useADialogCores(['dlgName', 'testName']);
 *       const dlgCore = dlgCores.dlgName;
 *       const testDlgCore = dlgCores.testName;
 *
 */
export declare const useADialogCore: () => IADialogCore;
export declare const useADialogCores: <T extends string>(extDlgNames: T[] | readonly T[]) => TADialogCores<T>;
export declare const CreateADC: <P extends {
    dlgCore: IADialogCore;
}>(Builder: (props: P) => React.ReactNode) => (props: P) => import("react/jsx-runtime").JSX.Element;
export declare const dlgF: {
    closeAllDlgs: () => void;
};
