UNPKG

react-material-overlay

Version:

A fully featured Material UI implementation of overlays like modals, alert dialogs, lightboxes, and bottom sheets featuring easy stack management and browser history integration

69 lines 2.59 kB
import { Id } from '../../types'; export interface PushOptions { /** * Optional identifier for the item being pushed. */ id?: Id; /** * listen to event that triggered when the item is popped. */ onPopState: () => void; } export interface SinglePopOptions { /** * If true, prevents triggering the event when the item is popped. */ preventEventTriggering?: boolean; /** * Optional identifier to match the item that should be popped. */ id?: Id; } /** * Stack management object with methods for pushing, popping, flushing, and querying the stack. */ declare const RmoStack: { /** * Pushes a new item onto the stack, sets an event listener, and updates the history state. * @param {PushOptions} options - containing the optional `id` and a `listiner` that invoked when the item is popped. * @returns {Promise<{ id: Id; index: number }>} - A promise that resolves with the id and index of the pushed item. */ push(options: PushOptions): Promise<{ id: Id; index: number; }>; pop: { /** * Pops item from the stack. * @param {SinglePopOptions} [params] - options for pop. * @returns {Promise<void>} - A promise that resolves when the pop operation is complete. */ (params?: SinglePopOptions): Promise<void>; /** * Pops items from the stack. * @param {number} [count] - The number of items to pop. * @param {boolean} [preventEventTriggering] - If true, prevents triggering the associated events. * @returns {Promise<void>} - A promise that resolves when the pop operation is complete. */ (count?: number, preventEventTriggering?: boolean): Promise<void>; }; /** * Flushes all items from the stack, optionally triggering events for each item. * @param {boolean} [preventEventTriggering=false] - If `true`, prevents triggering events for each flushed item. * @returns {Promise<void>} - A promise that resolves when all items are flushed. */ flush(preventEventTriggering?: boolean): Promise<void>; /** * Finds the index of an item in the stack by its id. * @param {Id} id - The id of the item to search for in the stack. * @returns {number} - The index of the item in the stack, or -1 if not found. */ findIndexById(id: Id): number; /** * The current length of the stack. * @returns {number} */ readonly length: number; }; export default RmoStack; //# sourceMappingURL=index.d.ts.map