@angular/material 19.2.0-next.0 → 19.2.0-next.2
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/autocomplete/index.d.ts +2 -4
- package/bottom-sheet/index.d.ts +17 -6
- package/button/_button-base.scss +3 -3
- package/checkbox/_checkbox-common.scss +10 -10
- package/core/index.d.ts +1 -0
- package/datepicker/index.d.ts +11 -8
- package/dialog/index.d.ts +5 -1
- package/fesm2022/autocomplete.mjs +19 -45
- package/fesm2022/autocomplete.mjs.map +1 -1
- package/fesm2022/badge.mjs +10 -10
- package/fesm2022/badge.mjs.map +1 -1
- package/fesm2022/bottom-sheet/testing.mjs +1 -1
- package/fesm2022/bottom-sheet/testing.mjs.map +1 -1
- package/fesm2022/bottom-sheet.mjs +79 -50
- package/fesm2022/bottom-sheet.mjs.map +1 -1
- package/fesm2022/button-toggle.mjs +11 -11
- package/fesm2022/button-toggle.mjs.map +1 -1
- package/fesm2022/button.mjs +42 -42
- package/fesm2022/button.mjs.map +1 -1
- package/fesm2022/card.mjs +46 -46
- package/fesm2022/card.mjs.map +1 -1
- package/fesm2022/checkbox.mjs +16 -16
- package/fesm2022/checkbox.mjs.map +1 -1
- package/fesm2022/chips.mjs +45 -46
- package/fesm2022/chips.mjs.map +1 -1
- package/fesm2022/core.mjs +74 -76
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/datepicker.mjs +181 -160
- package/fesm2022/datepicker.mjs.map +1 -1
- package/fesm2022/dialog.mjs +31 -27
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/divider.mjs +7 -7
- package/fesm2022/divider.mjs.map +1 -1
- package/fesm2022/expansion.mjs +26 -26
- package/fesm2022/expansion.mjs.map +1 -1
- package/fesm2022/form-field.mjs +69 -62
- package/fesm2022/form-field.mjs.map +1 -1
- package/fesm2022/grid-list.mjs +22 -22
- package/fesm2022/grid-list.mjs.map +1 -1
- package/fesm2022/icon/testing.mjs +7 -7
- package/fesm2022/icon/testing.mjs.map +1 -1
- package/fesm2022/icon.mjs +10 -10
- package/fesm2022/icon.mjs.map +1 -1
- package/fesm2022/input.mjs +7 -7
- package/fesm2022/input.mjs.map +1 -1
- package/fesm2022/list.mjs +49 -49
- package/fesm2022/list.mjs.map +1 -1
- package/fesm2022/menu.mjs +27 -30
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/paginator.mjs +10 -10
- package/fesm2022/paginator.mjs.map +1 -1
- package/fesm2022/progress-bar.mjs +7 -7
- package/fesm2022/progress-bar.mjs.map +1 -1
- package/fesm2022/progress-spinner.mjs +7 -7
- package/fesm2022/progress-spinner.mjs.map +1 -1
- package/fesm2022/radio.mjs +10 -10
- package/fesm2022/radio.mjs.map +1 -1
- package/fesm2022/select.mjs +106 -69
- package/fesm2022/select.mjs.map +1 -1
- package/fesm2022/sidenav.mjs +22 -22
- package/fesm2022/sidenav.mjs.map +1 -1
- package/fesm2022/slide-toggle.mjs +14 -14
- package/fesm2022/slide-toggle.mjs.map +1 -1
- package/fesm2022/slider.mjs +16 -16
- package/fesm2022/slider.mjs.map +1 -1
- package/fesm2022/snack-bar.mjs +134 -91
- package/fesm2022/snack-bar.mjs.map +1 -1
- package/fesm2022/sort.mjs +13 -13
- package/fesm2022/sort.mjs.map +1 -1
- package/fesm2022/stepper.mjs +31 -31
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +55 -55
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/tabs.mjs +43 -43
- package/fesm2022/tabs.mjs.map +1 -1
- package/fesm2022/timepicker.mjs +36 -43
- package/fesm2022/timepicker.mjs.map +1 -1
- package/fesm2022/toolbar.mjs +10 -10
- package/fesm2022/toolbar.mjs.map +1 -1
- package/fesm2022/tooltip.mjs +10 -10
- package/fesm2022/tooltip.mjs.map +1 -1
- package/fesm2022/tree.mjs +25 -25
- package/fesm2022/tree.mjs.map +1 -1
- package/form-field/_form-field-subscript.scss +18 -0
- package/form-field/_mdc-text-field-structure.scss +6 -3
- package/form-field/index.d.ts +5 -4
- package/menu/index.d.ts +1 -5
- package/package.json +2 -2
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/index.mjs +1 -1
- package/select/index.d.ts +10 -8
- package/snack-bar/index.d.ts +8 -6
- package/timepicker/index.d.ts +4 -1
package/fesm2022/snack-bar.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Directive, inject, Component, ViewEncapsulation, ChangeDetectionStrategy, NgZone, ElementRef, ChangeDetectorRef, ViewChild, Injector, TemplateRef, Injectable, NgModule } from '@angular/core';
|
|
2
|
+
import { InjectionToken, Directive, inject, Component, ViewEncapsulation, ChangeDetectionStrategy, NgZone, ElementRef, ChangeDetectorRef, ANIMATION_MODULE_TYPE, afterRender, ViewChild, Injector, TemplateRef, Injectable, NgModule } from '@angular/core';
|
|
3
3
|
import { MatButton, MatButtonModule } from '@angular/material/button';
|
|
4
|
-
import { Subject } from 'rxjs';
|
|
4
|
+
import { Subject, of } from 'rxjs';
|
|
5
5
|
import { DOCUMENT } from '@angular/common';
|
|
6
|
-
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
7
6
|
import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, TemplatePortal, PortalModule } from '@angular/cdk/portal';
|
|
8
7
|
import { _IdGenerator, LiveAnnouncer } from '@angular/cdk/a11y';
|
|
9
8
|
import { Platform } from '@angular/cdk/platform';
|
|
9
|
+
import { take, takeUntil } from 'rxjs/operators';
|
|
10
10
|
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
|
|
11
11
|
import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
|
|
12
|
-
import { takeUntil } from 'rxjs/operators';
|
|
13
12
|
import { MatCommonModule } from '@angular/material/core';
|
|
13
|
+
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
14
14
|
|
|
15
15
|
/** Maximum amount of milliseconds that can be passed into setTimeout. */
|
|
16
16
|
const MAX_TIMEOUT = Math.pow(2, 31) - 1;
|
|
@@ -140,10 +140,10 @@ class MatSnackBarConfig {
|
|
|
140
140
|
|
|
141
141
|
/** Directive that should be applied to the text element to be rendered in the snack bar. */
|
|
142
142
|
class MatSnackBarLabel {
|
|
143
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
144
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.
|
|
143
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarLabel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
144
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.3", type: MatSnackBarLabel, isStandalone: true, selector: "[matSnackBarLabel]", host: { classAttribute: "mat-mdc-snack-bar-label mdc-snackbar__label" }, ngImport: i0 });
|
|
145
145
|
}
|
|
146
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarLabel, decorators: [{
|
|
147
147
|
type: Directive,
|
|
148
148
|
args: [{
|
|
149
149
|
selector: `[matSnackBarLabel]`,
|
|
@@ -154,10 +154,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-rc.0", ng
|
|
|
154
154
|
}] });
|
|
155
155
|
/** Directive that should be applied to the element containing the snack bar's action buttons. */
|
|
156
156
|
class MatSnackBarActions {
|
|
157
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
158
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.
|
|
157
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarActions, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
158
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.3", type: MatSnackBarActions, isStandalone: true, selector: "[matSnackBarActions]", host: { classAttribute: "mat-mdc-snack-bar-actions mdc-snackbar__actions" }, ngImport: i0 });
|
|
159
159
|
}
|
|
160
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
160
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarActions, decorators: [{
|
|
161
161
|
type: Directive,
|
|
162
162
|
args: [{
|
|
163
163
|
selector: `[matSnackBarActions]`,
|
|
@@ -168,10 +168,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-rc.0", ng
|
|
|
168
168
|
}] });
|
|
169
169
|
/** Directive that should be applied to each of the snack bar's action buttons. */
|
|
170
170
|
class MatSnackBarAction {
|
|
171
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
172
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.
|
|
171
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarAction, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
172
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.3", type: MatSnackBarAction, isStandalone: true, selector: "[matSnackBarAction]", host: { classAttribute: "mat-mdc-snack-bar-action mdc-snackbar__action" }, ngImport: i0 });
|
|
173
173
|
}
|
|
174
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarAction, decorators: [{
|
|
175
175
|
type: Directive,
|
|
176
176
|
args: [{
|
|
177
177
|
selector: `[matSnackBarAction]`,
|
|
@@ -193,38 +193,18 @@ class SimpleSnackBar {
|
|
|
193
193
|
get hasAction() {
|
|
194
194
|
return !!this.data.action;
|
|
195
195
|
}
|
|
196
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
197
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.
|
|
196
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: SimpleSnackBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
197
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.3", type: SimpleSnackBar, isStandalone: true, selector: "simple-snack-bar", host: { classAttribute: "mat-mdc-simple-snack-bar" }, exportAs: ["matSnackBar"], ngImport: i0, template: "<div matSnackBarLabel>\n {{data.message}}\n</div>\n\n@if (hasAction) {\n <div matSnackBarActions>\n <button mat-button matSnackBarAction (click)=\"action()\">\n {{data.action}}\n </button>\n </div>\n}\n", styles: [".mat-mdc-simple-snack-bar{display:flex}"], dependencies: [{ kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: MatSnackBarLabel, selector: "[matSnackBarLabel]" }, { kind: "directive", type: MatSnackBarActions, selector: "[matSnackBarActions]" }, { kind: "directive", type: MatSnackBarAction, selector: "[matSnackBarAction]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
198
198
|
}
|
|
199
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
199
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: SimpleSnackBar, decorators: [{
|
|
200
200
|
type: Component,
|
|
201
201
|
args: [{ selector: 'simple-snack-bar', exportAs: 'matSnackBar', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [MatButton, MatSnackBarLabel, MatSnackBarActions, MatSnackBarAction], host: {
|
|
202
202
|
'class': 'mat-mdc-simple-snack-bar',
|
|
203
203
|
}, template: "<div matSnackBarLabel>\n {{data.message}}\n</div>\n\n@if (hasAction) {\n <div matSnackBarActions>\n <button mat-button matSnackBarAction (click)=\"action()\">\n {{data.action}}\n </button>\n </div>\n}\n", styles: [".mat-mdc-simple-snack-bar{display:flex}"] }]
|
|
204
204
|
}], ctorParameters: () => [] });
|
|
205
205
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
* @docs-private
|
|
209
|
-
*/
|
|
210
|
-
const matSnackBarAnimations = {
|
|
211
|
-
/** Animation that shows and hides a snack bar. */
|
|
212
|
-
snackBarState: trigger('state', [
|
|
213
|
-
state('void, hidden', style({
|
|
214
|
-
transform: 'scale(0.8)',
|
|
215
|
-
opacity: 0,
|
|
216
|
-
})),
|
|
217
|
-
state('visible', style({
|
|
218
|
-
transform: 'scale(1)',
|
|
219
|
-
opacity: 1,
|
|
220
|
-
})),
|
|
221
|
-
transition('* => visible', animate('150ms cubic-bezier(0, 0, 0.2, 1)')),
|
|
222
|
-
transition('* => void, * => hidden', animate('75ms cubic-bezier(0.4, 0.0, 1, 1)', style({
|
|
223
|
-
opacity: 0,
|
|
224
|
-
}))),
|
|
225
|
-
]),
|
|
226
|
-
};
|
|
227
|
-
|
|
206
|
+
const ENTER_ANIMATION = '_mat-snack-bar-enter';
|
|
207
|
+
const EXIT_ANIMATION = '_mat-snack-bar-exit';
|
|
228
208
|
/**
|
|
229
209
|
* Internal component that wraps user-provided snack bar content.
|
|
230
210
|
* @docs-private
|
|
@@ -234,9 +214,14 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
234
214
|
_elementRef = inject(ElementRef);
|
|
235
215
|
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
236
216
|
_platform = inject(Platform);
|
|
217
|
+
_rendersRef;
|
|
218
|
+
_animationsDisabled = inject(ANIMATION_MODULE_TYPE, { optional: true }) === 'NoopAnimations';
|
|
237
219
|
snackBarConfig = inject(MatSnackBarConfig);
|
|
238
220
|
_document = inject(DOCUMENT);
|
|
239
221
|
_trackedModals = new Set();
|
|
222
|
+
_enterFallback;
|
|
223
|
+
_exitFallback;
|
|
224
|
+
_renders = new Subject();
|
|
240
225
|
/** The number of milliseconds to wait before announcing the snack bar's content. */
|
|
241
226
|
_announceDelay = 150;
|
|
242
227
|
/** The timeout for announcing the snack bar's content. */
|
|
@@ -292,6 +277,10 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
292
277
|
this._role = 'alert';
|
|
293
278
|
}
|
|
294
279
|
}
|
|
280
|
+
// Note: ideally we'd just do an `afterNextRender` in the places where we need to delay
|
|
281
|
+
// something, however in some cases (TestBed teardown) the injector can be destroyed at an
|
|
282
|
+
// unexpected time, causing the `afterRender` to fail.
|
|
283
|
+
this._rendersRef = afterRender(() => this._renders.next(), { manualCleanup: true });
|
|
295
284
|
}
|
|
296
285
|
/** Attach a component portal as content to this snack bar container. */
|
|
297
286
|
attachComponentPortal(portal) {
|
|
@@ -319,18 +308,15 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
319
308
|
return result;
|
|
320
309
|
};
|
|
321
310
|
/** Handle end of animations, updating the state of the snackbar. */
|
|
322
|
-
onAnimationEnd(
|
|
323
|
-
|
|
324
|
-
if ((toState === 'void' && fromState !== 'void') || toState === 'hidden') {
|
|
311
|
+
onAnimationEnd(animationName) {
|
|
312
|
+
if (animationName === EXIT_ANIMATION) {
|
|
325
313
|
this._completeExit();
|
|
326
314
|
}
|
|
327
|
-
if (
|
|
328
|
-
|
|
329
|
-
// because it can cause a memory leak.
|
|
330
|
-
const onEnter = this._onEnter;
|
|
315
|
+
else if (animationName === ENTER_ANIMATION) {
|
|
316
|
+
clearTimeout(this._enterFallback);
|
|
331
317
|
this._ngZone.run(() => {
|
|
332
|
-
|
|
333
|
-
|
|
318
|
+
this._onEnter.next();
|
|
319
|
+
this._onEnter.complete();
|
|
334
320
|
});
|
|
335
321
|
}
|
|
336
322
|
}
|
|
@@ -343,10 +329,27 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
343
329
|
this._changeDetectorRef.markForCheck();
|
|
344
330
|
this._changeDetectorRef.detectChanges();
|
|
345
331
|
this._screenReaderAnnounce();
|
|
332
|
+
if (this._animationsDisabled) {
|
|
333
|
+
this._renders.pipe(take(1)).subscribe(() => {
|
|
334
|
+
this._ngZone.run(() => queueMicrotask(() => this.onAnimationEnd(ENTER_ANIMATION)));
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
clearTimeout(this._enterFallback);
|
|
339
|
+
this._enterFallback = setTimeout(() => {
|
|
340
|
+
// The snack bar will stay invisible if it fails to animate. Add a fallback class so it
|
|
341
|
+
// becomes visible. This can happen in some apps that do `* {animation: none !important}`.
|
|
342
|
+
this._elementRef.nativeElement.classList.add('mat-snack-bar-fallback-visible');
|
|
343
|
+
this.onAnimationEnd(ENTER_ANIMATION);
|
|
344
|
+
}, 200);
|
|
345
|
+
}
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
/** Begin animation of the snack bar exiting from view. */
|
|
349
349
|
exit() {
|
|
350
|
+
if (this._destroyed) {
|
|
351
|
+
return of(undefined);
|
|
352
|
+
}
|
|
350
353
|
// It's common for snack bars to be opened by random outside calls like HTTP requests or
|
|
351
354
|
// errors. Run inside the NgZone to ensure that it functions correctly.
|
|
352
355
|
this._ngZone.run(() => {
|
|
@@ -362,6 +365,15 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
362
365
|
// If the snack bar hasn't been announced by the time it exits it wouldn't have been open
|
|
363
366
|
// long enough to visually read it either, so clear the timeout for announcing.
|
|
364
367
|
clearTimeout(this._announceTimeoutId);
|
|
368
|
+
if (this._animationsDisabled) {
|
|
369
|
+
this._renders.pipe(take(1)).subscribe(() => {
|
|
370
|
+
this._ngZone.run(() => queueMicrotask(() => this.onAnimationEnd(EXIT_ANIMATION)));
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
clearTimeout(this._exitFallback);
|
|
375
|
+
this._exitFallback = setTimeout(() => this.onAnimationEnd(EXIT_ANIMATION), 200);
|
|
376
|
+
}
|
|
365
377
|
});
|
|
366
378
|
return this._onExit;
|
|
367
379
|
}
|
|
@@ -370,12 +382,11 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
370
382
|
this._destroyed = true;
|
|
371
383
|
this._clearFromModals();
|
|
372
384
|
this._completeExit();
|
|
385
|
+
this._renders.complete();
|
|
386
|
+
this._rendersRef.destroy();
|
|
373
387
|
}
|
|
374
|
-
/**
|
|
375
|
-
* Removes the element in a microtask. Helps prevent errors where we end up
|
|
376
|
-
* removing an element which is in the middle of an animation.
|
|
377
|
-
*/
|
|
378
388
|
_completeExit() {
|
|
389
|
+
clearTimeout(this._exitFallback);
|
|
379
390
|
queueMicrotask(() => {
|
|
380
391
|
this._onExit.next();
|
|
381
392
|
this._onExit.complete();
|
|
@@ -458,40 +469,48 @@ class MatSnackBarContainer extends BasePortalOutlet {
|
|
|
458
469
|
* announce it.
|
|
459
470
|
*/
|
|
460
471
|
_screenReaderAnnounce() {
|
|
461
|
-
if (
|
|
462
|
-
|
|
463
|
-
this._announceTimeoutId = setTimeout(() => {
|
|
464
|
-
const inertElement = this._elementRef.nativeElement.querySelector('[aria-hidden]');
|
|
465
|
-
const liveElement = this._elementRef.nativeElement.querySelector('[aria-live]');
|
|
466
|
-
if (inertElement && liveElement) {
|
|
467
|
-
// If an element in the snack bar content is focused before being moved
|
|
468
|
-
// track it and restore focus after moving to the live region.
|
|
469
|
-
let focusedElement = null;
|
|
470
|
-
if (this._platform.isBrowser &&
|
|
471
|
-
document.activeElement instanceof HTMLElement &&
|
|
472
|
-
inertElement.contains(document.activeElement)) {
|
|
473
|
-
focusedElement = document.activeElement;
|
|
474
|
-
}
|
|
475
|
-
inertElement.removeAttribute('aria-hidden');
|
|
476
|
-
liveElement.appendChild(inertElement);
|
|
477
|
-
focusedElement?.focus();
|
|
478
|
-
this._onAnnounce.next();
|
|
479
|
-
this._onAnnounce.complete();
|
|
480
|
-
}
|
|
481
|
-
}, this._announceDelay);
|
|
482
|
-
});
|
|
472
|
+
if (this._announceTimeoutId) {
|
|
473
|
+
return;
|
|
483
474
|
}
|
|
475
|
+
this._ngZone.runOutsideAngular(() => {
|
|
476
|
+
this._announceTimeoutId = setTimeout(() => {
|
|
477
|
+
if (this._destroyed) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
const element = this._elementRef.nativeElement;
|
|
481
|
+
const inertElement = element.querySelector('[aria-hidden]');
|
|
482
|
+
const liveElement = element.querySelector('[aria-live]');
|
|
483
|
+
if (inertElement && liveElement) {
|
|
484
|
+
// If an element in the snack bar content is focused before being moved
|
|
485
|
+
// track it and restore focus after moving to the live region.
|
|
486
|
+
let focusedElement = null;
|
|
487
|
+
if (this._platform.isBrowser &&
|
|
488
|
+
document.activeElement instanceof HTMLElement &&
|
|
489
|
+
inertElement.contains(document.activeElement)) {
|
|
490
|
+
focusedElement = document.activeElement;
|
|
491
|
+
}
|
|
492
|
+
inertElement.removeAttribute('aria-hidden');
|
|
493
|
+
liveElement.appendChild(inertElement);
|
|
494
|
+
focusedElement?.focus();
|
|
495
|
+
this._onAnnounce.next();
|
|
496
|
+
this._onAnnounce.complete();
|
|
497
|
+
}
|
|
498
|
+
}, this._announceDelay);
|
|
499
|
+
});
|
|
484
500
|
}
|
|
485
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
486
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.
|
|
501
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarContainer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
502
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.3", type: MatSnackBarContainer, isStandalone: true, selector: "mat-snack-bar-container", host: { listeners: { "animationend": "onAnimationEnd($event.animationName)", "animationcancel": "onAnimationEnd($event.animationName)" }, properties: { "class.mat-snack-bar-container-enter": "_animationState === \"visible\"", "class.mat-snack-bar-container-exit": "_animationState === \"hidden\"", "class.mat-snack-bar-container-animations-enabled": "!_animationsDisabled" }, classAttribute: "mdc-snackbar mat-mdc-snack-bar-container" }, viewQueries: [{ propertyName: "_portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }, { propertyName: "_label", first: true, predicate: ["label"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"mdc-snackbar__surface mat-mdc-snackbar-surface\">\n <!--\n This outer label wrapper will have the class `mdc-snackbar__label` applied if\n the attached template/component does not contain it.\n -->\n <div class=\"mat-mdc-snack-bar-label\" #label>\n <!-- Initialy holds the snack bar content, will be empty after announcing to screen readers. -->\n <div aria-hidden=\"true\">\n <ng-template cdkPortalOutlet />\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 [attr.aria-live]=\"_live\" [attr.role]=\"_role\" [attr.id]=\"_liveElementId\"></div>\n </div>\n</div>\n", styles: ["@keyframes _mat-snack-bar-enter{from{transform:scale(0.8);opacity:0}to{transform:scale(1);opacity:1}}@keyframes _mat-snack-bar-exit{from{opacity:1}to{opacity:0}}.mat-mdc-snack-bar-container{display:flex;align-items:center;justify-content:center;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0);margin:8px}.mat-mdc-snack-bar-handset .mat-mdc-snack-bar-container{width:100vw}.mat-snack-bar-container-animations-enabled{opacity:0}.mat-snack-bar-container-animations-enabled.mat-snack-bar-fallback-visible{opacity:1}.mat-snack-bar-container-animations-enabled.mat-snack-bar-container-enter{animation:_mat-snack-bar-enter 150ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-snack-bar-container-animations-enabled.mat-snack-bar-container-exit{animation:_mat-snack-bar-exit 75ms cubic-bezier(0.4, 0, 1, 1) forwards}.mat-mdc-snackbar-surface{box-shadow:0px 3px 5px -1px rgba(0, 0, 0, 0.2), 0px 6px 10px 0px rgba(0, 0, 0, 0.14), 0px 1px 18px 0px rgba(0, 0, 0, 0.12);display:flex;align-items:center;justify-content:flex-start;box-sizing:border-box;padding-left:0;padding-right:8px}[dir=rtl] .mat-mdc-snackbar-surface{padding-right:0;padding-left:8px}.mat-mdc-snack-bar-container .mat-mdc-snackbar-surface{min-width:344px;max-width:672px}.mat-mdc-snack-bar-handset .mat-mdc-snackbar-surface{width:100%;min-width:0}@media(forced-colors: active){.mat-mdc-snackbar-surface{outline:solid 1px}}.mat-mdc-snack-bar-container .mat-mdc-snackbar-surface{color:var(--mdc-snackbar-supporting-text-color, var(--mat-sys-inverse-on-surface));border-radius:var(--mdc-snackbar-container-shape, var(--mat-sys-corner-extra-small));background-color:var(--mdc-snackbar-container-color, var(--mat-sys-inverse-surface))}.mdc-snackbar__label{width:100%;flex-grow:1;box-sizing:border-box;margin:0;padding:14px 8px 14px 16px}[dir=rtl] .mdc-snackbar__label{padding-left:8px;padding-right:16px}.mat-mdc-snack-bar-container .mdc-snackbar__label{font-family:var(--mdc-snackbar-supporting-text-font, var(--mat-sys-body-medium-font));font-size:var(--mdc-snackbar-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mdc-snackbar-supporting-text-weight, var(--mat-sys-body-medium-weight));line-height:var(--mdc-snackbar-supporting-text-line-height, var(--mat-sys-body-medium-line-height))}.mat-mdc-snack-bar-actions{display:flex;flex-shrink:0;align-items:center;box-sizing:border-box}.mat-mdc-snack-bar-handset,.mat-mdc-snack-bar-container,.mat-mdc-snack-bar-label{flex:1 1 auto}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled).mat-unthemed{color:var(--mat-snack-bar-button-color, var(--mat-sys-inverse-primary))}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled){--mat-text-button-state-layer-color:currentColor;--mat-text-button-ripple-color:currentColor}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled) .mat-ripple-element{opacity:.1}"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
|
|
487
503
|
}
|
|
488
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
504
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarContainer, decorators: [{
|
|
489
505
|
type: Component,
|
|
490
|
-
args: [{ selector: 'mat-snack-bar-container', changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.None,
|
|
506
|
+
args: [{ selector: 'mat-snack-bar-container', changeDetection: ChangeDetectionStrategy.Default, encapsulation: ViewEncapsulation.None, imports: [CdkPortalOutlet], host: {
|
|
491
507
|
'class': 'mdc-snackbar mat-mdc-snack-bar-container',
|
|
492
|
-
'[
|
|
493
|
-
'
|
|
494
|
-
|
|
508
|
+
'[class.mat-snack-bar-container-enter]': '_animationState === "visible"',
|
|
509
|
+
'[class.mat-snack-bar-container-exit]': '_animationState === "hidden"',
|
|
510
|
+
'[class.mat-snack-bar-container-animations-enabled]': '!_animationsDisabled',
|
|
511
|
+
'(animationend)': 'onAnimationEnd($event.animationName)',
|
|
512
|
+
'(animationcancel)': 'onAnimationEnd($event.animationName)',
|
|
513
|
+
}, template: "<div class=\"mdc-snackbar__surface mat-mdc-snackbar-surface\">\n <!--\n This outer label wrapper will have the class `mdc-snackbar__label` applied if\n the attached template/component does not contain it.\n -->\n <div class=\"mat-mdc-snack-bar-label\" #label>\n <!-- Initialy holds the snack bar content, will be empty after announcing to screen readers. -->\n <div aria-hidden=\"true\">\n <ng-template cdkPortalOutlet />\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 [attr.aria-live]=\"_live\" [attr.role]=\"_role\" [attr.id]=\"_liveElementId\"></div>\n </div>\n</div>\n", styles: ["@keyframes _mat-snack-bar-enter{from{transform:scale(0.8);opacity:0}to{transform:scale(1);opacity:1}}@keyframes _mat-snack-bar-exit{from{opacity:1}to{opacity:0}}.mat-mdc-snack-bar-container{display:flex;align-items:center;justify-content:center;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0);margin:8px}.mat-mdc-snack-bar-handset .mat-mdc-snack-bar-container{width:100vw}.mat-snack-bar-container-animations-enabled{opacity:0}.mat-snack-bar-container-animations-enabled.mat-snack-bar-fallback-visible{opacity:1}.mat-snack-bar-container-animations-enabled.mat-snack-bar-container-enter{animation:_mat-snack-bar-enter 150ms cubic-bezier(0, 0, 0.2, 1) forwards}.mat-snack-bar-container-animations-enabled.mat-snack-bar-container-exit{animation:_mat-snack-bar-exit 75ms cubic-bezier(0.4, 0, 1, 1) forwards}.mat-mdc-snackbar-surface{box-shadow:0px 3px 5px -1px rgba(0, 0, 0, 0.2), 0px 6px 10px 0px rgba(0, 0, 0, 0.14), 0px 1px 18px 0px rgba(0, 0, 0, 0.12);display:flex;align-items:center;justify-content:flex-start;box-sizing:border-box;padding-left:0;padding-right:8px}[dir=rtl] .mat-mdc-snackbar-surface{padding-right:0;padding-left:8px}.mat-mdc-snack-bar-container .mat-mdc-snackbar-surface{min-width:344px;max-width:672px}.mat-mdc-snack-bar-handset .mat-mdc-snackbar-surface{width:100%;min-width:0}@media(forced-colors: active){.mat-mdc-snackbar-surface{outline:solid 1px}}.mat-mdc-snack-bar-container .mat-mdc-snackbar-surface{color:var(--mdc-snackbar-supporting-text-color, var(--mat-sys-inverse-on-surface));border-radius:var(--mdc-snackbar-container-shape, var(--mat-sys-corner-extra-small));background-color:var(--mdc-snackbar-container-color, var(--mat-sys-inverse-surface))}.mdc-snackbar__label{width:100%;flex-grow:1;box-sizing:border-box;margin:0;padding:14px 8px 14px 16px}[dir=rtl] .mdc-snackbar__label{padding-left:8px;padding-right:16px}.mat-mdc-snack-bar-container .mdc-snackbar__label{font-family:var(--mdc-snackbar-supporting-text-font, var(--mat-sys-body-medium-font));font-size:var(--mdc-snackbar-supporting-text-size, var(--mat-sys-body-medium-size));font-weight:var(--mdc-snackbar-supporting-text-weight, var(--mat-sys-body-medium-weight));line-height:var(--mdc-snackbar-supporting-text-line-height, var(--mat-sys-body-medium-line-height))}.mat-mdc-snack-bar-actions{display:flex;flex-shrink:0;align-items:center;box-sizing:border-box}.mat-mdc-snack-bar-handset,.mat-mdc-snack-bar-container,.mat-mdc-snack-bar-label{flex:1 1 auto}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled).mat-unthemed{color:var(--mat-snack-bar-button-color, var(--mat-sys-inverse-primary))}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled){--mat-text-button-state-layer-color:currentColor;--mat-text-button-ripple-color:currentColor}.mat-mdc-snack-bar-container .mat-mdc-button.mat-mdc-snack-bar-action:not(:disabled) .mat-ripple-element{opacity:.1}"] }]
|
|
495
514
|
}], ctorParameters: () => [], propDecorators: { _portalOutlet: [{
|
|
496
515
|
type: ViewChild,
|
|
497
516
|
args: [CdkPortalOutlet, { static: true }]
|
|
@@ -664,6 +683,10 @@ class MatSnackBar {
|
|
|
664
683
|
this._live.clear();
|
|
665
684
|
}
|
|
666
685
|
});
|
|
686
|
+
// If a dismiss timeout is provided, set up dismiss based on after the snackbar is opened.
|
|
687
|
+
if (config.duration && config.duration > 0) {
|
|
688
|
+
snackBarRef.afterOpened().subscribe(() => snackBarRef._dismissAfter(config.duration));
|
|
689
|
+
}
|
|
667
690
|
if (this._openedSnackBarRef) {
|
|
668
691
|
// If a snack bar is already in view, dismiss it and enter the
|
|
669
692
|
// new snack bar after exit animation is complete.
|
|
@@ -676,10 +699,6 @@ class MatSnackBar {
|
|
|
676
699
|
// If no snack bar is in view, enter the new snack bar.
|
|
677
700
|
snackBarRef.containerInstance.enter();
|
|
678
701
|
}
|
|
679
|
-
// If a dismiss timeout is provided, set up dismiss based on after the snackbar is opened.
|
|
680
|
-
if (config.duration && config.duration > 0) {
|
|
681
|
-
snackBarRef.afterOpened().subscribe(() => snackBarRef._dismissAfter(config.duration));
|
|
682
|
-
}
|
|
683
702
|
}
|
|
684
703
|
/**
|
|
685
704
|
* Creates a new overlay and places it in the correct location.
|
|
@@ -729,29 +748,29 @@ class MatSnackBar {
|
|
|
729
748
|
],
|
|
730
749
|
});
|
|
731
750
|
}
|
|
732
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
733
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.
|
|
751
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBar, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
752
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBar, providedIn: 'root' });
|
|
734
753
|
}
|
|
735
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
754
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBar, decorators: [{
|
|
736
755
|
type: Injectable,
|
|
737
756
|
args: [{ providedIn: 'root' }]
|
|
738
757
|
}], ctorParameters: () => [] });
|
|
739
758
|
|
|
740
759
|
const DIRECTIVES = [MatSnackBarContainer, MatSnackBarLabel, MatSnackBarActions, MatSnackBarAction];
|
|
741
760
|
class MatSnackBarModule {
|
|
742
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.
|
|
743
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.
|
|
761
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
762
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarModule, imports: [OverlayModule,
|
|
744
763
|
PortalModule,
|
|
745
764
|
MatButtonModule,
|
|
746
765
|
MatCommonModule,
|
|
747
766
|
SimpleSnackBar, MatSnackBarContainer, MatSnackBarLabel, MatSnackBarActions, MatSnackBarAction], exports: [MatCommonModule, MatSnackBarContainer, MatSnackBarLabel, MatSnackBarActions, MatSnackBarAction] });
|
|
748
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.
|
|
767
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarModule, providers: [MatSnackBar], imports: [OverlayModule,
|
|
749
768
|
PortalModule,
|
|
750
769
|
MatButtonModule,
|
|
751
770
|
MatCommonModule,
|
|
752
771
|
SimpleSnackBar, MatCommonModule] });
|
|
753
772
|
}
|
|
754
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.
|
|
773
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.3", ngImport: i0, type: MatSnackBarModule, decorators: [{
|
|
755
774
|
type: NgModule,
|
|
756
775
|
args: [{
|
|
757
776
|
imports: [
|
|
@@ -767,6 +786,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0-rc.0", ng
|
|
|
767
786
|
}]
|
|
768
787
|
}] });
|
|
769
788
|
|
|
789
|
+
/**
|
|
790
|
+
* Animations used by the Material snack bar.
|
|
791
|
+
* @docs-private
|
|
792
|
+
* @deprecated No longer used, will be removed.
|
|
793
|
+
* @breaking-change 21.0.0
|
|
794
|
+
*/
|
|
795
|
+
const matSnackBarAnimations = {
|
|
796
|
+
/** Animation that shows and hides a snack bar. */
|
|
797
|
+
snackBarState: trigger('state', [
|
|
798
|
+
state('void, hidden', style({
|
|
799
|
+
transform: 'scale(0.8)',
|
|
800
|
+
opacity: 0,
|
|
801
|
+
})),
|
|
802
|
+
state('visible', style({
|
|
803
|
+
transform: 'scale(1)',
|
|
804
|
+
opacity: 1,
|
|
805
|
+
})),
|
|
806
|
+
transition('* => visible', animate('150ms cubic-bezier(0, 0, 0.2, 1)')),
|
|
807
|
+
transition('* => void, * => hidden', animate('75ms cubic-bezier(0.4, 0.0, 1, 1)', style({
|
|
808
|
+
opacity: 0,
|
|
809
|
+
}))),
|
|
810
|
+
]),
|
|
811
|
+
};
|
|
812
|
+
|
|
770
813
|
/**
|
|
771
814
|
* Generated bundle index. Do not edit.
|
|
772
815
|
*/
|