ant-design/components/message/interface.ts
二货机器人 2341a25d91
feat: refactor useNotification (#35423)
* more refactor

* chore: motion support

* chore: tmp test

* test: Hooks

* chore: static function

* tmp of it

* all of it

* mv prefix

* chore: clean up

* chore: clean up

* more test case

* test: all base test

* test: all test case

* init

* refactor: rm notification.open instance related code

* follow up

* refactor: singlton

* test: notification test case

* refactor to destroy

* refactor: message base

* test: part test case

* test: more

* test: more

* test: all test

* chore: clean up

* docs: reorder

* chore: fix lint

* test: fix test case

* chore: add act

* chore: back

* chore: fix style

* test: notification test

* test: more and more

* test: fix more test

* test: index

* test: more & more

* test: fix placement

* test: fix coverage

* chore: clean up

* chore: bundle size

* fix: 17

* chore: more

* test: message

* test: more test

* fix: lint

* test: rm class in static

* chore: clean up

* test: coverage

* chore: fix lint
2022-05-11 14:26:18 +08:00

48 lines
1.1 KiB
TypeScript

import type * as React from 'react';
export type NoticeType = 'info' | 'success' | 'error' | 'warning' | 'loading';
export interface ConfigOptions {
top?: number;
duration?: number;
prefixCls?: string;
getContainer?: () => HTMLElement;
transitionName?: string;
maxCount?: number;
rtl?: boolean;
}
export interface ArgsProps {
content: React.ReactNode;
duration?: number;
type?: NoticeType;
onClose?: () => void;
icon?: React.ReactNode;
key?: string | number;
style?: React.CSSProperties;
className?: string;
onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
}
export type JointContent = React.ReactNode | ArgsProps;
export interface MessageType extends PromiseLike<boolean> {
(): void;
}
export type TypeOpen = (
content: JointContent,
duration?: number | VoidFunction, // Also can use onClose directly
onClose?: VoidFunction,
) => MessageType;
export interface MessageInstance {
info: TypeOpen;
success: TypeOpen;
error: TypeOpen;
warning: TypeOpen;
loading: TypeOpen;
open(args: ArgsProps): MessageType;
destroy(key?: React.Key): void;
}