@villedemontreal/angular-ui 15.0.0 → 15.1.1

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { SecurityContext, Injectable, Inject, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, NgModule, Directive, EventEmitter, Output, CUSTOM_ELEMENTS_SCHEMA, ViewChild, forwardRef, InjectionToken, ContentChildren, Optional, HostListener, ContentChild, Injector, TemplateRef, SkipSelf, ViewChildren } from '@angular/core';
2
+ import { SecurityContext, Injectable, Inject, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, NgModule, Directive, EventEmitter, Output, CUSTOM_ELEMENTS_SCHEMA, ViewChild, forwardRef, InjectionToken, ContentChildren, Optional, HostListener, ContentChild, Injector, TemplateRef, SkipSelf, ViewChildren, inject } from '@angular/core';
3
3
  import * as i1$1 from '@angular/common';
4
4
  import { DOCUMENT, CommonModule } from '@angular/common';
5
5
  import * as i1 from '@angular/platform-browser';
@@ -12,11 +12,14 @@ import * as i2 from '@angular/cdk/collections';
12
12
  import * as i1$4 from '@angular/cdk/overlay';
13
13
  import { OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
14
14
  import * as i3 from '@angular/cdk/portal';
15
- import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, TemplatePortal, PortalModule, DomPortal } from '@angular/cdk/portal';
15
+ import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, TemplatePortal, PortalModule, DomPortal, PortalInjector } from '@angular/cdk/portal';
16
16
  import { Subject, filter, take, defer, startWith } from 'rxjs';
17
17
  import { __awaiter } from 'tslib';
18
+ import * as i1$5 from '@angular/cdk/platform';
18
19
  import { _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';
19
20
  import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
21
+ import { take as take$1 } from 'rxjs/operators';
22
+ import { trigger, state, style, transition, animate } from '@angular/animations';
20
23
 
21
24
  function baoColorToHex(baoColor) {
22
25
  switch (baoColor) {
@@ -3234,14 +3237,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
3234
3237
  }] });
3235
3238
 
3236
3239
  // Counter for unique modal ids.
3237
- let uniqueId = 0;
3240
+ let uniqueId$1 = 0;
3238
3241
  /**
3239
3242
  * Reference to a modal opened via the BaoModalService.
3240
3243
  */
3241
3244
  class BaoModalRef {
3242
3245
  constructor(_overlayRef, _containerInstance,
3243
3246
  /** Id of the modal. */
3244
- id = `bao-modal-${uniqueId++}`) {
3247
+ id = `bao-modal-${uniqueId$1++}`) {
3245
3248
  this._overlayRef = _overlayRef;
3246
3249
  this._containerInstance = _containerInstance;
3247
3250
  this.id = id;
@@ -4308,11 +4311,18 @@ class BaoDropdownMenuTrigger {
4308
4311
  overlayY: 'bottom'
4309
4312
  },
4310
4313
  {
4311
- // top-right of the overlay is connected to bottom-left of the origin;
4312
- originX: 'start',
4314
+ // top-right of the overlay is connected to bottom-right of the origin;
4315
+ originX: 'end',
4313
4316
  originY: 'bottom',
4314
4317
  overlayX: 'end',
4315
4318
  overlayY: 'top'
4319
+ },
4320
+ {
4321
+ // bottom-right of the overlay is connected to top-right of the origin;
4322
+ originX: 'end',
4323
+ originY: 'top',
4324
+ overlayX: 'end',
4325
+ overlayY: 'bottom'
4316
4326
  }
4317
4327
  ]),
4318
4328
  backdropClass: 'bao-overlay-transparent-backdrop',
@@ -4976,6 +4986,774 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
4976
4986
  }]
4977
4987
  }] });
4978
4988
 
