flicker-alerts 1.0.80 → 1.0.82
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.
- package/index.js +32 -9
- package/package.json +2 -2
- package/logo.png +0 -0
package/index.js
CHANGED
@@ -101,9 +101,8 @@ if (typeof document !== 'undefined') {
|
|
101
101
|
// Exportação
|
102
102
|
|
103
103
|
|
104
|
-
|
105
104
|
const FlickerModals = {
|
106
|
-
showModal: function ({ type, title, message,
|
105
|
+
showModal: function ({ type, title, message, onConfirm, onCancel, timer = 5000 }) {
|
107
106
|
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
108
107
|
let container = document.getElementById('modals-container');
|
109
108
|
if (!container) {
|
@@ -193,8 +192,9 @@ const FlickerModals = {
|
|
193
192
|
modalContainer.appendChild(modalDialog);
|
194
193
|
container.appendChild(modalContainer);
|
195
194
|
|
196
|
-
//
|
197
|
-
|
195
|
+
// Timeout para remover o modal após o tempo especificado
|
196
|
+
let timeoutId; // Mover a declaração para o início
|
197
|
+
timeoutId = setTimeout(() => {
|
198
198
|
removeModal();
|
199
199
|
}, timer);
|
200
200
|
|
@@ -202,7 +202,7 @@ const FlickerModals = {
|
|
202
202
|
function removeModal() {
|
203
203
|
modalContainer.style.opacity = '0';
|
204
204
|
setTimeout(() => modalContainer.remove(), 300);
|
205
|
-
clearTimeout(timeoutId);
|
205
|
+
clearTimeout(timeoutId); // Limpar timeout após remoção
|
206
206
|
}
|
207
207
|
}
|
208
208
|
}
|
@@ -215,8 +215,19 @@ if (typeof document !== 'undefined') {
|
|
215
215
|
type: 'warning',
|
216
216
|
title: 'Tem certeza que deseja aceitar?',
|
217
217
|
message: 'Você tem certeza que deseja aceitar isso?',
|
218
|
-
onConfirm: () => {
|
219
|
-
|
218
|
+
onConfirm: () => {
|
219
|
+
console.log('Confirmado!');
|
220
|
+
// Exibir alerta de sucesso após a confirmação
|
221
|
+
FlickerAlerts.showAlert({
|
222
|
+
type: 'success',
|
223
|
+
title: 'Sucesso!',
|
224
|
+
message: 'Ação realizada com sucesso!',
|
225
|
+
duration: 3000 // duração do alerta
|
226
|
+
});
|
227
|
+
},
|
228
|
+
onCancel: () => {
|
229
|
+
console.log('Cancelado!');
|
230
|
+
}
|
220
231
|
});
|
221
232
|
});
|
222
233
|
|
@@ -225,9 +236,21 @@ if (typeof document !== 'undefined') {
|
|
225
236
|
type: 'delete',
|
226
237
|
title: 'Tem certeza que deseja deletar?',
|
227
238
|
message: 'Você tem certeza que deseja deletar isso?',
|
228
|
-
onConfirm: () => {
|
229
|
-
|
239
|
+
onConfirm: () => {
|
240
|
+
console.log('Deletado com sucesso!');
|
241
|
+
// Exibir alerta de sucesso após a confirmação
|
242
|
+
FlickerAlerts.showAlert({
|
243
|
+
type: 'success',
|
244
|
+
title: 'Sucesso!',
|
245
|
+
message: 'Item deletado com sucesso!',
|
246
|
+
duration: 3000 // duração do alerta
|
247
|
+
});
|
248
|
+
},
|
249
|
+
onCancel: () => {
|
250
|
+
console.log('Cancelado!');
|
251
|
+
}
|
230
252
|
});
|
231
253
|
});
|
232
254
|
}
|
255
|
+
|
233
256
|
export { FlickerAlerts, FlickerModals };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "flicker-alerts",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.82",
|
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.
|
21
|
+
"flicker-alerts": "^1.0.82"
|
22
22
|
}
|
23
23
|
}
|
package/logo.png
DELETED
Binary file
|