UNPKG

1.57 kBTypeScriptView Raw
1import type React from 'react';
2export type Placement = 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight';
3type NoticeSemanticProps = 'wrapper';
4export interface NoticeConfig {
5 content?: React.ReactNode;
6 duration?: number | null;
7 showProgress?: boolean;
8 pauseOnHover?: boolean;
9 closeIcon?: React.ReactNode;
10 closable?: boolean | ({
11 closeIcon?: React.ReactNode;
12 } & React.AriaAttributes);
13 className?: string;
14 style?: React.CSSProperties;
15 classNames?: {
16 [key in NoticeSemanticProps]?: string;
17 };
18 styles?: {
19 [key in NoticeSemanticProps]?: React.CSSProperties;
20 };
21 /** @private Internal usage. Do not override in your code */
22 props?: React.HTMLAttributes<HTMLDivElement> & Record<string, any>;
23 onClose?: VoidFunction;
24 onClick?: React.MouseEventHandler<HTMLDivElement>;
25}
26export interface OpenConfig extends NoticeConfig {
27 key: React.Key;
28 placement?: Placement;
29 content?: React.ReactNode;
30 duration?: number | null;
31}
32export type InnerOpenConfig = OpenConfig & {
33 times?: number;
34};
35export type Placements = Partial<Record<Placement, OpenConfig[]>>;
36export type StackConfig = boolean | {
37 /**
38 * When number is greater than threshold, notifications will be stacked together.
39 * @default 3
40 */
41 threshold?: number;
42 /**
43 * Offset when notifications are stacked together.
44 * @default 8
45 */
46 offset?: number;
47 /**
48 * Spacing between each notification when expanded.
49 */
50 gap?: number;
51};
52export {};