4989
+ /** Injection token that can be used to access the data that was passed in to a snack bar. */
4990
+ const BAO_SNACK_BAR_DATA = new InjectionToken('BaoSnackBarData');
4991
+ /**
4992
+ * Configuration used when opening a snack-bar.
4993
+ */
4994
+ class BaoSnackBarConfig {
4995
+ constructor() {
4996
+ /** The message to display in the snackbar. */
4997
+ this.message = 'No message';
4998
+ /** The type of snackbar template to display. */
4999
+ this.toastType = 'info';
5000
+ /**
5001
+ * The attached action to the snack bar. If the name of the action matches an icon provided as part of
5002
+ * angular-ui icon dictionnary an icon will be displayed instead of text.
5003
+ * */
5004
+ this.actionLabelOrIcon = '';
5005
+ /** Displays the close button when set to true */
5006
+ this.showClose = false;
5007
+ /** The length of time in milliseconds to wait before automatically dismissing the snack bar. */
5008
+ this.duration = 5000;
5009
+ /** The politeness level for the MatAriaLiveAnnouncer announcement. */
5010
+ this.politeness = 'assertive';
5011
+ /**
5012
+ * Message to be announced by the LiveAnnouncer. When opening a snackbar without a custom
5013
+ * component or template, the announcement message will default to the specified message.
5014
+ */
5015
+ this.announcementMessage = '';
5016
+ /** Data being injected into the child component. */
5017
+ this.data = null;
5018
+ /** The horizontal position to place the snack bar. */
5019
+ this.horizontalPosition = 'left';
5020
+ /** The vertical position to place the snack bar. */
5021
+ this.verticalPosition = 'bottom';
5022
+ }
5023
+ }
5024
+
5025
+ /** Maximum amount of milliseconds that can be passed into setTimeout. */
5026
+ const MAX_TIMEOUT = Math.pow(2, 31) - 1;
5027
+ /**
5028
+ * Reference to a snack bar dispatched from the snack bar service.
5029
+ */
5030
+ class BaoSnackBarRef {
5031
+ constructor(containerInstance, _overlayRef) {
5032
+ this._overlayRef = _overlayRef;
5033
+ /** Subject for notifying the user that the snack bar has been dismissed. */
5034
+ this._afterDismissed = new Subject();
5035
+ /** Subject for notifying the user that the snack bar has opened and appeared. */
5036
+ this._afterOpened = new Subject();
5037
+ /** Subject for notifying the user that the snack bar action was called. */
5038
+ this._onAction = new Subject();
5039
+ /** Whether the snack bar was dismissed using the action button. */
5040
+ this._dismissedByAction = false;
5041
+ this.containerInstance = containerInstance;
5042
+ // Dismiss snackbar on action.
5043
+ this.onAction().subscribe(() => this.dismiss());
5044
+ containerInstance._onExit.subscribe(() => this.finishDismiss());
5045
+ }
5046
+ /** Dismisses the snack bar. */
5047
+ dismiss() {
5048
+ if (!this._afterDismissed.closed) {
5049
+ this.containerInstance.exit();
5050
+ }
5051
+ clearTimeout(this._durationTimeoutId);
5052
+ }
5053
+ /** Marks the snackbar action clicked. */
5054
+ dismissWithAction() {
5055
+ if (!this._onAction.closed) {
5056
+ this._dismissedByAction = true;
5057
+ this._onAction.next();
5058
+ this._onAction.complete();
5059
+ }
5060
+ }
5061
+ /** Dismisses the snack bar after some duration */
5062
+ dismissAfter(duration) {
5063
+ // Note that we need to cap the duration to the maximum value for setTimeout, because
5064
+ // it'll revert to 1 if somebody passes in something greater (e.g. `Infinity`). See #17234.
5065
+ // @TODO: window.setTimeout() ?
5066
+ this._durationTimeoutId = window.setTimeout(() => this.dismiss(), Math.min(duration, MAX_TIMEOUT));
5067
+ }
5068
+ /** Marks the snackbar as opened */
5069
+ open() {
5070
+ if (!this._afterOpened.closed) {
5071
+ this._afterOpened.next();
5072
+ this._afterOpened.complete();
5073
+ }
5074
+ }
5075
+ /** Gets an observable that is notified when the snack bar is finished closing. */
5076
+ afterDismissed() {
5077
+ return this._afterDismissed;
5078
+ }
5079
+ /** Gets an observable that is notified when the snack bar has opened and appeared. */
5080
+ afterOpened() {
5081
+ return this.containerInstance._onEnter;
5082
+ }
5083
+ /** Gets an observable that is notified when the snack bar action is called. */
5084
+ onAction() {
5085
+ return this._onAction;
5086
+ }
5087
+ /** Cleans up the DOM after closing. */
5088
+ finishDismiss() {
5089
+ this._overlayRef.dispose();
5090
+ if (!this._onAction.closed) {
5091
+ this._onAction.complete();
5092
+ }
5093
+ this._afterDismissed.next({ dismissedByAction: this._dismissedByAction });
5094
+ this._afterDismissed.complete();
5095
+ this._dismissedByAction = false;
5096
+ }
5097
+ }
5098
+
5099
+ /*
5100
+ * Copyright (c) 2023 Ville de Montreal. All rights reserved.
5101
+ * Licensed under the MIT license.
5102
+ * See LICENSE file in the project root for full license information.
5103
+ */
5104
+ const toastTypeToAttributes = {
5105
+ info: {
5106
+ toastClass: 'bao-snackbar-info',
5107
+ icon: 'icon-info',
5108
+ iconTitle: 'Information',
5109
+ politeness: 'assertive'
5110
+ },
5111
+ success: {
5112
+ toastClass: 'bao-snackbar-success',
5113
+ icon: 'icon-check-circle',
5114
+ iconTitle: 'Succès',
5115
+ politeness: 'polite'
5116
+ },
5117
+ danger: {
5118
+ toastClass: 'bao-snackbar-danger',
5119
+ icon: 'icon-error',
5120
+ iconTitle: 'Erreur',
5121
+ politeness: 'assertive'
5122
+ }
5123
+ };
5124
+ /**
5125
+ * A component used to open as the default snack bar, matching material spec.
5126
+ * This should only be used internally by the snack bar service.
5127
+ */
5128
+ class BaoSimpleSnackBarComponent {
5129
+ constructor(snackBarRef, data) {
5130
+ this.snackBarRef = snackBarRef;
5131
+ this.showCloseTitle = 'Fermer le message';
5132
+ this.data = data;
5133
+ }
5134
+ /** Returns the politeness */
5135
+ get politeness() {
5136
+ var _a;
5137
+ return (((_a = toastTypeToAttributes[this.data.toastType]) === null || _a === void 0 ? void 0 : _a.politeness) ||
5138
+ toastTypeToAttributes['info'].politeness);
5139
+ }
5140
+ /** Returns the toast class */
5141
+ get toastClass() {
5142
+ var _a;
5143
+ return (((_a = toastTypeToAttributes[this.data.toastType]) === null || _a === void 0 ? void 0 : _a.toastClass) ||
5144
+ toastTypeToAttributes['info'].toastClass);
5145
+ }
5146
+ /** Returns the toast icon */
5147
+ get toastIcon() {
5148
+ var _a;
5149
+ return (((_a = toastTypeToAttributes[this.data.toastType]) === null || _a === void 0 ? void 0 : _a.icon) ||
5150
+ toastTypeToAttributes['info'].icon);
5151
+ }
5152
+ /** Returns the toast icon title */
5153
+ get toastIconTitle() {
5154
+ var _a;
5155
+ return (((_a = toastTypeToAttributes[this.data.toastType]) === null || _a === void 0 ? void 0 : _a.iconTitle) ||
5156
+ toastTypeToAttributes['info'].iconTitle);
5157
+ }
5158
+ /** If the action button should be shown. */
5159
+ get hasAction() {
5160
+ return !!this.data.actionLabelOrIcon;
5161
+ }
5162
+ /** If the action is an icon */
5163
+ get isActionIcon() {
5164
+ return !!ICONS_DCT[this.data.actionLabelOrIcon];
5165
+ }
5166
+ /** Performs the action on the snack bar. */
5167
+ action() {
5168
+ this.snackBarRef.dismissWithAction();
5169
+ }
5170
+ /** Closes the snack bar. */
5171
+ close() {
5172
+ this.snackBarRef.dismiss();
5173
+ }
5174
+ }
5175
+ BaoSimpleSnackBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: BaoSimpleSnackBarComponent, deps: [{ token: BaoSnackBarRef }, { token: BAO_SNACK_BAR_DATA }], target: i0.ɵɵFactoryTarget.Component });
5176
+ BaoSimpleSnackBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: BaoSimpleSnackBarComponent, selector: "bao-simple-snack-bar", host: { classAttribute: "bao-simple-snackbar" }, ngImport: i0, template: "<div\n class=\"bao-snackbar show\"\n [ngClass]=\"toastClass\"\n [attr.aria-live]=\"politeness\"\n aria-atomic=\"true\"\n>\n <div class=\"bao-snackbar-icon\">\n <bao-icon [svgIcon]=\"toastIcon\" [title]=\"toastIconTitle\"></bao-icon>\n </div>\n <div class=\"bao-snackbar-body\">\n {{ data.message }}\n </div>\n <div class=\"bao-snackbar-action\">\n <div *ngIf=\"hasAction\">\n <button\n bao-button\n role=\"button\"\n type=\"utility\"\n level=\"tertiary\"\n [reversed]=\"true\"\n [title]=\"data.actionLabelOrIcon\"\n (click)=\"action()\"\n >\n <bao-icon\n *ngIf=\"isActionIcon; else isActionText\"\n [svgIcon]=\"data.actionLabelOrIcon\"\n [title]=\"data.actionLabelOrIcon\"\n ></bao-icon>\n <ng-template #isActionText\n ><span>{{ data.actionLabelOrIcon }}</span></ng-template\n >\n </button>\n </div>\n <div *ngIf=\"data.showClose\">\n <button\n bao-button\n role=\"button\"\n type=\"utility\"\n level=\"tertiary\"\n [reversed]=\"true\"\n title=\"{{ showCloseTitle }}\"\n (click)=\"close()\"\n >\n <bao-icon svgIcon=\"icon-x\" title=\"{{ showCloseTitle }}\"></bao-icon>\n </button>\n </div>\n </div>\n</div>\n", styles: [".bao-container{padding-right:16px;padding-left:16px;margin-right:auto;margin-left:auto;width:100%}@media (min-width: 576px){.bao-container{max-width:576px}}@media (min-width: 768px){.bao-container{max-width:768px}}@media (min-width: 992px){.bao-container{max-width:992px}}@media (min-width: 1200px){.bao-container{max-width:1200px}}.bao-row{display:flex;flex-wrap:wrap;margin-right:-16px;margin-left:-16px}.bao-col-12,.bao-col-lg-7{position:relative;width:100%;padding-right:1rem;padding-left:1rem}@media (min-width: 992px){.bao-col-lg-7{flex:0 0 58.33333%;max-width:58.33333%}}.bao-snackbar{overflow:hidden;font-size:.875rem;line-height:1.25rem;color:#fff;background-color:#004b7b;background-clip:padding-box;box-shadow:0 2px 8px #0000001a;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);opacity:0;border-radius:.25rem;width:100%}.bao-snackbar:not(:last-child){margin-bottom:1rem}.bao-snackbar.showing{opacity:1}.bao-snackbar.show{display:inline-flex;opacity:1}.bao-snackbar.hide{display:none}@media (min-width: 768px){.bao-snackbar{margin:1rem;width:auto}}.bao-snackbar-icon{display:inline-flex;align-items:center;flex-grow:0;margin:1rem 0 1rem 1rem}.bao-snackbar-body{display:flex;align-items:center;padding:1rem;margin:0}.bao-snackbar-action{display:flex;align-items:center;margin-left:auto}.bao-snackbar-action:last-child{margin-right:.5rem}.bao-snackbar-info{color:#fff;background-color:#004b7b}.bao-snackbar-success{color:#fff;background-color:#025d29}.bao-snackbar-danger{color:#fff;background-color:#851a00}\n"], dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: BaoButtonComponent, selector: "button[bao-button]", inputs: ["displayType", "level", "size", "loading", "reversed", "loadingSpinnerAriaLabel", "fullWidth"] }, { kind: "component", type: BaoIconComponent, selector: "bao-icon", inputs: ["color", "size", "svgIcon", "title"], exportAs: ["baoIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
5177
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: BaoSimpleSnackBarComponent, decorators: [{
5178
+ type: Component,
5179
+ args: [{ selector: 'bao-simple-snack-bar', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
5180
+ class: 'bao-simple-snackbar'
5181
+ }, template: "<div\n class=\"bao-snackbar show\"\n [ngClass]=\"toastClass\"\n [attr.aria-live]=\"politeness\"\n aria-atomic=\"true\"\n>\n <div class=\"bao-snackbar-icon\">\n <bao-icon [svgIcon]=\"toastIcon\" [title]=\"toastIconTitle\"></bao-icon>\n </div>\n <div class=\"bao-snackbar-body\">\n {{ data.message }}\n </div>\n <div class=\"bao-snackbar-action\">\n <div *ngIf=\"hasAction\">\n <button\n bao-button\n role=\"button\"\n type=\"utility\"\n level=\"tertiary\"\n [reversed]=\"true\"\n [title]=\"data.actionLabelOrIcon\"\n (click)=\"action()\"\n >\n <bao-icon\n *ngIf=\"isActionIcon; else isActionText\"\n [svgIcon]=\"data.actionLabelOrIcon\"\n [title]=\"data.actionLabelOrIcon\"\n ></bao-icon>\n <ng-template #isActionText\n ><span>{{ data.actionLabelOrIcon }}</span></ng-template\n >\n </button>\n </div>\n <div *ngIf=\"data.showClose\">\n <button\n bao-button\n role=\"button\"\n type=\"utility\"\n level=\"tertiary\"\n [reversed]=\"true\"\n title=\"{{ showCloseTitle }}\"\n (click)=\"close()\"\n >\n <bao-icon svgIcon=\"icon-x\" title=\"{{ showCloseTitle }}\"></bao-icon>\n </button>\n </div>\n </div>\n</div>\n", styles: [".bao-container{padding-right:16px;padding-left:16px;margin-right:auto;margin-left:auto;width:100%}@media (min-width: 576px){.bao-container{max-width:576px}}@media (min-width: 768px){.bao-container{max-width:768px}}@media (min-width: 992px){.bao-container{max-width:992px}}@media (min-width: 1200px){.bao-container{max-width:1200px}}.bao-row{display:flex;flex-wrap:wrap;margin-right:-16px;margin-left:-16px}.bao-col-12,.bao-col-lg-7{position:relative;width:100%;padding-right:1rem;padding-left:1rem}@media (min-width: 992px){.bao-col-lg-7{flex:0 0 58.33333%;max-width:58.33333%}}.bao-snackbar{overflow:hidden;font-size:.875rem;line-height:1.25rem;color:#fff;background-color:#004b7b;background-clip:padding-box;box-shadow:0 2px 8px #0000001a;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);opacity:0;border-radius:.25rem;width:100%}.bao-snackbar:not(:last-child){margin-bottom:1rem}.bao-snackbar.showing{opacity:1}.bao-snackbar.show{display:inline-flex;opacity:1}.bao-snackbar.hide{display:none}@media (min-width: 768px){.bao-snackbar{margin:1rem;width:auto}}.bao-snackbar-icon{display:inline-flex;align-items:center;flex-grow:0;margin:1rem 0 1rem 1rem}.bao-snackbar-body{display:flex;align-items:center;padding:1rem;margin:0}.bao-snackbar-action{display:flex;align-items:center;margin-left:auto}.bao-snackbar-action:last-child{margin-right:.5rem}.bao-snackbar-info{color:#fff;background-color:#004b7b}.bao-snackbar-success{color:#fff;background-color:#025d29}.bao-snackbar-danger{color:#fff;background-color:#851a00}\n"] }]
5182
+ }], ctorParameters: function () {
5183
+ return [{ type: BaoSnackBarRef }, { type: undefined, decorators: [{
5184
+ type: Inject,
5185
+ args: [BAO_SNACK_BAR_DATA]
5186
+ }] }];
5187
+ } });
5188
+
5189
+ /*
5190
+ * Copyright (c) 2023 Ville de Montreal. All rights reserved.
5191
+ * Licensed under the MIT license.
5192
+ * See LICENSE file in the project root for full license information.
5193
+ */
5194
+ /**
5195
+ * Animations used by the Material snack bar.
5196
+ * @docs-private
5197
+ */
5198
+ const matSnackBarAnimations = {
5199
+ /** Animation that shows and hides a snack bar. */
5200
+ snackBarState: trigger('state', [
5201
+ state('void, hidden', style({
5202
+ transform: 'scale(0.8)',
5203
+ opacity: 0
5204
+ })),
5205
+ state('visible', style({
5206
+ transform: 'scale(1)',
5207
+ opacity: 1
5208
+ })),
5209
+ transition('* => visible', animate('150ms cubic-bezier(0, 0, 0.2, 1)')),
5210
+ transition('* => void, * => hidden', animate('75ms cubic-bezier(0.4, 0.0, 1, 1)', style({
5211
+ opacity: 0
5212
+ })))
5213
+ ])
5214
+ };
5215
+
5216
+ let uniqueId = 0;
5217
+ /**
5218
+ * Internal component that wraps user-provided snack bar content.
5219
+ * @docs-private
5220
+ */
5221
+ class BaoSnackBarContainerComponent extends BasePortalOutlet {
5222
+ constructor(_ngZone, _elementRef, _changeDetectorRef, _platform,
5223
+ /** The snack bar configuration. */
5224
+ snackBarConfig) {
5225
+ super();
5226
+ this._ngZone = _ngZone;
5227
+ this._elementRef = _elementRef;
5228
+ this._changeDetectorRef = _changeDetectorRef;
5229
+ this._platform = _platform;
5230
+ this.snackBarConfig = snackBarConfig;
5231
+ this._document = inject(DOCUMENT);
5232
+ this._trackedModals = new Set();
5233
+ /** Subject for notifying that the snack bar has announced to screen readers. */
5234
+ this._onAnnounce = new Subject();
5235
+ /** Subject for notifying that the snack bar has exited from view. */
5236
+ this._onExit = new Subject();
5237
+ /** Subject for notifying that the snack bar has finished entering the view. */
5238
+ this._onEnter = new Subject();
5239
+ /** The state of the snack bar animations. */
5240
+ this._animationState = 'void';
5241
+ /** The number of milliseconds to wait before announcing the snack bar's content. */
5242
+ this._announceDelay = 150;
5243
+ /** Whether the component has been destroyed. */
5244
+ this._destroyed = false;
5245
+ /** Unique ID of the aria-live element. */
5246
+ this._liveElementId = `bao-snack-bar-container-live-${uniqueId++}`;
5247
+ /**
5248
+ * Attaches a DOM portal to the snack bar container.
5249
+ * @deprecated To be turned into a method.
5250
+ * @breaking-change 10.0.0
5251
+ */
5252
+ this.attachDomPortal = (portal) => {
5253
+ this.assertNotAttached();
5254
+ const result = this._portalOutlet.attachDomPortal(portal);
5255
+ this._afterPortalAttached();
5256
+ return result;
5257
+ };
5258
+ // Use aria-live rather than a live role like 'alert' or 'status'
5259
+ // because NVDA and JAWS have show inconsistent behavior with live roles.
5260
+ if (snackBarConfig.politeness === 'assertive' &&
5261
+ !snackBarConfig.announcementMessage) {
5262
+ this._live = 'assertive';
5263
+ }
5264
+ else if (snackBarConfig.politeness === 'off') {
5265
+ this._live = 'off';
5266
+ }
5267
+ else {
5268
+ this._live = 'polite';
5269
+ }
5270
+ // Only set role for Firefox. Set role based on aria-live because setting role="alert" implies
5271
+ // aria-live="assertive" which may cause issues if aria-live is set to "polite" above.
5272
+ if (this._platform.FIREFOX) {
5273
+ if (this._live === 'polite') {
5274
+ this._role = 'status';
5275
+ }
5276
+ if (this._live === 'assertive') {
5277
+ this._role = 'alert';
5278
+ }
5279
+ }
5280
+ }
5281
+ /** Attach a component portal as content to this snack bar container. */
5282
+ attachComponentPortal(portal) {
5283
+ this.assertNotAttached();
5284
+ this.applySnackBarClasses();
5285
+ const result = this._portalOutlet.attachComponentPortal(portal);
5286
+ this._afterPortalAttached();
5287
+ return result;
5288
+ }
5289
+ /** Attach a template portal as content to this snack bar container. */
5290
+ attachTemplatePortal(portal) {
5291
+ this.assertNotAttached();
5292
+ this.applySnackBarClasses();
5293
+ const result = this._portalOutlet.attachTemplatePortal(portal);
5294
+ this._afterPortalAttached();
5295
+ return result;
5296
+ }
5297
+ /** Handle end of animations, updating the state of the snackbar. */
5298
+ onAnimationEnd(event) {
5299
+ const { fromState, toState } = event;
5300
+ if ((toState === 'void' && fromState !== 'void') || toState === 'hidden') {
5301
+ this.completeExit();
5302
+ }
5303
+ if (toState === 'visible') {
5304
+ // Note: we shouldn't use `this` inside the zone callback,
5305
+ // because it can cause a memory leak.
5306
+ const onEnter = this._onEnter;
5307
+ this._ngZone.run(() => {
5308
+ onEnter.next();
5309
+ onEnter.complete();
5310
+ });
5311
+ }
5312
+ }
5313
+ /** Begin animation of snack bar entrance into view. */
5314
+ enter() {
5315
+ if (!this._destroyed) {
5316
+ this._animationState = 'visible';
5317
+ this._changeDetectorRef.detectChanges();
5318
+ this.screenReaderAnnounce();
5319
+ }
5320
+ }
5321
+ /** Begin animation of the snack bar exiting from view. */
5322
+ exit() {
5323
+ // Note: this one transitions to `hidden`, rather than `void`, in order to handle the case
5324
+ // where multiple snack bars are opened in quick succession (e.g. two consecutive calls to
5325
+ // `MatSnackBar.open`).
5326
+ this._animationState = 'hidden';
5327
+ // Mark this element with an 'exit' attribute to indicate that the snackbar has
5328
+ // been dismissed and will soon be removed from the DOM. This is used by the snackbar
5329
+ // test harness.
5330
+ this._elementRef.nativeElement.setAttribute('mat-exit', '');
5331
+ // If the snack bar hasn't been announced by the time it exits it wouldn't have been open
5332
+ // long enough to visually read it either, so clear the timeout for announcing.
5333
+ clearTimeout(this._announceTimeoutId);
5334
+ return this._onExit;
5335
+ }
5336
+ /** Makes sure the exit callbacks have been invoked when the element is destroyed. */
5337
+ ngOnDestroy() {
5338
+ this._destroyed = true;
5339
+ this.completeExit();
5340
+ }
5341
+ /**
5342
+ * Waits for the zone to settle before removing the element. Helps prevent
5343
+ * errors where we end up removing an element which is in the middle of an animation.
5344
+ */
5345
+ completeExit() {
5346
+ this._ngZone.onMicrotaskEmpty.pipe(take$1(1)).subscribe(() => {
5347
+ this._onExit.next();
5348
+ this._onExit.complete();
5349
+ });
5350
+ }
5351
+ /** Applies the various positioning and user-configured CSS classes to the snack bar. */
5352
+ applySnackBarClasses() {
5353
+ const element = this._elementRef.nativeElement;
5354
+ const panelClasses = this.snackBarConfig.panelClass;
5355
+ if (panelClasses) {
5356
+ if (Array.isArray(panelClasses)) {
5357
+ // Note that we can't use a spread here, because IE doesn't support multiple arguments.
5358
+ panelClasses.forEach(cssClass => element.classList.add(cssClass));
5359
+ }
5360
+ else {
5361
+ element.classList.add(panelClasses);
5362
+ }
5363
+ }
5364
+ if (this.snackBarConfig.horizontalPosition === 'center') {
5365
+ element.classList.add('bao-snack-bar-center');
5366
+ }
5367
+ if (this.snackBarConfig.verticalPosition === 'top') {
5368
+ element.classList.add('bao-snack-bar-top');
5369
+ }
5370
+ }
5371
+ /**
5372
+ * Called after the portal contents have been attached. Can be
5373
+ * used to modify the DOM once it's guaranteed to be in place.
5374
+ */
5375
+ _afterPortalAttached() {
5376
+ const element = this._elementRef.nativeElement;
5377
+ const panelClasses = this.snackBarConfig.panelClass;
5378
+ if (panelClasses) {
5379
+ if (Array.isArray(panelClasses)) {
5380
+ // Note that we can't use a spread here, because IE doesn't support multiple arguments.
5381
+ panelClasses.forEach(cssClass => element.classList.add(cssClass));
5382
+ }
5383
+ else {
5384
+ element.classList.add(panelClasses);
5385
+ }
5386
+ }
5387
+ this._exposeToModals();
5388
+ }
5389
+ /**
5390
+ * Some browsers won't expose the accessibility node of the live element if there is an
5391
+ * `aria-modal` and the live element is outside of it. This method works around the issue by
5392
+ * pointing the `aria-owns` of all modals to the live element.
5393
+ */
5394
+ _exposeToModals() {
5395
+ // Note that the selector here is limited to CDK overlays at the moment in order to reduce the
5396
+ // section of the DOM we need to look through. This should cover all the cases we support, but
5397
+ // the selector can be expanded if it turns out to be too narrow.
5398
+ const id = this._liveElementId;
5399
+ const modals = this._document.querySelectorAll('body > .cdk-overlay-container [aria-modal="true"]');
5400
+ for (let i = 0; i < modals.length; i++) {
5401
+ const modal = modals[i];
5402
+ const ariaOwns = modal.getAttribute('aria-owns');
5403
+ this._trackedModals.add(modal);
5404
+ if (!ariaOwns) {
5405
+ modal.setAttribute('aria-owns', id);
5406
+ }
5407
+ else if (ariaOwns.indexOf(id) === -1) {
5408
+ modal.setAttribute('aria-owns', ariaOwns + ' ' + id);
5409
+ }
5410
+ }
5411
+ }
5412
+ /** Clears the references to the live element from any modals it was added to. */
5413
+ _clearFromModals() {
5414
+ this._trackedModals.forEach(modal => {
5415
+ const ariaOwns = modal.getAttribute('aria-owns');
5416
+ if (ariaOwns) {
5417
+ const newValue = ariaOwns.replace(this._liveElementId, '').trim();
5418
+ if (newValue.length > 0) {
5419
+ modal.setAttribute('aria-owns', newValue);
5420
+ }
5421
+ else {
5422
+ modal.removeAttribute('aria-owns');
5423
+ }
5424
+ }
5425
+ });
5426
+ this._trackedModals.clear();
5427
+ }
5428
+ /** Asserts that no content is already attached to the container. */
5429
+ assertNotAttached() {
5430
+ if (this._portalOutlet.hasAttached()) {
5431
+ throw Error('Attempting to attach snack bar content after content is already attached');
5432
+ }
5433
+ }
5434
+ /**
5435
+ * Starts a timeout to move the snack bar content to the live region so screen readers will
5436
+ * announce it.
5437
+ */
5438
+ screenReaderAnnounce() {
5439
+ if (!this._announceTimeoutId) {
5440
+ this._ngZone.runOutsideAngular(() => {
5441
+ this._announceTimeoutId = window.setTimeout(() => {
5442
+ const inertElement = this._elementRef.nativeElement.querySelector('[aria-hidden]');
5443
+ const liveElement = this._elementRef.nativeElement.querySelector('[aria-live]');
5444
+ if (inertElement && liveElement) {
5445
+ // If an element in the snack bar content is focused before being moved
5446
+ // track it and restore focus after moving to the live region.
5447
+ let focusedElement = null;
5448
+ if (this._platform.isBrowser &&
5449
+ document.activeElement instanceof HTMLElement &&
5450
+ inertElement.contains(document.activeElement)) {
5451
+ focusedElement = document.activeElement;
5452
+ }
5453
+ inertElement.removeAttribute('aria-hidden');
5454
+ liveElement.appendChild(inertElement);
5455
+ focusedElement === null || focusedElement === void 0 ? void 0 : focusedElement.focus();
5456
+ this._onAnnounce.next();
5457
+ this._onAnnounce.complete();
5458
+ }
5459
+ }, this._announceDelay);
5460
+ });
5461
+ }
5462
+ }
5463
+ }
5464
+ BaoSnackBarContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: BaoSnackBarContainerComponent, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$5.Platform }, { token: BaoSnackBarConfig }], target: i0.ɵɵFactoryTarget.Component });
5465
+ BaoSnackBarContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.3", type: BaoSnackBarContainerComponent, selector: "bao-snack-bar-container", host: { listeners: { "@state.done": "onAnimationEnd($event)" }, properties: { "@state": "_animationState" }, classAttribute: "bao-snack-bar-container" }, viewQueries: [{ propertyName: "_portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<!-- Initialy holds the snack bar content, will be empty after announcing to screen readers. -->\n<div aria-hidden=\"true\">\n <ng-template cdkPortalOutlet></ng-template>\n</div>\n\n<!-- Will receive the snack bar content from the non-live div, move will happen a short delay after opening -->\n<div\n [attr.aria-live]=\"_live\"\n [attr.role]=\"_role\"\n [attr.id]=\"_liveElementId\"\n></div>\n", styles: [".bao-container{padding-right:16px;padding-left:16px;margin-right:auto;margin-left:auto;width:100%}@media (min-width: 576px){.bao-container{max-width:576px}}@media (min-width: 768px){.bao-container{max-width:768px}}@media (min-width: 992px){.bao-container{max-width:992px}}@media (min-width: 1200px){.bao-container{max-width:1200px}}.bao-row{display:flex;flex-wrap:wrap;margin-right:-16px;margin-left:-16px}.bao-col-12,.bao-col-lg-7{position:relative;width:100%;padding-right:1rem;padding-left:1rem}@media (min-width: 992px){.bao-col-lg-7{flex:0 0 58.33333%;max-width:58.33333%}}.cdk-overlay-pane{width:100%}@media (min-width: 768px){.cdk-overlay-pane{margin:0;width:auto}}.bao-snack-bar-container{border-radius:.25rem;box-sizing:border-box;display:block;margin:1rem;max-width:100vw;min-width:15rem;min-height:3rem;transform-origin:center;width:100%}\n"], dependencies: [{ kind: "directive", type: i3.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], animations: [matSnackBarAnimations.snackBarState], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
5466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: BaoSnackBarContainerComponent, decorators: [{
5467
+ type: Component,
5468
+ args: [{ selector: 'bao-snack-bar-container', changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.None, animations: [matSnackBarAnimations.snackBarState], host: {
5469
+ class: 'bao-snack-bar-container',
5470
+ '[@state]': '_animationState',
5471
+ '(@state.done)': 'onAnimationEnd($event)'
5472
+ }, template: "<!-- Initialy holds the snack bar content, will be empty after announcing to screen readers. -->\n<div aria-hidden=\"true\">\n <ng-template cdkPortalOutlet></ng-template>\n</div>\n\n<!-- Will receive the snack bar content from the non-live div, move will happen a short delay after opening -->\n<div\n [attr.aria-live]=\"_live\"\n [attr.role]=\"_role\"\n [attr.id]=\"_liveElementId\"\n></div>\n", styles: [".bao-container{padding-right:16px;padding-left:16px;margin-right:auto;margin-left:auto;width:100%}@media (min-width: 576px){.bao-container{max-width:576px}}@media (min-width: 768px){.bao-container{max-width:768px}}@media (min-width: 992px){.bao-container{max-width:992px}}@media (min-width: 1200px){.bao-container{max-width:1200px}}.bao-row{display:flex;flex-wrap:wrap;margin-right:-16px;margin-left:-16px}.bao-col-12,.bao-col-lg-7{position:relative;width:100%;padding-right:1rem;padding-left:1rem}@media (min-width: 992px){.bao-col-lg-7{flex:0 0 58.33333%;max-width:58.33333%}}.cdk-overlay-pane{width:100%}@media (min-width: 768px){.cdk-overlay-pane{margin:0;width:auto}}.bao-snack-bar-container{border-radius:.25rem;box-sizing:border-box;display:block;margin:1rem;max-width:100vw;min-width:15rem;min-height:3rem;transform-origin:center;width:100%}\n"] }]
5473
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$5.Platform }, { type: BaoSnackBarConfig }]; }, propDecorators: { _portalOutlet: [{
5474
+ type: ViewChild,
5475
+ args: [CdkPortalOutlet, { static: true }]
5476
+ }] } });
5477
+
5478
+ function baoFactory() {
5479
+ return new BaoSnackBarConfig();
5480
+ }
5481
+ /** Injection token that can be used to specify default snack bar. */
5482
+ const BAO_SNACK_BAR_DEFAULT_OPTIONS = new InjectionToken('bao-snack-bar-default-options', {
5483
+ providedIn: 'root',
5484
+ factory: baoFactory
5485
+ });
5486
+ /**
5487
+ * Service to dispatch Material Design snack bar messages.
5488
+ */
5489
+ class BaoSnackBarService {
5490
+ constructor(_overlay, _live, _injector, _parentSnackBar, _defaultConfig) {
5491
+ this._overlay = _overlay;
5492
+ this._live = _live;
5493
+ this._injector = _injector;
5494
+ this._parentSnackBar = _parentSnackBar;
5495
+ this._defaultConfig = _defaultConfig;
5496
+ /** The component that should be rendered as the snack bar's simple component. */
5497
+ this.simpleSnackBarComponent = BaoSimpleSnackBarComponent;
5498
+ /** The container component that attaches the provided template or component. */
5499
+ this.snackBarContainerComponent = BaoSnackBarContainerComponent;
5500
+ /**
5501
+ * Reference to the current snack bar in the view *at this level* (in the Angular injector tree).
5502
+ * If there is a parent snack-bar service, all operations should delegate to that parent
5503
+ * via `_openedSnackBarRef`.
5504
+ */
5505
+ this._snackBarRefAtThisLevel = null;
5506
+ }
5507
+ /** Reference to the currently opened snackbar at *any* level. */
5508
+ get _openedSnackBarRef() {
5509
+ const parent = this._parentSnackBar;
5510
+ return parent ? parent._openedSnackBarRef : this._snackBarRefAtThisLevel;
5511
+ }
5512
+ set _openedSnackBarRef(value) {
5513
+ if (this._parentSnackBar) {
5514
+ this._parentSnackBar._openedSnackBarRef = value;
5515
+ }
5516
+ else {
5517
+ this._snackBarRefAtThisLevel = value;
5518
+ }
5519
+ }
5520
+ /**
5521
+ * Creates and dispatches a snack bar with a custom component for the content, removing any
5522
+ * currently opened snack bars.
5523
+ *
5524
+ * @param component Component to be instantiated.
5525
+ * @param config Extra configuration for the snack bar.
5526
+ */
5527
+ openFromComponent(component, config) {
5528
+ return this.attach(component, config);
5529
+ }
5530
+ /**
5531
+ * Creates and dispatches a snack bar with a custom template for the content, removing any
5532
+ * currently opened snack bars.
5533
+ *
5534
+ * @param template Template to be instantiated.
5535
+ * @param config Extra configuration for the snack bar.
5536
+ */
5537
+ openFromTemplate(template, config) {
5538
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
5539
+ return this.attach(template, config);
5540
+ }
5541
+ /**
5542
+ * Opens a snackbar with a message and an optional action.
5543
+ * @param message The message to show in the snackbar.
5544
+ * @param toastType The type of of toast to display the snackbar.
5545
+ * @param actionLabelOrIcon The label or icon for the snackbar action.
5546
+ * @param showClose If true, the snackbar will require user interaction to close.
5547
+ * @param config Additional configuration options for the snackbar.
5548
+ */
5549
+ open(config) {
5550
+ const _config = Object.assign(Object.assign({}, this._defaultConfig), config);
5551
+ // Since the user doesn't have access to the component, we can
5552
+ // override the data to pass in our own message, action and type.
5553
+ _config.data = {
5554
+ message: _config.message,
5555
+ toastType: _config.toastType,
5556
+ actionLabelOrIcon: _config.actionLabelOrIcon,
5557
+ showClose: _config.showClose
5558
+ };
5559
+ if (_config.showClose)
5560
+ _config.duration = 0;
5561
+ if (!_config.announcementMessage) {
5562
+ _config.announcementMessage = _config.message;
5563
+ }
5564
+ return this.openFromComponent(this.simpleSnackBarComponent, _config);
5565
+ }
5566
+ /**
5567
+ * Dismisses the currently-visible snack bar.
5568
+ */
5569
+ dismiss() {
5570
+ if (this._openedSnackBarRef) {
5571
+ this._openedSnackBarRef.dismiss();
5572
+ }
5573
+ }
5574
+ ngOnDestroy() {
5575
+ // Only dismiss the snack bar at the current level on destroy.
5576
+ if (this._snackBarRefAtThisLevel) {
5577
+ this._snackBarRefAtThisLevel.dismiss();
5578
+ }
5579
+ }
5580
+ /**
5581
+ * Attaches the snack bar container component to the overlay.
5582
+ */
5583
+ attachSnackBarContainer(overlayRef, config) {
5584
+ const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
5585
+ const injector = new PortalInjector(userInjector || this._injector, new WeakMap([[BaoSnackBarConfig, config]]));
5586
+ const containerPortal = new ComponentPortal(this.snackBarContainerComponent, config.viewContainerRef, injector);
5587
+ const containerRef = overlayRef.attach(containerPortal);
5588
+ containerRef.instance.snackBarConfig = config;
5589
+ return containerRef.instance;
5590
+ }
5591
+ /**
5592
+ * Places a new component or a template as the content of the snack bar container.
5593
+ */
5594
+ attach(content, userConfig) {
5595
+ const config = Object.assign(Object.assign(Object.assign({}, new BaoSnackBarConfig()), this._defaultConfig), userConfig);
5596
+ const overlayRef = this.createOverlay(config);
5597
+ const container = this.attachSnackBarContainer(overlayRef, config);
5598
+ const snackBarRef = new BaoSnackBarRef(container, overlayRef);
5599
+ if (content instanceof TemplateRef) {
5600
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
5601
+ const portal = new TemplatePortal(content, null, {
5602
+ $implicit: config.data,
5603
+ snackBarRef
5604
+ });
5605
+ snackBarRef.instance = container.attachTemplatePortal(portal);
5606
+ }
5607
+ else {
5608
+ const injector = this.createInjector(config, snackBarRef);
5609
+ const portal = new ComponentPortal(content, undefined, injector);
5610
+ const contentRef = container.attachComponentPortal(portal);
5611
+ // We can't pass this via the injector, because the injector is created earlier.
5612
+ snackBarRef.instance = contentRef.instance;
5613
+ }
5614
+ this.animateSnackBar(snackBarRef, config);
5615
+ this._openedSnackBarRef = snackBarRef;
5616
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
5617
+ return this._openedSnackBarRef;
5618
+ }
5619
+ /** Animates the old snack bar out and the new one in. */
5620
+ animateSnackBar(snackBarRef, config) {
5621
+ // When the snackbar is dismissed, clear the reference to it.
5622
+ snackBarRef.afterDismissed().subscribe(() => {
5623
+ // Clear the snackbar ref if it hasn't already been replaced by a newer snackbar.
5624
+ // eslint-disable-next-line eqeqeq
5625
+ if (this._openedSnackBarRef == snackBarRef) {
5626
+ this._openedSnackBarRef = null;
5627
+ }
5628
+ if (config.announcementMessage) {
5629
+ this._live.clear();
5630
+ }
5631
+ });
5632
+ if (this._openedSnackBarRef) {
5633
+ // If a snack bar is already in view, dismiss it and enter the
5634
+ // new snack bar after exit animation is complete.
5635
+ this._openedSnackBarRef.afterDismissed().subscribe(() => {
5636
+ snackBarRef.containerInstance.enter();
5637
+ });
5638
+ this._openedSnackBarRef.dismiss();
5639
+ }
5640
+ else {
5641
+ // If no snack bar is in view, enter the new snack bar.
5642
+ snackBarRef.containerInstance.enter();
5643
+ }
5644
+ // If a dismiss timeout is provided, set up dismiss based on after the snackbar is opened.
5645
+ if (config.duration && config.duration > 0) {
5646
+ snackBarRef
5647
+ .afterOpened()
5648
+ .subscribe(() => snackBarRef.dismissAfter(config.duration));
5649
+ }
5650
+ if (config.announcementMessage) {
5651
+ void this._live.announce(config.announcementMessage, config.politeness);
5652
+ }
5653
+ }
5654
+ /**
5655
+ * Creates a new overlay and places it in the correct location.
5656
+ * @param config The user-specified snack bar config.
5657
+ */
5658
+ createOverlay(config) {
5659
+ const overlayConfig = new OverlayConfig();
5660
+ overlayConfig.direction = config.direction;
5661
+ const positionStrategy = this._overlay.position().global();
5662
+ // Set horizontal position.
5663
+ const isRtl = config.direction === 'rtl';
5664
+ const isLeft = config.horizontalPosition === 'left' ||
5665
+ (config.horizontalPosition === 'start' && !isRtl) ||
5666
+ (config.horizontalPosition === 'end' && isRtl);
5667
+ const isRight = !isLeft && config.horizontalPosition !== 'center';
5668
+ if (isLeft) {
5669
+ positionStrategy.left('0');
5670
+ }
5671
+ else if (isRight) {
5672
+ positionStrategy.right('0');
5673
+ }
5674
+ else {
5675
+ positionStrategy.centerHorizontally();
5676
+ }
5677
+ // Set horizontal position.
5678
+ if (config.verticalPosition === 'top') {
5679
+ positionStrategy.top('0');
5680
+ }
5681
+ else {
5682
+ positionStrategy.bottom('0');
5683
+ }
5684
+ overlayConfig.positionStrategy = positionStrategy;
5685
+ return this._overlay.create(overlayConfig);
5686
+ }
5687
+ /**
5688
+ * Creates an injector to be used inside of a snack bar component.
5689
+ * @param config Config that was used to create the snack bar.
5690
+ * @param snackBarRef Reference to the snack bar.
5691
+ */
5692
+ createInjector(config, snackBarRef) {
5693
+ const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
5694
+ return new PortalInjector(userInjector || this._injector, new WeakMap([
5695
+ [BaoSnackBarRef, snackBarRef],
5696
+ [BAO_SNACK_BAR_DATA, config.data]
5697
+ ]));
5698
+ }
5699
+ }
5700
+ BaoSnackBarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: BaoSnackBarService, deps: [{ token: i1$4.Overlay }, { token: i1$3.LiveAnnouncer }, { token: i0.Injector }, { token: BaoSnackBarService, optional: true, skipSelf: true }, { token: BAO_SNACK_BAR_DEFAULT_OPTIONS }], target: i0.ɵɵFactoryTarget.Injectable });
5701
+ BaoSnackBarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: BaoSnackBarService, providedIn: 'root' });
5702
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: BaoSnackBarService, decorators: [{
5703
+ type: Injectable,
5704
+ args: [{ providedIn: 'root' }]
5705
+ }], ctorParameters: function () {
5706
+ return [{ type: i1$4.Overlay }, { type: i1$3.LiveAnnouncer }, { type: i0.Injector }, { type: BaoSnackBarService, decorators: [{
5707
+ type: Optional
5708
+ }, {
5709
+ type: SkipSelf
5710
+ }] }, { type: BaoSnackBarConfig, decorators: [{
5711
+ type: Inject,
5712
+ args: [BAO_SNACK_BAR_DEFAULT_OPTIONS]
5713
+ }] }];
5714
+ } });
5715
+
5716
+ /*
5717
+ * Copyright (c) 2023 Ville de Montreal. All rights reserved.
5718
+ * Licensed under the MIT license.
5719
+ * See LICENSE file in the project root for full license information.
5720
+ */
5721
+ const SNACKBAR_DIRECTIVES = [
5722
+ BaoSimpleSnackBarComponent,
5723
+ BaoSnackBarContainerComponent
5724
+ ];
5725
+ class BaoSnackBarModule {
5726
+ }
5727
+ BaoSnackBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: BaoSnackBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
5728
+ BaoSnackBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.3", ngImport: i0, type: BaoSnackBarModule, declarations: [BaoSimpleSnackBarComponent,
5729
+ BaoSnackBarContainerComponent], imports: [CommonModule,
5730
+ OverlayModule,
5731
+ PortalModule,
5732
+ BaoButtonModule,
5733
+ BaoIconModule], exports: [BaoSimpleSnackBarComponent,
5734
+ BaoSnackBarContainerComponent] });
5735
+ BaoSnackBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: BaoSnackBarModule, providers: [BaoSnackBarService, BaoSnackBarConfig], imports: [CommonModule,
5736
+ OverlayModule,
5737
+ PortalModule,
5738
+ BaoButtonModule,
5739
+ BaoIconModule] });
5740
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: BaoSnackBarModule, decorators: [{
5741
+ type: NgModule,
5742
+ args: [{
5743
+ imports: [
5744
+ CommonModule,
5745
+ OverlayModule,
5746
+ PortalModule,
5747
+ BaoButtonModule,
5748
+ BaoIconModule
5749
+ ],
5750
+ providers: [BaoSnackBarService, BaoSnackBarConfig],
5751
+ declarations: SNACKBAR_DIRECTIVES,
5752
+ exports: SNACKBAR_DIRECTIVES,
5753
+ entryComponents: [SNACKBAR_DIRECTIVES]
5754
+ }]
5755
+ }] });
5756
+
4979
5757
  /*
4980
5758
  * Copyright (c) 2023 Ville de Montreal. All rights reserved.
4981
5759
  * Licensed under the MIT license.
@@ -5006,9 +5784,9 @@ BaoModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.
5006
5784
  BaoModalModule,
5007
5785
  BaoHyperlinkModule,
5008
5786
  BaoDropdownMenuModule,
5009
- BaoFileModule
5787
+ BaoFileModule,
5788
+ BaoSnackBarModule
5010
5789
  // TODO: reactivate once component does not depend on global css BaoBadgeModule,
5011
- // TODO: reactivate once component does not depend on global css BaoSnackBarModule,
5012
5790
  ] });
5013
5791
  BaoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: BaoModule, imports: [BaoIconModule,
5014
5792
  BaoButtonModule,
@@ -5032,9 +5810,9 @@ BaoModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.
5032
5810
  BaoModalModule,
5033
5811
  BaoHyperlinkModule,
5034
5812
  BaoDropdownMenuModule,
5035
- BaoFileModule
5813
+ BaoFileModule,
5814
+ BaoSnackBarModule
5036
5815
  // TODO: reactivate once component does not depend on global css BaoBadgeModule,
5037
- // TODO: reactivate once component does not depend on global css BaoSnackBarModule,
5038
5816
  ] });
5039
5817
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImport: i0, type: BaoModule, decorators: [{
5040
5818
  type: NgModule,
@@ -5065,9 +5843,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
5065
5843
  BaoModalModule,
5066
5844
  BaoHyperlinkModule,
5067
5845
  BaoDropdownMenuModule,
5068
- BaoFileModule
5846
+ BaoFileModule,
5847
+ BaoSnackBarModule
5069
5848
  // TODO: reactivate once component does not depend on global css BaoBadgeModule,
5070
- // TODO: reactivate once component does not depend on global css BaoSnackBarModule,
5071
5849
  ]
5072
5850
  }]
5073
5851
  }] });
@@ -5147,9 +5925,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.3", ngImpor
5147
5925
  * See LICENSE file in the project root for full license information.
5148
5926
  */
