diff --git a/README.md b/README.md index 58686654..0fb6c4f7 100644 --- a/README.md +++ b/README.md @@ -33,14 +33,14 @@ DEMO: https://ngx-toastr.vercel.app Latest version available for each version of Angular -| ngx-toastr | Angular | -| ---------- | ----------- | -| 11.3.3 | 8.x | -| 12.1.0 | 9.x | -| 13.2.1 | 10.x 11.x | -| 14.3.0 | 12.x 13.x | -| 15.2.2 | 14.x. | -| current | >= 15.x | +| ngx-toastr | Angular | +| ---------- | --------- | +| 11.3.3 | 8.x | +| 12.1.0 | 9.x | +| 13.2.1 | 10.x 11.x | +| 14.3.0 | 12.x 13.x | +| 15.2.2 | 14.x. | +| current | >= 15.x | ## Install @@ -137,25 +137,26 @@ There are **individual options** and **global options**. Passed to `ToastrService.success/error/warning/info/show()` -| Option | Type | Default | Description -| ----------------- | ------------------------------ | ------------------------------ | ------------------------------------------------- | -| toastComponent | Component | Toast | Angular component that will be used | -| closeButton | boolean | false | Show close button | -| timeOut | number | 5000 | Time to live in milliseconds | -| extendedTimeOut | number | 1000 | Time to close after a user hovers over toast | -| disableTimeOut | `boolean \| 'timeOut' \| 'extendedTimeOut'` | false | Disable both timeOut and extendedTimeOut when set to `true`. Allows specifying which timeOut to disable, either: `timeOut` or `extendedTimeOut` | -| easing | string | 'ease-in' | Toast component easing | -| easeTime | string \| number | 300 | Time spent easing | -| enableHtml | boolean | false | Allow html in message | -| newestOnTop | boolean | true | New toast placement | -| progressBar | boolean | false | Show progress bar | -| progressAnimation | `'decreasing' \| 'increasing'` | 'decreasing' | Changes the animation of the progress bar. | -| toastClass | string | 'ngx-toastr' | CSS class(es) for toast | -| positionClass | string | 'toast-top-right' | CSS class(es) for toast container | -| titleClass | string | 'toast-title' | CSS class(es) for inside toast on title | -| messageClass | string | 'toast-message' | CSS class(es) for inside toast on message | -| tapToDismiss | boolean | true | Close on click | -| onActivateTick | boolean | false | Fires `changeDetectorRef.detectChanges()` when activated. Helps show toast from asynchronous events outside of Angular's change detection | +| Option | Type | Default | Description | +| ----------------- | ------------------------------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | +| toastComponent | Component | Toast | Angular component that will be used | +| closeButton | boolean | false | Show close button | +| timeOut | number | 5000 | Time to live in milliseconds | +| extendedTimeOut | number | 1000 | Time to close after a user hovers over toast | +| disableTimeOut | `boolean \| 'timeOut' \| 'extendedTimeOut'` | false | Disable both timeOut and extendedTimeOut when set to `true`. Allows specifying which timeOut to disable, either: `timeOut` or `extendedTimeOut` | +| easing | string | 'ease-in' | Toast component easing | +| easeTime | string \| number | 300 | Time spent easing | +| enableHtml | boolean | false | Allow html in message | +| newestOnTop | boolean | true | New toast placement | +| progressBar | boolean | false | Show progress bar | +| progressAnimation | `'decreasing' \| 'increasing'` | 'decreasing' | Changes the animation of the progress bar. | +| toastClass | string | 'ngx-toastr' | CSS class(es) for toast | +| positionClass | string | 'toast-top-right' | CSS class(es) for toast container | +| titleClass | string | 'toast-title' | CSS class(es) for inside toast on title | +| messageClass | string | 'toast-message' | CSS class(es) for inside toast on message | +| tapToDismiss | boolean | true | Close on click | +| onActivateTick | boolean | false | Fires `changeDetectorRef.detectChanges()` when activated. Helps show toast from asynchronous events outside of Angular's change detection | +| enableSound | boolean | false | Allow sound with notification | #### Setting Individual Options @@ -175,14 +176,14 @@ options to affect all toasts. In addition, global options include the following options: | Option | Type | Default | Description | -| ----------------------- | ------- | ---------------------------------- | ------------------------------------------------------------------ | -| maxOpened | number | 0 | Max toasts opened. Toasts will be queued. 0 is unlimited | -| autoDismiss | boolean | false | Dismiss current toast when max is reached | -| iconClasses | object | [see below](#iconclasses-defaults) | Classes used on toastr service methods | -| preventDuplicates | boolean | false | Block duplicate messages | +| ----------------------- | ------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------- | +| maxOpened | number | 0 | Max toasts opened. Toasts will be queued. 0 is unlimited | +| autoDismiss | boolean | false | Dismiss current toast when max is reached | +| iconClasses | object | [see below](#iconclasses-defaults) | Classes used on toastr service methods | +| preventDuplicates | boolean | false | Block duplicate messages | | countDuplicates | boolean | false | Displays a duplicates counter (preventDuplicates must be true). Toast must have a title and duplicate message | -| resetTimeoutOnDuplicate | boolean | false | Reset toast timeout on duplicate (preventDuplicates must be true) | -| includeTitleDuplicates | boolean | false | Include the title of a toast when checking for duplicates (by default only message is compared) | +| resetTimeoutOnDuplicate | boolean | false | Reset toast timeout on duplicate (preventDuplicates must be true) | +| includeTitleDuplicates | boolean | false | Include the title of a toast when checking for duplicates (by default only message is compared) | ##### iconClasses defaults @@ -391,6 +392,7 @@ ngOnInit() { 4. How can I translate messages?\ See: https://github.com/scttcper/ngx-toastr/issues/201. 5. How to handle toastr click/tap action? + ```ts showToaster() { this.toastr.success('Hello world!', 'Toastr fun!') @@ -403,10 +405,11 @@ ngOnInit() { console.log('Toastr clicked'); } ``` -6. How to customize styling without overridding defaults?\ + +6. How to customize styling without overridding defaults?\ Add multiple CSS classes separated by a space: ```ts - toastClass: 'yourclass ngx-toastr' + toastClass: 'yourclass ngx-toastr'; ``` See: https://github.com/scttcper/ngx-toastr/issues/594. diff --git a/package-lock.json b/package-lock.json index dc17bacc..f590e313 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,6 +26,7 @@ "@angular/platform-browser-dynamic": "15.0.4", "@angular/router": "15.0.4", "@ctrl/ngx-github-buttons": "8.0.0", + "@types/howler": "^2.2.7", "@types/jasmine": "4.3.1", "@types/lodash-es": "4.17.6", "@types/node": "18.11.18", @@ -34,6 +35,7 @@ "bootstrap": "5.2.3", "cpy-cli": "4.2.0", "eslint": "8.31.0", + "howler": "^2.2.3", "jasmine-core": "4.5.0", "jasmine-spec-reporter": "7.0.0", "karma": "6.4.1", @@ -3495,6 +3497,12 @@ "@types/range-parser": "*" } }, + "node_modules/@types/howler": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/@types/howler/-/howler-2.2.7.tgz", + "integrity": "sha512-PEZldwZqJJw1PWRTpupyC7ajVTZA8aHd8nB/Y0n6zRZi5u8ktYDntsHj13ltEiBRqWwF06pASxBEvCTxniG8eA==", + "dev": true + }, "node_modules/@types/http-proxy": { "version": "1.17.9", "resolved": "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.9.tgz", @@ -7975,6 +7983,12 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, + "node_modules/howler": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/howler/-/howler-2.2.3.tgz", + "integrity": "sha512-QM0FFkw0LRX1PR8pNzJVAY25JhIWvbKMBFM4gqk+QdV+kPXOhleWGCB6AiAF/goGjIHK2e/nIElplvjQwhr0jg==", + "dev": true + }, "node_modules/hpack.js": { "version": "2.1.6", "resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz", diff --git a/package.json b/package.json index 075c42e6..43fbc3c0 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "@angular/platform-browser-dynamic": "15.0.4", "@angular/router": "15.0.4", "@ctrl/ngx-github-buttons": "8.0.0", + "@types/howler": "^2.2.7", "@types/jasmine": "4.3.1", "@types/lodash-es": "4.17.6", "@types/node": "18.11.18", @@ -44,6 +45,7 @@ "bootstrap": "5.2.3", "cpy-cli": "4.2.0", "eslint": "8.31.0", + "howler": "^2.2.3", "jasmine-core": "4.5.0", "jasmine-spec-reporter": "7.0.0", "karma": "6.4.1", diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index e9e20903..7add17f4 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -123,6 +123,15 @@ /> +
+ + +