UNPKG

@react-crates/modal

Version:

리액트 모달을 쉽게 등록하고 사용가능한 라이브러리입니다.

97 lines (96 loc) 3.57 kB
import { CSSProperties, FocusEventHandler } from "react"; import { ModalManagerInterface, ModalActionState, ModalCallback, ModalComponent, ModalConfirmType, ModalLifecycleState, ModalMiddlewareProps, ModalOptions, ModalState, StateControllerOptions, ModalEditOptions } from "../types"; interface ModalProps { id: number; modalKey: string | null; name: string; component: ModalComponent; options: ModalOptions<any>; } export declare class Modal { private manager; private lifecycleState; private actionState; private actionCallback; private afterCloseCallback; private listeners; private breakPoint; private isInitial; private stateResponsive; private initialComponent; private currentComponent; private componentProps; private escKeyActive; private role; private label; private isOpened; private isPostOpened; private _id; private _modalKey; private _name; private _options; private _isCurrent; private _isAwaitingConfirm; private _isCloseDelay; private _closeDelayDuration; private _confirm; private _onOpenAutoFocus; private _state; private _currentPosition; private _disableFocusHandling; componentRef: HTMLDivElement | null; constructor({ id, modalKey, name, component, options }: ModalProps, manager: ModalManagerInterface); private bind; private setOption; private initComponent; get id(): number; get options(): ModalOptions<any, string>; get modalKey(): string | null; get name(): string; get component(): ModalComponent; get confirm(): ModalConfirmType | undefined; get isCurrent(): boolean; get isAwaitingConfirm(): boolean; get isCloseDelay(): boolean; get closeDelayDuration(): number; get callback(): ModalCallback; get onOpenAutoFocus(): FocusEventHandler<HTMLDivElement> | undefined; get state(): ModalState; get currentPosition(): string; private setComponentProps; /** * TO-DO * modal에서는 그냥 바꾸는 로직만 있고 modalManager에서 처리할 것. */ private changeComponent; private changeStateResponsiveComponent; private changeState; edit({ component, ...contents }: Omit<ModalEditOptions, 'zIndex'>): void; getActionState(): ModalActionState; getLifecycleState(): ModalLifecycleState; init(): Promise<void>; postOpen(callback?: () => void): void; active(): void; close(): Promise<boolean>; blockCloseDelay(): this; setCloseDelay(duration?: number): this; updateIsCurrent(isCurrent: boolean): this; getState(): ModalState; subscribe(listener: (state: ModalState) => void): this; unsubscribe(listener: (state: ModalState) => void): this; notify(): this; getMiddlewareProps(): ModalMiddlewareProps; action(confirm?: ModalConfirmType, callback?: ModalCallback): Promise<boolean>; initial(): this; pending(message?: string | Omit<StateControllerOptions, "afterCloseCallback" | "isAwaitingConfirm">): this; success(message?: string | StateControllerOptions | ((confirm?: ModalConfirmType) => void)): this; error(message?: string | StateControllerOptions | ((confirm?: ModalConfirmType) => void)): this; end(message?: string | Omit<StateControllerOptions, "component"> | ((confirm?: ModalConfirmType) => void)): this; getModalStyle(): { className?: string; style: CSSProperties; }; getBackCoverStyle(): CSSProperties; setBreakPoint(breakPoint: number): void; } export {};