You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.7 KiB

import React, { Component } from 'react';
import { NoticeProps } from './Notice';
export interface NoticeContent extends Omit<NoticeProps, 'prefixCls' | 'children'> {
prefixCls?: string;
key?: React.Key;
updateKey?: React.Key;
content?: React.ReactNode;
}
export declare type NoticeFunc = (noticeProps: NoticeContent) => void;
export declare type HolderReadyCallback = (div: HTMLDivElement, noticeProps: NoticeProps & {
key: React.Key;
}) => void;
export interface NotificationInstance {
notice: NoticeFunc;
removeNotice: (key: React.Key) => void;
destroy: () => void;
component: Notification;
useNotification: () => [NoticeFunc, React.ReactElement];
}
export interface NotificationProps {
prefixCls?: string;
className?: string;
style?: React.CSSProperties;
transitionName?: string;
animation?: string | object;
maxCount?: number;
closeIcon?: React.ReactNode;
}
interface NotificationState {
notices: {
notice: NoticeContent;
holderCallback?: HolderReadyCallback;
}[];
}
declare class Notification extends Component<NotificationProps, NotificationState> {
static newInstance: (properties: NotificationProps & {
getContainer?: () => HTMLElement;
}, callback: (instance: NotificationInstance) => void) => void;
static defaultProps: {
prefixCls: string;
animation: string;
style: {
top: number;
left: string;
};
};
state: NotificationState;
private hookRefs;
getTransitionName(): string;
add: (notice: NoticeContent, holderCallback?: HolderReadyCallback) => void;
remove: (key: string | number) => void;
render(): JSX.Element;
}
export default Notification;