2022-05-11 14:26:18 +08:00
|
|
|
import type * as React from 'react';
|
2024-04-08 14:04:08 +08:00
|
|
|
|
2024-03-06 11:53:05 +08:00
|
|
|
import type { ClosableType } from '../_util/hooks/useClosable';
|
2022-05-11 14:26:18 +08:00
|
|
|
|
2022-10-11 21:33:29 +08:00
|
|
|
interface DivProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
|
'data-testid'?: string;
|
|
|
|
}
|
|
|
|
|
2023-09-13 15:19:18 +08:00
|
|
|
export const NotificationPlacements = [
|
|
|
|
'top',
|
|
|
|
'topLeft',
|
|
|
|
'topRight',
|
|
|
|
'bottom',
|
|
|
|
'bottomLeft',
|
|
|
|
'bottomRight',
|
|
|
|
] as const;
|
2024-01-11 15:11:55 +08:00
|
|
|
export type NotificationPlacement = (typeof NotificationPlacements)[number];
|
2022-05-11 14:26:18 +08:00
|
|
|
|
|
|
|
export type IconType = 'success' | 'info' | 'error' | 'warning';
|
|
|
|
|
|
|
|
export interface ArgsProps {
|
|
|
|
message: React.ReactNode;
|
|
|
|
description?: React.ReactNode;
|
|
|
|
btn?: React.ReactNode;
|
|
|
|
key?: React.Key;
|
|
|
|
onClose?: () => void;
|
|
|
|
duration?: number | null;
|
2024-05-17 15:39:30 +08:00
|
|
|
showProgress?: boolean;
|
2024-05-27 13:35:37 +08:00
|
|
|
pauseOnHover?: boolean;
|
2022-05-11 14:26:18 +08:00
|
|
|
icon?: React.ReactNode;
|
|
|
|
placement?: NotificationPlacement;
|
|
|
|
style?: React.CSSProperties;
|
|
|
|
className?: string;
|
|
|
|
readonly type?: IconType;
|
|
|
|
onClick?: () => void;
|
2024-01-11 15:11:55 +08:00
|
|
|
closeIcon?: React.ReactNode;
|
2024-03-06 11:53:05 +08:00
|
|
|
closable?: ClosableType;
|
2022-10-11 21:33:29 +08:00
|
|
|
props?: DivProps;
|
2023-05-19 18:21:31 +08:00
|
|
|
role?: 'alert' | 'status';
|
2022-05-11 14:26:18 +08:00
|
|
|
}
|
|
|
|
|
2023-02-23 16:38:06 +08:00
|
|
|
type StaticFn = (args: ArgsProps) => void;
|
|
|
|
|
2022-05-11 14:26:18 +08:00
|
|
|
export interface NotificationInstance {
|
2023-02-23 16:38:06 +08:00
|
|
|
success: StaticFn;
|
|
|
|
error: StaticFn;
|
|
|
|
info: StaticFn;
|
|
|
|
warning: StaticFn;
|
|
|
|
open: StaticFn;
|
2022-05-11 14:26:18 +08:00
|
|
|
destroy(key?: React.Key): void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface GlobalConfigProps {
|
|
|
|
top?: number;
|
|
|
|
bottom?: number;
|
|
|
|
duration?: number;
|
2024-05-17 15:39:30 +08:00
|
|
|
showProgress?: boolean;
|
2024-05-27 13:35:37 +08:00
|
|
|
pauseOnHover?: boolean;
|
2022-05-11 14:26:18 +08:00
|
|
|
prefixCls?: string;
|
2023-05-10 14:37:48 +08:00
|
|
|
getContainer?: () => HTMLElement | ShadowRoot;
|
2022-05-11 14:26:18 +08:00
|
|
|
placement?: NotificationPlacement;
|
|
|
|
closeIcon?: React.ReactNode;
|
2024-03-06 11:53:05 +08:00
|
|
|
closable?: ClosableType;
|
2022-05-11 14:26:18 +08:00
|
|
|
rtl?: boolean;
|
|
|
|
maxCount?: number;
|
2022-10-11 21:33:29 +08:00
|
|
|
props?: DivProps;
|
2022-05-11 14:26:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface NotificationConfig {
|
|
|
|
top?: number;
|
|
|
|
bottom?: number;
|
|
|
|
prefixCls?: string;
|
2023-05-10 17:42:07 +08:00
|
|
|
getContainer?: () => HTMLElement | ShadowRoot;
|
2023-02-24 18:13:49 +08:00
|
|
|
placement?: NotificationPlacement;
|
2022-05-11 14:26:18 +08:00
|
|
|
maxCount?: number;
|
|
|
|
rtl?: boolean;
|
2023-09-13 15:19:18 +08:00
|
|
|
stack?: boolean | { threshold?: number };
|
2024-01-24 15:25:56 +08:00
|
|
|
duration?: number;
|
2024-05-17 15:39:30 +08:00
|
|
|
showProgress?: boolean;
|
2024-05-27 13:35:37 +08:00
|
|
|
pauseOnHover?: boolean;
|
2022-05-11 14:26:18 +08:00
|
|
|
}
|