@avoraui/av-notifications 0.0.2 → 0.0.4

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 (35) hide show
  1. package/README.md +63 -7
  2. package/ng-package.json +7 -0
  3. package/package.json +19 -43
  4. package/src/lib/av-notifications.module.ts +17 -0
  5. package/src/lib/av-notifications.spec.ts +23 -0
  6. package/src/lib/components/av-failed-notification/av-failed-notification.css +180 -0
  7. package/src/lib/components/av-failed-notification/av-failed-notification.html +16 -0
  8. package/src/lib/components/av-failed-notification/av-failed-notification.spec.ts +23 -0
  9. package/src/lib/components/av-failed-notification/av-failed-notification.ts +315 -0
  10. package/src/lib/components/av-info-notification/av-info-notification.css +166 -0
  11. package/src/lib/components/av-info-notification/av-info-notification.html +16 -0
  12. package/src/lib/components/av-info-notification/av-info-notification.spec.ts +27 -0
  13. package/src/lib/components/av-info-notification/av-info-notification.ts +189 -0
  14. package/src/lib/components/av-success-notification/av-success-notification.css +166 -0
  15. package/src/lib/components/av-success-notification/av-success-notification.html +16 -0
  16. package/src/lib/components/av-success-notification/av-success-notification.spec.ts +23 -0
  17. package/src/lib/components/av-success-notification/av-success-notification.ts +314 -0
  18. package/src/lib/components/av-warning-notification/av-warning-notification.css +166 -0
  19. package/src/lib/components/av-warning-notification/av-warning-notification.html +16 -0
  20. package/src/lib/components/av-warning-notification/av-warning-notification.spec.ts +23 -0
  21. package/src/lib/components/av-warning-notification/av-warning-notification.ts +306 -0
  22. package/src/lib/models/notification-config.interface.ts +32 -0
  23. package/src/lib/services/av-notification.service.ts +148 -0
  24. package/src/lib/services/av-notification.spec.ts +16 -0
  25. package/src/public-api.ts +6 -0
  26. package/tsconfig.lib.json +18 -0
  27. package/tsconfig.lib.prod.json +11 -0
  28. package/tsconfig.spec.json +14 -0
  29. package/av-notifications-0.0.1.tgz +0 -0
  30. package/avoraui-av-notifications-0.0.2.tgz +0 -0
  31. package/fesm2022/av-notifications.mjs +0 -690
  32. package/fesm2022/av-notifications.mjs.map +0 -1
  33. package/fesm2022/avoraui-av-notifications.mjs +0 -690
  34. package/fesm2022/avoraui-av-notifications.mjs.map +0 -1
  35. package/index.d.ts +0 -44
package/README.md CHANGED
@@ -4,8 +4,8 @@ A flexible and customizable Angular notification service that provides toast-sty
4
4
 
5
5
  ## Features
6
6
 
7
- - ✅ **Multiple Notification Types**: Success, Error, and Warning notifications
8
- - ✅ **Flexible Positioning**: 8 different position options (top, bottom, corners, sides)
7
+ - ✅ **Multiple Notification Types**: Success, Error, Info and Warning notifications
8
+ - ✅ **Flexible Positioning**: 9 different position options (top, bottom, corners, sides)
9
9
  - ✅ **Theme Support**: Light, dark, and auto themes
10
10
  - ✅ **Auto-close Functionality**: Configurable duration with optional manual close
11
11
  - ✅ **Animation Effects**: Smooth entrance and exit animations
@@ -40,7 +40,7 @@ import { MatCard } from "@angular/material/card";
40
40
  ### Basic Usage
41
41
 
42
42
  ```typescript
43
- import { AvNotificationService } from 'your-library/notification';
43
+ import { AvNotificationService } from '@avoraui/av-notifications';
44
44
 
45
45
  export class MyComponent {
46
46
  constructor(private notificationService: AvNotificationService) {}
@@ -54,6 +54,9 @@ export class MyComponent {
54
54
 
55
55
  // Warning notification
56
56
  this.notificationService.showWarning('Please check your input!');
57
+
58
+ // Info notification
59
+ this.notificationService.showInfo('Here is some information');
57
60
  }
58
61
  }
59
62
  ```
@@ -92,6 +95,16 @@ export class AdvancedNotificationComponent {
92
95
  theme: 'auto',
93
96
  animationDuration: 300
94
97
  });
98
+
99
+ // Info with custom configuration
100
+ this.notificationService.showInfo('Here is some information', {
101
+ position: 'top-left',
102
+ duration: 4000,
103
+ theme: 'dark',
104
+ showCloseButton: true,
105
+ autoClose: true,
106
+ animationDuration: 500
107
+ });
95
108
  }
