@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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2023 Google LLC.
3
+ Copyright (c) 2024 Google LLC.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/_index.scss CHANGED
@@ -151,4 +151,4 @@
151
151
 
152
152
  // New theming APIs:
153
153
  @forward './core/theming/inspection' show get-theme-version, get-theme-type, get-theme-color,
154
- get-theme-typography, get-theme-density, theme-has;
154
+ get-theme-typography, get-theme-density, theme-has, theme-remove;
@@ -1,4 +1,3 @@
1
- @use '@material/button/button' as mdc-button;
2
1
  @use '@material/button/button-text-theme' as mdc-button-text-theme;
3
2
  @use '@material/button/button-filled-theme' as mdc-button-filled-theme;
4
3
  @use '@material/button/button-protected-theme' as mdc-button-protected-theme;
@@ -19,7 +18,7 @@
19
18
  @use '../core/tokens/m2/mat/protected-button' as tokens-mat-protected-button;
20
19
  @use '../core/tokens/m2/mdc/text-button' as tokens-mdc-text-button;
21
20
  @use '../core/tokens/m2/mat/text-button' as tokens-mat-text-button;
22
-
21
+ @use '../core/style/sass-utils';
23
22
 
24
23
  @mixin _text-button-variant($theme, $palette) {
25
24
  $mdc-tokens: if($palette,
@@ -165,15 +164,16 @@
165
164
  }
166
165
 
167
166
  @mixin typography($theme) {
168
- @include mdc-helpers.using-mdc-typography($theme) {
169
- @include mdc-button.without-ripple($query: mdc-helpers.$mdc-typography-styles-query);
170
- }
171
-
172
- .mat-mdc-button,
173
- .mat-mdc-raised-button,
174
- .mat-mdc-outlined-button,
175
- .mat-mdc-unelevated-button {
176
- line-height: inherit;
167
+ @include sass-utils.current-selector-or-root() {
168
+ $text-typography-tokens: tokens-mdc-text-button.get-typography-tokens($theme);
169
+ $filled-typography-tokens: tokens-mdc-filled-button.get-typography-tokens($theme);
170
+ $outlined-typography-tokens: tokens-mdc-outlined-button.get-typography-tokens($theme);
171
+ $protected-typography-tokens: tokens-mdc-protected-button.get-typography-tokens($theme);
172
+
173
+ @include mdc-button-text-theme.theme($text-typography-tokens);
174
+ @include mdc-button-filled-theme.theme($filled-typography-tokens);
175
+ @include mdc-button-outlined-theme.theme($outlined-typography-tokens);
176
+ @include mdc-button-protected-theme.theme($protected-typography-tokens);
177
177
  }
178
178
  }
179
179
 
package/core/index.d.ts CHANGED
@@ -784,6 +784,8 @@ export declare class MatRipple implements OnInit, OnDestroy, RippleTarget {
784
784
  *
785
785
  * This service allows us to avoid eagerly creating & attaching MatRipples.
786
786
  * It works by creating & attaching a ripple only when a component is first interacted with.
787
+ *
788
+ * @docs-private
787
789
  */
788
790
  export declare class MatRippleLoader implements OnDestroy {
789
791
  private _document;
@@ -791,6 +793,7 @@ export declare class MatRippleLoader implements OnDestroy {
791
793
  private _globalRippleOptions;
792
794
  private _platform;
793
795
  private _ngZone;
796
+ private _hosts;
794
797
  constructor();
795
798
  ngOnDestroy(): void;
796
799
  /**
@@ -811,8 +814,9 @@ export declare class MatRippleLoader implements OnDestroy {
811
814
  /** Handles creating and attaching component internals when a component it is initially interacted with. */
812
815
  private _onInteraction;
813
816
  /** Creates a MatRipple and appends it to the given element. */
814
- createRipple(host: HTMLElement): MatRipple | undefined;
815
- attachRipple(host: Element, ripple: MatRipple): void;
817
+ private _createRipple;
818
+ attachRipple(host: HTMLElement, ripple: MatRipple): void;
819
+ destroyRipple(host: HTMLElement): void;
816
820
  static ɵfac: i0.ɵɵFactoryDeclaration<MatRippleLoader, never>;
817
821
  static ɵprov: i0.ɵɵInjectableDeclaration<MatRippleLoader>;
818
822
  }
@@ -1,6 +1,10 @@
1
+ @use 'sass:math';
1
2
  @use 'sass:map';
3
+ @use '@material/textfield' as mdc-textfield;
4
+ @use '@material/density' as mdc-density;
2
5
  @use '../../token-utils';
3
6
  @use '../../../style/sass-utils';
7
+ @use '../../../theming/theming';
4
8
  @use '../../../theming/inspection';
5
9
  @use '../../../theming/palette';
6
10
 
@@ -86,7 +90,52 @@ $prefix: (mat, form-field);
86
90
 
87
91
  // Tokens that can be configured through Angular Material's density theming API.
88
92
  @function get-density-tokens($theme) {
89
- @return ();
93
+ $density-scale: theming.clamp-density(inspection.get-theme-density($theme), -4);
94
+ $height: mdc-density.prop-value(
95
+ $density-config: mdc-textfield.$density-config,
96
+ $density-scale: inspection.get-theme-density($theme),
97
+ $property-name: height,
98
+ );
99
+ $hide-label: $height < mdc-textfield.$minimum-height-for-filled-label;
100
+
101
+ // We computed the desired height of the form-field using the density configuration. The
102
+ // spec only describes vertical spacing/alignment in non-dense mode. This means that we
103
+ // cannot update the spacing to explicit numbers based on the density scale. Instead, we
104
+ // determine the height reduction and equally subtract it from the default `top` and `bottom`
105
+ // padding that is provided by the Material Design specification.
106
+ $vertical-deduction: math.div(mdc-textfield.$height - $height, 2);
107
+
108
+ // Note: these calculations are trivial enough that we could do them at runtime with `calc`
109
+ // and the value of the `height` token. The problem is that because we need to hide the label
110
+ // if the container becomes too short, we have to change the padding calculation. This is
111
+ // complicated further by the fact that filled form fields without labels have the same
112
+ // vertical padding as outlined ones. Alternatives:
113
+ // 1. Using container queries to hide the label and change the padding - this doesn't work
114
+ // because size container queries require setting the `container-type` property which breaks
115
+ // the form field layout. We could use style queries, but they're only supported in Chrome.
116
+ // 2. Monitoring the size of the label - we already have a `ResizeObserver` on the label so we
117
+ // could reuse it to also check when it becomes `display: none`. This would allows us to remove
118
+ // the three padding tokens. We don't do it, because it would require us to always set up
119
+ // the resize observer, as opposed to currently where it's only set up for outlined form fields.
120
+ // This may lead to performance regressions.
121
+ // 3. Conditionally adding `::before` and `::after` to the infix with positive and negative
122
+ // margin respectively - this works, but is likely to break a lot of overrides that are targeting
123
+ // a specific padding. It also runs the risk of overflowing the container.
124
+ // TODO: switch the padding tokens to style-based container queries
125
+ // when they become available in all the browsers we support.
126
+ $filled-with-label-padding-top: 24px - $vertical-deduction;
127
+ $filled-with-label-padding-bottom: 8px - $vertical-deduction;
128
+ $vertical-padding: 16px - $vertical-deduction;
129
+
130
+ @return (
131
+ container-height: $height,
132
+ filled-label-display: if($hide-label, none, block),
133
+ container-vertical-padding: $vertical-padding,
134
+ filled-with-label-container-padding-top:
135
+ if($hide-label, $vertical-padding, $filled-with-label-padding-top),
136
+ filled-with-label-container-padding-bottom:
137
+ if($hide-label, $vertical-padding, $filled-with-label-padding-bottom),
138
+ );
90
139
  }
91
140
 
92
141
  // Combines the tokens generated by the above functions into a single map with placeholder values.
@@ -1,3 +1,4 @@
1
+ @use 'sass:map';
1
2
  @use '../../token-utils';
2
3
  @use '../../../style/sass-utils';
3
4
  @use '../../../theming/inspection';
@@ -8,23 +9,48 @@ $prefix: (mat, slider);
8
9
  // Tokens that can't be configured through Angular Material's current theming API,
9
10
  // but may be in a future version of the theming API.
10
11
  @function get-unthemable-tokens() {
11
- @return ();
12
+ @return (
13
+ value-indicator-width: auto,
14
+ value-indicator-height: 32px,
15
+ value-indicator-caret-display: block,
16
+ value-indicator-border-radius: 4px,
17
+ value-indicator-padding: 0 12px,
18
+ value-indicator-text-transform: none,
19
+ value-indicator-container-transform: translateX(-50%)
20
+ );
12
21
  }
13
22
 
14
23
  // Tokens that can be configured through Angular Material's color theming API.
15
24
  @function get-color-tokens($theme) {
25
+ $theme-color-tokens: private-get-color-palette-color-tokens($theme, primary);
16
26
  $is-dark: inspection.get-theme-type($theme) == dark;
17
27
 
28
+ @return map.merge(
29
+ $theme-color-tokens,
30
+ (
31
+ // Opacity of value indicator text container
32
+ value-indicator-opacity: if($is-dark, 0.9, 0.6)
33
+ ),
34
+ );
35
+ }
36
+
37
+ // Generates tokens for the slider properties that change based on the theme.
38
+ @function private-get-color-palette-color-tokens($theme, $palette-name) {
39
+ $ripple-color: inspection.get-theme-color($theme, $palette-name);
40
+ $hover-ripple-color: if($ripple-color == null, null, #{rgba($ripple-color, 0.05)});
41
+ $focus-ripple-color: if($ripple-color == null, null, #{rgba($ripple-color, 0.2)});
42
+
18
43
  @return (
19
- // Opacity of value indicator text container
20
- value-indicator-opacity: if($is-dark, 0.9, 0.6),
44
+ ripple-color: $ripple-color,
45
+ hover-state-layer-color: $hover-ripple-color,
46
+ focus-state-layer-color: $focus-ripple-color
21
47
  );
22
48
  }
23
49
 
24
50
  // Tokens that can be configured through Angular Material's typography theming API.
25
51
  @function get-typography-tokens($theme) {
26
52
  @return ();
27
- }
53
+ }
28
54
 
29
55
  // Tokens that can be configured through Angular Material's density theming API.
30
56
  @function get-density-tokens($theme) {
@@ -35,9 +61,9 @@ $prefix: (mat, slider);
35
61
  // This is used to create token slots.
36
62
  @function get-token-slots() {
37
63
  @return sass-utils.deep-merge-all(
38
- get-unthemable-tokens(),
39
- get-color-tokens(token-utils.$placeholder-color-config),
40
- get-typography-tokens(token-utils.$placeholder-typography-config),
41
- get-density-tokens(token-utils.$placeholder-density-config)
64
+ get-unthemable-tokens(),
65
+ get-color-tokens(token-utils.$placeholder-color-config),
66
+ get-typography-tokens(token-utils.$placeholder-typography-config),
67
+ get-density-tokens(token-utils.$placeholder-density-config)
42
68
  );
43
69
  }
@@ -8,7 +8,12 @@ $prefix: (mat, tab-header);
8
8
  // Tokens that can't be configured through Angular Material's current theming API,
9
9
  // but may be in a future version of the theming API.
10
10
  @function get-unthemable-tokens() {
11
- @return ();
11
+ @return (
12
+ // For some period of time, the MDC tabs removed the divider. This has been added back in
13
+ // and will be present in M3.
14
+ divider-color: transparent,
15
+ divider-height: 0,
16
+ );
12
17
  }
13
18
 
14
19
  // Tokens that can be configured through Angular Material's color theming API.
@@ -35,11 +35,6 @@ $prefix: (mdc, filled-button);
35
35
  container-shadow-color: null,
36
36
  focus-label-text-color: null,
37
37
  hover-label-text-color: null,
38
- label-text-font: null,
39
- label-text-size: null,
40
- label-text-tracking: null,
41
- label-text-transform: null,
42
- label-text-weight: null,
43
38
  pressed-label-text-color: null,
44
39
  with-icon-disabled-icon-color: null,
45
40
  with-icon-focus-icon-color: null,
@@ -81,7 +76,13 @@ $prefix: (mdc, filled-button);
81
76
 
82
77
  // Tokens that can be configured through Angular Material's typography theming API.
83
78
  @function get-typography-tokens($theme) {
84
- @return ();
79
+ @return (
80
+ label-text-font: inspection.get-theme-typography($theme, button, font-family),
81
+ label-text-size: inspection.get-theme-typography($theme, button, font-size),
82
+ label-text-tracking: inspection.get-theme-typography($theme, button, letter-spacing),
83
+ label-text-weight: inspection.get-theme-typography($theme, button, font-weight),
84
+ label-text-transform: none,
85
+ );
85
86
  }
86
87
 
87
88
  // Tokens that can be configured through Angular Material's density theming API.
@@ -49,12 +49,6 @@ $prefix: (mdc, outlined-button);
49
49
  with-icon-focus-icon-color: null,
50
50
  with-icon-pressed-icon-color: null,
51
51
  with-icon-disabled-icon-color: null,
52
-
53
- label-text-size: null,
54
- label-text-font: null,
55
- label-text-weight: null,
56
- label-text-tracking: null,
57
- label-text-transform: null
58
52
  );
59
53
  }
60
54
 
@@ -87,7 +81,13 @@ $prefix: (mdc, outlined-button);
87
81
 
88
82
  // Tokens that can be configured through Angular Material's typography theming API.
89
83
  @function get-typography-tokens($theme) {
90
- @return ();
84
+ @return (
85
+ label-text-font: inspection.get-theme-typography($theme, button, font-family),
86
+ label-text-size: inspection.get-theme-typography($theme, button, font-size),
87
+ label-text-tracking: inspection.get-theme-typography($theme, button, letter-spacing),
88
+ label-text-weight: inspection.get-theme-typography($theme, button, font-weight),
89
+ label-text-transform: none,
90
+ );
91
91
  }
92
92
 
93
93
  // Tokens that can be configured through Angular Material's density theming API.
@@ -33,11 +33,6 @@ $prefix: (mdc, protected-button);
33
33
  disabled-container-elevation: null,
34
34
  focus-container-elevation: null,
35
35
  pressed-container-elevation: null,
36
- label-text-font: null,
37
- label-text-size: null,
38
- label-text-tracking: null,
39
- label-text-transform: null,
40
- label-text-weight: null,
41
36
  with-icon-icon-size: null,
42
37
  focus-label-text-color: null,
43
38
  hover-label-text-color: null,
@@ -80,7 +75,13 @@ $prefix: (mdc, protected-button);
80
75
 
81
76
  // Tokens that can be configured through Angular Material's typography theming API.
82
77
  @function get-typography-tokens($theme) {
83
- @return ();
78
+ @return (
79
+ label-text-font: inspection.get-theme-typography($theme, button, font-family),
80
+ label-text-size: inspection.get-theme-typography($theme, button, font-size),
81
+ label-text-tracking: inspection.get-theme-typography($theme, button, letter-spacing),
82
+ label-text-weight: inspection.get-theme-typography($theme, button, font-weight),
83
+ label-text-transform: none,
84
+ );
84
85
  }
85
86
 
86
87
  // Tokens that can be configured through Angular Material's density theming API.
@@ -21,13 +21,6 @@ $prefix: (mdc, text-button);
21
21
  // prevent the buttons from collapsing if a density mixin isn't included.
22
22
  container-height: 36px,
23
23
 
24
- // TODO: handle these through the typography styles eventually.
25
- label-text-font: null,
26
- label-text-size: null,
27
- label-text-tracking: null,
28
- label-text-transform: null,
29
- label-text-weight: null,
30
-
31
24
  // =============================================================================================
32
25
  // = TOKENS NOT USED IN ANGULAR MATERIAL =
33
26
  // =============================================================================================
@@ -74,7 +67,13 @@ $prefix: (mdc, text-button);
74
67
 
75
68
  // Tokens that can be configured through Angular Material's typography theming API.
76
69
  @function get-typography-tokens($theme) {
77
- @return ();
70
+ @return (
71
+ label-text-font: inspection.get-theme-typography($theme, button, font-family),
72
+ label-text-size: inspection.get-theme-typography($theme, button, font-size),
73
+ label-text-tracking: inspection.get-theme-typography($theme, button, letter-spacing),
74
+ label-text-weight: inspection.get-theme-typography($theme, button, font-weight),
75
+ label-text-transform: none,
76
+ );
78
77
  }
79
78
 
80
79
  // Tokens that can be configured through Angular Material's density theming API.