44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
|
import * as React from 'react';
|
||
|
import { CSSTransitionProps } from '../csstransition';
|
||
|
|
||
|
type ToastSeverityType = 'success' | 'info' | 'warn' | 'error' | (string & {});
|
||
|
|
||
|
type ToastMessageType = ToastMessage | ToastMessage[];
|
||
|
|
||
|
type ToastPositionType = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-center' | 'top-left' | 'top-right' | 'bottom-center' | 'bottom-left' | 'bottom-right';
|
||
|
|
||
|
type ToastAppendToType = 'self' | HTMLElement | undefined | null;
|
||
|
|
||
|
export interface ToastMessage {
|
||
|
severity?: ToastSeverityType;
|
||
|
summary?: React.ReactNode;
|
||
|
detail?: React.ReactNode;
|
||
|
content?: React.ReactNode;
|
||
|
closable?: boolean;
|
||
|
sticky?: boolean;
|
||
|
life?: number;
|
||
|
className?: string;
|
||
|
style?: object;
|
||
|
contentClassName?: string;
|
||
|
contentStyle?: object;
|
||
|
}
|
||
|
|
||
|
export interface ToastProps {
|
||
|
id?: string;
|
||
|
className?: string;
|
||
|
style?: object;
|
||
|
baseZIndex?: number;
|
||
|
position?: ToastPositionType;
|
||
|
transitionOptions?: CSSTransitionProps;
|
||
|
appendTo?: ToastAppendToType;
|
||
|
onClick?(message: ToastMessage): void;
|
||
|
onRemove?(message: ToastMessage): void;
|
||
|
onShow?(): void;
|
||
|
onHide?(): void;
|
||
|
}
|
||
|
|
||
|
export declare class Toast extends React.Component<ToastProps, any> {
|
||
|
public show(message: ToastMessageType): void;
|
||
|
public clear(): void;
|
||
|
}
|