rails_toastify 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +5 -6
- data/app/assets/javascripts/rails_toastify.js +68 -27
- data/app/assets/stylesheets/rails_toastify.css +332 -81
- data/app/helpers/rails_toastify_helper.rb +7 -1
- data/lib/generators/rails_toastify/install/templates/rails_toastify.rb +4 -4
- data/lib/rails_toastify/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 945c13b91a63c76ae7495b43253a3f2db190158570c702608c27da46e643bc93
|
|
4
|
+
data.tar.gz: d745890b255432f0444a51ed46391514f3454abffe24d443c41d774b0715f356
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b5d18bd374d5cd845ad9a91f68ba9985f3e05a02133464e586eac92b573c9b1dd36c088fef83c00622b2f897e187519ec8dc3acb3e9d66cdcbfe4ed7264cadd
|
|
7
|
+
data.tar.gz: c577e75f695069e74e3d22b94e81890d6025375f6d7da1622699a74ab1172715f3f8631c0a8d77a19b8d95bb66ec0bae4ef81287a005ee51d525c01c8f0c5eac
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## 1.2.3
|
|
2
|
+
|
|
3
|
+
- Fix position configuration bug (position classes now properly override default positioning)
|
|
4
|
+
- Fix progress bar duration bug (was hardcoded to 3000ms, now respects configured duration)
|
|
5
|
+
- Replace Font Awesome dependency for close button with inline SVG
|
|
6
|
+
- Add type-specific SVG icons (info, success, warning, error) matching React Toastify
|
|
7
|
+
- Add "colored" theme support
|
|
8
|
+
- Add exit animations (bounce, slide, zoom, flip)
|
|
9
|
+
- Add top-center and bottom-center position options
|
|
10
|
+
- Add CSS variables for easy customization
|
|
11
|
+
- Add z-index (9999) to toast container
|
|
12
|
+
- Update visual styling to match React Toastify (dimensions, colors, shadows, typography)
|
|
13
|
+
- Add mobile responsive layout
|
|
14
|
+
- Improve RailsToastify.show() to use notice defaults when called without explicit options
|
|
15
|
+
|
|
1
16
|
## 1.2.2
|
|
2
17
|
|
|
3
18
|
- Fix relative field to helpers to force autoload before include
|
data/README.md
CHANGED
|
@@ -25,13 +25,13 @@ This will create a file *config/initializers/rails_toastify.rb* where you can de
|
|
|
25
25
|
|
|
26
26
|
```ruby
|
|
27
27
|
RailsToastify.setup do |configuration|
|
|
28
|
-
configuration.position = 'toast-container-top-right'
|
|
29
|
-
configuration.notice_animation = 'bounce' # bounce, slide, flip, zoom
|
|
28
|
+
configuration.position = 'toast-container-top-right' # top-right, top-left, top-center, bottom-right, bottom-left, bottom-center
|
|
29
|
+
configuration.notice_animation = 'bounce' # bounce, slide, flip, zoom
|
|
30
30
|
configuration.alert_animation = 'slide' # bounce, slide, flip, zoom
|
|
31
31
|
configuration.notice_duration = 3000
|
|
32
32
|
configuration.alert_duration = 3000
|
|
33
|
-
configuration.notice_theme = 'light' # light, dark
|
|
34
|
-
configuration.alert_theme = 'light' # light, dark
|
|
33
|
+
configuration.notice_theme = 'light' # light, dark, colored
|
|
34
|
+
configuration.alert_theme = 'light' # light, dark, colored
|
|
35
35
|
configuration.notice_type = 'default' # default, success, warning, error, info
|
|
36
36
|
configuration.alert_type = 'error' # default, success, warning, error, info
|
|
37
37
|
end
|
|
@@ -87,9 +87,8 @@ To see notice or alert in a toast add this in application.html.erb:
|
|
|
87
87
|
## Next steps
|
|
88
88
|
|
|
89
89
|
- Add tests
|
|
90
|
-
- Add others positions (left, center, bottom)
|
|
91
|
-
- Add fade in and fade out animation
|
|
92
90
|
- In addition to the colors, allow the user to choose any color for the progress bar
|
|
91
|
+
- Add drag to close support
|
|
93
92
|
|
|
94
93
|
## Requirements
|
|
95
94
|
|
|
@@ -1,19 +1,47 @@
|
|
|
1
|
-
const totalDuration = 3000;
|
|
2
1
|
let toastIdCounter = 0;
|
|
3
2
|
|
|
3
|
+
const TOAST_ICONS = {
|
|
4
|
+
info: '<svg viewBox="0 0 24 24" width="100%" height="100%" fill="currentColor"><path d="M12 0a12 12 0 1012 12A12.013 12.013 0 0012 0zm.25 5a1.5 1.5 0 110 3 1.5 1.5 0 010-3zm2.25 13.5h-4a1 1 0 010-2h.75a.25.25 0 00.25-.25v-4.5a.25.25 0 00-.25-.25h-.75a1 1 0 010-2h1a2 2 0 012 2v4.75a.25.25 0 00.25.25h.75a1 1 0 110 2z"/></svg>',
|
|
5
|
+
success: '<svg viewBox="0 0 24 24" width="100%" height="100%" fill="currentColor"><path d="M12 0a12 12 0 1012 12A12.014 12.014 0 0012 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 01-1.43.188l-4.888-3.908a1 1 0 111.25-1.562l4.076 3.261 6.227-8.451a1 1 0 111.61 1.183z"/></svg>',
|
|
6
|
+
warning: '<svg viewBox="0 0 24 24" width="100%" height="100%" fill="currentColor"><path d="M23.32 17.191L15.438 2.184C14.728.833 13.416 0 11.996 0c-1.42 0-2.733.833-3.443 2.184L.533 17.448a4.744 4.744 0 000 4.368C1.243 23.167 2.555 24 3.975 24h16.05C22.22 24 24 22.044 24 19.632c0-.904-.232-1.747-.68-2.441zM12.002 7a1.5 1.5 0 011.5 1.5v5a1.5 1.5 0 01-3 0v-5a1.5 1.5 0 011.5-1.5zm-.004 12a2 2 0 110-4 2 2 0 010 4z"/></svg>',
|
|
7
|
+
error: '<svg viewBox="0 0 24 24" width="100%" height="100%" fill="currentColor"><path d="M11.983 0a12.206 12.206 0 00-8.51 3.653A11.8 11.8 0 000 12.207 11.779 11.779 0 0011.8 24h.214A12.111 12.111 0 0024 11.791 11.766 11.766 0 0011.983 0zM10.5 16.542a1.476 1.476 0 011.449-1.53h.027a1.527 1.527 0 011.523 1.47 1.475 1.475 0 01-1.449 1.53h-.027a1.529 1.529 0 01-1.523-1.47zM11 12.5v-6a1 1 0 012 0v6a1 1 0 11-2 0z"/></svg>'
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const CLOSE_SVG = '<svg viewBox="0 0 14 14" width="14" height="14" fill="currentColor"><path d="M14 1.41L12.59 0 7 5.59 1.41 0 0 1.41 5.59 7 0 12.59 1.41 14 7 8.41 12.59 14 14 12.59 8.41 7z"/></svg>';
|
|
11
|
+
|
|
4
12
|
function showToast(message, options) {
|
|
13
|
+
options = options || {};
|
|
14
|
+
const theme = options.theme || 'light';
|
|
15
|
+
const animation = options.animation || 'bounce';
|
|
16
|
+
const duration = options.duration || 3000;
|
|
17
|
+
const type = options.type || 'default';
|
|
18
|
+
|
|
5
19
|
const toastContainer = document.getElementById('toast-container');
|
|
6
|
-
|
|
20
|
+
if (!toastContainer) return;
|
|
21
|
+
|
|
22
|
+
const currentId = toastIdCounter;
|
|
7
23
|
const toast = document.createElement('div');
|
|
8
|
-
toast.
|
|
9
|
-
toast.
|
|
24
|
+
toast.id = `toast-${currentId}`;
|
|
25
|
+
toast.setAttribute('data-animation', animation);
|
|
10
26
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
let classes = `toast toast-${theme} show ${animation}`;
|
|
28
|
+
if (type !== 'default') {
|
|
29
|
+
classes += ` toast-type-${type}`;
|
|
30
|
+
}
|
|
31
|
+
toast.className = classes;
|
|
32
|
+
|
|
33
|
+
let iconHtml = '';
|
|
34
|
+
if (type !== 'default' && TOAST_ICONS[type]) {
|
|
35
|
+
iconHtml = `<div class="toast-icon toast-icon-${type}">${TOAST_ICONS[type]}</div>`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
toast.innerHTML =
|
|
39
|
+
`<div class="toast-body">` +
|
|
40
|
+
iconHtml +
|
|
41
|
+
`<div class="toast-message">${message}</div>` +
|
|
42
|
+
`</div>` +
|
|
43
|
+
`<span class="close-icon" onclick="hideToast(${currentId})" aria-label="close">${CLOSE_SVG}</span>` +
|
|
44
|
+
`<div class="progress-bar progress-bar-${type}" id="progress-bar-${currentId}"></div>`;
|
|
17
45
|
|
|
18
46
|
toastContainer.appendChild(toast);
|
|
19
47
|
toastIdCounter++;
|
|
@@ -21,10 +49,9 @@ function showToast(message, options) {
|
|
|
21
49
|
const progressBar = toast.querySelector('.progress-bar');
|
|
22
50
|
progressBar.style.width = '100%';
|
|
23
51
|
|
|
24
|
-
let remainingTime =
|
|
52
|
+
let remainingTime = duration;
|
|
25
53
|
let lastUpdateTime = Date.now();
|
|
26
54
|
let paused = false;
|
|
27
|
-
let intervalId;
|
|
28
55
|
|
|
29
56
|
function updateProgressBar() {
|
|
30
57
|
if (!paused) {
|
|
@@ -33,16 +60,12 @@ function showToast(message, options) {
|
|
|
33
60
|
remainingTime -= elapsedTime;
|
|
34
61
|
lastUpdateTime = currentTime;
|
|
35
62
|
|
|
36
|
-
const progress = (remainingTime /
|
|
37
|
-
progressBar.style.width = `${progress}%`;
|
|
63
|
+
const progress = (remainingTime / duration) * 100;
|
|
64
|
+
progressBar.style.width = `${Math.max(progress, 0)}%`;
|
|
38
65
|
|
|
39
66
|
if (remainingTime <= 0) {
|
|
40
67
|
clearInterval(intervalId);
|
|
41
|
-
toast
|
|
42
|
-
toast.classList.add('hide');
|
|
43
|
-
setTimeout(() => {
|
|
44
|
-
toast.parentElement.removeChild(toast);
|
|
45
|
-
}, 300);
|
|
68
|
+
dismissToast(toast);
|
|
46
69
|
return;
|
|
47
70
|
}
|
|
48
71
|
}
|
|
@@ -57,20 +80,38 @@ function showToast(message, options) {
|
|
|
57
80
|
lastUpdateTime = Date.now();
|
|
58
81
|
});
|
|
59
82
|
|
|
60
|
-
intervalId = setInterval(updateProgressBar, 100);
|
|
83
|
+
const intervalId = setInterval(updateProgressBar, 100);
|
|
84
|
+
toast._intervalId = intervalId;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function dismissToast(toast) {
|
|
88
|
+
if (toast._intervalId) {
|
|
89
|
+
clearInterval(toast._intervalId);
|
|
90
|
+
toast._intervalId = null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const animation = toast.getAttribute('data-animation') || 'bounce';
|
|
94
|
+
toast.classList.remove('show');
|
|
95
|
+
toast.classList.remove(animation);
|
|
96
|
+
toast.classList.add(`${animation}-exit`);
|
|
97
|
+
|
|
98
|
+
let removed = false;
|
|
99
|
+
const removeToast = () => {
|
|
100
|
+
if (!removed && toast.parentElement) {
|
|
101
|
+
removed = true;
|
|
102
|
+
toast.parentElement.removeChild(toast);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
toast.addEventListener('animationend', removeToast);
|
|
107
|
+
setTimeout(removeToast, 1000);
|
|
61
108
|
}
|
|
62
109
|
|
|
63
110
|
function hideToast(toastId) {
|
|
64
111
|
const toast = document.getElementById(`toast-${toastId}`);
|
|
65
112
|
if (toast) {
|
|
66
|
-
toast
|
|
67
|
-
toast.classList.add('hide');
|
|
68
|
-
setTimeout(() => {
|
|
69
|
-
toast.parentElement.removeChild(toast);
|
|
70
|
-
}, 300);
|
|
113
|
+
dismissToast(toast);
|
|
71
114
|
}
|
|
72
115
|
}
|
|
73
116
|
|
|
74
117
|
window.hideToast = hideToast;
|
|
75
|
-
|
|
76
|
-
/* showToast('slide'); */
|
|
@@ -1,127 +1,265 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--toastify-color-light: #fff;
|
|
3
|
+
--toastify-color-dark: #121212;
|
|
4
|
+
--toastify-color-info: #3498db;
|
|
5
|
+
--toastify-color-success: #07bc0c;
|
|
6
|
+
--toastify-color-warning: #f1c40f;
|
|
7
|
+
--toastify-color-error: #e74c3c;
|
|
8
|
+
--toastify-toast-width: 320px;
|
|
9
|
+
--toastify-toast-offset: 16px;
|
|
10
|
+
--toastify-toast-min-height: 64px;
|
|
11
|
+
--toastify-toast-bd-radius: 6px;
|
|
12
|
+
--toastify-toast-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
|
|
13
|
+
--toastify-font-family: sans-serif;
|
|
14
|
+
--toastify-z-index: 9999;
|
|
15
|
+
--toastify-text-color-light: #757575;
|
|
16
|
+
--toastify-text-color-dark: #fff;
|
|
17
|
+
--toastify-color-progress-light: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55);
|
|
18
|
+
--toastify-color-progress-dark: #bb86fc;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* CONTAINER */
|
|
1
22
|
.toast-container {
|
|
2
23
|
position: fixed;
|
|
3
|
-
|
|
4
|
-
top: 20px;
|
|
5
|
-
right: 20px;
|
|
6
|
-
/************/
|
|
24
|
+
z-index: var(--toastify-z-index);
|
|
7
25
|
display: flex;
|
|
8
26
|
flex-direction: column;
|
|
9
|
-
gap:
|
|
27
|
+
gap: 12px;
|
|
10
28
|
}
|
|
11
29
|
|
|
30
|
+
/* POSITIONS */
|
|
31
|
+
.toast-container-top-left {
|
|
32
|
+
top: var(--toastify-toast-offset);
|
|
33
|
+
left: var(--toastify-toast-offset);
|
|
34
|
+
bottom: auto;
|
|
35
|
+
right: auto;
|
|
36
|
+
}
|
|
37
|
+
.toast-container-top-right {
|
|
38
|
+
top: var(--toastify-toast-offset);
|
|
39
|
+
right: var(--toastify-toast-offset);
|
|
40
|
+
bottom: auto;
|
|
41
|
+
left: auto;
|
|
42
|
+
}
|
|
43
|
+
.toast-container-top-center {
|
|
44
|
+
top: var(--toastify-toast-offset);
|
|
45
|
+
left: 50%;
|
|
46
|
+
transform: translateX(-50%);
|
|
47
|
+
bottom: auto;
|
|
48
|
+
right: auto;
|
|
49
|
+
}
|
|
50
|
+
.toast-container-bottom-left {
|
|
51
|
+
bottom: var(--toastify-toast-offset);
|
|
52
|
+
left: var(--toastify-toast-offset);
|
|
53
|
+
top: auto;
|
|
54
|
+
right: auto;
|
|
55
|
+
}
|
|
56
|
+
.toast-container-bottom-right {
|
|
57
|
+
bottom: var(--toastify-toast-offset);
|
|
58
|
+
right: var(--toastify-toast-offset);
|
|
59
|
+
top: auto;
|
|
60
|
+
left: auto;
|
|
61
|
+
}
|
|
62
|
+
.toast-container-bottom-center {
|
|
63
|
+
bottom: var(--toastify-toast-offset);
|
|
64
|
+
left: 50%;
|
|
65
|
+
transform: translateX(-50%);
|
|
66
|
+
top: auto;
|
|
67
|
+
right: auto;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* TOAST */
|
|
12
71
|
.toast {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
72
|
+
width: var(--toastify-toast-width);
|
|
73
|
+
min-height: var(--toastify-toast-min-height);
|
|
74
|
+
padding: 8px;
|
|
75
|
+
border-radius: var(--toastify-toast-bd-radius);
|
|
76
|
+
box-shadow: var(--toastify-toast-shadow);
|
|
77
|
+
font-family: var(--toastify-font-family);
|
|
78
|
+
background-color: var(--toastify-color-light);
|
|
79
|
+
color: var(--toastify-text-color-light);
|
|
21
80
|
opacity: 0;
|
|
22
81
|
transition: opacity 0.3s ease-in-out;
|
|
23
82
|
display: flex;
|
|
24
83
|
align-items: center;
|
|
25
|
-
justify-content: space-between;
|
|
26
84
|
overflow: hidden;
|
|
27
85
|
position: relative;
|
|
86
|
+
box-sizing: border-box;
|
|
87
|
+
cursor: default;
|
|
28
88
|
}
|
|
29
89
|
|
|
30
90
|
.toast.show {
|
|
31
91
|
opacity: 1;
|
|
32
92
|
}
|
|
33
93
|
|
|
94
|
+
/* TOAST BODY */
|
|
95
|
+
.toast-body {
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
flex: 1 1 auto;
|
|
99
|
+
padding: 6px;
|
|
100
|
+
gap: 10px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* TYPE ICON */
|
|
104
|
+
.toast-icon {
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
flex-shrink: 0;
|
|
108
|
+
width: 20px;
|
|
109
|
+
height: 20px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.toast-icon svg {
|
|
113
|
+
fill: currentColor;
|
|
114
|
+
width: 100%;
|
|
115
|
+
height: 100%;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* CLOSE BUTTON */
|
|
34
119
|
.close-icon {
|
|
35
|
-
|
|
120
|
+
align-self: flex-start;
|
|
121
|
+
color: #000;
|
|
122
|
+
background: transparent;
|
|
123
|
+
border: none;
|
|
124
|
+
outline: none;
|
|
36
125
|
cursor: pointer;
|
|
126
|
+
opacity: 0.3;
|
|
127
|
+
transition: opacity 0.3s ease;
|
|
128
|
+
padding: 4px;
|
|
129
|
+
display: flex;
|
|
130
|
+
align-items: center;
|
|
131
|
+
flex-shrink: 0;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.close-icon:hover,
|
|
135
|
+
.close-icon:focus {
|
|
136
|
+
opacity: 0.6;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.close-icon svg {
|
|
140
|
+
width: 14px;
|
|
141
|
+
height: 14px;
|
|
142
|
+
fill: currentColor;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.toast-dark .close-icon,
|
|
146
|
+
.toast-colored .close-icon {
|
|
147
|
+
color: #fff;
|
|
148
|
+
opacity: 0.7;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.toast-dark .close-icon:hover,
|
|
152
|
+
.toast-dark .close-icon:focus,
|
|
153
|
+
.toast-colored .close-icon:hover,
|
|
154
|
+
.toast-colored .close-icon:focus {
|
|
155
|
+
opacity: 1;
|
|
37
156
|
}
|
|
38
157
|
|
|
158
|
+
/* PROGRESS BAR */
|
|
39
159
|
.progress-bar {
|
|
40
160
|
height: 5px;
|
|
41
161
|
width: 100%;
|
|
42
|
-
/**TYPE**/
|
|
43
|
-
/* background será adicionado através da classe escolhida colocando a respectiva progress bar no javascript */
|
|
44
|
-
/* background: linear-gradient(90deg,#4cd964,#5ac8fa,#007aff,#34aadc,#5856d6,#ff2d55); */
|
|
45
|
-
/************/
|
|
46
162
|
position: absolute;
|
|
47
163
|
bottom: 0;
|
|
48
164
|
left: 0;
|
|
49
165
|
transition: width 0.1s linear;
|
|
50
166
|
}
|
|
51
167
|
|
|
52
|
-
/*
|
|
168
|
+
/* THEMES */
|
|
53
169
|
.toast-light {
|
|
54
|
-
background-color:
|
|
55
|
-
color:
|
|
170
|
+
background-color: var(--toastify-color-light);
|
|
171
|
+
color: var(--toastify-text-color-light);
|
|
56
172
|
}
|
|
173
|
+
|
|
57
174
|
.toast-dark {
|
|
58
|
-
background-color:
|
|
175
|
+
background-color: var(--toastify-color-dark);
|
|
176
|
+
color: var(--toastify-text-color-dark);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.toast-colored.toast-type-info {
|
|
180
|
+
background-color: var(--toastify-color-info);
|
|
59
181
|
color: #fff;
|
|
60
182
|
}
|
|
61
183
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
184
|
+
.toast-colored.toast-type-success {
|
|
185
|
+
background-color: var(--toastify-color-success);
|
|
186
|
+
color: #fff;
|
|
65
187
|
}
|
|
66
|
-
|
|
67
|
-
|
|
188
|
+
|
|
189
|
+
.toast-colored.toast-type-warning {
|
|
190
|
+
background-color: var(--toastify-color-warning);
|
|
191
|
+
color: #fff;
|
|
68
192
|
}
|
|
69
|
-
|
|
70
|
-
|
|
193
|
+
|
|
194
|
+
.toast-colored.toast-type-error {
|
|
195
|
+
background-color: var(--toastify-color-error);
|
|
196
|
+
color: #fff;
|
|
71
197
|
}
|
|
72
|
-
|
|
73
|
-
|
|
198
|
+
|
|
199
|
+
/* TYPE ICON COLORS */
|
|
200
|
+
.toast-icon-info {
|
|
201
|
+
color: var(--toastify-color-info);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.toast-icon-success {
|
|
205
|
+
color: var(--toastify-color-success);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.toast-icon-warning {
|
|
209
|
+
color: var(--toastify-color-warning);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.toast-icon-error {
|
|
213
|
+
color: var(--toastify-color-error);
|
|
74
214
|
}
|
|
215
|
+
|
|
216
|
+
.toast-colored .toast-icon {
|
|
217
|
+
color: #fff;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/* PROGRESS BAR TYPES */
|
|
75
221
|
.progress-bar-default {
|
|
76
|
-
background:
|
|
222
|
+
background: var(--toastify-color-progress-light);
|
|
77
223
|
}
|
|
78
224
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
top: 20px;
|
|
82
|
-
left: 20px;
|
|
225
|
+
.progress-bar-success {
|
|
226
|
+
background-color: var(--toastify-color-success);
|
|
83
227
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
228
|
+
|
|
229
|
+
.progress-bar-info {
|
|
230
|
+
background-color: var(--toastify-color-info);
|
|
87
231
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
232
|
+
|
|
233
|
+
.progress-bar-error {
|
|
234
|
+
background-color: var(--toastify-color-error);
|
|
91
235
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
236
|
+
|
|
237
|
+
.progress-bar-warning {
|
|
238
|
+
background-color: var(--toastify-color-warning);
|
|
95
239
|
}
|
|
96
240
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/* @keyframes bounce-in {
|
|
100
|
-
0% {
|
|
101
|
-
transform: scale(0.8);
|
|
102
|
-
}
|
|
103
|
-
50% {
|
|
104
|
-
transform: scale(1.1);
|
|
105
|
-
}
|
|
106
|
-
100% {
|
|
107
|
-
transform: scale(1);
|
|
108
|
-
}
|
|
241
|
+
.toast-dark .progress-bar-default {
|
|
242
|
+
background: var(--toastify-color-progress-dark);
|
|
109
243
|
}
|
|
110
244
|
|
|
111
|
-
.toast.
|
|
112
|
-
|
|
113
|
-
}
|
|
245
|
+
.toast-colored .progress-bar {
|
|
246
|
+
background: rgba(255, 255, 255, 0.7);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* ENTRY ANIMATIONS */
|
|
114
250
|
|
|
251
|
+
/* BOUNCE */
|
|
115
252
|
@keyframes bounce-all {
|
|
116
253
|
from,
|
|
117
254
|
60%,
|
|
118
255
|
75%,
|
|
119
256
|
90%,
|
|
120
257
|
to {
|
|
258
|
+
animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
|
|
121
259
|
}
|
|
122
260
|
from {
|
|
123
261
|
opacity: 0;
|
|
124
|
-
transform: translate3d(
|
|
262
|
+
transform: translate3d(3000px, 0, 0);
|
|
125
263
|
}
|
|
126
264
|
60% {
|
|
127
265
|
opacity: 1;
|
|
@@ -139,53 +277,166 @@
|
|
|
139
277
|
}
|
|
140
278
|
|
|
141
279
|
.toast.bounce {
|
|
142
|
-
animation: bounce-all 0.
|
|
280
|
+
animation: bounce-all 0.7s both;
|
|
143
281
|
}
|
|
144
282
|
|
|
145
283
|
/* SLIDE */
|
|
146
284
|
@keyframes slide-in {
|
|
147
|
-
|
|
148
|
-
transform:
|
|
149
|
-
|
|
285
|
+
from {
|
|
286
|
+
transform: translate3d(110%, 0, 0);
|
|
287
|
+
visibility: visible;
|
|
150
288
|
}
|
|
151
|
-
|
|
152
|
-
transform:
|
|
153
|
-
opacity: 1;
|
|
289
|
+
to {
|
|
290
|
+
transform: translate3d(0, 0, 0);
|
|
154
291
|
}
|
|
155
292
|
}
|
|
156
293
|
|
|
157
294
|
.toast.slide {
|
|
158
|
-
animation: slide-in 0.
|
|
295
|
+
animation: slide-in 0.3s ease-out both;
|
|
159
296
|
}
|
|
160
297
|
|
|
161
298
|
/* ZOOM */
|
|
162
299
|
@keyframes zoom-in {
|
|
163
|
-
|
|
164
|
-
transform: scale(0);
|
|
300
|
+
from {
|
|
165
301
|
opacity: 0;
|
|
302
|
+
transform: scale3d(0.3, 0.3, 0.3);
|
|
166
303
|
}
|
|
167
|
-
|
|
168
|
-
transform: scale(1);
|
|
304
|
+
50% {
|
|
169
305
|
opacity: 1;
|
|
170
306
|
}
|
|
171
307
|
}
|
|
172
308
|
|
|
173
309
|
.toast.zoom {
|
|
174
|
-
animation: zoom-in 0.3s
|
|
310
|
+
animation: zoom-in 0.3s both;
|
|
175
311
|
}
|
|
176
312
|
|
|
177
313
|
/* FLIP */
|
|
178
314
|
@keyframes flip-in {
|
|
179
|
-
|
|
180
|
-
transform:
|
|
315
|
+
from {
|
|
316
|
+
transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
|
|
317
|
+
animation-timing-function: ease-in;
|
|
181
318
|
opacity: 0;
|
|
182
319
|
}
|
|
183
|
-
|
|
184
|
-
transform:
|
|
320
|
+
40% {
|
|
321
|
+
transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
|
|
322
|
+
animation-timing-function: ease-in;
|
|
323
|
+
}
|
|
324
|
+
60% {
|
|
325
|
+
transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
|
|
185
326
|
opacity: 1;
|
|
186
327
|
}
|
|
328
|
+
80% {
|
|
329
|
+
transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
|
|
330
|
+
}
|
|
331
|
+
to {
|
|
332
|
+
transform: perspective(400px);
|
|
333
|
+
}
|
|
187
334
|
}
|
|
188
335
|
|
|
189
336
|
.toast.flip {
|
|
190
|
-
animation: flip-in 0.5s ease-in-out;
|
|
191
|
-
}
|
|
337
|
+
animation: flip-in 0.5s ease-in-out both;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/* EXIT ANIMATIONS */
|
|
341
|
+
|
|
342
|
+
@keyframes bounce-out-right {
|
|
343
|
+
from {
|
|
344
|
+
opacity: 1;
|
|
345
|
+
transform: translate3d(0, 0, 0);
|
|
346
|
+
}
|
|
347
|
+
20% {
|
|
348
|
+
opacity: 1;
|
|
349
|
+
transform: translate3d(-20px, 0, 0);
|
|
350
|
+
}
|
|
351
|
+
to {
|
|
352
|
+
opacity: 0;
|
|
353
|
+
transform: translate3d(2000px, 0, 0);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
@keyframes slide-out-right {
|
|
358
|
+
from {
|
|
359
|
+
opacity: 1;
|
|
360
|
+
transform: translate3d(0, 0, 0);
|
|
361
|
+
}
|
|
362
|
+
to {
|
|
363
|
+
opacity: 0;
|
|
364
|
+
transform: translate3d(110%, 0, 0);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
@keyframes zoom-out {
|
|
369
|
+
from {
|
|
370
|
+
opacity: 1;
|
|
371
|
+
transform: scale3d(1, 1, 1);
|
|
372
|
+
}
|
|
373
|
+
50% {
|
|
374
|
+
opacity: 0;
|
|
375
|
+
transform: scale3d(0.3, 0.3, 0.3);
|
|
376
|
+
}
|
|
377
|
+
to {
|
|
378
|
+
opacity: 0;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
@keyframes flip-out {
|
|
383
|
+
from {
|
|
384
|
+
opacity: 1;
|
|
385
|
+
transform: perspective(400px);
|
|
386
|
+
}
|
|
387
|
+
30% {
|
|
388
|
+
opacity: 1;
|
|
389
|
+
transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
|
|
390
|
+
}
|
|
391
|
+
to {
|
|
392
|
+
opacity: 0;
|
|
393
|
+
transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.toast.bounce-exit {
|
|
398
|
+
animation: bounce-out-right 0.7s both;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.toast.slide-exit {
|
|
402
|
+
animation: slide-out-right 0.3s ease-in both;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.toast.zoom-exit {
|
|
406
|
+
animation: zoom-out 0.3s both;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.toast.flip-exit {
|
|
410
|
+
animation: flip-out 0.5s ease-in-out both;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/* MOBILE RESPONSIVE */
|
|
414
|
+
@media only screen and (max-width: 480px) {
|
|
415
|
+
.toast-container {
|
|
416
|
+
width: 100vw;
|
|
417
|
+
padding: 0;
|
|
418
|
+
margin: 0;
|
|
419
|
+
}
|
|
420
|
+
.toast-container-top-left,
|
|
421
|
+
.toast-container-top-right,
|
|
422
|
+
.toast-container-top-center {
|
|
423
|
+
top: 0;
|
|
424
|
+
left: 0;
|
|
425
|
+
right: 0;
|
|
426
|
+
bottom: auto;
|
|
427
|
+
transform: none;
|
|
428
|
+
}
|
|
429
|
+
.toast-container-bottom-left,
|
|
430
|
+
.toast-container-bottom-right,
|
|
431
|
+
.toast-container-bottom-center {
|
|
432
|
+
bottom: 0;
|
|
433
|
+
left: 0;
|
|
434
|
+
right: 0;
|
|
435
|
+
top: auto;
|
|
436
|
+
transform: none;
|
|
437
|
+
}
|
|
438
|
+
.toast {
|
|
439
|
+
width: 100%;
|
|
440
|
+
border-radius: 0;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
@@ -10,7 +10,13 @@ module RailsToastifyHelper
|
|
|
10
10
|
window.RailsToastify = {
|
|
11
11
|
config: #{RailsToastify.configuration.to_h.to_json},
|
|
12
12
|
show: function(message, options) {
|
|
13
|
-
|
|
13
|
+
var defaults = {
|
|
14
|
+
theme: this.config.notice_theme || 'light',
|
|
15
|
+
animation: this.config.notice_animation || 'bounce',
|
|
16
|
+
duration: this.config.notice_duration || 3000,
|
|
17
|
+
type: this.config.notice_type || 'default'
|
|
18
|
+
};
|
|
19
|
+
options = Object.assign({}, defaults, options || {});
|
|
14
20
|
showToast(message, options);
|
|
15
21
|
}
|
|
16
22
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
RailsToastify.setup do |configuration|
|
|
2
|
-
configuration.position = 'toast-container-top-right'
|
|
3
|
-
configuration.notice_animation = 'bounce' # bounce, slide, flip, zoom
|
|
2
|
+
configuration.position = 'toast-container-top-right' # top-right, top-left, top-center, bottom-right, bottom-left, bottom-center
|
|
3
|
+
configuration.notice_animation = 'bounce' # bounce, slide, flip, zoom
|
|
4
4
|
configuration.alert_animation = 'slide' # bounce, slide, flip, zoom
|
|
5
5
|
configuration.notice_duration = 3000
|
|
6
6
|
configuration.alert_duration = 3000
|
|
7
|
-
configuration.notice_theme = 'light' # light, dark
|
|
8
|
-
configuration.alert_theme = 'light' # light, dark
|
|
7
|
+
configuration.notice_theme = 'light' # light, dark, colored
|
|
8
|
+
configuration.alert_theme = 'light' # light, dark, colored
|
|
9
9
|
configuration.notice_type = 'default' # default, success, warning, error, info
|
|
10
10
|
configuration.alert_type = 'error' # default, success, warning, error, info
|
|
11
11
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_toastify
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Elton Santos
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: "\U0001F389 Rails Toastify allows you to add notifications to your app
|
|
14
14
|
with ease. Pay Attention: this gem still is in development. Please CONTRIBUTE"
|
|
@@ -39,7 +39,7 @@ metadata:
|
|
|
39
39
|
homepage_uri: https://github.com/eltonsantos/rails_toastify
|
|
40
40
|
source_code_uri: https://github.com/eltonsantos/rails_toastify
|
|
41
41
|
changelog_uri: https://github.com/eltonsantos/rails_toastify/blob/master/CHANGELOG.md
|
|
42
|
-
post_install_message:
|
|
42
|
+
post_install_message:
|
|
43
43
|
rdoc_options: []
|
|
44
44
|
require_paths:
|
|
45
45
|
- lib
|
|
@@ -54,8 +54,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
55
|
version: '0'
|
|
56
56
|
requirements: []
|
|
57
|
-
rubygems_version: 3.5.
|
|
58
|
-
signing_key:
|
|
57
|
+
rubygems_version: 3.5.11
|
|
58
|
+
signing_key:
|
|
59
59
|
specification_version: 4
|
|
60
60
|
summary: "\U0001F389 Rails Toastify allows you to add notifications to your app with
|
|
61
61
|
ease."
|