UNPKG

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