flicker-alerts 1.0.75 → 1.0.78

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.
Files changed (4) hide show
  1. package/index.js +17 -10
  2. package/package.json +2 -2
  3. package/readme.md +3 -3
  4. package/style.css +79 -29
package/index.js CHANGED
@@ -1,22 +1,26 @@
1
1
  const FlickerAlerts = {
2
- showAlert: function ({ type, title, message, duration = 3000, position = 'top-right' }) { // duração padrão: 3 segundos
2
+ showAlert: function ({ type, title, message, duration = 3000, position = 'top-right' }) {
3
3
  if (typeof window !== 'undefined' && typeof document !== 'undefined') {
4
4
  let container = document.getElementById('alerts-container');
5
5
  if (!container) {
6
6
  container = document.createElement('div');
7
7
  container.id = 'alerts-container';
8
8
  container.style.position = 'fixed';
9
- container.style.top = 0;
10
- container.style.left = 0;
11
- container.style.width = '100vw';
12
- container.style.height = '100vh';
13
9
  container.style.pointerEvents = 'none';
14
10
  document.body.appendChild(container);
11
+
12
+ // Define posição com base no parâmetro
13
+ const positionStyles = {
14
+ 'top-right': { top: '0', right: '0', flexDirection: 'column' },
15
+ 'top-left': { top: '0', left: '0', flexDirection: 'column' },
16
+ 'bottom-right': { bottom: '0', right: '0', flexDirection: 'column-reverse' },
17
+ 'bottom-left': { bottom: '0', left: '0', flexDirection: 'column-reverse' },
18
+ };
19
+ Object.assign(container.style, positionStyles[position] || positionStyles['top-right']);
15
20
  }
16
21
 
17
22
  const alertBox = document.createElement('div');
18
23
  alertBox.className = `notification ${type}`;
19
- alertBox.classList.add(position);
20
24
 
21
25
  // Ícone
22
26
  const icon = document.createElement('div');
@@ -29,7 +33,10 @@ const FlickerAlerts = {
29
33
  }[type];
30
34
  icon.innerHTML = `<i class="fas ${iconClass}" style="font-size: 24px;"></i>`;
31
35
  alertBox.appendChild(icon);
32
-
36
+ const divider = document.createElement('div');
37
+ divider.className = 'divider';
38
+ alertBox.appendChild(divider);
39
+
33
40
  // Conteúdo
34
41
  const content = document.createElement('div');
35
42
  content.innerHTML = `<div class="title">${title}</div><div class="message">${message}</div>`;
@@ -51,7 +58,9 @@ const FlickerAlerts = {
51
58
  });
52
59
 
53
60
  alertBox.appendChild(closeButton);
54
- container.appendChild(alertBox);
61
+
62
+ // Adiciona no contêiner
63
+ container.prepend(alertBox);
55
64
 
56
65
  // Timeout para remover automaticamente o alerta
57
66
  const timeoutId = setTimeout(() => {
@@ -66,8 +75,6 @@ const FlickerAlerts = {
66
75
  },
67
76
  };
68
77
 
69
-
70
-
71
78
  // Botões de teste - Eles podem ser removidos se não forem necessários
72
79
  if (typeof document !== 'undefined') {
73
80
  document.getElementById('success-btn')?.addEventListener('click', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flicker-alerts",
3
- "version": "1.0.75",
3
+ "version": "1.0.78",
4
4
  "repository": "https://www.linkedin.com/in/bruno-carneiro-9a53aa190/",
5
5
  "homepage": "https://flickeralerts.netlify.app/",
6
6
  "description": "Biblioteca para alertas animados",
@@ -18,6 +18,6 @@
18
18
  "author": "https://www.linkedin.com/in/bruno-carneiro-9a53aa190/",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "flicker-alerts": "^1.0.75"
21
+ "flicker-alerts": "^1.0.78"
22
22
  }
23
23
  }
package/readme.md CHANGED
@@ -51,7 +51,7 @@ FlickerAlerts.showAlert({
51
51
  type: 'success', // 'success', 'info', 'warning', 'danger'
52
52
  title: 'Sucesso!',
53
53
  message: 'Operação realizada com sucesso.',
54
- position: 'top-right' // 'top-right', 'top-left', 'bottom-right', 'bottom-left', 'center'
54
+ position: 'top-right', // 'top-right', 'top-left', 'bottom-right', 'bottom-left', 'center'
55
55
  duration: 5000
56
56
  });
57
57
  ```
@@ -73,7 +73,7 @@ export class AppComponent {
73
73
  type: 'warning',
74
74
  title: 'Atenção!',
75
75
  message: 'Algo deu errado.',
76
- position: 'top-center'
76
+ position: 'top-center',
77
77
  duration: 5000
78
78
  });
79
79
  }
@@ -116,7 +116,7 @@ const App = () => {
116
116
  type: 'info',
117
117
  title: 'Informação',
118
118
  message: 'Este é um alerta informativo.',
119
- position: 'bottom-left'
119
+ position: 'bottom-left',
120
120
  duration: 5000
121
121
  });
122
122
  };
package/style.css CHANGED
@@ -1,32 +1,81 @@
1
1
 
2
-
3
2
  #alerts-container {
4
3
  position: fixed;
5
4
  top: 0;
6
- left: 0;
7
- width: 100vw;
8
- height: 100vh;
9
- pointer-events: none; /* Impede que o contêiner interfira nos cliques */
10
- padding-right: 20px;
5
+ right: 0;
6
+ display: flex;
7
+ flex-direction: column-reverse;
8
+ align-items: flex-end;
9
+ gap: 10px;
10
+ width: auto;
11
+ pointer-events: none;
11
12
  }
12
13
 
13
14
 
14
15
  .notification {
15
- margin: 20px;
16
+ margin: 5px 20px 5px 0;
16
17
  background-color: #ffffff;
18
+ border: 1px solid #ced4da;
19
+ box-shadow: 6px 6px 6px rgba(0, 0, 0, 0.1);
17
20
  border-radius: 10px;
18
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
19
21
  padding: 20px;
20
22
  min-width: 300px;
21
23
  max-width: 500px;
22
24
  display: flex;
23
25
  align-items: center;
24
- position: absolute;
25
- z-index: 9999; /* Garante que as notificações fiquem acima de outros elementos */
26
+ position: relative;
26
27
  opacity: 1;
27
- transition: opacity 0.3s ease-out;
28
- pointer-events: auto; /* Permite interagir com o conteúdo da notificação */
28
+ transition: opacity 0.3s ease-out, transform 0.3s ease;
29
+ pointer-events: auto;
30
+ }
31
+
32
+ .notification .icon {
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ font-size: 24px;
37
+ color: #5a5a5a;
38
+ margin-right: 10px;
29
39
  }
40
+
41
+ .notification .divider {
42
+ width: 1px;
43
+ height: 40px;
44
+ background-color: #e0e0e0;
45
+ margin-right: 15px;
46
+ }
47
+
48
+ .notification .content {
49
+ display: flex;
50
+ flex-direction: column;
51
+ }
52
+
53
+ .notification .title {
54
+ font-weight: bold;
55
+ font-size: 16px;
56
+ margin-bottom: 5px;
57
+ color: #333;
58
+ }
59
+
60
+ .notification .message {
61
+ font-size: 14px;
62
+ color: #555;
63
+ }
64
+
65
+
66
+ .notification .close {
67
+ position: absolute;
68
+ top: 10px;
69
+ right: 10px;
70
+ cursor: pointer;
71
+ font-size: 16px;
72
+ color: #999;
73
+ }
74
+
75
+ .notification .close:hover {
76
+ color: #666;
77
+ }
78
+
30
79
  .text-import{
31
80
  color: rgb(255, 0, 85);
32
81
  }
@@ -82,7 +131,7 @@ margin: 20px;
82
131
  font-size: 16px;
83
132
  }
84
133
 
85
- /* Tipos de alerta */
134
+
86
135
  .success .icon {
87
136
  background-color: #28a745;
88
137
  }
@@ -115,7 +164,7 @@ margin: 20px;
115
164
  color: #ffc107;
116
165
  }
117
166
 
118
- /* Posicionamento das notificações */
167
+
119
168
  .top-right {
120
169
  top: 1rem;
121
170
  right: 1rem;
@@ -157,7 +206,7 @@ margin: 20px;
157
206
 
158
207
 
159
208
 
160
- /* Barra de carregamento */
209
+
161
210
  .notification .progress-bar {
162
211
  position: absolute;
163
212
  bottom: 0;
@@ -170,7 +219,7 @@ margin: 20px;
170
219
  border-bottom-right-radius: 10px;
171
220
  }
172
221
 
173
- /* Animação da barra de carregamento */
222
+
174
223
  @keyframes progress-animation {
175
224
  from {
176
225
  width: 0%;
@@ -180,7 +229,7 @@ margin: 20px;
180
229
  }
181
230
  }
182
231
 
183
- /* Cores específicas para cada tipo */
232
+
184
233
  .success .progress-bar {
185
234
  background-color: #28a745;
186
235
  }
@@ -200,20 +249,20 @@ margin: 20px;
200
249
 
201
250
 
202
251
 
203
- /* Modal */
252
+
204
253
 
205
254
  .modal-container {
206
-
255
+
207
256
  display: flex;
208
- justify-content: center; /* Alinha o modal horizontalmente */
209
- align-items: center; /* Alinha o modal verticalmente */
210
- position: fixed; /* Fixa o modal na tela */
211
- top: 0; /* Alinha o topo */
212
- left: 0; /* Alinha o lado esquerdo */
213
- width: 100vw; /* Ocupa toda a largura da tela */
214
- height: 100vh; /* Ocupa toda a altura da tela */
257
+ justify-content: center;
258
+ align-items: center;
259
+ position: fixed;
260
+ top: 0;
261
+ left: 0;
262
+ width: 100vw;
263
+ height: 100vh;
215
264
  margin: 0;
216
- z-index: 9999; /* Garante que o modal ficará acima de outros elementos */
265
+ z-index: 9999;
217
266
  }
218
267
 
219
268
  .modal-dialog {
@@ -224,8 +273,9 @@ margin: 20px;
224
273
  background-color: white;
225
274
  border-radius: 10px;
226
275
  padding: 20px;
227
- border: none;
228
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
276
+ border: 1px solid #ced4da;
277
+ box-shadow: 6px 6px 6px rgba(0, 0, 0, 0.1);
278
+
229
279
  }
230
280
  .modal-header {
231
281
  border-bottom: none;