toastify-pro 1.2.0 → 1.3.0
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/README.md +341 -40
- package/dist/toastify-pro.esm.js +404 -4
- package/dist/toastify-pro.esm.js.map +1 -1
- package/dist/toastify-pro.umd.js +404 -4
- package/dist/toastify-pro.umd.js.map +1 -1
- package/dist/toastify-pro.umd.min.js +5 -2
- package/dist/toastify-pro.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/src/toastify-pro.js +404 -4
package/README.md
CHANGED
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
|
|
19
19
|
- 🚀 **Lightweight** - Minimal bundle size with zero dependencies
|
|
20
20
|
- 🎨 **6 Built-in Themes** - Success, Error, Info, Warning, Dark, and Light themes
|
|
21
|
-
-
|
|
22
|
-
-
|
|
21
|
+
- 🎯 **Interactive Confirmation Dialogs** - Perfect replacement for SweetAlert with dark/light themes only
|
|
22
|
+
- 📱 **7 Flexible Positions** - Including new center position ideal for confirmations
|
|
23
|
+
- ⚡ **Apple-Style Animations** - Smooth AirDrop-inspired entrance and car-swipe exit effects
|
|
23
24
|
- 🔧 **Framework Agnostic** - Works with React, Vue, Angular, or vanilla JS
|
|
24
25
|
- 🎯 **Auto-dismiss** - Configurable timeout with manual close option
|
|
25
26
|
- 📝 **Description Support** - Optional secondary text for detailed messages
|
|
26
27
|
- 🌈 **Easy Customization** - Simple API with sensible defaults
|
|
27
|
-
- ♿ **Accessible** - Clean HTML structure with proper
|
|
28
|
+
- ♿ **Accessible** - Clean HTML structure with proper ARIA support
|
|
28
29
|
- 🎨 **Custom SVG Icons** - Beautiful vector icons for each toast type
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
- 📊 **Progress Bar Animation** - Visual countdown with shimmer effects
|
|
30
|
+
- ✨ **Modern Design** - Glassmorphism effects with backdrop blur
|
|
31
|
+
- � **Perfect Callback Handling** - No double execution, conflict-free patterns
|
|
32
|
+
- ❌ **Close Button** - Interactive close buttons for confirmation dialogs
|
|
33
33
|
|
|
34
34
|
## 🚀 Quick Start
|
|
35
35
|
|
|
@@ -65,6 +65,31 @@ toast.light('Light themed message');
|
|
|
65
65
|
toast.success('Success!', 'Your changes have been saved successfully.');
|
|
66
66
|
toast.error('Error occurred!', 'Please check your network connection and try again.');
|
|
67
67
|
toast.info('New feature!', 'Check out our latest updates in the dashboard.');
|
|
68
|
+
|
|
69
|
+
// 🆕 NEW: Confirmation dialogs
|
|
70
|
+
toast.conf('Delete this item?', (confirmed) => {
|
|
71
|
+
if (confirmed) {
|
|
72
|
+
toast.success('Item deleted successfully!');
|
|
73
|
+
} else {
|
|
74
|
+
toast.info('Delete cancelled');
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Confirmation with description
|
|
79
|
+
toast.conf('Are you sure?', 'This action cannot be undone.', (confirmed) => {
|
|
80
|
+
console.log('User confirmed:', confirmed);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// Advanced confirmation options
|
|
84
|
+
toast.conf('Save changes?', {
|
|
85
|
+
description: 'Your changes will be permanently saved.',
|
|
86
|
+
confirmText: 'Save',
|
|
87
|
+
cancelText: 'Discard',
|
|
88
|
+
theme: 'light', // 'dark' (default) or 'light'
|
|
89
|
+
position: 'center', // Default for confirmations
|
|
90
|
+
onConfirm: () => console.log('Confirmed!'),
|
|
91
|
+
onCancel: () => console.log('Cancelled!')
|
|
92
|
+
});
|
|
68
93
|
```
|
|
69
94
|
|
|
70
95
|
#### With CDN
|
|
@@ -77,6 +102,7 @@ toast.info('New feature!', 'Check out our latest updates in the dashboard.');
|
|
|
77
102
|
</head>
|
|
78
103
|
<body>
|
|
79
104
|
<button onclick="showToast()">Show Toast</button>
|
|
105
|
+
<button onclick="showConfirmation()">Show Confirmation</button>
|
|
80
106
|
|
|
81
107
|
<script>
|
|
82
108
|
const toast = new ToastifyPro();
|
|
@@ -95,6 +121,29 @@ toast.info('New feature!', 'Check out our latest updates in the dashboard.');
|
|
|
95
121
|
allowClose: true
|
|
96
122
|
});
|
|
97
123
|
}
|
|
124
|
+
|
|
125
|
+
// 🆕 NEW: Confirmation dialogs
|
|
126
|
+
function showConfirmation() {
|
|
127
|
+
toast.conf('Delete this item?', 'This action cannot be undone.', (confirmed) => {
|
|
128
|
+
if (confirmed) {
|
|
129
|
+
toast.success('Item deleted!');
|
|
130
|
+
} else {
|
|
131
|
+
toast.info('Delete cancelled');
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function showAdvancedConfirmation() {
|
|
137
|
+
toast.conf('Save document?', {
|
|
138
|
+
description: 'All your changes will be saved permanently.',
|
|
139
|
+
confirmText: 'Save Now',
|
|
140
|
+
cancelText: 'Cancel',
|
|
141
|
+
theme: 'light',
|
|
142
|
+
position: 'center'
|
|
143
|
+
}, (confirmed) => {
|
|
144
|
+
console.log('User decision:', confirmed);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
98
147
|
</script>
|
|
99
148
|
</body>
|
|
100
149
|
</html>
|
|
@@ -120,6 +169,7 @@ const toast = new ToastifyPro({
|
|
|
120
169
|
- `bottom-left` - Bottom left corner
|
|
121
170
|
- `bottom-right` - Bottom right corner
|
|
122
171
|
- `bottom-center` - Bottom center (default)
|
|
172
|
+
- `center` - Perfect center of screen (ideal for confirmations)
|
|
123
173
|
|
|
124
174
|
### Methods
|
|
125
175
|
|
|
@@ -185,6 +235,78 @@ toast.light('Settings updated', { timeout: 2000 });
|
|
|
185
235
|
toast.light('Light Mode', 'Switched to clean light theme.'); // With description
|
|
186
236
|
```
|
|
187
237
|
|
|
238
|
+
#### 🆕 `toast.conf(message, descriptionOrCallback, callback)`
|
|
239
|
+
Display an interactive confirmation dialog with confirm/cancel buttons.
|
|
240
|
+
|
|
241
|
+
**Features:**
|
|
242
|
+
- 🎯 **Center positioning** (default) for maximum attention
|
|
243
|
+
- ✖️ **Close button** in top-right corner (acts as cancel)
|
|
244
|
+
- 🎨 **Simple theming** - Dark (default) or Light themes only
|
|
245
|
+
- 📱 **Responsive** design for mobile devices
|
|
246
|
+
- ⚡ **No auto-dismiss** - requires user interaction
|
|
247
|
+
|
|
248
|
+
**Theme Options:**
|
|
249
|
+
- `theme: 'dark'` (default) - Dark theme with elegant styling
|
|
250
|
+
- `theme: 'light'` or `theme: 'white'` - Clean light theme with dark text
|
|
251
|
+
|
|
252
|
+
```javascript
|
|
253
|
+
// Simple confirmation with callback
|
|
254
|
+
toast.conf('Delete this item?', (confirmed) => {
|
|
255
|
+
if (confirmed) {
|
|
256
|
+
console.log('User confirmed');
|
|
257
|
+
} else {
|
|
258
|
+
console.log('User cancelled');
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
// Confirmation with description
|
|
263
|
+
toast.conf('Are you sure?', 'This action cannot be undone.', (confirmed) => {
|
|
264
|
+
handleUserChoice(confirmed);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
// Advanced confirmation with full options
|
|
268
|
+
toast.conf('Save changes?', {
|
|
269
|
+
description: 'Your changes will be permanently saved to the server.',
|
|
270
|
+
confirmText: 'Save Now', // Custom confirm button text
|
|
271
|
+
cancelText: 'Discard', // Custom cancel button text
|
|
272
|
+
theme: 'light', // Theme: 'dark' (default) or 'light'
|
|
273
|
+
position: 'center', // Position (defaults to 'center' for confirmations)
|
|
274
|
+
onConfirm: () => saveData(), // Alternative callback approach
|
|
275
|
+
onCancel: () => discardChanges()
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// Real-world example: Delete confirmation
|
|
279
|
+
function deleteItem(itemId) {
|
|
280
|
+
toast.conf('Delete item?',
|
|
281
|
+
'This will permanently remove the item from your account.',
|
|
282
|
+
(confirmed) => {
|
|
283
|
+
if (confirmed) {
|
|
284
|
+
// Perform deletion
|
|
285
|
+
deleteFromServer(itemId);
|
|
286
|
+
toast.success('Item deleted successfully!');
|
|
287
|
+
} else {
|
|
288
|
+
toast.info('Delete cancelled');
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Form save confirmation
|
|
295
|
+
function handleFormSubmit() {
|
|
296
|
+
toast.conf('Save changes?', {
|
|
297
|
+
description: 'Your form data will be submitted and cannot be edited later.',
|
|
298
|
+
confirmText: 'Submit',
|
|
299
|
+
cancelText: 'Keep Editing',
|
|
300
|
+
theme: 'dark', // Default theme, can be 'light'
|
|
301
|
+
position: 'center'
|
|
302
|
+
}, (confirmed) => {
|
|
303
|
+
if (confirmed) {
|
|
304
|
+
submitForm();
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
188
310
|
### 🆕 Enhanced Features
|
|
189
311
|
|
|
190
312
|
#### Custom SVG Icons
|
|
@@ -305,6 +427,34 @@ function App() {
|
|
|
305
427
|
toast?.info('New Feature!', 'Check out our latest React integration updates.');
|
|
306
428
|
};
|
|
307
429
|
|
|
430
|
+
// 🆕 NEW: Confirmation dialog examples
|
|
431
|
+
const handleDelete = () => {
|
|
432
|
+
toast?.conf('Delete item?', 'This action cannot be undone.', (confirmed) => {
|
|
433
|
+
if (confirmed) {
|
|
434
|
+
// Perform deletion logic
|
|
435
|
+
console.log('Deleting item...');
|
|
436
|
+
toast?.success('Item deleted successfully!');
|
|
437
|
+
} else {
|
|
438
|
+
toast?.info('Delete cancelled');
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
const handleLogout = () => {
|
|
444
|
+
toast?.conf('Sign out?', {
|
|
445
|
+
description: 'You will need to sign in again to access your account.',
|
|
446
|
+
confirmText: 'Sign Out',
|
|
447
|
+
cancelText: 'Stay Signed In',
|
|
448
|
+
theme: 'dark',
|
|
449
|
+
position: 'center'
|
|
450
|
+
}, (confirmed) => {
|
|
451
|
+
if (confirmed) {
|
|
452
|
+
// Logout logic
|
|
453
|
+
window.location.href = '/login';
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
};
|
|
457
|
+
|
|
308
458
|
const handleIconDemo = () => {
|
|
309
459
|
// Showcase different icons with descriptions
|
|
310
460
|
toast?.success('✓ Success Icon', 'Beautiful checkmark with green theme');
|
|
@@ -319,6 +469,8 @@ function App() {
|
|
|
319
469
|
<button onClick={handleError}>Show Error</button>
|
|
320
470
|
<button onClick={handleWithDescription}>Show with Description</button>
|
|
321
471
|
<button onClick={handleIconDemo}>Demo All Icons</button>
|
|
472
|
+
<button onClick={handleDelete}>Delete with Confirmation</button>
|
|
473
|
+
<button onClick={handleLogout}>Logout Confirmation</button>
|
|
322
474
|
</div>
|
|
323
475
|
);
|
|
324
476
|
}
|
|
@@ -333,6 +485,8 @@ export default App;
|
|
|
333
485
|
<button @click="showSuccess">Show Success</button>
|
|
334
486
|
<button @click="showError">Show Error</button>
|
|
335
487
|
<button @click="showCustom">Show Custom</button>
|
|
488
|
+
<button @click="showConfirmation">Show Confirmation</button>
|
|
489
|
+
<button @click="showDeleteConfirmation">Delete Item</button>
|
|
336
490
|
</div>
|
|
337
491
|
</template>
|
|
338
492
|
|
|
@@ -364,6 +518,38 @@ export default {
|
|
|
364
518
|
timeout: 6000,
|
|
365
519
|
allowClose: true
|
|
366
520
|
});
|
|
521
|
+
},
|
|
522
|
+
// 🆕 NEW: Confirmation methods
|
|
523
|
+
showConfirmation() {
|
|
524
|
+
this.toast.conf('Save changes?', (confirmed) => {
|
|
525
|
+
if (confirmed) {
|
|
526
|
+
this.saveData();
|
|
527
|
+
} else {
|
|
528
|
+
this.toast.info('Changes not saved');
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
},
|
|
532
|
+
showDeleteConfirmation() {
|
|
533
|
+
this.toast.conf('Delete this item?', {
|
|
534
|
+
description: 'This action cannot be undone and will remove all associated data.',
|
|
535
|
+
confirmText: 'Delete',
|
|
536
|
+
cancelText: 'Keep',
|
|
537
|
+
theme: 'dark',
|
|
538
|
+
position: 'center'
|
|
539
|
+
}, (confirmed) => {
|
|
540
|
+
if (confirmed) {
|
|
541
|
+
this.deleteItem();
|
|
542
|
+
this.toast.success('Item deleted successfully!');
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
},
|
|
546
|
+
saveData() {
|
|
547
|
+
// Save logic here
|
|
548
|
+
this.toast.success('Data saved successfully!');
|
|
549
|
+
},
|
|
550
|
+
deleteItem() {
|
|
551
|
+
// Delete logic here
|
|
552
|
+
console.log('Item deleted');
|
|
367
553
|
}
|
|
368
554
|
}
|
|
369
555
|
};
|
|
@@ -381,6 +567,8 @@ import ToastifyPro from 'toastify-pro';
|
|
|
381
567
|
<button (click)="showSuccess()">Show Success</button>
|
|
382
568
|
<button (click)="showError()">Show Error</button>
|
|
383
569
|
<button (click)="showInfo()">Show Info</button>
|
|
570
|
+
<button (click)="showConfirmation()">Show Confirmation</button>
|
|
571
|
+
<button (click)="showLogoutConfirmation()">Logout</button>
|
|
384
572
|
`
|
|
385
573
|
})
|
|
386
574
|
export class ToastExampleComponent implements OnInit {
|
|
@@ -407,6 +595,41 @@ export class ToastExampleComponent implements OnInit {
|
|
|
407
595
|
timeout: 5000
|
|
408
596
|
});
|
|
409
597
|
}
|
|
598
|
+
|
|
599
|
+
// 🆕 NEW: Confirmation methods
|
|
600
|
+
showConfirmation() {
|
|
601
|
+
this.toast.conf('Save document?', 'All changes will be saved permanently.', (confirmed: boolean) => {
|
|
602
|
+
if (confirmed) {
|
|
603
|
+
this.saveDocument();
|
|
604
|
+
} else {
|
|
605
|
+
this.toast.info('Save cancelled');
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
showLogoutConfirmation() {
|
|
611
|
+
this.toast.conf('Sign out?', {
|
|
612
|
+
description: 'You will be logged out of your account.',
|
|
613
|
+
confirmText: 'Sign Out',
|
|
614
|
+
cancelText: 'Cancel',
|
|
615
|
+
theme: 'light',
|
|
616
|
+
position: 'center'
|
|
617
|
+
}, (confirmed: boolean) => {
|
|
618
|
+
if (confirmed) {
|
|
619
|
+
this.logout();
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
private saveDocument() {
|
|
625
|
+
// Save logic
|
|
626
|
+
this.toast.success('Document saved successfully!');
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
private logout() {
|
|
630
|
+
// Logout logic
|
|
631
|
+
this.toast.success('Logged out successfully!');
|
|
632
|
+
}
|
|
410
633
|
}
|
|
411
634
|
```
|
|
412
635
|
|
|
@@ -419,30 +642,71 @@ const toast = new ToastifyPro({
|
|
|
419
642
|
allowClose: true
|
|
420
643
|
});
|
|
421
644
|
|
|
422
|
-
// Form submission example
|
|
645
|
+
// Form submission example with confirmation
|
|
423
646
|
document.getElementById('submitForm').addEventListener('click', async function() {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
647
|
+
toast.conf('Submit form?', 'Your data will be sent to the server.', async (confirmed) => {
|
|
648
|
+
if (confirmed) {
|
|
649
|
+
try {
|
|
650
|
+
// Simulate API call
|
|
651
|
+
const response = await fetch('/api/submit', { method: 'POST' });
|
|
652
|
+
|
|
653
|
+
if (response.ok) {
|
|
654
|
+
toast.success('Form submitted successfully!', 'Your data has been processed and saved.');
|
|
655
|
+
} else {
|
|
656
|
+
toast.error('Failed to submit form', 'Please check your inputs and try again.');
|
|
657
|
+
}
|
|
658
|
+
} catch (error) {
|
|
659
|
+
toast.error('Network error occurred', 'Check your connection and retry.');
|
|
660
|
+
}
|
|
432
661
|
}
|
|
433
|
-
}
|
|
434
|
-
toast.error('Network error occurred', 'Check your connection and retry.');
|
|
435
|
-
}
|
|
662
|
+
});
|
|
436
663
|
});
|
|
437
664
|
|
|
438
|
-
//
|
|
665
|
+
// Delete confirmation example
|
|
666
|
+
function deleteItem(itemId) {
|
|
667
|
+
toast.conf('Delete this item?', {
|
|
668
|
+
description: 'This action cannot be undone and will permanently remove all associated data.',
|
|
669
|
+
confirmText: 'Delete',
|
|
670
|
+
cancelText: 'Keep',
|
|
671
|
+
theme: 'dark',
|
|
672
|
+
position: 'center'
|
|
673
|
+
}, (confirmed) => {
|
|
674
|
+
if (confirmed) {
|
|
675
|
+
// Perform deletion
|
|
676
|
+
console.log('Deleting item:', itemId);
|
|
677
|
+
toast.success('Item deleted!', 'The item has been permanently removed.');
|
|
678
|
+
} else {
|
|
679
|
+
toast.info('Delete cancelled', 'Your item is safe.');
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// File upload with confirmation and progress
|
|
439
685
|
function handleFileUpload() {
|
|
440
|
-
toast.
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
686
|
+
toast.conf('Upload file?', 'The file will be uploaded to your account.', (confirmed) => {
|
|
687
|
+
if (confirmed) {
|
|
688
|
+
toast.info('Uploading...', 'Please wait while we process your file.');
|
|
689
|
+
|
|
690
|
+
// Simulate upload completion
|
|
691
|
+
setTimeout(() => {
|
|
692
|
+
toast.success('Upload complete!', 'Your file has been uploaded successfully.');
|
|
693
|
+
}, 3000);
|
|
694
|
+
}
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// Logout confirmation
|
|
699
|
+
function logout() {
|
|
700
|
+
toast.conf('Sign out?', {
|
|
701
|
+
description: 'You will need to sign in again to access your account.',
|
|
702
|
+
confirmText: 'Sign Out',
|
|
703
|
+
cancelText: 'Stay Signed In',
|
|
704
|
+
theme: 'light'
|
|
705
|
+
}, (confirmed) => {
|
|
706
|
+
if (confirmed) {
|
|
707
|
+
window.location.href = '/login';
|
|
708
|
+
}
|
|
709
|
+
});
|
|
446
710
|
}
|
|
447
711
|
|
|
448
712
|
// Multiple toast types with descriptions
|
|
@@ -455,7 +719,7 @@ function showAllTypes() {
|
|
|
455
719
|
setTimeout(() => toast.light('Light Mode', 'Clean light notification'), 2500);
|
|
456
720
|
}
|
|
457
721
|
|
|
458
|
-
// Showcase new enhanced features
|
|
722
|
+
// Showcase new enhanced features including confirmations
|
|
459
723
|
function demoEnhancedFeatures() {
|
|
460
724
|
// SVG Icons demo
|
|
461
725
|
toast.success('✓ Beautiful Icons', 'Each type has its own vector icon that scales perfectly');
|
|
@@ -474,24 +738,61 @@ function demoEnhancedFeatures() {
|
|
|
474
738
|
setTimeout(() => {
|
|
475
739
|
toast.dark('✨ Glassmorphism', 'Modern backdrop blur with translucent design');
|
|
476
740
|
}, 3000);
|
|
741
|
+
|
|
742
|
+
// 🆕 Confirmation dialog demo
|
|
743
|
+
setTimeout(() => {
|
|
744
|
+
toast.conf('Try confirmation?', 'Experience the new interactive dialog feature.', (confirmed) => {
|
|
745
|
+
if (confirmed) {
|
|
746
|
+
toast.success('🎉 Confirmation works!', 'You can now create interactive dialogs easily.');
|
|
747
|
+
} else {
|
|
748
|
+
toast.info('No problem!', 'Confirmation dialogs are optional.');
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
}, 4000);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// Advanced confirmation examples
|
|
755
|
+
function advancedConfirmationExamples() {
|
|
756
|
+
// Settings reset confirmation
|
|
757
|
+
toast.conf('Reset all settings?', {
|
|
758
|
+
description: 'This will restore all settings to their default values.',
|
|
759
|
+
confirmText: 'Reset',
|
|
760
|
+
cancelText: 'Cancel',
|
|
761
|
+
theme: 'dark',
|
|
762
|
+
position: 'center'
|
|
763
|
+
}, (confirmed) => {
|
|
764
|
+
if (confirmed) {
|
|
765
|
+
// Reset settings logic
|
|
766
|
+
toast.success('Settings reset!', 'All settings have been restored to defaults.');
|
|
767
|
+
}
|
|
768
|
+
});
|
|
477
769
|
}
|
|
478
770
|
|
|
479
771
|
// Advanced usage with all new features
|
|
480
772
|
function advancedExample() {
|
|
481
|
-
// Progress indication with
|
|
482
|
-
toast.
|
|
483
|
-
description: '
|
|
484
|
-
|
|
485
|
-
|
|
773
|
+
// Progress indication with confirmation first
|
|
774
|
+
toast.conf('Start processing?', {
|
|
775
|
+
description: 'This will upload your file to the server and may take a few minutes.',
|
|
776
|
+
confirmText: 'Start',
|
|
777
|
+
cancelText: 'Later',
|
|
778
|
+
theme: 'light'
|
|
779
|
+
}, (confirmed) => {
|
|
780
|
+
if (confirmed) {
|
|
781
|
+
toast.info('Processing...', {
|
|
782
|
+
description: 'Please wait while we upload your file to the server',
|
|
783
|
+
timeout: 0, // No auto-dismiss
|
|
784
|
+
allowClose: true
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
// Simulate progress completion
|
|
788
|
+
setTimeout(() => {
|
|
789
|
+
toast.success('Upload Complete!', {
|
|
790
|
+
description: 'Your file has been uploaded successfully with all metadata',
|
|
791
|
+
timeout: 5000
|
|
792
|
+
});
|
|
793
|
+
}, 3000);
|
|
794
|
+
}
|
|
486
795
|
});
|
|
487
|
-
|
|
488
|
-
// Simulate progress completion
|
|
489
|
-
setTimeout(() => {
|
|
490
|
-
toast.success('Upload Complete!', {
|
|
491
|
-
description: 'Your file has been uploaded successfully with all metadata',
|
|
492
|
-
timeout: 5000
|
|
493
|
-
});
|
|
494
|
-
}, 3000);
|
|
495
796
|
}
|
|
496
797
|
```
|
|
497
798
|
|