@angular/material 19.0.3 → 19.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/autocomplete/index.d.ts +6 -6
  2. package/button/index.d.ts +2 -0
  3. package/chips/index.d.ts +1 -1
  4. package/core/theming/_theming.scss +1 -1
  5. package/expansion/index.d.ts +2 -0
  6. package/fesm2022/autocomplete.mjs +41 -37
  7. package/fesm2022/autocomplete.mjs.map +1 -1
  8. package/fesm2022/button.mjs +5 -3
  9. package/fesm2022/button.mjs.map +1 -1
  10. package/fesm2022/chips.mjs.map +1 -1
  11. package/fesm2022/core.mjs +1 -1
  12. package/fesm2022/core.mjs.map +1 -1
  13. package/fesm2022/expansion.mjs +5 -3
  14. package/fesm2022/expansion.mjs.map +1 -1
  15. package/fesm2022/form-field.mjs +5 -3
  16. package/fesm2022/form-field.mjs.map +1 -1
  17. package/fesm2022/input.mjs +19 -25
  18. package/fesm2022/input.mjs.map +1 -1
  19. package/fesm2022/list.mjs +9 -6
  20. package/fesm2022/list.mjs.map +1 -1
  21. package/fesm2022/menu.mjs +163 -118
  22. package/fesm2022/menu.mjs.map +1 -1
  23. package/fesm2022/progress-bar.mjs +5 -3
  24. package/fesm2022/progress-bar.mjs.map +1 -1
  25. package/fesm2022/radio.mjs +5 -4
  26. package/fesm2022/radio.mjs.map +1 -1
  27. package/fesm2022/select.mjs.map +1 -1
  28. package/fesm2022/sidenav.mjs +6 -5
  29. package/fesm2022/sidenav.mjs.map +1 -1
  30. package/fesm2022/slider.mjs +22 -23
  31. package/fesm2022/slider.mjs.map +1 -1
  32. package/fesm2022/sort.mjs +2 -2
  33. package/fesm2022/sort.mjs.map +1 -1
  34. package/fesm2022/table.mjs +4 -15
  35. package/fesm2022/table.mjs.map +1 -1
  36. package/fesm2022/timepicker.mjs +5 -3
  37. package/fesm2022/timepicker.mjs.map +1 -1
  38. package/fesm2022/tooltip.mjs +2 -2
  39. package/fesm2022/tooltip.mjs.map +1 -1
  40. package/form-field/index.d.ts +1 -0
  41. package/input/index.d.ts +8 -5
  42. package/list/index.d.ts +3 -1
  43. package/menu/index.d.ts +13 -14
  44. package/package.json +2 -2
  45. package/progress-bar/index.d.ts +2 -0
  46. package/radio/index.d.ts +2 -0
  47. package/schematics/ng-add/index.js +1 -1
  48. package/schematics/ng-add/index.mjs +1 -1
  49. package/select/index.d.ts +1 -1
  50. package/sidenav/index.d.ts +1 -0
  51. package/slider/index.d.ts +4 -1
  52. package/timepicker/index.d.ts +1 -0
@@ -212,7 +212,7 @@ export declare interface MatAutocompleteDefaultOptions {
212
212
  requireSelection?: boolean;
213
213
  /** Class or list of classes to be applied to the autocomplete's overlay panel. */
214
214
  overlayPanelClass?: string | string[];
215
- /** Wheter icon indicators should be hidden for single-selection. */
215
+ /** Whether icon indicators should be hidden for single-selection. */
216
216
  hideSingleSelectionIndicator?: boolean;
217
217
  }
218
218
 
