react-snappy-modal
Version:
Flexible and easy-to-use modal library for React, supporting customizable dialogs with promise-based interactions.
29 lines (26 loc) • 1.05 kB
TypeScript
import React from 'react';
declare class SnappyModal {
static isShow(): boolean;
static getCurrentComponent(layer: number): ModalProgress;
static removeModalProcess(layer: number): void;
static getModalProcess(): ModalProgress[];
static close(value?: any, layer?: number): void;
static throw(thrower?: any, layer?: number): void;
static show(component: React.ReactElement, options?: SnappyModalOptions): Promise<any>;
}
interface ModalProgress {
component: React.FC<any>;
options: SnappyModalOptions;
resolve: (value?: any) => void;
throw: (thrower?: any) => void;
}
type SnappyModalPosition = "top-left" | "top-center" | "top-right" | "center-left" | "center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
type SnappyModalOptions = {
allowOutsideClick?: boolean;
allowScroll?: boolean;
backdrop?: boolean | string;
position?: SnappyModalPosition;
zIndex?: number;
layer?: number;
};
export { type ModalProgress, SnappyModal, type SnappyModalOptions };