ant-design/components/notification/interface.ts
MadCcc c5bed69883
feat: notification support stack (#44618)
* feat: notification stack

* feat: notification support stack

* docs: add demo

* fix: message animation

* chore: better imports

* test: fix pure panel

* feat: code optimize

* chore: update snapshot

* chore: update test case

* test: update test

* chore: update deps

* chore: bump rc-notification

* feat: add backdrop filter

* chore

* feat: add token colorBgBlur

* chore: bump

* feat: update colorBgBlur in dark mode

* fix: compatible with safari

---------

Signed-off-by: MadCcc <1075746765@qq.com>
2023-09-13 15:19:18 +08:00

71 lines
1.6 KiB
TypeScript

import type * as React from 'react';
interface DivProps extends React.HTMLProps<HTMLDivElement> {
'data-testid'?: string;
}
export const NotificationPlacements = [
'top',
'topLeft',
'topRight',
'bottom',
'bottomLeft',
'bottomRight',
] as const;
export type NotificationPlacement = typeof NotificationPlacements[number];
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;
icon?: React.ReactNode;
placement?: NotificationPlacement;
style?: React.CSSProperties;
className?: string;
readonly type?: IconType;
onClick?: () => void;
closeIcon?: boolean | React.ReactNode;
props?: DivProps;
role?: 'alert' | 'status';
}
type StaticFn = (args: ArgsProps) => void;
export interface NotificationInstance {
success: StaticFn;
error: StaticFn;
info: StaticFn;
warning: StaticFn;
open: StaticFn;
destroy(key?: React.Key): void;
}
export interface GlobalConfigProps {
top?: number;
bottom?: number;
duration?: number;
prefixCls?: string;
getContainer?: () => HTMLElement | ShadowRoot;
placement?: NotificationPlacement;
closeIcon?: React.ReactNode;
rtl?: boolean;
maxCount?: number;
props?: DivProps;
}
export interface NotificationConfig {
top?: number;
bottom?: number;
prefixCls?: string;
getContainer?: () => HTMLElement | ShadowRoot;
placement?: NotificationPlacement;
maxCount?: number;
rtl?: boolean;
stack?: boolean | { threshold?: number };
}