apphouse
Version:
Component library for React that uses observable state management and theme-able components.
50 lines (49 loc) • 1.28 kB
TypeScript
/// <reference types="react" />
import { Popup } from './Popup';
import { List } from '../List';
/**
* Manages the state of Popups (Stack able UIs)
*/
declare class PopupStore {
items: List<Popup>;
constructor();
/**
* List of all the open popups, latest on top
*/
get list(): Popup[];
/**
* How many popups are open
*/
get length(): number;
/**
* Clear all popups in the stack
*/
clear: () => void;
/**
* remove last opened popup
*/
pop: () => void;
/**
* Get popup data by id
* @param popupId id of the popup to get data from
* @returns the popup data associated with the id
*/
get: (popupId: string) => Popup | undefined;
/**
* Add a new popup to the stack
* @param uiid Id for the UI associated with this popup
* @param title Title for the component
* @param data data related to the popup
* @param popupComponent the popup component to render
*/
set: (uiid: string, title?: string, data?: any, popupComponent?: JSX.Element) => void;
/**
* Get the last opened popup
*/
peak: () => Popup | undefined;
/**
* remove popup with id
*/
remove: (popupId: string) => void;
}
export default PopupStore;