@angular/material 17.0.3 → 17.0.5

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 (98) hide show
  1. package/LICENSE +1 -1
  2. package/_index.scss +1 -1
  3. package/button/_button-theme.scss +11 -11
  4. package/core/index.d.ts +6 -2
  5. package/core/tokens/m2/mat/_form-field.scss +50 -1
  6. package/core/tokens/m2/mat/_slider.scss +34 -8
  7. package/core/tokens/m2/mat/_tab-header.scss +6 -1
  8. package/core/tokens/m2/mdc/_filled-button.scss +7 -6
  9. package/core/tokens/m2/mdc/_outlined-button.scss +7 -7
  10. package/core/tokens/m2/mdc/_protected-button.scss +7 -6
  11. package/core/tokens/m2/mdc/_text-button.scss +7 -8
  12. package/esm2022/autocomplete/autocomplete-trigger.mjs +12 -4
  13. package/esm2022/autocomplete/autocomplete.mjs +2 -3
  14. package/esm2022/button/button-base.mjs +2 -1
  15. package/esm2022/button/button.mjs +4 -4
  16. package/esm2022/chips/chip-listbox.mjs +2 -3
  17. package/esm2022/chips/chip.mjs +2 -1
  18. package/esm2022/chips/tokens.mjs +8 -2
  19. package/esm2022/core/private/ripple-loader.mjs +27 -9
  20. package/esm2022/core/ripple/ripple-renderer.mjs +1 -1
  21. package/esm2022/core/version.mjs +1 -1
  22. package/esm2022/datepicker/datepicker-base.mjs +8 -2
  23. package/esm2022/expansion/accordion.mjs +2 -3
  24. package/esm2022/expansion/expansion-panel.mjs +3 -3
  25. package/esm2022/form-field/form-field.mjs +3 -3
  26. package/esm2022/list/tokens.mjs +2 -2
  27. package/esm2022/menu/menu-trigger.mjs +8 -2
  28. package/esm2022/menu/menu.mjs +2 -3
  29. package/esm2022/select/select.mjs +22 -16
  30. package/esm2022/sidenav/drawer.mjs +16 -12
  31. package/esm2022/sidenav/sidenav.mjs +4 -7
  32. package/esm2022/slider/slider-input.mjs +24 -19
  33. package/esm2022/slider/slider-interface.mjs +1 -1
  34. package/esm2022/slider/slider-thumb.mjs +9 -2
  35. package/esm2022/slider/slider.mjs +3 -4
  36. package/esm2022/snack-bar/snack-bar-container.mjs +6 -9
  37. package/esm2022/tabs/ink-bar.mjs +4 -4
  38. package/esm2022/tabs/tab-group.mjs +11 -2
  39. package/esm2022/tabs/tab-header.mjs +2 -2
  40. package/esm2022/tabs/tab-nav-bar/tab-nav-bar.mjs +2 -2
  41. package/esm2022/tooltip/tooltip.mjs +9 -3
  42. package/expansion/index.d.ts +2 -2
  43. package/fesm2022/autocomplete.mjs +12 -5
  44. package/fesm2022/autocomplete.mjs.map +1 -1
  45. package/fesm2022/button.mjs +5 -4
  46. package/fesm2022/button.mjs.map +1 -1
  47. package/fesm2022/chips.mjs +8 -3
  48. package/fesm2022/chips.mjs.map +1 -1
  49. package/fesm2022/core.mjs +27 -9
  50. package/fesm2022/core.mjs.map +1 -1
  51. package/fesm2022/datepicker.mjs +7 -1
  52. package/fesm2022/datepicker.mjs.map +1 -1
  53. package/fesm2022/expansion.mjs +3 -4
  54. package/fesm2022/expansion.mjs.map +1 -1
  55. package/fesm2022/form-field.mjs +2 -2
  56. package/fesm2022/form-field.mjs.map +1 -1
  57. package/fesm2022/list.mjs +1 -1
  58. package/fesm2022/list.mjs.map +1 -1
  59. package/fesm2022/menu.mjs +8 -3
  60. package/fesm2022/menu.mjs.map +1 -1
  61. package/fesm2022/select.mjs +21 -15
  62. package/fesm2022/select.mjs.map +1 -1
  63. package/fesm2022/sidenav.mjs +18 -17
  64. package/fesm2022/sidenav.mjs.map +1 -1
  65. package/fesm2022/slider.mjs +32 -22
  66. package/fesm2022/slider.mjs.map +1 -1
  67. package/fesm2022/snack-bar.mjs +6 -8
  68. package/fesm2022/snack-bar.mjs.map +1 -1
  69. package/fesm2022/tabs.mjs +17 -8
  70. package/fesm2022/tabs.mjs.map +1 -1
  71. package/fesm2022/tooltip.mjs +8 -2
  72. package/fesm2022/tooltip.mjs.map +1 -1
  73. package/form-field/_form-field-subscript.scss +1 -2
  74. package/form-field/_form-field-theme.scss +4 -2
  75. package/form-field/_mdc-text-field-density-overrides.scss +60 -0
  76. package/list/index.d.ts +1 -1
  77. package/package.json +2 -2
  78. package/paginator/_paginator-theme.scss +5 -4
  79. package/prebuilt-themes/deeppurple-amber.css +1 -1
  80. package/prebuilt-themes/indigo-pink.css +1 -1
  81. package/prebuilt-themes/pink-bluegrey.css +1 -1
  82. package/prebuilt-themes/purple-green.css +1 -1
  83. package/schematics/ng-add/index.js +1 -1
  84. package/schematics/ng-add/index.mjs +1 -1
  85. package/schematics/ng-generate/address-form/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +3 -3
  86. package/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html.template +1 -1
  87. package/schematics/ng-generate/dashboard/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +5 -3
  88. package/schematics/ng-generate/mdc-migration/schema.json +0 -1
  89. package/schematics/ng-generate/navigation/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +3 -3
  90. package/schematics/ng-generate/table/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +3 -3
  91. package/schematics/ng-generate/tree/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.ts.template +3 -3
  92. package/slider/_slider-theme.scss +10 -12
  93. package/slider/index.d.ts +3 -12
  94. package/snack-bar/index.d.ts +2 -2
  95. package/tabs/_tabs-common.scss +20 -1
  96. package/tabs/index.d.ts +6 -2
  97. package/form-field/_form-field-density.scss +0 -118
  98. package/form-field/_form-field-sizing.scss +0 -40