96
109
  }
97
110
  ```
@@ -122,13 +135,14 @@ type NotificationPosition =
122
135
  | 'top-left' // Top left corner
123
136
  | 'top-right' // Top right corner
124
137
  | 'bottom-left' // Bottom left corner
125
- | 'bottom-right'; // Bottom right corner
138
+ | 'bottom-right' // Bottom right corner
139
+ | 'center'; // Center
126
140
  ```
127
141
 
128
142
  ### Notification Types
129
143
 
130
144
  ```typescript
131
- type NotificationType = 'success' | 'error' | 'warning';
145
+ type NotificationType = 'success' | 'error' | 'warning' | 'info';
132
146
  ```
133
147
 
134
148
  ### Theme Options
@@ -150,6 +164,9 @@ showFailure(message: string, options?: Partial<NotificationConfig>): MatDialogRe
150
164
 
151
165
  // Show warning notification
152
166
  showWarning(message: string, options?: Partial<NotificationConfig>): MatDialogRef<any>
167
+
168
+ // Show info notification
169
+ showInfo(message: string, options?: Partial<NotificationConfig>): MatDialogRef<any>
153
170
  ```
154
171
 
155
172
  ### Management Methods
@@ -215,6 +232,18 @@ export class EcommerceService {
215
232
  animationDuration: 500
216
233
  });
217
234
  }
235
+
236
+ // Info notification
237
+ showInfoNotification() {
238
+ this.notificationService.showInfo('Here is some information', {
239
+ position: 'top-left',
240
+ duration: 4000,
241
+ theme: 'dark',
242
+ showCloseButton: true,
243
+ autoClose: true,
244
+ animationDuration: 500
245
+ });
246
+ }
218
247
  }
219
248
  ```
220
249
 
@@ -250,6 +279,16 @@ export class UserFormComponent {
250
279
  theme: 'auto'
251
280
  });
252
281
  }
282
+
283
+ // Info notification
284
+ this.notificationService.showInfo('Here is some information', {
285
+ position: 'top-left',
286
+ duration: 4000,
287
+ theme: 'dark',
288
+ showCloseButton: true,
289
+ autoClose: true,
290
+ animationDuration: 500
291
+ });
253
292
  }
254
293
  }
255
294
  ```
@@ -336,6 +375,15 @@ export class SystemNotificationService {
336
375
  theme: 'light'
337
376
  });
338
377
  }
378
+
379
+ // Info notification
380
+ showInfoNotification() {
381
+ this.notificationService.showInfo('Here is some information', {
382
+ position: 'top-left',
383
+ duration: 4000,
384
+ theme: 'dark'
385
+ });
386
+ }
339
387
  }
340
388
  ```
341
389
 
@@ -366,6 +414,12 @@ export class NotificationManagerComponent {
366
414
  position: 'top-right',
367
415
  duration: 8000
368
416
  });
417
+
418
+ // Info notification
419
+ this.notificationService.showInfo('Here is some information', {
420
+ position: 'top-left',
421
+ duration: 4000,
422
+ });
369
423
  }
370
424
 
