rails_toastify 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 041d336902b6df731f5af562e2277cd7a3553e8a3f1993e6c3b9616b1c356605
4
- data.tar.gz: 21e63fa2d7676cb312449e2b9d56eefb5129ecbdff0e04b30b53dd6b9a3658fe
3
+ metadata.gz: c6d828b6b26290af46ef2beb27cbd662e963f2b8b9969e55a782ce34a5a4bf4d
4
+ data.tar.gz: 768fa851fdcb5d66f8e692346f0d13fa3d99e75bfc69683a6d2f022b09b78139
5
5
  SHA512:
6
- metadata.gz: 689f7d721c8a252f8fd37bd2dbdbcbcf6c3f5d937a11fb1c54394d124ca80f306d0b0a99a2b9e54a3a7f84a5073b62e8a2df4dc5d0e2e07b2578dd088573dd6d
7
- data.tar.gz: 9a3167a81c64d577366013c6f3075773f30ad6d747b7dd0fcf5ec7eee5e5e65afc213da6c6c930c896bfefaaf8131f91be3297c1a3ff329be3c0ddfbc8c68840
6
+ metadata.gz: 845a520486d658392542d67daf6e70b5b72fb4854c04e05b497f4b2d89f421040bcedf5a08b871c9827745420d2d3ea7e8a1523c09ecf9bf56d429fc04e5ec5a
7
+ data.tar.gz: '00893d8c3e0237247046bdea15d9a01a418f684037c398a707bac9f91a033012667ccac26620de2cc0123f623681cea0c0e28ae0a3337d3a6e8c1d400fb28107'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.1.8
2
+
3
+ - Fix progressbar
4
+
1
5
  # 0.1.7
2
6
 
3
7
  - Fix problem with toast disappear when mouseover
@@ -5,22 +5,27 @@ document.addEventListener('DOMContentLoaded', () => {
5
5
  const toast = createToast(message, type, duration);
6
6
  toastContainer.appendChild(toast);
7
7
 
8
- let timeoutId = setTimeout(() => {
8
+ let startTime = Date.now();
9
+ let remainingTime = duration;
10
+
11
+ const hideToast = () => {
9
12
  toast.classList.add('hide');
10
13
  toast.addEventListener('transitionend', () => toast.remove());
11
- }, duration);
14
+ };
15
+
16
+ let timeoutId = setTimeout(hideToast, remainingTime);
12
17
 
13
18
  toast.addEventListener('mouseover', () => {
14
19
  clearTimeout(timeoutId);
15
- progressBar.style.animationPlayState = 'paused';
20
+ const elapsedTime = Date.now() - startTime;
21
+ remainingTime -= elapsedTime;
22
+ toast.querySelector('.toast__progress-bar').style.animationPlayState = 'paused';
16
23
  });
17
24
 
18
25
  toast.addEventListener('mouseout', () => {
19
- progressBar.style.animationPlayState = 'running';
20
- timeoutId = setTimeout(() => {
21
- toast.classList.add('hide');
22
- toast.addEventListener('transitionend', () => toast.remove());
23
- }, duration - progressBar.getBoundingClientRect().width * (duration / progressBar.offsetWidth));
26
+ startTime = Date.now();
27
+ toast.querySelector('.toast__progress-bar').style.animationPlayState = 'running';
28
+ timeoutId = setTimeout(hideToast, remainingTime);
24
29
  });
25
30
  }
26
31
  };
@@ -20,7 +20,7 @@
20
20
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
21
21
  transform: translateX(100%);
22
22
  max-width: 300px;
23
- pointer-events: auto; /* Para permitir interações do mouse */
23
+ pointer-events: auto;
24
24
  }
25
25
 
26
26
  .toast.show {
@@ -71,6 +71,7 @@
71
71
  width: 100%;
72
72
  height: 4px;
73
73
  animation: progress-bar 5s linear forwards;
74
+ animation-play-state: running;
74
75
  }
75
76
 
76
77
  @keyframes progress-bar {
@@ -91,11 +92,11 @@
91
92
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
92
93
  transform: translateX(100%);
93
94
  }
94
-
95
+
95
96
  .toast.show {
96
97
  transform: translateX(0);
97
98
  }
98
-
99
+
99
100
  .toast.hide {
100
101
  transform: translateX(100%);
101
102
  opacity: 0;
@@ -127,6 +128,7 @@
127
128
  .toast__progress-bar {
128
129
  @apply absolute bottom-0 left-0 w-full h-1;
129
130
  animation: progress-bar 5s linear forwards;
131
+ animation-play-state: running;
130
132
  }
131
133
 
132
134
  @keyframes progress-bar {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsToastify
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.8"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_toastify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elton Santos