UNPKG

1.2 kBTypeScriptView Raw
1import { ReactNode, MouseEventHandler, CSSProperties } from "react";
2
3export interface NotificationConfig {
4 offset?: [number, number];
5 maxCount?: number;
6 size?: 'large' | 'medium';
7 duration?: number;
8 getContainer?: () => HTMLElement;
9 placement?: 'topRight' | 'topLeft' | 'bottomLeft' | 'bottomRight',
10}
11
12export interface NotificationOptions {
13 key?: string;
14 type?: 'success' | 'error' | 'warning' | 'notice' | 'help';
15 title?: ReactNode;
16 content?: ReactNode;
17 icon?: string;
18 duration?: number;
19 onClick?: MouseEventHandler;
20 style?: CSSProperties;
21 className?: string;
22 onClose?: () => void;
23}
24
25export default class Notification {
26 static config: (config: NotificationConfig) => NotificationConfig;
27 static open: (options: NotificationOptions) => string;
28 static close: (key: string) => void;
29 static destroy: () => void;
30 static success: (options: NotificationOptions) => string;
31 static error: (options: NotificationOptions) => string;
32 static warning: (options: NotificationOptions) => string;
33 static notice: (options: NotificationOptions) => string;
34 static help: (options: NotificationOptions) => string;
35}