UNPKG

mithril-materialized

Version:
46 lines (45 loc) 1.54 kB
import { FactoryComponent } from 'mithril'; export interface ToastOptions { /** HTML content for the toast */ html?: string; /** Display length in milliseconds */ displayLength?: number; /** Animation in duration in milliseconds */ inDuration?: number; /** Animation out duration in milliseconds */ outDuration?: number; /** Additional CSS classes */ classes?: string; /** Callback function called when toast is dismissed */ completeCallback?: () => void; /** Activation percentage for swipe dismissal */ activationPercent?: number; } export declare class Toast { el: HTMLElement; options: Required<ToastOptions>; private state; private static _toasts; private static _container; private static _draggedToast; private static defaults; constructor(options?: ToastOptions); static getInstance(el: HTMLElement): Toast | undefined; static _createContainer(): void; static _removeContainer(): void; static _onDragStart: (e: Event) => void; static _onDragMove: (e: Event) => void; static _onDragEnd: () => void; static _xPos(e: Event): number; static dismissAll(): void; _createToast(): HTMLElement; _animateIn(): void; _setTimer(): void; dismiss(): void; } export declare const toast: (options: ToastOptions) => Toast; export interface ToastComponentAttrs extends ToastOptions { /** Whether to show the toast */ show?: boolean; } export declare const ToastComponent: FactoryComponent<ToastComponentAttrs>;