forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
react-notification-system.d.ts
85 lines (71 loc) · 2.45 KB
/
react-notification-system.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Type definitions for React Notification System v0.2.6
// Project: https://www.npmjs.com/package/react-notification-system
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>, Deividas Bakanas <https://github.com/DeividasBakanas>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../react/react.d.ts" />
declare namespace NotificationSystem {
import React = __React;
export interface System extends React.Component<any, any> {
addNotification(notification: Notification): Notification;
removeNotification(notification: Notification): void;
removeNotification(uid: string): void;
}
export interface CallBackFunction {
(notification: Notification): void;
}
export interface Notification {
title?: string;
message?: string;
level?: "error" | "warning" | "info" | "success";
position?: "tr" | "tl" | "tc" | "br" | "bl" | "bc";
autoDismiss?: number;
dismissible?: boolean;
action?: ActionObject;
onAdd?: CallBackFunction;
onRemove?: CallBackFunction;
uid?: number | string;
}
export interface ActionObject {
label: string;
callback?: () => void;
}
export interface ContainersStyle {
DefaultStyle: React.CSSProperties;
tl?: React.CSSProperties;
tr?: React.CSSProperties;
tc?: React.CSSProperties;
bl?: React.CSSProperties;
br?: React.CSSProperties;
bc?: React.CSSProperties;
}
export interface ItemStyle {
DefaultStyle?: React.CSSProperties;
success?: React.CSSProperties;
error?: React.CSSProperties;
warning?: React.CSSProperties;
info?: React.CSSProperties;
}
export interface WrapperStyle {
DefaultStyle?: React.CSSProperties;
}
export interface Style {
Wrapper?: any;
Containers?: ContainersStyle;
NotificationItem?: ItemStyle;
Title?: ItemStyle;
MessageWrapper?: WrapperStyle;
Dismiss?: ItemStyle;
Action?: ItemStyle;
ActionWrapper?: WrapperStyle;
}
export interface Attributes {
noAnimation?: boolean;
ref?: string;
style?: Style | boolean;
allowHTML?: boolean;
}
}
declare module 'react-notification-system' {
var component: __React.ClassicComponentClass<NotificationSystem.Attributes>;
export = component;
}