@@ -248,6 +248,7 @@ export declare class MatAutocompleteSelectedEvent {
248
248
 
249
249
  /** Base class with all of the `MatAutocompleteTrigger` functionality. */
250
250
  export declare class MatAutocompleteTrigger implements ControlValueAccessor, AfterViewInit, OnChanges, OnDestroy {
251
+ private _injector;
251
252
  private _element;
252
253
  private _overlay;
253
254
  private _viewContainerRef;
@@ -257,13 +258,16 @@ export declare class MatAutocompleteTrigger implements ControlValueAccessor, Aft
257
258
  private _formField;
258
259
  private _document;
259
260
  private _viewportRuler;
261
+ private _scrollStrategy;
262
+ private _renderer;
260
263
  private _defaults;
261
264
  private _overlayRef;
262
265
  private _portal;
263
266
  private _componentDestroyed;
264
- private _scrollStrategy;
267
+ private _initialized;
265
268
  private _keydownSubscription;
266
269
  private _outsideClickSubscription;
270
+ private _cleanupWindowBlur;
267
271
  /** Old value of the native input. Used to work around issues with the `input` event on IE. */
268
272
  private _previousValue;
269
273
  /** Value of the input element when the panel was attached (even if there are no options). */
@@ -330,8 +334,6 @@ export declare class MatAutocompleteTrigger implements ControlValueAccessor, Aft
330
334
  * act as a regular input and the user won't be able to open the panel.
331
335
  */
332
336
  autocompleteDisabled: boolean;
333
- private _initialized;
334
- private _injector;
335
337
  constructor(...args: unknown[]);
336
338
  /** Class to apply to the panel when it's above the input. */
337
339
  private _aboveClass;
@@ -428,8 +430,6 @@ export declare class MatAutocompleteTrigger implements ControlValueAccessor, Aft
428
430
  private _resetActiveItem;
429
431
  /** Determines whether the panel can be opened. */
430
432
  private _canOpen;
431
- /** Use defaultView of injected document if available or fallback to global window reference */
432
- private _getWindow;
433
433
  /** Scrolls to a particular option in the list. */
434
434
  private _scrollToOption;
435
435
  /**
package/button/index.d.ts CHANGED
@@ -65,6 +65,8 @@ export declare class MatAnchor extends MatAnchorBase {
65
65
  * Anchor button base.
66
66
  */
67
67
  declare class MatAnchorBase extends MatButtonBase implements OnInit, OnDestroy {
68
+ private _renderer;
69
+ private _cleanupClick;
68
70
  tabIndex: number;
69
71
  ngOnInit(): void;
70
72
  ngOnDestroy(): void;
package/chips/index.d.ts CHANGED
@@ -849,7 +849,7 @@ export declare class MatChipRow extends MatChip implements AfterViewInit {
849
849
  export declare interface MatChipsDefaultOptions {
850
850
  /** The list of key codes that will trigger a chipEnd event. */
851
851
  separatorKeyCodes: readonly number[] | ReadonlySet<number>;
852
- /** Wheter icon indicators should be hidden for single-selection. */
852
+ /** Whether icon indicators should be hidden for single-selection. */
853
853
  hideSingleSelectionIndicator?: boolean;
854
854
  }
855
855
 
@@ -15,7 +15,7 @@ $_generate-default-density: true !default;
15
15
 
16
16
  // Warning that will be printed if duplicated styles are generated by a theme.
17
17
  $_duplicate-warning: 'Read more about how style duplication can be avoided in a dedicated ' +
18
- 'guide. https://github.com/angular/components/blob/main/guides/duplicate-theming-styles.md';
18
+ 'guide. https://v18.material.angular.io/guide/duplicate-theming-styles';
19
19
 
20
20
  // Warning that will be printed if the legacy theming API is used.
21
21
  $private-legacy-theme-warning: 'Angular Material themes should be created from a map containing ' +
@@ -171,6 +171,8 @@ export declare class MatExpansionPanel extends CdkAccordionItem implements After
171
171
  private _document;
172
172
  private _ngZone;
173
173
  private _elementRef;
174
+ private _renderer;
175
+ private _cleanupTransitionEnd;
174
176
  /** Whether the toggle indicator should be hidden. */
175
177
  get hideToggle(): boolean;
176
178
  set hideToggle(value: boolean);
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, ChangeDetectorRef, ElementRef, EventEmitter, booleanAttribute, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, ContentChildren, Input, Output, Directive, forwardRef, ViewContainerRef, NgZone, Injector, afterNextRender, NgModule } from '@angular/core';
2
+ import { InjectionToken, inject, ChangeDetectorRef, ElementRef, EventEmitter, booleanAttribute, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, ViewChild, ContentChildren, Input, Output, Directive, forwardRef, Injector, ViewContainerRef, NgZone, Renderer2, afterNextRender, NgModule } from '@angular/core';
3
3
  import { MAT_OPTION_PARENT_COMPONENT, MatOption, MAT_OPTGROUP, MatOptionSelectionChange, _countGroupLabelsBeforeOption, _getOptionScrollPosition, MatOptionModule, MatCommonModule } from '@angular/material/core';
4
4
  export { MatOptgroup, MatOption } from '@angular/material/core';
5
5
  import { ViewportRuler, CdkScrollableModule } from '@angular/cdk/scrolling';
@@ -7,7 +7,7 @@ import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
7
7
  import { _IdGenerator, ActiveDescendantKeyManager, removeAriaReferencedId, addAriaReferencedId } from '@angular/cdk/a11y';
8
8
  import { Platform, _getEventTarget } from '@angular/cdk/platform';
9
9
  import { trigger, state, style, transition, group, animate } from '@angular/animations';
10
- import { Subscription, Subject, merge, of, defer, fromEvent, Observable } from 'rxjs';
10
+ import { Subscription, Subject, merge, of, defer, Observable } from 'rxjs';
11
11
  import { Directionality } from '@angular/cdk/bidi';
12
12
  import { hasModifierKey, ESCAPE, ENTER, UP_ARROW, DOWN_ARROW, TAB } from '@angular/cdk/keycodes';
13
13
  import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
@@ -356,6 +356,7 @@ const MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = {
356
356
  };
357
357
  /** Base class with all of the `MatAutocompleteTrigger` functionality. */
358
358
  class MatAutocompleteTrigger {
359
+ _injector = inject(Injector);
359
360
  _element = inject(ElementRef);
360
361
  _overlay = inject(Overlay);
361
362
  _viewContainerRef = inject(ViewContainerRef);
@@ -365,13 +366,16 @@ class MatAutocompleteTrigger {
365
366
  _formField = inject(MAT_FORM_FIELD, { optional: true, host: true });
366
367
  _document = inject(DOCUMENT);
367
368
  _viewportRuler = inject(ViewportRuler);
369
+ _scrollStrategy = inject(MAT_AUTOCOMPLETE_SCROLL_STRATEGY);
370
+ _renderer = inject(Renderer2);
368
371
  _defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, { optional: true });
369
372
  _overlayRef;
370
373
  _portal;
371
374
  _componentDestroyed = false;
372
- _scrollStrategy = inject(MAT_AUTOCOMPLETE_SCROLL_STRATEGY);
375
+ _initialized = new Subject();
373
376
  _keydownSubscription;
374
377
  _outsideClickSubscription;
378
+ _cleanupWindowBlur;
375
379
  /** Old value of the native input. Used to work around issues with the `input` event on IE. */
376
380
  _previousValue;
377
381
  /** Value of the input element when the panel was attached (even if there are no options). */
@@ -444,18 +448,13 @@ class MatAutocompleteTrigger {
444
448
  * act as a regular input and the user won't be able to open the panel.
445
449
  */
446
450
  autocompleteDisabled;
447
- _initialized = new Subject();
448
- _injector = inject(Injector);
449
451
  constructor() { }
450
452
  /** Class to apply to the panel when it's above the input. */
451
453
  _aboveClass = 'mat-mdc-autocomplete-panel-above';
452
454
  ngAfterViewInit() {
453
455
  this._initialized.next();
454
456
  this._initialized.complete();
455
- const window = this._getWindow();
456
- if (typeof window !== 'undefined') {
457
- this._zone.runOutsideAngular(() => window.addEventListener('blur', this._windowBlurHandler));
458
- }
457
+ this._cleanupWindowBlur = this._renderer.listen('window', 'blur', this._windowBlurHandler);
459
458
  }
460
459
  ngOnChanges(changes) {
461
460
  if (changes['position'] && this._positionStrategy) {
@@ -466,10 +465,7 @@ class MatAutocompleteTrigger {
466
465
  }
467
466
  }
468
467
  ngOnDestroy() {
469
- const window = this._getWindow();
470
- if (typeof window !== 'undefined') {
471
- window.removeEventListener('blur', this._windowBlurHandler);
472
- }
468
+ this._cleanupWindowBlur?.();
473
469
  this._handsetLandscapeSubscription.unsubscribe();
474
470
  this._viewportSubscription.unsubscribe();
475
471
  this._componentDestroyed = true;
@@ -567,26 +563,38 @@ class MatAutocompleteTrigger {
567
563
  }
568
564
  /** Stream of clicks outside of the autocomplete panel. */
569
565
  _getOutsideClickStream() {
570
- return merge(fromEvent(this._document, 'click'), fromEvent(this._document, 'auxclick'), fromEvent(this._document, 'touchend')).pipe(filter(event => {
571
- // If we're in the Shadow DOM, the event target will be the shadow root, so we have to
572
- // fall back to check the first element in the path of the click event.
573
- const clickTarget = _getEventTarget(event);
574
- const formField = this._formField
575
- ? this._formField.getConnectedOverlayOrigin().nativeElement
576
- : null;
577
- const customOrigin = this.connectedTo ? this.connectedTo.elementRef.nativeElement : null;
578
- return (this._overlayAttached &&
579
- clickTarget !== this._element.nativeElement &&
580
- // Normally focus moves inside `mousedown` so this condition will almost always be
581
- // true. Its main purpose is to handle the case where the input is focused from an
582
- // outside click which propagates up to the `body` listener within the same sequence
583
- // and causes the panel to close immediately (see #3106).
584
- this._document.activeElement !== this._element.nativeElement &&
585
- (!formField || !formField.contains(clickTarget)) &&
586
- (!customOrigin || !customOrigin.contains(clickTarget)) &&
587
- !!this._overlayRef &&
588
- !this._overlayRef.overlayElement.contains(clickTarget));
589
- }));
566
+ return new Observable(observer => {
567
+ const listener = (event) => {
568
+ // If we're in the Shadow DOM, the event target will be the shadow root, so we have to
569
+ // fall back to check the first element in the path of the click event.
570
+ const clickTarget = _getEventTarget(event);
571
+ const formField = this._formField
572
+ ? this._formField.getConnectedOverlayOrigin().nativeElement
573
+ : null;
574
+ const customOrigin = this.connectedTo ? this.connectedTo.elementRef.nativeElement : null;
575
+ if (this._overlayAttached &&
576
+ clickTarget !== this._element.nativeElement &&
577
+ // Normally focus moves inside `mousedown` so this condition will almost always be
578
+ // true. Its main purpose is to handle the case where the input is focused from an
579
+ // outside click which propagates up to the `body` listener within the same sequence
580
+ // and causes the panel to close immediately (see #3106).
581
+ this._document.activeElement !== this._element.nativeElement &&
582
+ (!formField || !formField.contains(clickTarget)) &&
583
+ (!customOrigin || !customOrigin.contains(clickTarget)) &&
584
+ !!this._overlayRef &&
585
+ !this._overlayRef.overlayElement.contains(clickTarget)) {
586
+ observer.next(event);
587
+ }
588
+ };
589
+ const cleanups = [
590
+ this._renderer.listen('document', 'click', listener),
591
+ this._renderer.listen('document', 'auxclick', listener),
592
+ this._renderer.listen('document', 'touchend', listener),
593
+ ];
594
+ return () => {
595
+ cleanups.forEach(current => current());
596
+ };
597
+ });
590
598
  }
591
599
  // Implemented as part of ControlValueAccessor.
592
600
  writeValue(value) {
@@ -1075,10 +1083,6 @@ class MatAutocompleteTrigger {
1075
1083
  const element = this._element.nativeElement;
1076
1084
  return !element.readOnly && !element.disabled && !this.autocompleteDisabled;
1077
1085
  }
1078
- /** Use defaultView of injected document if available or fallback to global window reference */
1079
- _getWindow() {
1080
- return this._document?.defaultView || window;
1081
- }
1082
1086
  /** Scrolls to a particular option in the list. */
1083
1087
  _scrollToOption(index) {
1084
1088
  // Given that we are not actually focusing active options, we must manually adjust scroll