@ng-bootstrap/ng-bootstrap
Version:
Angular powered Bootstrap
1 lines • 7.71 kB
Source Map (JSON)
{"version":3,"file":"ng-bootstrap-ng-bootstrap-alert.mjs","sources":["../../../src/alert/alert-config.ts","../../../src/alert/alert-transition.ts","../../../src/alert/alert.ts","../../../src/alert/alert.module.ts","../../../src/alert/ng-bootstrap-ng-bootstrap-alert.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { NgbConfig } from '@ng-bootstrap/ng-bootstrap/config';\n\n/**\n * A configuration service for the [NgbAlert](#/components/alert/api#NgbAlert) component.\n *\n * You can inject this service, typically in your root component, and customize its properties\n * to provide default values for all alerts used in the application.\n */\n@Injectable({ providedIn: 'root' })\nexport class NgbAlertConfig {\n\tprivate _ngbConfig = inject(NgbConfig);\n\tprivate _animation: boolean;\n\n\tdismissible = true;\n\ttype = 'warning';\n\n\tget animation(): boolean {\n\t\treturn this._animation ?? this._ngbConfig.animation;\n\t}\n\tset animation(animation: boolean) {\n\t\tthis._animation = animation;\n\t}\n}\n","import { NgbTransitionStartFn } from './_ngb-ngbootstrap-utilities.mjs';\n\nexport const ngbAlertFadingTransition: NgbTransitionStartFn = ({ classList }: HTMLElement) => {\n\tclassList.remove('show');\n};\n","import {\n\tChangeDetectionStrategy,\n\tComponent,\n\tElementRef,\n\tEventEmitter,\n\tinject,\n\tInput,\n\tNgZone,\n\tOutput,\n\tViewEncapsulation,\n} from '@angular/core';\n\nimport { Observable } from 'rxjs';\n\nimport { NgbAlertConfig } from './alert-config';\nimport { ngbRunTransition } from './_ngb-ngbootstrap-utilities.mjs';\nimport { ngbAlertFadingTransition } from './alert-transition';\n\n/**\n * Alert is a component to provide contextual feedback messages for user.\n *\n * It supports several alert types and can be dismissed.\n */\n@Component({\n\tselector: 'ngb-alert',\n\texportAs: 'ngbAlert',\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tencapsulation: ViewEncapsulation.None,\n\thost: {\n\t\trole: 'alert',\n\t\t'[class]': '\"alert show\" + (type ? \" alert-\" + type : \"\")',\n\t\t'[class.fade]': 'animation',\n\t\t'[class.alert-dismissible]': 'dismissible',\n\t},\n\ttemplate: `\n\t\t<ng-content />\n\t\t@if (dismissible) {\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"btn-close\"\n\t\t\t\taria-label=\"Close\"\n\t\t\t\ti18n-aria-label=\"@@ngb.alert.close\"\n\t\t\t\t(click)=\"close()\"\n\t\t\t></button>\n\t\t}\n\t`,\n\tstyleUrl: './alert.scss',\n})\nexport class NgbAlert {\n\tprivate _config = inject(NgbAlertConfig);\n\tprivate _elementRef = inject(ElementRef<HTMLElement>);\n\tprivate _zone = inject(NgZone);\n\n\t/**\n\t * If `true`, alert closing will be animated.\n\t *\n\t * Animation is triggered only when clicked on the close button (×)\n\t * or via the `.close()` function\n\t *\n\t * @since 8.0.0\n\t */\n\t@Input() animation = this._config.animation;\n\n\t/**\n\t * If `true`, alert can be dismissed by the user.\n\t *\n\t * The close button (×) will be displayed and you can be notified\n\t * of the event with the `(closed)` output.\n\t */\n\t@Input() dismissible = this._config.dismissible;\n\n\t/**\n\t * Type of the alert.\n\t *\n\t * Bootstrap provides styles for the following types: `'success'`, `'info'`, `'warning'`, `'danger'`, `'primary'`,\n\t * `'secondary'`, `'light'` and `'dark'`.\n\t */\n\t@Input() type = this._config.type;\n\n\t/**\n\t * An event emitted when the close button is clicked. It has no payload and only relevant for dismissible alerts.\n\t *\n\t * @since 8.0.0\n\t */\n\t@Output() closed = new EventEmitter<void>();\n\n\t/**\n\t * Triggers alert closing programmatically (same as clicking on the close button (×)).\n\t *\n\t * The returned observable will emit and be completed once the closing transition has finished.\n\t * If the animations are turned off this happens synchronously.\n\t *\n\t * Alternatively you could listen or subscribe to the `(closed)` output\n\t *\n\t * @since 8.0.0\n\t */\n\tclose(): Observable<void> {\n\t\tconst transition = ngbRunTransition(this._zone, this._elementRef.nativeElement, ngbAlertFadingTransition, {\n\t\t\tanimation: this.animation,\n\t\t\trunningTransition: 'continue',\n\t\t});\n\t\ttransition.subscribe(() => this.closed.emit());\n\t\treturn transition;\n\t}\n}\n","import { NgModule } from '@angular/core';\n\nimport { NgbAlert } from './alert';\n\nexport { NgbAlert } from './alert';\nexport { NgbAlertConfig } from './alert-config';\n\n@NgModule({\n\timports: [NgbAlert],\n\texports: [NgbAlert],\n})\nexport class NgbAlertModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAGA;;;;;AAKG;MAEU,cAAc,CAAA;AAD3B,IAAA,WAAA,GAAA;AAES,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC;QAGtC,IAAA,CAAA,WAAW,GAAG,IAAI;QAClB,IAAA,CAAA,IAAI,GAAG,SAAS;AAQhB,IAAA;AANA,IAAA,IAAI,SAAS,GAAA;QACZ,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS;IACpD;IACA,IAAI,SAAS,CAAC,SAAkB,EAAA;AAC/B,QAAA,IAAI,CAAC,UAAU,GAAG,SAAS;IAC5B;8GAZY,cAAc,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAd,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,cAAc,cADD,MAAM,EAAA,CAAA,CAAA;;2FACnB,cAAc,EAAA,UAAA,EAAA,CAAA;kBAD1B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACP3B,MAAM,wBAAwB,GAAyB,CAAC,EAAE,SAAS,EAAe,KAAI;AAC5F,IAAA,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC;AACzB,CAAC;;ACcD;;;;AAIG;MA0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