371
425
  clearSpecificNotifications() {
@@ -445,14 +499,17 @@ export class NotificationManagerComponent {
445
499
  this.notificationService.showSuccess('Data saved successfully');
446
500
  this.notificationService.showFailure('Validation error occurred');
447
501
  this.notificationService.showWarning('Session expiring soon');
502
+ this.notificationService.showInfo('Here is some information');
448
503
 
449
504
  // ✅ Configure duration based on content importance
450
505
  this.notificationService.showSuccess('Quick action completed', { duration: 3000 });
451
506
  this.notificationService.showFailure('Critical error', { autoClose: false });
507
+ this.notificationService.showInfo('Here is some information', { duration: 4000 });
452
508
 
453
509
  // ✅ Use consistent positioning
454
510
  this.notificationService.showSuccess('Success', { position: 'top-right' });
455
511
  this.notificationService.showFailure('Error', { position: 'top-right' });
512
+ this.notificationService.showInfo('Here is some information', { position: 'top-left' });
456
513
  ```
457
514
 
458
515
  ### Don'ts
@@ -492,8 +549,7 @@ This project is licensed under the MIT License - see the LICENSE file for detail
492
549
 
493
550
  ## Changelog
494
551
 
495
- ### v0.0.1
496
- - Initial release
552
+ ### v0.0.4
497
553
  - Success, error, and warning notification types
498
554
  - 8 positioning options
499
555
  - Theme support (light, dark, auto)
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/av-notifications",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,43 +1,19 @@
1
- {
2
- "name": "@avoraui/av-notifications",
3
- "version": "0.0.2",
4
- "description": "A flexible Angular notification service with toast-style alerts, multiple positioning options, and theme support. Built with Angular Material for modern web applications.",
5
- "keywords": [
6
- "angular",
7
- "notification",
8
- "toast",
9
- "alert",
10
- "ui-component",
11
- "typescript",
12
- "notification-service",
13
- "popup",
14
- "message",
15
- "avora-ui",
16
- "snackbar",
17
- "dialog"
18
- ],
19
- "author": "Dileesha Ekanayake",
20
- "license": "MIT",
21
- "peerDependencies": {
22
- "@angular/common": "^20.1.0",
23
- "@angular/core": "^20.1.0"
24
- },
25
- "dependencies": {
26
- "tslib": "^2.3.0"
27
- },
28
- "sideEffects": false,
29
- "publishConfig": {
30
- "access": "public"
31
- },
32
- "module": "fesm2022/avoraui-av-notifications.mjs",
33
- "typings": "index.d.ts",
34
- "exports": {
35
- "./package.json": {
36
- "default": "./package.json"
37
- },
38
- ".": {
39
- "types": "./index.d.ts",
40
- "default": "./fesm2022/avoraui-av-notifications.mjs"
41
- }
42
- }
43
- }
1
+ {
2
+ "name": "@avoraui/av-notifications",
3
+ "version": "0.0.4",
4
+ "description": "A flexible Angular notification service with toast-style alerts, multiple positioning options, and theme support. Built with Angular Material for modern web applications.",
5
+ "keywords": ["angular", "notification", "toast", "alert", "ui-component", "typescript", "notification-service", "popup", "message", "avora-ui", "snackbar", "dialog"],
6
+ "author": "Dileesha Ekanayake",
7
+ "license": "MIT",
8
+ "peerDependencies": {
9
+ "@angular/common": "^20.1.0",
10
+ "@angular/core": "^20.1.0"
11
+ },
12
+ "dependencies": {
13
+ "tslib": "^2.3.0"
14
+ },
15
+ "sideEffects": false,
16
+ "publishConfig": {
17
+ "access": "public"
18
+ }
19
+ }
@@ -0,0 +1,17 @@
1
+ import {NgModule} from '@angular/core';
2
+ import {CommonModule} from '@angular/common';
3
+ import {AvNotificationService} from './services/av-notification.service';
4
+
5
+
6
+ @NgModule({
7
+ imports: [
8
+ CommonModule,
9
+ ],
10
+ providers: [
11
+ AvNotificationService
12
+ ],
13
+ })
14
+
15
+ export class AvNotificationsModule {
16
+
17
+ }
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { AvNotificationsModule } from './av-notifications.module';
4
+
5
+ describe('AvNotificationsModule', () => {
6
+ let component: AvNotificationsModule;
7
+ let fixture: ComponentFixture<AvNotificationsModule>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [AvNotificationsModule]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(AvNotificationsModule);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,180 @@
1
+ :host {
2
+ display: block !important;
3
+ }
4
+
5
+ .notification-box {
6
+ display: flex;
7
+ flex-direction: row;
8
+ justify-content: space-between;
9
+ align-items: center;
10
+ min-height: 3rem;
11
+ min-width: 300px;
12
+ max-width: 500px;
13
+ border-radius: 15px;
14
+ padding: 16px 20px;
15
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
16
+ backdrop-filter: blur(10px);
17
+ position: relative;
18
+ overflow: hidden;
19
+ transition: all 0.3s ease;
20
+ }
21
+
22
+ .notification-content {
23
+ display: flex;
24
+ align-items: center;
25
+ gap: 12px;
26
+ flex: 1;
27
+ }
28
+
29
+ .notification-icon {
30
+ font-size: 20px !important;
31
+ width: 20px !important;
32
+ height: 20px !important;
33
+ flex-shrink: 0;
34
+ }
35
+
36
+ .message {
37
+ font-size: 14px;
38
+ font-weight: 500;
39
+ line-height: 1.4;
40
+ word-break: break-word;
41
+ }
42
+
43
+ .close-button {
44
+ flex-shrink: 0;
45
+ width: 32px !important;
46
+ height: 32px !important;
47
+ margin-left: 8px;
48
+ opacity: 0.7;
49
+ transition: all 0.2s ease;
50
+ border-radius: 50%;
51
+ }
52
+
53
+ .close-button:hover {
54
+ opacity: 1;
55
+ }
56
+
57
+ .close-button mat-icon {
58
+ display: flex;
59
+ align-items: center;
60
+ justify-content: center;
61
+ font-size: 18px !important;
62
+ width: 18px !important;
63
+ height: 18px !important;
64
+ }
65
+
66
+ /* Position-specific styles */
67
+ .position-top,
68
+ .position-top-left,
69
+ .position-top-right {
70
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
71
+ }
72
+
73
+ .position-bottom,
74
+ .position-bottom-left,
75
+ .position-bottom-right {
76
+ box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.15);
77
+ }
78
+
79
+ .position-left {
80
+ box-shadow: 10px 0 25px rgba(0, 0, 0, 0.15);
81
+ }
82
+
83
+ .position-right {
84
+ box-shadow: -10px 0 25px rgba(0, 0, 0, 0.15);
85
+ }
86
+
87
+ /* ==================== LIGHT THEME ==================== */
88
+ .failed-box.theme-light {
89
+ background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
90
+ color: #dc2626;
91
+ border: 1px solid rgba(220, 38, 38, 0.3);
92
+ }
93
+
94
+ .failed-box.theme-light .close-button {
95
+ background-color: rgba(220, 38, 38, 0.15);
96
+ color: #dc2626;
97
+ }
98
+
99
+ .failed-box.theme-light .close-button:hover {
100
+ background-color: rgba(220, 38, 38, 0.25);
101
+ color: #b91c1c;
102
+ }
103
+
104
+ .failed-box.theme-light .notification-icon {
105
+ color: #dc2626;
106
+ }
107
+
108
+ /* ==================== DARK THEME ==================== */
109
+ .failed-box.theme-dark {
110
+ background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%);
111
+ color: #fca5a5;
112
+ border: 1px solid rgba(252, 165, 165, 0.3);
113
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
114
+ }
115
+
116
+ .failed-box.theme-dark .close-button {
117
+ background-color: rgba(252, 165, 165, 0.15);
118
+ color: #fca5a5;
119
+ }
120
+
121
+ .failed-box.theme-dark .close-button:hover {
122
+ background-color: rgba(252, 165, 165, 0.25);
123
+ color: #fbbf24;
124
+ }
125
+
126
+ .failed-box.theme-dark .notification-icon {
127
+ color: #fca5a5;
128
+ }
129
+
130
+ .failed-box.theme-dark .message {
131
+ color: #fca5a5;
132
+ }
133
+
134
+ /* ==================== RESPONSIVE DESIGN ==================== */
135
+ @media (max-width: 768px) {
136
+ .notification-box {
137
+ min-width: 280px;
138
+ max-width: calc(100vw - 40px);
139
+ margin: 0 20px;
140
+ }
141
+
142
+ .message {
143
+ font-size: 13px;
144
+ }
145
+ }
146
+
147
+ /* ==================== DIALOG OVERLAY CUSTOMIZATION ==================== */
148
+ >>> .notification-dialog .mat-mdc-dialog-container {
149
+ background: transparent !important;
150
+ box-shadow: none !important;
151
+ padding: 0 !important;
152
+ }
153
+
154
+ >>> .notification-dialog .mat-mdc-dialog-surface {
155
+ background: transparent !important;
156
+ box-shadow: none !important;
157
+ padding: 0 !important;
158
+ }
159
+
160
+ >>> .mdc-dialog--open .mat-mdc-dialog-surface {
161
+ border-radius: 15px !important;
162
+ }
163
+
164
+ >>> .mdc-dialog--closing .mat-mdc-dialog-surface {
165
+ border-radius: 15px !important;
166
+ }
167
+
168
+ /* ==================== THEME TRANSITION ANIMATIONS ==================== */
169
+ .notification-box {
170
+ transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
171
+ }
172
+
173
+ .close-button {
174
+ transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
175
+ }
176
+
177
+ .notification-icon,
178
+ .message {
179
+ transition: color 0.3s ease;
180
+ }
@@ -0,0 +1,16 @@
1
+ <div mat-dialog-content
2
+ class="notification-box failed-box"
3
+ [class]="getNotificationClasses()"
4
+ [@notificationAnimation]>
5
+
6
+ <div class="notification-content">
7
+ <mat-icon class="notification-icon">error</mat-icon>
8
+ <span class="message">{{ config.message }}</span>
9
+ </div>
10
+
11
+ @if (config.showCloseButton) {
12
+ <button mat-icon-button class="close-button" (click)="close()">
13
+ <mat-icon>close</mat-icon>
14
+ </button>
15
+ }
16
+ </div>
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { AvFailedNotification } from './av-failed-notification';
4
+
5
+ describe('AvFailedNotification', () => {
6
+ let component: AvFailedNotification;
7
+ let fixture: ComponentFixture<AvFailedNotification>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [AvFailedNotification]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(AvFailedNotification);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });