@adaptui/react
Version:
Collection of headless components/hooks that are accessible, composable, customizable from low level to build your own UI & Design System powered by Reakit
52 lines (51 loc) • 1.12 kB
TypeScript
export interface DefaultToast {
id: string;
visible: boolean;
reverseOrder: boolean;
animationDuration: number;
children?: React.ReactNode;
}
export declare type TimerToast = DefaultToast & {
createdAt: number;
pauseDuration: number;
pausedAt: number | null;
autoDismiss: boolean;
dismissDuration: number;
};
export interface State<T> {
toasts: T[];
}
export declare enum ActionType {
ADD_TOAST = 0,
UPSERT_TOAST = 1,
UPDATE_TOAST = 2,
UPDATE_FIELD_TOAST = 3,
UPDATE_ALL_TOAST = 4,
DISMISS_TOAST = 5,
REMOVE_TOAST = 6
}
export declare type Action<T> = {
type: ActionType.ADD_TOAST;
toast: T;
maxToasts?: number;
} | {
type: ActionType.UPSERT_TOAST;
toast: T;
} | {
type: ActionType.UPDATE_TOAST;
toast: Partial<T>;
} | {
type: ActionType.UPDATE_FIELD_TOAST;
field: keyof T;
fieldValue: any;
toast: Partial<T>;
} | {
type: ActionType.UPDATE_ALL_TOAST;
toast: Partial<T>;
} | {
type: ActionType.DISMISS_TOAST;
toastId?: string;
} | {
type: ActionType.REMOVE_TOAST;
toastId?: string;
};