5149
5927
 
5928
+ /*
5929
+ * Copyright (c) 2023 Ville de Montreal. All rights reserved.
5930
+ * Licensed under the MIT license.
5931
+ * See LICENSE file in the project root for full license information.
5932
+ */
5933
+
5150
5934
  /**
5151
5935
  * Generated bundle index. Do not edit.
5152
5936
  */
5153
5937
 
5154
- export { BAO_FILE_INTL_PROVIDER, BAO_FILE_INTL_PROVIDER_FACTORY, BAO_MODAL_DATA, BAO_RADIO_GROUP, BaoAlertActions, BaoAlertComponent, BaoAlertContent, BaoAlertLink, BaoAlertModule, BaoAlertTitle, BaoAvatarComponent, BaoAvatarContent, BaoAvatarModule, BaoBadgeComponent, BaoBadgeModule, BaoBreadcrumbComponent, BaoBreadcrumbModule, BaoButtonComponent, BaoButtonModule, BaoCardComponent, BaoCardContent, BaoCardHeader, BaoCardModule, BaoCardTextInterface, BaoCardTitle, BaoCheckBoxDescription, BaoCheckboxComponent, BaoCheckboxGroupComponent, BaoCheckboxModule, BaoCommonComponentsModule, BaoDropdownMenuComponent, BaoDropdownMenuDivider, BaoDropdownMenuItem, BaoDropdownMenuItemDescription, BaoDropdownMenuItemLabel, BaoDropdownMenuModule, BaoDropdownMenuSection, BaoDropdownMenuTrigger, BaoErrorTextComponent, BaoFileDropDirective, BaoFileDropzoneIntructions, BaoFileInputComponent, BaoFileIntl, BaoFileIntlEnglish, BaoFileModule, BaoFilePreviewComponent, BaoGuidingTextComponent, BaoHeaderInfoComponent, BaoHeaderInfoContent, BaoHeaderInfoModule, BaoHeaderInfoSubtitle, BaoHeaderInfoSurtitle, BaoHeaderInfoTitle, BaoHeaderInfoTitleGroupComponent, BaoHyperlinkComponent, BaoHyperlinkModule, BaoIconComponent, BaoIconModule, BaoLabelTextComponent, BaoList, BaoListItem, BaoListItemDescription, BaoListItemTitle, BaoListModule, BaoListSummary, BaoListSummaryItem, BaoModal, BaoModalBase, BaoModalClose, BaoModalContainer, BaoModalInitialConfig, BaoModalModule, BaoModalRef, BaoModule, BaoNavList, BaoRadioButtonComponent, BaoRadioButtonGroupComponent, BaoRadioDescription, BaoRadioModule, BaoSummaryComponent, BaoSummaryDescription, BaoSummaryModule, BaoTabHeader, BaoTabPanel, BaoTablistComponent, BaoTabsContainer, BaoTabsModule, BaoTagComponent, BaoTagModule, BaoTitleTextComponent, _BaoModalContainerBase, _closeModalVia, eModalDesktopWidthSize, eModalMobileWidthSize, throwBaoModalContentAlreadyAttachedError };
5938
+ export { BAO_FILE_INTL_PROVIDER, BAO_FILE_INTL_PROVIDER_FACTORY, BAO_MODAL_DATA, BAO_RADIO_GROUP, BAO_SNACK_BAR_DATA, BAO_SNACK_BAR_DEFAULT_OPTIONS, BaoAlertActions, BaoAlertComponent, BaoAlertContent, BaoAlertLink, BaoAlertModule, BaoAlertTitle, BaoAvatarComponent, BaoAvatarContent, BaoAvatarModule, BaoBadgeComponent, BaoBadgeModule, BaoBreadcrumbComponent, BaoBreadcrumbModule, BaoButtonComponent, BaoButtonModule, BaoCardComponent, BaoCardContent, BaoCardHeader, BaoCardModule, BaoCardTextInterface, BaoCardTitle, BaoCheckBoxDescription, BaoCheckboxComponent, BaoCheckboxGroupComponent, BaoCheckboxModule, BaoCommonComponentsModule, BaoDropdownMenuComponent, BaoDropdownMenuDivider, BaoDropdownMenuItem, BaoDropdownMenuItemDescription, BaoDropdownMenuItemLabel, BaoDropdownMenuModule, BaoDropdownMenuSection, BaoDropdownMenuTrigger, BaoErrorTextComponent, BaoFileDropDirective, BaoFileDropzoneIntructions, BaoFileInputComponent, BaoFileIntl, BaoFileIntlEnglish, BaoFileModule, BaoFilePreviewComponent, BaoGuidingTextComponent, BaoHeaderInfoComponent, BaoHeaderInfoContent, BaoHeaderInfoModule, BaoHeaderInfoSubtitle, BaoHeaderInfoSurtitle, BaoHeaderInfoTitle, BaoHeaderInfoTitleGroupComponent, BaoHyperlinkComponent, BaoHyperlinkModule, BaoIconComponent, BaoIconModule, BaoLabelTextComponent, BaoList, BaoListItem, BaoListItemDescription, BaoListItemTitle, BaoListModule, BaoListSummary, BaoListSummaryItem, BaoModal, BaoModalBase, BaoModalClose, BaoModalContainer, BaoModalInitialConfig, BaoModalModule, BaoModalRef, BaoModule, BaoNavList, BaoRadioButtonComponent, BaoRadioButtonGroupComponent, BaoRadioDescription, BaoRadioModule, BaoSimpleSnackBarComponent, BaoSnackBarConfig, BaoSnackBarContainerComponent, BaoSnackBarModule, BaoSnackBarRef, BaoSnackBarService, BaoSummaryComponent, BaoSummaryDescription, BaoSummaryModule, BaoTabHeader, BaoTabPanel, BaoTablistComponent, BaoTabsContainer, BaoTabsModule, BaoTagComponent, BaoTagModule, BaoTitleTextComponent, _BaoModalContainerBase, _closeModalVia, baoFactory, eModalDesktopWidthSize, eModalMobileWidthSize, throwBaoModalContentAlreadyAttachedError };
5155
5939
  //# sourceMappingURL=villedemontreal-angular-ui.mjs.map