import './style.css'; export interface Action { /** * Action button text */ text: string; /** * Action button style * @example * * ```js * { * color: 'red' * } * ``` */ style?: { [k: string]: any; }; /** * Invoke a function when the action button is clicked */ callback?: ActionCallback; } export declare type ActionCallback = (button: HTMLButtonElement, snackbar: Snackbar) => void; export declare type Position = 'left' | 'center' | 'right'; export interface SnackOptions { /** * Automatically destroy the snackbar in specific timeout (ms) * @default `0` means we won't automatically destroy the snackbar */ timeout?: number; /** * An array of action buttons */ actions?: Action[]; /** * Show snackbar in given position * @default `center` */ position?: Position; theme?: 'light' | 'dark' | ThemeRules; /** * Maximum stacks to display, earlier created snackbar will be hidden * @default 3 */ maxStack?: number; } export interface SnackInstanceOptions { timeout: number; actions: Action[]; position: Position; theme: ThemeRules; maxStack: number; } export interface SnackResult { destroy: () => void; } export interface ThemeRules { backgroundColor?: string; textColor?: string; boxShadow?: string; actionColor?: string; } export declare type Message = string | HTMLElement; export declare class Snackbar { message: Message; options: SnackInstanceOptions; wrapper: HTMLDivElement; /** * The snackbar element */ el?: HTMLDivElement; private timeoutId?; private visibilityTimeoutId?; constructor(message: Message, options?: SnackOptions); readonly theme: ThemeRules; getWrapper(position: Position): HTMLDivElement; insert(): void; stack(): void; expand(): void; toggleVisibility(el: HTMLDivElement, hidden: boolean): void; /** * Destory the snackbar */ destroy(): Promise; startTimer(): void; stopTimer(): void; } export declare function createSnackbar(message: Message, options?: SnackOptions): Snackbar; export declare function destroyAllSnackbars(): Promise;