sass-notification 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sass-notification might be problematic. Click here for more details.
- package/.eslintignore +1 -0
- package/README.md +460 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/samples/js/components/App.d.ts +3 -0
- package/dist/samples/js/components/Content.d.ts +3 -0
- package/dist/samples/js/components/Header.d.ts +3 -0
- package/dist/samples/js/components/examples/AnimationExample.d.ts +2 -0
- package/dist/samples/js/components/examples/ContainerExample.d.ts +2 -0
- package/dist/samples/js/components/examples/CustomContentExample.d.ts +2 -0
- package/dist/samples/js/components/examples/InsertExample.d.ts +2 -0
- package/dist/samples/js/components/examples/TypeExample.d.ts +2 -0
- package/dist/samples/js/helpers/code.d.ts +2 -0
- package/dist/samples/js/helpers/notification.d.ts +46 -0
- package/dist/samples/js/helpers/randomize.d.ts +4 -0
- package/dist/samples/js/index.d.ts +1 -0
- package/dist/scss/_containers.scss +100 -0
- package/dist/scss/_types.scss +91 -0
- package/dist/scss/_variables.scss +35 -0
- package/dist/scss/notification.scss +110 -0
- package/dist/src/components/Container.d.ts +31 -0
- package/dist/src/components/Notification.d.ts +22 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/store/index.d.ts +16 -0
- package/dist/src/typings.d.ts +90 -0
- package/dist/src/utils/constants.d.ts +37 -0
- package/dist/src/utils/enums.d.ts +29 -0
- package/dist/src/utils/helpers.d.ts +27 -0
- package/dist/src/utils/timer.d.ts +10 -0
- package/dist/src/utils/validators.d.ts +3 -0
- package/dist/theme.css +1 -0
- package/fastflow.js +32 -0
- package/global.d.ts +6 -0
- package/package.json +47 -0
- package/tohash.json +46 -0
- package/tsconfig.json +42 -0
@@ -0,0 +1,2 @@
|
|
1
|
+
export declare const install = "npm install react-notifications-component";
|
2
|
+
export declare const usage = "import React from \"react\";\nimport ReactNotification from \"react-notifications-component\";\n\nclass App extends React.Component {\n constructor(props) {\n super(props);\n this.addNotification = this.addNotification.bind(this);\n this.notificationDOMRef = React.createRef();\n }\n\n addNotification() {\n this.notificationDOMRef.current.addNotification({\n title: \"Awesomeness\",\n message: \"Awesome Notifications!\",\n type: \"success\",\n insert: \"top\",\n container: \"top-right\",\n animationIn: [\"animate__animated\", \"animate__fadeIn\"],\n animationOut: [\"animate__animated\", \"animate__fadeOut\"],\n dismiss: { duration: 2000 }\n });\n }\n\n render() {\n return (\n <div className=\"app-content\">\n <ReactNotification ref={this.notificationDOMRef} />\n <button onClick={this.addNotification} className=\"btn btn-primary\">\n Add Awesome Notification\n </button>\n </div>\n );\n }\n}";
|
@@ -0,0 +1,46 @@
|
|
1
|
+
declare const _default: {
|
2
|
+
title: string;
|
3
|
+
message: string;
|
4
|
+
type: string;
|
5
|
+
container: string;
|
6
|
+
insert: string;
|
7
|
+
animationIn: string[];
|
8
|
+
animationOut: string[];
|
9
|
+
slidingEnter: {
|
10
|
+
duration: number;
|
11
|
+
timingFunction: string;
|
12
|
+
delay: number;
|
13
|
+
};
|
14
|
+
slidingExit: {
|
15
|
+
duration: number;
|
16
|
+
timingFunction: string;
|
17
|
+
delay: number;
|
18
|
+
};
|
19
|
+
touchRevert: {
|
20
|
+
duration: number;
|
21
|
+
timingFunction: string;
|
22
|
+
delay: number;
|
23
|
+
};
|
24
|
+
touchSlidingExit: {
|
25
|
+
swipe: {
|
26
|
+
duration: number;
|
27
|
+
timingFunction: string;
|
28
|
+
delay: number;
|
29
|
+
};
|
30
|
+
fade: {
|
31
|
+
duration: number;
|
32
|
+
timingFunction: string;
|
33
|
+
delay: number;
|
34
|
+
};
|
35
|
+
};
|
36
|
+
dismiss: {
|
37
|
+
duration: number;
|
38
|
+
onScreen: boolean;
|
39
|
+
pauseOnHover: boolean;
|
40
|
+
waitForAnimation: boolean;
|
41
|
+
showIcon: boolean;
|
42
|
+
click: boolean;
|
43
|
+
touch: boolean;
|
44
|
+
};
|
45
|
+
};
|
46
|
+
export default _default;
|
@@ -0,0 +1 @@
|
|
1
|
+
import 'styles/stylesheet.scss';
|
@@ -0,0 +1,100 @@
|
|
1
|
+
.rnc__notification-container--top-center,
|
2
|
+
.rnc__notification-container--top-left,
|
3
|
+
.rnc__notification-container--top-right,
|
4
|
+
.rnc__notification-container--bottom-center,
|
5
|
+
.rnc__notification-container--bottom-left,
|
6
|
+
.rnc__notification-container--bottom-right,
|
7
|
+
.rnc__notification-container--center,
|
8
|
+
.rnc__notification-container--top-full,
|
9
|
+
.rnc__notification-container--bottom-full {
|
10
|
+
min-width: 325px;
|
11
|
+
position: absolute;
|
12
|
+
pointer-events: all;
|
13
|
+
}
|
14
|
+
|
15
|
+
.rnc__notification-container--center,
|
16
|
+
.rnc__notification-container--top-center,
|
17
|
+
.rnc__notification-container--bottom-center {
|
18
|
+
display: flex;
|
19
|
+
justify-content: center;
|
20
|
+
align-items: center;
|
21
|
+
flex-direction: column;
|
22
|
+
left: calc(50% - 175px);
|
23
|
+
}
|
24
|
+
|
25
|
+
.rnc__notification-container--center,
|
26
|
+
.rnc__notification-container--top-center,
|
27
|
+
.rnc__notification-container--bottom-center {
|
28
|
+
max-width: 350px;
|
29
|
+
}
|
30
|
+
|
31
|
+
.rnc__notification-container--center {
|
32
|
+
top: 20px;
|
33
|
+
height: 100%;
|
34
|
+
pointer-events: none;
|
35
|
+
}
|
36
|
+
|
37
|
+
.rnc__notification-container--top-full,
|
38
|
+
.rnc__notification-container--bottom-full {
|
39
|
+
width: 100%;
|
40
|
+
min-width: 100%;
|
41
|
+
}
|
42
|
+
|
43
|
+
.rnc__notification-container--bottom-full {
|
44
|
+
bottom: 0;
|
45
|
+
}
|
46
|
+
|
47
|
+
.rnc__util--flex-center {
|
48
|
+
min-width: 325px;
|
49
|
+
display: flex;
|
50
|
+
justify-content: center;
|
51
|
+
align-items: center;
|
52
|
+
flex-direction: column;
|
53
|
+
pointer-events: all;
|
54
|
+
}
|
55
|
+
|
56
|
+
.rnc__notification-container--top-center {
|
57
|
+
top: 20px;
|
58
|
+
}
|
59
|
+
.rnc__notification-container--bottom-center {
|
60
|
+
bottom: 20px;
|
61
|
+
}
|
62
|
+
|
63
|
+
.rnc__notification-container--top-left {
|
64
|
+
left: 20px;
|
65
|
+
top: 20px;
|
66
|
+
}
|
67
|
+
|
68
|
+
.rnc__notification-container--top-right {
|
69
|
+
right: 20px;
|
70
|
+
top: 20px;
|
71
|
+
}
|
72
|
+
|
73
|
+
.rnc__notification-container--bottom-left {
|
74
|
+
left: 20px;
|
75
|
+
bottom: 20px;
|
76
|
+
}
|
77
|
+
|
78
|
+
.rnc__notification-container--bottom-right {
|
79
|
+
bottom: 20px;
|
80
|
+
right: 20px;
|
81
|
+
}
|
82
|
+
|
83
|
+
.rnc__notification-container--mobile-top,
|
84
|
+
.rnc__notification-container--mobile-bottom {
|
85
|
+
pointer-events: all;
|
86
|
+
position: absolute;
|
87
|
+
}
|
88
|
+
|
89
|
+
.rnc__notification-container--mobile-top {
|
90
|
+
right: 20px;
|
91
|
+
left: 20px;
|
92
|
+
top: 20px;
|
93
|
+
}
|
94
|
+
|
95
|
+
.rnc__notification-container--mobile-bottom {
|
96
|
+
right: 20px;
|
97
|
+
left: 20px;
|
98
|
+
bottom: 20px;
|
99
|
+
margin-bottom: -15px;
|
100
|
+
}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
@import "_variables.scss";
|
2
|
+
|
3
|
+
.rnc__notification-item--default {
|
4
|
+
background-color: $default;
|
5
|
+
border-left: 8px solid $default_dark;
|
6
|
+
|
7
|
+
.rnc__notification-timer {
|
8
|
+
background-color: $default_timer;
|
9
|
+
}
|
10
|
+
.rnc__notification-timer-filler {
|
11
|
+
background-color: $default_timer_filler;
|
12
|
+
}
|
13
|
+
.rnc__notification-close-mark {
|
14
|
+
background-color: $default;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
.rnc__notification-item--success {
|
19
|
+
background-color: $success;
|
20
|
+
border-left: 8px solid $success_dark;
|
21
|
+
|
22
|
+
.rnc__notification-timer {
|
23
|
+
background-color: $success_timer;
|
24
|
+
}
|
25
|
+
.rnc__notification-timer-filler {
|
26
|
+
background-color: $success_timer_filler;
|
27
|
+
}
|
28
|
+
.rnc__notification-close-mark {
|
29
|
+
background-color: $success;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
.rnc__notification-item--danger {
|
34
|
+
background-color: $danger;
|
35
|
+
border-left: 8px solid $danger_dark;
|
36
|
+
|
37
|
+
.rnc__notification-timer {
|
38
|
+
background-color: $danger_timer;
|
39
|
+
}
|
40
|
+
.rnc__notification-timer-filler {
|
41
|
+
background-color: $danger_timer_filler;
|
42
|
+
}
|
43
|
+
.rnc__notification-close-mark {
|
44
|
+
background-color: $danger;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
.rnc__notification-item--info {
|
49
|
+
background-color: $info;
|
50
|
+
border-left: 8px solid $info_dark;
|
51
|
+
|
52
|
+
.rnc__notification-timer {
|
53
|
+
background-color: $info_timer;
|
54
|
+
}
|
55
|
+
.rnc__notification-timer-filler {
|
56
|
+
background-color: $info_timer_filler;
|
57
|
+
}
|
58
|
+
.rnc__notification-close-mark {
|
59
|
+
background-color: $info;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
.rnc__notification-item--warning {
|
64
|
+
background-color: $warning;
|
65
|
+
border-left: 8px solid $warning_dark;
|
66
|
+
|
67
|
+
.rnc__notification-timer {
|
68
|
+
background-color: $warning_timer;
|
69
|
+
}
|
70
|
+
.rnc__notification-timer-filler {
|
71
|
+
background-color: $warning_timer_filler;
|
72
|
+
}
|
73
|
+
.rnc__notification-close-mark {
|
74
|
+
background-color: $warning;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
.rnc__notification-item--awesome {
|
79
|
+
background-color: $awesome;
|
80
|
+
border-left: 8px solid $awesome_dark;
|
81
|
+
|
82
|
+
.rnc__notification-timer {
|
83
|
+
background-color: $awesome_timer;
|
84
|
+
}
|
85
|
+
.rnc__notification-timer-filler {
|
86
|
+
background-color: $awesome_timer_filler;
|
87
|
+
}
|
88
|
+
.rnc__notification-close-mark {
|
89
|
+
background-color: $awesome;
|
90
|
+
}
|
91
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
$default: #007bff !default;
|
2
|
+
$default_dark: #0562c7 !default;
|
3
|
+
|
4
|
+
$success: #28a745 !default;
|
5
|
+
$success_dark: #1f8838 !default;
|
6
|
+
|
7
|
+
$danger: #dc3545 !default;
|
8
|
+
$danger_dark: #bd1120 !default;
|
9
|
+
|
10
|
+
$info: #17a2b8 !default;
|
11
|
+
$info_dark: #138b9e !default;
|
12
|
+
|
13
|
+
$warning: #eab000 !default;
|
14
|
+
$warning_dark: #ce9c09 !default;
|
15
|
+
|
16
|
+
$awesome: #685dc3 !default;
|
17
|
+
$awesome_dark: #4c3fb1 !default;
|
18
|
+
|
19
|
+
$default_timer: #007bff !default;
|
20
|
+
$default_timer_filler: #fff !default;
|
21
|
+
|
22
|
+
$success_timer: #28a745 !default;
|
23
|
+
$success_timer_filler: #fff !default;
|
24
|
+
|
25
|
+
$danger_timer: #dc3545 !default;
|
26
|
+
$danger_timer_filler: #fff !default;
|
27
|
+
|
28
|
+
$info_timer: #17a2b8 !default;
|
29
|
+
$info_timer_filler: #fff !default;
|
30
|
+
|
31
|
+
$warning_timer: #eab000 !default;
|
32
|
+
$warning_timer_filler: #fff !default;
|
33
|
+
|
34
|
+
$awesome_timer: #685dc3 !default;
|
35
|
+
$awesome_timer_filler: #fff !default;
|
@@ -0,0 +1,110 @@
|
|
1
|
+
@import "./_containers.scss";
|
2
|
+
@import "./_types.scss";
|
3
|
+
|
4
|
+
@keyframes timer {
|
5
|
+
0% { width: 100%; }
|
6
|
+
100% { width: 0%; }
|
7
|
+
}
|
8
|
+
|
9
|
+
.rnc__base {
|
10
|
+
position: fixed;
|
11
|
+
z-index: 9000;
|
12
|
+
pointer-events: none;
|
13
|
+
width: 100%;
|
14
|
+
height: 100%;
|
15
|
+
}
|
16
|
+
|
17
|
+
.rnc__notification-item {
|
18
|
+
display: flex;
|
19
|
+
position: relative;
|
20
|
+
border-radius: 3px;
|
21
|
+
margin-bottom: 15px;
|
22
|
+
box-shadow: 1px 3px 4px rgba(0, 0, 0, 0.2);
|
23
|
+
cursor: pointer;
|
24
|
+
}
|
25
|
+
|
26
|
+
.rnc__notification-container--top-full .rnc__notification-item,
|
27
|
+
.rnc__notification-container--bottom-full .rnc__notification-item {
|
28
|
+
margin-bottom: 0;
|
29
|
+
border-radius: 0;
|
30
|
+
}
|
31
|
+
|
32
|
+
.rnc__notification-container--top-full .rnc__notification,
|
33
|
+
.rnc__notification-container--bottom-full .rnc__notification {
|
34
|
+
width: 100% !important;
|
35
|
+
}
|
36
|
+
|
37
|
+
.rnc__notification-timer {
|
38
|
+
width: 100%;
|
39
|
+
height: 3px;
|
40
|
+
margin-top: 10px;
|
41
|
+
border-radius: 5px;
|
42
|
+
}
|
43
|
+
.rnc__notification-timer-filler {
|
44
|
+
height: 3px;
|
45
|
+
border-radius: 5px;
|
46
|
+
}
|
47
|
+
.rnc__notification-title {
|
48
|
+
color: #fff;
|
49
|
+
font-weight: 700;
|
50
|
+
font-size: 14px;
|
51
|
+
margin-top: 5px;
|
52
|
+
margin-bottom: 5px;
|
53
|
+
}
|
54
|
+
.rnc__notification-message {
|
55
|
+
color: #fff;
|
56
|
+
max-width: calc(100% - 15px);
|
57
|
+
font-size: 14px;
|
58
|
+
line-height: 150%;
|
59
|
+
word-wrap: break-word;
|
60
|
+
margin-bottom: 0;
|
61
|
+
margin-top: 0;
|
62
|
+
}
|
63
|
+
.rnc__notification-content {
|
64
|
+
padding: 8px 15px;
|
65
|
+
display: inline-block;
|
66
|
+
width: 100%;
|
67
|
+
}
|
68
|
+
.rnc__notification-close-mark {
|
69
|
+
width: 18px;
|
70
|
+
height: 18px;
|
71
|
+
border-radius: 50%;
|
72
|
+
display: inline-block;
|
73
|
+
position: absolute;
|
74
|
+
right: 10px;
|
75
|
+
top: 10px;
|
76
|
+
|
77
|
+
&::after {
|
78
|
+
content: '\D7';
|
79
|
+
position: absolute;
|
80
|
+
transform: translate(-50%, -50%);
|
81
|
+
color: #fff;
|
82
|
+
font-size: 12px;
|
83
|
+
left: 50%;
|
84
|
+
top: 50%;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
.rnc__notification-container--mobile-top .rnc__notification-item,
|
89
|
+
.rnc__notification-container--mobile-bottom .rnc__notification-item,
|
90
|
+
.rnc__notification-container--mobile-top .notification,
|
91
|
+
.rnc__notification-container--mobile-bottom .notification {
|
92
|
+
max-width: 100%;
|
93
|
+
width: 100%;
|
94
|
+
}
|
95
|
+
|
96
|
+
.rnc__notification-container--top-right .notification,
|
97
|
+
.rnc__notification-container--bottom-right .notification {
|
98
|
+
margin-left: auto;
|
99
|
+
}
|
100
|
+
|
101
|
+
.rnc__notification-container--top-left .notification,
|
102
|
+
.rnc__notification-container--bottom-left .notification {
|
103
|
+
margin-right: auto;
|
104
|
+
}
|
105
|
+
|
106
|
+
.rnc__notification-container--mobile-top .notification,
|
107
|
+
.rnc__notification-container--mobile-bottom .notification {
|
108
|
+
margin-left: auto;
|
109
|
+
margin-right: auto;
|
110
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { iNotificationCustomType, iNotification } from '../../src/typings';
|
3
|
+
import "src/scss/notification.scss";
|
4
|
+
export { Container, iContainerProps, iContainerState };
|
5
|
+
interface iContainerProps {
|
6
|
+
isMobile?: boolean;
|
7
|
+
breakpoint?: number;
|
8
|
+
types?: iNotificationCustomType[];
|
9
|
+
defaultNotificationWidth?: number;
|
10
|
+
className?: string;
|
11
|
+
}
|
12
|
+
interface iContainerState {
|
13
|
+
isMobile: boolean;
|
14
|
+
breakpoint: number;
|
15
|
+
notifications: iNotification[];
|
16
|
+
windowWidth: number;
|
17
|
+
}
|
18
|
+
declare class Container extends React.Component<iContainerProps, iContainerState> {
|
19
|
+
constructor(props: iContainerProps);
|
20
|
+
componentDidMount(): void;
|
21
|
+
componentWillUnmount(): void;
|
22
|
+
handleResize: () => void;
|
23
|
+
add: (notification: iNotification) => string;
|
24
|
+
remove: (id: string) => void;
|
25
|
+
removeAllNotifications: () => void;
|
26
|
+
toggleRemoval: (id: string, callback: () => void) => void;
|
27
|
+
renderNotifications(notifications: iNotification[], isMobile: boolean): JSX.Element[];
|
28
|
+
renderMobileNotifications(props: any): JSX.Element;
|
29
|
+
renderScreenNotifications(props: any): JSX.Element;
|
30
|
+
render(): JSX.Element;
|
31
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { iNotificationProps, iNotificationState } from '../../src/typings';
|
3
|
+
export { Notification };
|
4
|
+
declare class Notification extends React.Component<iNotificationProps, iNotificationState> {
|
5
|
+
constructor(props: iNotificationProps);
|
6
|
+
private readonly rootElementRef;
|
7
|
+
private timer;
|
8
|
+
componentWillUnmount(): void;
|
9
|
+
componentDidMount(): void;
|
10
|
+
componentDidUpdate(prevProps: iNotificationProps): void;
|
11
|
+
removeNotification(removalFlag: string): void;
|
12
|
+
onClick: () => void;
|
13
|
+
onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => void;
|
14
|
+
onTouchMove: (event: React.TouchEvent) => void;
|
15
|
+
onTouchEnd: () => void;
|
16
|
+
onMouseEnter: () => void;
|
17
|
+
onMouseLeave: () => void;
|
18
|
+
renderTimer(): JSX.Element;
|
19
|
+
renderCustomContent(): JSX.Element;
|
20
|
+
renderNotification(): JSX.Element;
|
21
|
+
render(): JSX.Element;
|
22
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { iContainerProps, iContainerState, Container } from '../src/components/Container';
|
2
|
+
import Store from '../src/store';
|
3
|
+
import { iNotification, NotificationTitleMessage, NotificationContent, iTransition, iTouchTransition, iNotificationDismiss, iNotificationCustomType, iNotificationProps, iNotificationState, iNotificationParentStyle, iStore, iNotificationStoreParams, NOTIFICATION_CONTAINER, NOTIFICATION_TYPE, NOTIFICATION_INSERTION, NOTIFICATION_REMOVAL_SOURCE } from '../src/typings';
|
4
|
+
export { Container as ReactNotifications, Store, iContainerProps, iContainerState, iNotification, NotificationTitleMessage, NotificationContent, iTransition, iTouchTransition, iNotificationDismiss, iNotificationCustomType, iNotificationProps, iNotificationState, iNotificationParentStyle, iStore, iNotificationStoreParams, NOTIFICATION_CONTAINER, NOTIFICATION_TYPE, NOTIFICATION_INSERTION, NOTIFICATION_REMOVAL_SOURCE };
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { iNotification, iNotificationStoreParams, iStore } from '../../src/typings';
|
2
|
+
declare class Store implements iStore {
|
3
|
+
constructor();
|
4
|
+
removeNotification: (id: string) => void;
|
5
|
+
removeAllNotifications: () => void;
|
6
|
+
private types;
|
7
|
+
private add;
|
8
|
+
private defaultNotificationWidth;
|
9
|
+
private counter;
|
10
|
+
private incrementCounter;
|
11
|
+
addNotification(notification: iNotification): string;
|
12
|
+
getCounter: () => number;
|
13
|
+
register(parameters: iNotificationStoreParams): void;
|
14
|
+
}
|
15
|
+
declare const _default: Store;
|
16
|
+
export default _default;
|
@@ -0,0 +1,90 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
export { iNotification, NotificationTitleMessage, NotificationContent, iTransition, iTouchTransition, iNotificationDismiss, iNotificationCustomType, iNotificationProps, iNotificationState, iNotificationParentStyle, iStore, iNotificationStoreParams, NOTIFICATION_CONTAINER, NOTIFICATION_INSERTION, NOTIFICATION_TYPE, NOTIFICATION_REMOVAL_SOURCE, };
|
3
|
+
declare type NOTIFICATION_CONTAINER = 'bottom-left' | 'bottom-right' | 'bottom-center' | 'top-left' | 'top-right' | 'top-center' | 'center' | 'top-full' | 'bottom-full';
|
4
|
+
declare type NOTIFICATION_INSERTION = 'top' | 'bottom';
|
5
|
+
declare type NOTIFICATION_TYPE = 'success' | 'danger' | 'info' | 'default' | 'warning';
|
6
|
+
declare type NOTIFICATION_REMOVAL_SOURCE = 'timeout' | 'click' | 'touch' | 'manual';
|
7
|
+
interface iNotification {
|
8
|
+
id?: string;
|
9
|
+
onRemoval?: (id: string, removalFlag: string) => void;
|
10
|
+
title?: NotificationTitleMessage;
|
11
|
+
message?: NotificationTitleMessage;
|
12
|
+
content?: NotificationContent;
|
13
|
+
type?: NOTIFICATION_TYPE;
|
14
|
+
container: NOTIFICATION_CONTAINER;
|
15
|
+
insert?: NOTIFICATION_INSERTION;
|
16
|
+
dismiss?: iNotificationDismiss;
|
17
|
+
animationIn?: string[];
|
18
|
+
animationOut?: string[];
|
19
|
+
slidingEnter?: iTransition;
|
20
|
+
slidingExit?: iTransition;
|
21
|
+
touchRevert?: iTransition;
|
22
|
+
touchSlidingExit?: {
|
23
|
+
fade: iTransition;
|
24
|
+
swipe: iTransition;
|
25
|
+
};
|
26
|
+
userDefinedTypes?: iNotificationCustomType[];
|
27
|
+
width?: number;
|
28
|
+
hasBeenRemoved?: boolean;
|
29
|
+
}
|
30
|
+
declare type NotificationTitleMessage = string | React.ReactNode | React.FunctionComponent;
|
31
|
+
declare type NotificationContent = React.ComponentClass<any, any> | React.FunctionComponent<any> | React.ReactElement;
|
32
|
+
interface iTransition {
|
33
|
+
duration: number;
|
34
|
+
timingFunction: string;
|
35
|
+
delay: number;
|
36
|
+
}
|
37
|
+
interface iTouchTransition {
|
38
|
+
swipe: iTransition;
|
39
|
+
fade: iTransition;
|
40
|
+
}
|
41
|
+
interface iNotificationDismiss {
|
42
|
+
duration: number;
|
43
|
+
onScreen?: boolean;
|
44
|
+
pauseOnHover?: boolean;
|
45
|
+
waitForAnimation?: boolean;
|
46
|
+
click?: boolean;
|
47
|
+
touch?: boolean;
|
48
|
+
showIcon?: boolean;
|
49
|
+
}
|
50
|
+
interface iNotificationCustomType {
|
51
|
+
htmlClasses: string[];
|
52
|
+
name: string;
|
53
|
+
}
|
54
|
+
interface iNotificationProps {
|
55
|
+
id: string;
|
56
|
+
notification: iNotification;
|
57
|
+
defaultNotificationWidth: number;
|
58
|
+
notificationsCount: number;
|
59
|
+
isMobile: boolean;
|
60
|
+
hasBeenRemoved: boolean;
|
61
|
+
toggleRemoval: (id: string, callback: () => void) => void;
|
62
|
+
}
|
63
|
+
interface iNotificationState {
|
64
|
+
parentStyle?: iNotificationParentStyle;
|
65
|
+
htmlClassList?: string[];
|
66
|
+
animationPlayState?: string;
|
67
|
+
touchEnabled?: boolean;
|
68
|
+
onTransitionEnd?: (event: React.TransitionEvent<HTMLDivElement>) => void;
|
69
|
+
onAnimationEnd?: (event: React.AnimationEvent<HTMLDivElement>) => void;
|
70
|
+
startX?: number;
|
71
|
+
currentX?: number;
|
72
|
+
}
|
73
|
+
interface iNotificationParentStyle {
|
74
|
+
height?: string;
|
75
|
+
overflow?: string;
|
76
|
+
width?: string;
|
77
|
+
transition?: string;
|
78
|
+
}
|
79
|
+
interface iStore {
|
80
|
+
addNotification(notification: iNotification): string;
|
81
|
+
removeNotification(id: string): void;
|
82
|
+
register(param: iNotificationStoreParams): void;
|
83
|
+
}
|
84
|
+
interface iNotificationStoreParams {
|
85
|
+
addNotification: (notification: iNotification) => string;
|
86
|
+
removeNotification: (id: string) => void;
|
87
|
+
removeAllNotifications: () => void;
|
88
|
+
types: iNotificationCustomType[];
|
89
|
+
defaultNotificationWidth: number;
|
90
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
export declare const DEFAULT_CONTAINER_VALUES: {
|
2
|
+
isMobile: boolean;
|
3
|
+
breakpoint: number;
|
4
|
+
defaultNotificationWidth: number;
|
5
|
+
};
|
6
|
+
export declare const NOTIFICATION_BASE_CLASS = "rnc__notification-item";
|
7
|
+
export declare const ERROR: {
|
8
|
+
ANIMATION_IN: string;
|
9
|
+
ANIMATION_OUT: string;
|
10
|
+
DISMISS_REQUIRED: string;
|
11
|
+
DISMISS_NUMBER: string;
|
12
|
+
DISMISS_POSITIVE: string;
|
13
|
+
DISMISS_CLICK_BOOL: string;
|
14
|
+
DISMISS_TOUCH_BOOL: string;
|
15
|
+
DISMISS_WAIT: string;
|
16
|
+
DISMISS_PAUSE_BOOL: string;
|
17
|
+
DISMISS_ONSCREEN_BOOL: string;
|
18
|
+
DISMISS_ICON: string;
|
19
|
+
TITLE_STRING: string;
|
20
|
+
TITLE_ELEMENT: string;
|
21
|
+
MESSAGE_REQUIRED: string;
|
22
|
+
MESSAGE_STRING: string;
|
23
|
+
MESSAGE_ELEMENT: string;
|
24
|
+
TYPE_REQUIRED: string;
|
25
|
+
TYPE_STRING: string;
|
26
|
+
TYPE_NOT_EXISTENT: string;
|
27
|
+
CONTAINER_REQUIRED: string;
|
28
|
+
CONTAINER_STRING: string;
|
29
|
+
CONTENT_INVALID: string;
|
30
|
+
WIDTH_NUMBER: string;
|
31
|
+
INSERT_STRING: string;
|
32
|
+
TRANSITION_DURATION_NUMBER: string;
|
33
|
+
TRANSITION_TIMING_FUNCTION: string;
|
34
|
+
TRANSITION_DELAY_NUMBER: string;
|
35
|
+
TYPE_NOT_FOUND: string;
|
36
|
+
REMOVAL_FUNC: string;
|
37
|
+
};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
export { NOTIFICATION_CONTAINER, NOTIFICATION_INSERTION, NOTIFICATION_TYPE, NOTIFICATION_REMOVAL_SOURCE };
|
2
|
+
declare enum NOTIFICATION_CONTAINER {
|
3
|
+
BOTTOM_LEFT = "bottom-left",
|
4
|
+
BOTTOM_RIGHT = "bottom-right",
|
5
|
+
BOTTOM_CENTER = "bottom-center",
|
6
|
+
TOP_LEFT = "top-left",
|
7
|
+
TOP_RIGHT = "top-right",
|
8
|
+
TOP_CENTER = "top-center",
|
9
|
+
CENTER = "center",
|
10
|
+
TOP_FULL = "top-full",
|
11
|
+
BOTTOM_FULL = "bottom-full"
|
12
|
+
}
|
13
|
+
declare enum NOTIFICATION_INSERTION {
|
14
|
+
TOP = "top",
|
15
|
+
BOTTOM = "bottom"
|
16
|
+
}
|
17
|
+
declare enum NOTIFICATION_TYPE {
|
18
|
+
SUCCESS = "success",
|
19
|
+
DANGER = "danger",
|
20
|
+
INFO = "info",
|
21
|
+
DEFAULT = "default",
|
22
|
+
WARNING = "warning"
|
23
|
+
}
|
24
|
+
declare enum NOTIFICATION_REMOVAL_SOURCE {
|
25
|
+
TIMEOUT = "timeout",
|
26
|
+
CLICK = "click",
|
27
|
+
TOUCH = "touch",
|
28
|
+
MANUAL = "manual"
|
29
|
+
}
|