package/fesm2022/core.mjs CHANGED
@@ -14,7 +14,7 @@ import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
14
14
  import { ENTER, SPACE, hasModifierKey } from '@angular/cdk/keycodes';
15
15
 
16
16
  /** Current version of Angular Material. */
17
- const VERSION = new Version('17.0.3');
17
+ const VERSION = new Version('17.0.5');
18
18
 
19
19
  /** @docs-private */
20
20
  class AnimationCurves {
@@ -1723,6 +1723,8 @@ const matRippleDisabled = 'mat-ripple-loader-disabled';
1723
1723
  *
1724
1724
  * This service allows us to avoid eagerly creating & attaching MatRipples.
1725
1725
  * It works by creating & attaching a ripple only when a component is first interacted with.
1726
+ *
1727
+ * @docs-private
1726
1728
  */
1727
1729
  class MatRippleLoader {
1728
1730
  constructor() {
@@ -1731,6 +1733,7 @@ class MatRippleLoader {
1731
1733
  this._globalRippleOptions = inject(MAT_RIPPLE_GLOBAL_OPTIONS, { optional: true });
1732
1734
  this._platform = inject(Platform);
1733
1735
  this._ngZone = inject(NgZone);
1736
+ this._hosts = new Map();
1734
1737
  /** Handles creating and attaching component internals when a component it is initially interacted with. */
1735
1738
  this._onInteraction = (event) => {
1736
1739
  if (!(event.target instanceof HTMLElement)) {
@@ -1740,7 +1743,7 @@ class MatRippleLoader {
1740
1743
  // TODO(wagnermaciel): Consider batching these events to improve runtime performance.
1741
1744
  const element = eventTarget.closest(`[${matRippleUninitialized}]`);
1742
1745
  if (element) {
1743
- this.createRipple(element);
1746
+ this._createRipple(element);
1744
1747
  }
1745
1748
  };
1746
1749
  this._ngZone.runOutsideAngular(() => {
@@ -1750,6 +1753,10 @@ class MatRippleLoader {
1750
1753
  });
1751
1754
  }
1752
1755
  ngOnDestroy() {
1756
+ const hosts = this._hosts.keys();
1757
+ for (const host of hosts) {
1758
+ this.destroyRipple(host);
1759
+ }
1753
1760
  for (const event of rippleInteractionEvents) {
1754
1761
  this._document?.removeEventListener(event, this._onInteraction, eventListenerOptions);
1755
1762
  }
@@ -1777,14 +1784,12 @@ class MatRippleLoader {
1777
1784
  }
1778
1785
  /** Returns the ripple instance for the given host element. */
1779
1786
  getRipple(host) {
1780
- if (host.matRipple) {
1781
- return host.matRipple;
1782
- }
1783
- return this.createRipple(host);
1787
+ const ripple = this._hosts.get(host);
1788
+ return ripple || this._createRipple(host);
1784
1789
  }
1785
1790
  /** Sets the disabled state on the ripple instance corresponding to the given host element. */
1786
1791
  setDisabled(host, disabled) {
1787
- const ripple = host.matRipple;
1792
+ const ripple = this._hosts.get(host);
1788
1793
  // If the ripple has already been instantiated, just disable it.
1789
1794
  if (ripple) {
1790
1795
  ripple.disabled = disabled;
@@ -1800,10 +1805,14 @@ class MatRippleLoader {
1800
1805
  }
1801
1806
  }
1802
1807
  /** Creates a MatRipple and appends it to the given element. */
1803
- createRipple(host) {
1808
+ _createRipple(host) {
1804
1809
  if (!this._document) {
1805
1810
  return;
1806
1811
  }
1812
+ const existingRipple = this._hosts.get(host);
1813
+ if (existingRipple) {
1814
+ return existingRipple;
1815
+ }
1807
1816
  // Create the ripple element.
1808
1817
  host.querySelector('.mat-ripple')?.remove();
1809
1818
  const rippleEl = this._document.createElement('span');
@@ -1820,7 +1829,16 @@ class MatRippleLoader {
1820
1829
  }
1821
1830
  attachRipple(host, ripple) {
1822
1831
  host.removeAttribute(matRippleUninitialized);
1823
- host.matRipple = ripple;
1832
+ this._hosts.set(host, ripple);
1833
+ }
1834
+ destroyRipple(host) {
1835
+ const ripple = this._hosts.get(host);
1836
+ if (ripple) {
1837
+ // Since this directive is created manually, it needs to be destroyed manually too.
1838
+ // tslint:disable-next-line:no-lifecycle-invocation
1839
+ ripple.ngOnDestroy();
1840
+ this._hosts.delete(host);
1841
+ }
1824
1842
  }
1825
1843
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: MatRippleLoader, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1826
1844
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.4", ngImport: i0, type: MatRippleLoader, providedIn: 'root' }); }