UNPKG

1.57 kBTypeScriptView Raw
1import type { CSSMotionProps } from 'rc-motion';
2import * as React from 'react';
3import type { NotificationsProps } from '../Notifications';
4import type { OpenConfig, Placement, StackConfig } from '../interface';
5type OptionalConfig = Partial<OpenConfig>;
6export interface NotificationConfig {
7 prefixCls?: string;
8 /** Customize container. It will repeat call which means you should return same container element. */
9 getContainer?: () => HTMLElement | ShadowRoot;
10 motion?: CSSMotionProps | ((placement: Placement) => CSSMotionProps);
11 closeIcon?: React.ReactNode;
12 closable?: boolean | ({
13 closeIcon?: React.ReactNode;
14 } & React.AriaAttributes);
15 maxCount?: number;
16 duration?: number;
17 showProgress?: boolean;
18 pauseOnHover?: boolean;
19 /** @private. Config for notification holder style. Safe to remove if refactor */
20 className?: (placement: Placement) => string;
21 /** @private. Config for notification holder style. Safe to remove if refactor */
22 style?: (placement: Placement) => React.CSSProperties;
23 /** @private Trigger when all the notification closed. */
24 onAllRemoved?: VoidFunction;
25 stack?: StackConfig;
26 /** @private Slot for style in Notifications */
27 renderNotifications?: NotificationsProps['renderNotifications'];
28}
29export interface NotificationAPI {
30 open: (config: OptionalConfig) => void;
31 close: (key: React.Key) => void;
32 destroy: () => void;
33}
34export default function useNotification(rootConfig?: NotificationConfig): [NotificationAPI, React.ReactElement];
35export {};