@angular/material 19.0.0-next.9 → 19.0.0-rc.0

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 (219) hide show
  1. package/autocomplete/_autocomplete-theme.scss +8 -4
  2. package/autocomplete/index.d.ts +5 -6
  3. package/badge/_badge-theme.scss +10 -6
  4. package/bottom-sheet/_bottom-sheet-theme.scss +8 -4
  5. package/button/_button-theme.scss +10 -6
  6. package/button/_fab-theme.scss +10 -6
  7. package/button/_icon-button-theme.scss +8 -4
  8. package/button/index.d.ts +1 -1
  9. package/button-toggle/_button-toggle-theme.scss +11 -6
  10. package/card/_card-theme.scss +8 -4
  11. package/card/index.d.ts +2 -3
  12. package/checkbox/_checkbox-theme.scss +10 -6
  13. package/chips/_chips-theme.scss +10 -6
  14. package/core/_core-theme.scss +4 -7
  15. package/core/_core.scss +2 -5
  16. package/core/option/_optgroup-theme.scss +8 -4
  17. package/core/option/_option-theme.scss +10 -6
  18. package/core/ripple/_ripple-theme.scss +8 -4
  19. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +10 -6
  20. package/core/theming/_config-validation.scss +4 -4
  21. package/core/theming/_definition.scss +12 -2
  22. package/core/tokens/_m3-system.scss +55 -39
  23. package/datepicker/_datepicker-theme.scss +10 -6
  24. package/datepicker/index.d.ts +32 -33
  25. package/dialog/_dialog-theme.scss +8 -4
  26. package/divider/_divider-theme.scss +8 -4
  27. package/expansion/_expansion-theme.scss +8 -4
  28. package/fesm2022/autocomplete/testing.mjs +2 -5
  29. package/fesm2022/autocomplete/testing.mjs.map +1 -1
  30. package/fesm2022/autocomplete.mjs +220 -141
  31. package/fesm2022/autocomplete.mjs.map +1 -1
  32. package/fesm2022/badge/testing.mjs +2 -5
  33. package/fesm2022/badge/testing.mjs.map +1 -1
  34. package/fesm2022/badge.mjs +41 -30
  35. package/fesm2022/badge.mjs.map +1 -1
  36. package/fesm2022/bottom-sheet/testing.mjs +1 -1
  37. package/fesm2022/bottom-sheet/testing.mjs.map +1 -1
  38. package/fesm2022/bottom-sheet.mjs +76 -54
  39. package/fesm2022/bottom-sheet.mjs.map +1 -1
  40. package/fesm2022/button/testing.mjs +2 -2
  41. package/fesm2022/button/testing.mjs.map +1 -1
  42. package/fesm2022/button-toggle/testing.mjs +4 -7
  43. package/fesm2022/button-toggle/testing.mjs.map +1 -1
  44. package/fesm2022/button-toggle.mjs +78 -40
  45. package/fesm2022/button-toggle.mjs.map +1 -1
  46. package/fesm2022/button.mjs +87 -60
  47. package/fesm2022/button.mjs.map +1 -1
  48. package/fesm2022/card/testing.mjs +3 -6
  49. package/fesm2022/card/testing.mjs.map +1 -1
  50. package/fesm2022/card.mjs +38 -40
  51. package/fesm2022/card.mjs.map +1 -1
  52. package/fesm2022/checkbox/testing.mjs +4 -7
  53. package/fesm2022/checkbox/testing.mjs.map +1 -1
  54. package/fesm2022/checkbox.mjs +99 -56
  55. package/fesm2022/checkbox.mjs.map +1 -1
  56. package/fesm2022/chips/testing.mjs +11 -14
  57. package/fesm2022/chips/testing.mjs.map +1 -1
  58. package/fesm2022/chips.mjs +303 -251
  59. package/fesm2022/chips.mjs.map +1 -1
  60. package/fesm2022/core/testing.mjs +5 -11
  61. package/fesm2022/core/testing.mjs.map +1 -1
  62. package/fesm2022/core.mjs +217 -160
  63. package/fesm2022/core.mjs.map +1 -1
  64. package/fesm2022/datepicker/testing.mjs +13 -22
  65. package/fesm2022/datepicker/testing.mjs.map +1 -1
  66. package/fesm2022/datepicker.mjs +788 -533
  67. package/fesm2022/datepicker.mjs.map +1 -1
  68. package/fesm2022/dialog/testing.mjs +15 -9
  69. package/fesm2022/dialog/testing.mjs.map +1 -1
  70. package/fesm2022/dialog.mjs +210 -140
  71. package/fesm2022/dialog.mjs.map +1 -1
  72. package/fesm2022/divider/testing.mjs +1 -1
  73. package/fesm2022/divider/testing.mjs.map +1 -1
  74. package/fesm2022/divider.mjs +7 -9
  75. package/fesm2022/divider.mjs.map +1 -1
  76. package/fesm2022/expansion/testing.mjs +7 -10
  77. package/fesm2022/expansion/testing.mjs.map +1 -1
  78. package/fesm2022/expansion.mjs +76 -65
  79. package/fesm2022/expansion.mjs.map +1 -1
  80. package/fesm2022/form-field/testing.mjs +12 -15
  81. package/fesm2022/form-field/testing.mjs.map +1 -1
  82. package/fesm2022/form-field.mjs +165 -111
  83. package/fesm2022/form-field.mjs.map +1 -1
  84. package/fesm2022/grid-list/testing.mjs +11 -17
  85. package/fesm2022/grid-list/testing.mjs.map +1 -1
  86. package/fesm2022/grid-list.mjs +65 -43
  87. package/fesm2022/grid-list.mjs.map +1 -1
  88. package/fesm2022/icon/testing.mjs +6 -6
  89. package/fesm2022/icon/testing.mjs.map +1 -1
  90. package/fesm2022/icon.mjs +62 -42
  91. package/fesm2022/icon.mjs.map +1 -1
  92. package/fesm2022/input/testing.mjs +3 -3
  93. package/fesm2022/input/testing.mjs.map +1 -1
  94. package/fesm2022/input.mjs +101 -69
  95. package/fesm2022/input.mjs.map +1 -1
  96. package/fesm2022/list/testing.mjs +21 -38
  97. package/fesm2022/list/testing.mjs.map +1 -1
  98. package/fesm2022/list.mjs +175 -164
  99. package/fesm2022/list.mjs.map +1 -1
  100. package/fesm2022/menu/testing.mjs +3 -6
  101. package/fesm2022/menu/testing.mjs.map +1 -1
  102. package/fesm2022/menu.mjs +171 -118
  103. package/fesm2022/menu.mjs.map +1 -1
  104. package/fesm2022/paginator/testing.mjs +10 -13
  105. package/fesm2022/paginator/testing.mjs.map +1 -1
  106. package/fesm2022/paginator.mjs +79 -54
  107. package/fesm2022/paginator.mjs.map +1 -1
  108. package/fesm2022/progress-bar/testing.mjs +1 -1
  109. package/fesm2022/progress-bar/testing.mjs.map +1 -1
  110. package/fesm2022/progress-bar.mjs +33 -32
  111. package/fesm2022/progress-bar.mjs.map +1 -1
  112. package/fesm2022/progress-spinner/testing.mjs +1 -1
  113. package/fesm2022/progress-spinner/testing.mjs.map +1 -1
  114. package/fesm2022/progress-spinner.mjs +25 -11
  115. package/fesm2022/progress-spinner.mjs.map +1 -1
  116. package/fesm2022/radio/testing.mjs +6 -12
  117. package/fesm2022/radio/testing.mjs.map +1 -1
  118. package/fesm2022/radio.mjs +119 -82
  119. package/fesm2022/radio.mjs.map +1 -1
  120. package/fesm2022/select/testing.mjs +6 -9
  121. package/fesm2022/select/testing.mjs.map +1 -1
  122. package/fesm2022/select.mjs +215 -177
  123. package/fesm2022/select.mjs.map +1 -1
  124. package/fesm2022/sidenav/testing.mjs +6 -6
  125. package/fesm2022/sidenav/testing.mjs.map +1 -1
  126. package/fesm2022/sidenav.mjs +125 -112
  127. package/fesm2022/sidenav.mjs.map +1 -1
  128. package/fesm2022/slide-toggle/testing.mjs +3 -6
  129. package/fesm2022/slide-toggle/testing.mjs.map +1 -1
  130. package/fesm2022/slide-toggle.mjs +72 -41
  131. package/fesm2022/slide-toggle.mjs.map +1 -1
  132. package/fesm2022/slider/testing.mjs +2 -2
  133. package/fesm2022/slider/testing.mjs.map +1 -1
  134. package/fesm2022/slider.mjs +255 -185
  135. package/fesm2022/slider.mjs.map +1 -1
  136. package/fesm2022/snack-bar/testing.mjs +4 -7
  137. package/fesm2022/snack-bar/testing.mjs.map +1 -1
  138. package/fesm2022/snack-bar.mjs +133 -98
  139. package/fesm2022/snack-bar.mjs.map +1 -1
  140. package/fesm2022/sort/testing.mjs +3 -6
  141. package/fesm2022/sort/testing.mjs.map +1 -1
  142. package/fesm2022/sort.mjs +89 -68
  143. package/fesm2022/sort.mjs.map +1 -1
  144. package/fesm2022/stepper/testing.mjs +4 -4
  145. package/fesm2022/stepper/testing.mjs.map +1 -1
  146. package/fesm2022/stepper.mjs +133 -95
  147. package/fesm2022/stepper.mjs.map +1 -1
  148. package/fesm2022/table/testing.mjs +13 -25
  149. package/fesm2022/table/testing.mjs.map +1 -1
  150. package/fesm2022/table.mjs +164 -159
  151. package/fesm2022/table.mjs.map +1 -1
  152. package/fesm2022/tabs/testing.mjs +5 -5
  153. package/fesm2022/tabs/testing.mjs.map +1 -1
  154. package/fesm2022/tabs.mjs +308 -225
  155. package/fesm2022/tabs.mjs.map +1 -1
  156. package/fesm2022/timepicker/testing.mjs +7 -16
  157. package/fesm2022/timepicker/testing.mjs.map +1 -1
  158. package/fesm2022/timepicker.mjs +152 -146
  159. package/fesm2022/timepicker.mjs.map +1 -1
  160. package/fesm2022/toolbar/testing.mjs +2 -5
  161. package/fesm2022/toolbar/testing.mjs.map +1 -1
  162. package/fesm2022/toolbar.mjs +22 -12
  163. package/fesm2022/toolbar.mjs.map +1 -1
  164. package/fesm2022/tooltip/testing.mjs +6 -9
  165. package/fesm2022/tooltip/testing.mjs.map +1 -1
  166. package/fesm2022/tooltip.mjs +93 -69
  167. package/fesm2022/tooltip.mjs.map +1 -1
  168. package/fesm2022/tree/testing.mjs +3 -6
  169. package/fesm2022/tree/testing.mjs.map +1 -1
  170. package/fesm2022/tree.mjs +48 -46
  171. package/fesm2022/tree.mjs.map +1 -1
  172. package/form-field/_form-field-theme.scss +9 -5
  173. package/form-field/index.d.ts +8 -9
  174. package/grid-list/_grid-list-theme.scss +8 -4
  175. package/icon/_icon-theme.scss +10 -6
  176. package/input/_input-theme.scss +8 -4
  177. package/list/_list-theme.scss +8 -4
  178. package/list/index.d.ts +20 -21
  179. package/menu/_menu-theme.scss +8 -4
  180. package/menu/index.d.ts +8 -9
  181. package/package.json +2 -2
  182. package/paginator/_paginator-theme.scss +8 -4
  183. package/prebuilt-themes/azure-blue.css +1 -1
  184. package/prebuilt-themes/cyan-orange.css +1 -1
  185. package/prebuilt-themes/deeppurple-amber.css +1 -1
  186. package/prebuilt-themes/indigo-pink.css +1 -1
  187. package/prebuilt-themes/magenta-violet.css +1 -1
  188. package/prebuilt-themes/pink-bluegrey.css +1 -1
  189. package/prebuilt-themes/purple-green.css +1 -1
  190. package/prebuilt-themes/rose-red.css +1 -1
  191. package/progress-bar/_progress-bar-theme.scss +11 -9
  192. package/progress-spinner/_progress-spinner-theme.scss +11 -9
  193. package/progress-spinner/index.d.ts +3 -4
  194. package/radio/_radio-theme.scss +10 -6
  195. package/radio/index.d.ts +2 -3
  196. package/schematics/ng-add/index.js +1 -1
  197. package/schematics/ng-add/index.mjs +1 -1
  198. package/schematics/ng-add/theming/create-custom-theme.js +1 -6
  199. package/schematics/ng-add/theming/create-custom-theme.mjs +1 -6
  200. package/schematics/ng-generate/theme-color/index_bundled.js +35 -9
  201. package/schematics/ng-generate/theme-color/index_bundled.js.map +2 -2
  202. package/schematics/ng-update/index_bundled.js +6 -1
  203. package/schematics/ng-update/index_bundled.js.map +1 -1
  204. package/select/_select-theme.scss +10 -6
  205. package/select/index.d.ts +6 -7
  206. package/sidenav/_sidenav-theme.scss +8 -4
  207. package/slide-toggle/_slide-toggle-theme.scss +10 -6
  208. package/slider/_slider-theme.scss +10 -6
  209. package/snack-bar/_snack-bar-theme.scss +10 -6
  210. package/sort/_sort-theme.scss +8 -4
  211. package/stepper/_stepper-theme.scss +10 -6
  212. package/stepper/index.d.ts +14 -15
  213. package/table/_table-theme.scss +8 -4
  214. package/tabs/_tabs-theme.scss +10 -6
  215. package/timepicker/_timepicker-theme.scss +10 -6
  216. package/toolbar/_toolbar-theme.scss +10 -6
  217. package/tooltip/_tooltip-theme.scss +8 -4
  218. package/tooltip/index.d.ts +5 -6
  219. package/tree/_tree-theme.scss +8 -4
@@ -1,5 +1,6 @@
1
1
  @use '../style/elevation';
2
2
  @use '../style/sass-utils';
3
+ @use '../theming/config-validation';
3
4
  @use '../theming/definition';
4
5
  @use './m3/definitions';
5
6
  @use 'sass:map';
@@ -7,22 +8,15 @@
7
8
  @use 'sass:list';
8
9
  @use './m3-tokens';
9
10
 
10
- // Prefix used for component token fallback variables, e.g.
11
- // `color: var(--mdc-text-button-label-text-color, var(--mat-sys-primary));`
12
- $_system-fallback-prefix: mat-sys;
13
-
14
- // Default system level prefix to use when directly calling the `system-level-*` mixins
15
- $_system-level-prefix: sys;
16
-
17
11
  /// Emits necessary CSS variables for Material's system level values for the values defined in the
18
12
  /// config map. The config map can have values color, typography, and/or density.
19
13
  ///
20
14
  /// If the config map's color value is an Angular Material color palette, it will be used as the
21
- /// primary and tertiary colors with a light theme type. Otherwise if the color value is a map,
22
- /// it must have a `primary` value containing an Angular Material color palette, and optionally
23
- /// a different `tertiary` palette (defaults to primary palette) and `theme-type` that is either
24
- /// `light` or `dark` (defaults to light). Color variable definitions will not be emitted if there
25
- /// are no color values in the config.
15
+ /// primary and tertiary colors with a `color-scheme` theme type. Otherwise if the color value is a
16
+ /// map, it must have a `primary` value containing an Angular Material color palette, and
17
+ /// optionally a different `tertiary` palette (defaults to primary palette) and `theme-type` that
18
+ /// is either `light`, `dark`, or 'color-scheme` (defaults to `color-scheme`). Color variable
19
+ /// definitions will not be emitted if there are no color values in the config.
26
20
  ///
27
21
  /// If the config map's typography value is a font family string, it will be used as the
28
22
  /// plain and brand font family with default bold, medium, and regular weights of 700, 500, and 400,
@@ -44,11 +38,19 @@ $_system-level-prefix: sys;
44
38
  $color: map.get($config, color);
45
39
  $color-config: null;
46
40
  @if ($color) {
47
- $color-config: if(meta.type-of($color) == 'map',
48
- definition.define-colors($color),
49
- definition.define-colors((primary: $color)));
50
- @include system-level-colors($color-config, $overrides, $_system-fallback-prefix);
51
- @include system-level-elevation($color-config, $overrides, $_system-fallback-prefix);
41
+ // validate-palette returns null if it is a valid M3 palette
42
+ $is-palette: config-validation.validate-palette($color) == null;
43
+
44
+ // Default to "color-scheme" theme type if the config's color does not provide one.
45
+ @if (not $is-palette and not map.has-key($color, theme-type)) {
46
+ $color: map.set($color, theme-type, color-scheme);
47
+ }
48
+
49
+ $color-config: if($is-palette,
50
+ definition.define-colors((primary: $color, theme-type: color-scheme)),
51
+ definition.define-colors($color));
52
+ @include system-level-colors($color-config, $overrides, definition.$system-fallback-prefix);
53
+ @include system-level-elevation($color-config, $overrides, definition.$system-fallback-prefix);
52
54
  }
53
55
 
54
56
  $typography: map.get($config, typography);
@@ -57,7 +59,8 @@ $_system-level-prefix: sys;
57
59
  $typography-config: if(meta.type-of($typography) == 'map',
58
60
  definition.define-typography($typography),
59
61
  definition.define-typography((plain-family: $typography)));
60
- @include system-level-typography($typography-config, $overrides, $_system-fallback-prefix);
62
+ @include system-level-typography(
63
+ $typography-config, $overrides, definition.$system-fallback-prefix);
61
64
  }
62
65
 
63
66
  $density: map.get($config, density);
@@ -79,14 +82,13 @@ $_system-level-prefix: sys;
79
82
  }
80
83
  }
81
84
 
82
- @include system-level-shape($overrides: $overrides, $prefix: $_system-fallback-prefix);
83
- @include system-level-motion($overrides:$overrides, $prefix: $_system-fallback-prefix);
84
- @include system-level-state($overrides: $overrides, $prefix: $_system-fallback-prefix);
85
+ @include system-level-shape($overrides: $overrides, $prefix: definition.$system-fallback-prefix);
86
+ @include system-level-state($overrides: $overrides, $prefix: definition.$system-fallback-prefix);
85
87
  }
86
88
 
87
89
  /// Emits the system-level CSS variables for each of the provided override values. E.g. to
88
90
  /// change the primary color to red, use `mat.theme-overrides((primary: red));`
89
- @mixin theme-overrides($overrides, $prefix: $_system-fallback-prefix) {
91
+ @mixin theme-overrides($overrides, $prefix: definition.$system-fallback-prefix) {
90
92
  $sys-names: map-merge-all(
91
93
  definitions.md-sys-color-values-light(),
92
94
  definitions.md-sys-typescale-values(),
@@ -119,16 +121,14 @@ $_system-level-prefix: sys;
119
121
 
120
122
  @if (not $prefix) {
121
123
  $prefix: map.get($theme, _mat-theming-internals-do-not-access,
122
- color-system-variables-prefix) or $_system-level-prefix;
124
+ color-system-variables-prefix) or definition.$system-level-prefix;
123
125
  }
124
126
 
125
127
  $ref: (
126
128
  md-ref-palette: m3-tokens.generate-ref-palette-tokens($primary, $tertiary, $error)
127
129
  );
128
130
 
129
- $sys-colors: if($type == dark,
130
- definitions.md-sys-color-values-dark($ref),
131
- definitions.md-sys-color-values-light($ref));
131
+ $sys-colors: _generate-sys-colors($ref, $type);
132
132
 
133
133
  // Manually insert a subset of palette values that are used directly by components
134
134
  // instead of system variables.
@@ -144,6 +144,30 @@ $_system-level-prefix: sys;
144
144
  }
145
145
  }
146
146
 
147
+ @function _generate-sys-colors($ref, $type) {
148
+ $light-sys-colors: definitions.md-sys-color-values-light($ref);
149
+ @if ($type == light) {
150
+ @return $light-sys-colors;
151
+ }
152
+
153
+ $dark-sys-colors: definitions.md-sys-color-values-dark($ref);
154
+ @if ($type == dark) {
155
+ @return $dark-sys-colors;
156
+ }
157
+
158
+ @if ($type == color-scheme) {
159
+ $light-dark-sys-colors: ();
160
+ @each $name, $light-value in $light-sys-colors {
161
+ $dark-value: map.get($dark-sys-colors, $name);
162
+ $light-dark-sys-colors:
163
+ map.set($light-dark-sys-colors, $name, light-dark($light-value, $dark-value));
164
+ }
165
+ @return $light-dark-sys-colors;
166
+ }
167
+
168
+ @error 'Unknown theme-type provided: #{$type}';
169
+ }
170
+
147
171
  @mixin system-level-typography($theme, $overrides: (), $prefix: null) {
148
172
  $font-definition: map.get($theme, _mat-theming-internals-do-not-access, font-definition);
149
173
  $brand: map.get($font-definition, brand);
@@ -157,7 +181,7 @@ $_system-level-prefix: sys;
157
181
 
158
182
  @if (not $prefix) {
159
183
  $prefix: map.get($theme, _mat-theming-internals-do-not-access,
160
- typography-system-variables-prefix) or $_system-level-prefix;
184
+ typography-system-variables-prefix) or definition.$system-level-prefix;
161
185
  }
162
186
 
163
187
  & {
@@ -167,7 +191,7 @@ $_system-level-prefix: sys;
167
191
  }
168
192
  }
169
193
 
170
- @mixin system-level-elevation($theme, $overrides: (), $prefix: $_system-level-prefix) {
194
+ @mixin system-level-elevation($theme, $overrides: (), $prefix: definition.$system-level-prefix) {
171
195
  $shadow-color: map.get(
172
196
  $theme, _mat-theming-internals-do-not-access, color-tokens, (mdc, theme), shadow);
173
197
 
@@ -180,7 +204,7 @@ $_system-level-prefix: sys;
180
204
  }
181
205
  }
182
206
 
183
- @mixin system-level-shape($theme: (), $overrides: (), $prefix: $_system-level-prefix) {
207
+ @mixin system-level-shape($theme: (), $overrides: (), $prefix: definition.$system-level-prefix) {
184
208
  & {
185
209
  @each $name, $value in definitions.md-sys-shape-values() {
186
210
  --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
@@ -188,7 +212,7 @@ $_system-level-prefix: sys;
188
212
  }
189
213
  }
190
214
 
191
- @mixin system-level-state($theme: (), $overrides: (), $prefix: $_system-level-prefix) {
215
+ @mixin system-level-state($theme: (), $overrides: (), $prefix: definition.$system-level-prefix) {
192
216
  & {
193
217
  @each $name, $value in definitions.md-sys-state-values() {
194
218
  --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
@@ -196,21 +220,13 @@ $_system-level-prefix: sys;
196
220
  }
197
221
  }
198
222
 
199
- @mixin system-level-motion($theme: (), $overrides: (), $prefix: $_system-level-prefix) {
200
- & {
201
- @each $name, $value in definitions.md-sys-motion-values() {
202
- --#{$prefix}-#{$name}: #{map.get($overrides, $name) or $value};
203
- }
204
- }
205
- }
206
-
207
223
  // Return a new map where the values are the same as the provided map's
208
224
  // keys, prefixed with "--mat-sys-". For example:
209
225
  // (key1: '', key2: '') --> (key1: --mat-sys-key1, key2: --mat-sys-key2)
210
226
  @function _create-system-app-vars-map($map) {
211
227
  $new-map: ();
212
228
  @each $key, $value in $map {
213
- $new-map: map.set($new-map, $key, --#{$_system-fallback-prefix}-#{$key});
229
+ $new-map: map.set($new-map, $key, --#{definition.$system-fallback-prefix}-#{$key});
214
230
  }
215
231
  @return $new-map;
216
232
  }
@@ -145,18 +145,22 @@ $calendar-weekday-table-font-size: 11px !default;
145
145
  }
146
146
  }
147
147
 
148
- /// Outputs the CSS variable values for the given tokens.
149
- /// @param {Map} $tokens The token values to emit.
150
- @mixin overrides($tokens: ()) {
151
- @include token-utils.batch-create-token-values(
152
- $tokens,
148
+ /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
149
+ @function _define-overrides() {
150
+ @return (
153
151
  (
154
152
  namespace: tokens-mat-datepicker.$prefix,
155
153
  tokens: tokens-mat-datepicker.get-token-slots(),
156
- )
154
+ ),
157
155
  );
158
156
  }
159
157
 
158
+ /// Outputs the CSS variable values for the given tokens.
159
+ /// @param {Map} $tokens The token values to emit.
160
+ @mixin overrides($tokens: ()) {
161
+ @include token-utils.batch-create-token-values($tokens, _define-overrides()...);
162
+ }
163
+
160
164
  /// Outputs all (base, color, typography, and density) theme styles for the mat-datepicker.
161
165
  /// @param {Map} $theme The theme to generate styles for.
162
166
  /// @param {ArgList} Additional optional arguments (only supported for M3 themes):
@@ -17,13 +17,12 @@ import { FactoryProvider } from '@angular/core';
17
17
  import { FocusOrigin } from '@angular/cdk/a11y';
18
18
  import { FormGroupDirective } from '@angular/forms';
19
19
  import * as i0 from '@angular/core';
20
- import * as i1 from '@angular/common';
21
- import * as i2 from '@angular/material/button';
22
- import * as i20 from '@angular/cdk/scrolling';
23
- import * as i3 from '@angular/cdk/overlay';
24
- import * as i4 from '@angular/cdk/a11y';
25
- import * as i5 from '@angular/cdk/portal';
26
- import * as i6 from '@angular/material/core';
20
+ import * as i1 from '@angular/material/button';
21
+ import * as i19 from '@angular/cdk/scrolling';
22
+ import * as i2 from '@angular/cdk/overlay';
23
+ import * as i3 from '@angular/cdk/a11y';
24
+ import * as i4 from '@angular/cdk/portal';
25
+ import * as i5 from '@angular/material/core';
27
26
  import { InjectionToken } from '@angular/core';
28
27
  import { MatButton } from '@angular/material/button';
29
28
  import { MatFormFieldControl } from '@angular/material/form-field';
@@ -116,20 +115,6 @@ export declare type ExtractDateTypeFromSelection<T> = T extends DateRange<infer
116
115
  declare function getActiveOffset<D>(dateAdapter: DateAdapter<D>, activeDate: D, minDate: D | null, maxDate: D | null): number;
117
116
 
118
117
  declare namespace i10 {
119
- export {
120
- MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY,
121
- MAT_DATEPICKER_SCROLL_STRATEGY,
122
- DatepickerDropdownPositionX,
123
- DatepickerDropdownPositionY,
124
- MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER,
125
- MatDatepickerContent,
126
- MatDatepickerControl,
127
- MatDatepickerPanel,
128
- MatDatepickerBase
129
- }
130
- }
131
-
132
- declare namespace i11 {
133
118
  export {
134
119
  MAT_DATEPICKER_VALUE_ACCESSOR,
135
120
  MAT_DATEPICKER_VALIDATORS,
@@ -137,26 +122,26 @@ declare namespace i11 {
137
122
  }
138
123
  }
139
124
 
140
- declare namespace i12 {
125
+ declare namespace i11 {
141
126
  export {
142
127
  MatDatepickerToggleIcon,
143
128
  MatDatepickerToggle
144
129
  }
145
130
  }
146
131
 
147
- declare namespace i13 {
132
+ declare namespace i12 {
148
133
  export {
149
134
  MatMonthView
150
135
  }
151
136
  }
152
137
 
153
- declare namespace i14 {
138
+ declare namespace i13 {
154
139
  export {
155
140
  MatYearView
156
141
  }
157
142
  }
158
143
 
159
- declare namespace i15 {
144
+ declare namespace i14 {
160
145
  export {
161
146
  isSameMultiYearView,
162
147
  getActiveOffset,
@@ -166,13 +151,13 @@ declare namespace i15 {
166
151
  }
167
152
  }
168
153
 
169
- declare namespace i16 {
154
+ declare namespace i15 {
170
155
  export {
171
156
  MatDateRangeInput
172
157
  }
173
158
  }
174
159
 
175
- declare namespace i17 {
160
+ declare namespace i16 {
176
161
  export {
177
162
  MatDateRangeInputParent,
178
163
  MAT_DATE_RANGE_INPUT_PARENT,
@@ -181,14 +166,14 @@ declare namespace i17 {
181
166
  }
182
167
  }
183
168
 
184
- declare namespace i18 {
169
+ declare namespace i17 {
185
170
  export {
186
171
  MatDateRangePickerInput,
187
172
  MatDateRangePicker
188
173
  }
189
174
  }
190
175
 
191
- declare namespace i19 {
176
+ declare namespace i18 {
192
177
  export {
193
178
  MatDatepickerApply,
194
179
  MatDatepickerCancel,
@@ -196,7 +181,7 @@ declare namespace i19 {
196
181
  }
197
182
  }
198
183
 
199
- declare namespace i7 {
184
+ declare namespace i6 {
200
185
  export {
201
186
  MatCalendarView,
202
187
  MatCalendarHeader,
@@ -204,7 +189,7 @@ declare namespace i7 {
204
189
  }
205
190
  }
206
191
 
207
- declare namespace i8 {
192
+ declare namespace i7 {
208
193
  export {
209
194
  MatCalendarCellCssClasses,
210
195
  MatCalendarCellClassFunction,
@@ -214,12 +199,26 @@ declare namespace i8 {
214
199
  }
215
200
  }
216
201
 
217
- declare namespace i9 {
202
+ declare namespace i8 {
218
203
  export {
219
204
  MatDatepicker
220
205
  }
221
206
  }
222
207
 
208
+ declare namespace i9 {
209
+ export {
210
+ MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY,
211
+ MAT_DATEPICKER_SCROLL_STRATEGY,
212
+ DatepickerDropdownPositionX,
213
+ DatepickerDropdownPositionY,
214
+ MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER,
215
+ MatDatepickerContent,
216
+ MatDatepickerControl,
217
+ MatDatepickerPanel,
218
+ MatDatepickerBase
219
+ }
220
+ }
221
+
223
222
  declare function isSameMultiYearView<D>(dateAdapter: DateAdapter<D>, date1: D, date2: D, minDate: D | null, maxDate: D | null): boolean;
224
223
 
225
224
  /**
@@ -1148,7 +1147,7 @@ export declare class MatDatepickerIntl {
1148
1147
 
1149
1148
  export declare class MatDatepickerModule {
1150
1149
  static ɵfac: i0.ɵɵFactoryDeclaration<MatDatepickerModule, never>;
1151
- static ɵmod: i0.ɵɵNgModuleDeclaration<MatDatepickerModule, never, [typeof i1.CommonModule, typeof i2.MatButtonModule, typeof i3.OverlayModule, typeof i4.A11yModule, typeof i5.PortalModule, typeof i6.MatCommonModule, typeof i7.MatCalendar, typeof i8.MatCalendarBody, typeof i9.MatDatepicker, typeof i10.MatDatepickerContent, typeof i11.MatDatepickerInput, typeof i12.MatDatepickerToggle, typeof i12.MatDatepickerToggleIcon, typeof i13.MatMonthView, typeof i14.MatYearView, typeof i15.MatMultiYearView, typeof i7.MatCalendarHeader, typeof i16.MatDateRangeInput, typeof i17.MatStartDate, typeof i17.MatEndDate, typeof i18.MatDateRangePicker, typeof i19.MatDatepickerActions, typeof i19.MatDatepickerCancel, typeof i19.MatDatepickerApply], [typeof i20.CdkScrollableModule, typeof i7.MatCalendar, typeof i8.MatCalendarBody, typeof i9.MatDatepicker, typeof i10.MatDatepickerContent, typeof i11.MatDatepickerInput, typeof i12.MatDatepickerToggle, typeof i12.MatDatepickerToggleIcon, typeof i13.MatMonthView, typeof i14.MatYearView, typeof i15.MatMultiYearView, typeof i7.MatCalendarHeader, typeof i16.MatDateRangeInput, typeof i17.MatStartDate, typeof i17.MatEndDate, typeof i18.MatDateRangePicker, typeof i19.MatDatepickerActions, typeof i19.MatDatepickerCancel, typeof i19.MatDatepickerApply]>;
1150
+ static ɵmod: i0.ɵɵNgModuleDeclaration<MatDatepickerModule, never, [typeof i1.MatButtonModule, typeof i2.OverlayModule, typeof i3.A11yModule, typeof i4.PortalModule, typeof i5.MatCommonModule, typeof i6.MatCalendar, typeof i7.MatCalendarBody, typeof i8.MatDatepicker, typeof i9.MatDatepickerContent, typeof i10.MatDatepickerInput, typeof i11.MatDatepickerToggle, typeof i11.MatDatepickerToggleIcon, typeof i12.MatMonthView, typeof i13.MatYearView, typeof i14.MatMultiYearView, typeof i6.MatCalendarHeader, typeof i15.MatDateRangeInput, typeof i16.MatStartDate, typeof i16.MatEndDate, typeof i17.MatDateRangePicker, typeof i18.MatDatepickerActions, typeof i18.MatDatepickerCancel, typeof i18.MatDatepickerApply], [typeof i19.CdkScrollableModule, typeof i6.MatCalendar, typeof i7.MatCalendarBody, typeof i8.MatDatepicker, typeof i9.MatDatepickerContent, typeof i10.MatDatepickerInput, typeof i11.MatDatepickerToggle, typeof i11.MatDatepickerToggleIcon, typeof i12.MatMonthView, typeof i13.MatYearView, typeof i14.MatMultiYearView, typeof i6.MatCalendarHeader, typeof i15.MatDateRangeInput, typeof i16.MatStartDate, typeof i16.MatEndDate, typeof i17.MatDateRangePicker, typeof i18.MatDatepickerActions, typeof i18.MatDatepickerCancel, typeof i18.MatDatepickerApply]>;
1152
1151
  static ɵinj: i0.ɵɵInjectorDeclaration<MatDatepickerModule>;
1153
1152
  }
1154
1153
 
@@ -67,9 +67,9 @@
67
67
  }
68
68
  }
69
69
 
70
- @mixin overrides($tokens: ()) {
71
- @include token-utils.batch-create-token-values(
72
- $tokens,
70
+ /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
71
+ @function _define-overrides() {
72
+ @return (
73
73
  (
74
74
  namespace: tokens-mdc-dialog.$prefix,
75
75
  tokens: tokens-mdc-dialog.get-token-slots(),
@@ -77,10 +77,14 @@
77
77
  (
78
78
  namespace: tokens-mat-dialog.$prefix,
79
79
  tokens: tokens-mat-dialog.get-token-slots(),
80
- )
80
+ ),
81
81
  );
82
82
  }
83
83
 
84
+ @mixin overrides($tokens: ()) {
85
+ @include token-utils.batch-create-token-values($tokens, _define-overrides()...);
86
+ }
87
+
84
88
  @mixin theme($theme) {
85
89
  @include theming.private-check-duplicate-theme-styles($theme, 'mat-dialog') {
86
90
  @if inspection.get-theme-version($theme) == 1 {
@@ -46,16 +46,20 @@
46
46
  }
47
47
  }
48
48
 
49
- @mixin overrides($tokens: ()) {
50
- @include token-utils.batch-create-token-values(
51
- $tokens,
49
+ /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
50
+ @function _define-overrides() {
51
+ @return (
52
52
  (
53
53
  namespace: tokens-mat-divider.$prefix,
54
54
  tokens: tokens-mat-divider.get-token-slots(),
55
- )
55
+ ),
56
56
  );
57
57
  }
58
58
 
59
+ @mixin overrides($tokens: ()) {
60
+ @include token-utils.batch-create-token-values($tokens, _define-overrides()...);
61
+ }
62
+
59
63
  @mixin theme($theme) {
60
64
  @include theming.private-check-duplicate-theme-styles($theme, 'mat-divider') {
61
65
  @if inspection.get-theme-version($theme) == 1 {
@@ -62,16 +62,20 @@
62
62
  }
63
63
  }
64
64
 
65
- @mixin overrides($tokens: ()) {
66
- @include token-utils.batch-create-token-values(
67
- $tokens,
65
+ /// Defines the tokens that will be available in the `overrides` mixin and for docs extraction.
66
+ @function _define-overrides() {
67
+ @return (
68
68
  (
69
69
  namespace: tokens-mat-expansion.$prefix,
70
70
  tokens: tokens-mat-expansion.get-token-slots(),
71
- )
71
+ ),
72
72
  );
73
73
  }
74
74
 
75
+ @mixin overrides($tokens: ()) {
76
+ @include token-utils.batch-create-token-values($tokens, _define-overrides()...);
77
+ }
78
+
75
79
  @mixin theme($theme) {
76
80
  @include theming.private-check-duplicate-theme-styles($theme, 'mat-expansion') {
77
81
  @if inspection.get-theme-version($theme) == 1 {
@@ -3,12 +3,9 @@ import { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';
3
3
  import { MatOptionHarness, MatOptgroupHarness } from '@angular/material/core/testing';
4
4
 
5
5
  class MatAutocompleteHarness extends ComponentHarness {
6
- constructor() {
7
- super(...arguments);
8
- this._documentRootLocator = this.documentRootLocatorFactory();
9
- }
6
+ _documentRootLocator = this.documentRootLocatorFactory();
10
7
  /** The selector for the host element of a `MatAutocomplete` instance. */
11
- static { this.hostSelector = '.mat-mdc-autocomplete-trigger'; }
8
+ static hostSelector = '.mat-mdc-autocomplete-trigger';
12
9
  /**
13
10
  * Gets a `HarnessPredicate` that can be used to search for an autocomplete with specific
14
11
  * attributes.
@@ -1 +1 @@
1
- {"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/autocomplete/testing/autocomplete-harness.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n TestElement,\n} from '@angular/cdk/testing';\nimport {\n MatOptgroupHarness,\n MatOptionHarness,\n OptgroupHarnessFilters,\n OptionHarnessFilters,\n} from '@angular/material/core/testing';\nimport {AutocompleteHarnessFilters} from './autocomplete-harness-filters';\n\nexport class MatAutocompleteHarness extends ComponentHarness {\n private _documentRootLocator = this.documentRootLocatorFactory();\n\n /** The selector for the host element of a `MatAutocomplete` instance. */\n static hostSelector = '.mat-mdc-autocomplete-trigger';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for an autocomplete with specific\n * attributes.\n * @param options Options for filtering which autocomplete instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with<T extends MatAutocompleteHarness>(\n this: ComponentHarnessConstructor<T>,\n options: AutocompleteHarnessFilters = {},\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options)\n .addOption('value', options.value, (harness, value) =>\n HarnessPredicate.stringMatches(harness.getValue(), value),\n )\n .addOption('disabled', options.disabled, async (harness, disabled) => {\n return (await harness.isDisabled()) === disabled;\n });\n }\n\n /** Gets the value of the autocomplete input. */\n async getValue(): Promise<string> {\n return (await this.host()).getProperty<string>('value');\n }\n\n /** Whether the autocomplete input is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('disabled');\n return coerceBooleanProperty(await disabled);\n }\n\n /** Focuses the autocomplete input. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blurs the autocomplete input. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Whether the autocomplete input is focused. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /** Enters text into the autocomplete. */\n async enterText(value: string): Promise<void> {\n return (await this.host()).sendKeys(value);\n }\n\n /** Clears the input value. */\n async clear(): Promise<void> {\n return (await this.host()).clear();\n }\n\n /** Gets the options inside the autocomplete panel. */\n async getOptions(filters?: Omit<OptionHarnessFilters, 'ancestor'>): Promise<MatOptionHarness[]> {\n if (!(await this.isOpen())) {\n throw new Error('Unable to retrieve options for autocomplete. Autocomplete panel is closed.');\n }\n\n return this._documentRootLocator.locatorForAll(\n MatOptionHarness.with({\n ...(filters || {}),\n ancestor: await this._getPanelSelector(),\n } as OptionHarnessFilters),\n )();\n }\n\n /** Gets the option groups inside the autocomplete panel. */\n async getOptionGroups(\n filters?: Omit<OptgroupHarnessFilters, 'ancestor'>,\n ): Promise<MatOptgroupHarness[]> {\n if (!(await this.isOpen())) {\n throw new Error(\n 'Unable to retrieve option groups for autocomplete. Autocomplete panel is closed.',\n );\n }\n\n return this._documentRootLocator.locatorForAll(\n MatOptgroupHarness.with({\n ...(filters || {}),\n ancestor: await this._getPanelSelector(),\n } as OptgroupHarnessFilters),\n )();\n }\n\n /** Selects the first option matching the given filters. */\n async selectOption(filters: OptionHarnessFilters): Promise<void> {\n await this.focus(); // Focus the input to make sure the autocomplete panel is shown.\n const options = await this.getOptions(filters);\n if (!options.length) {\n throw Error(`Could not find a mat-option matching ${JSON.stringify(filters)}`);\n }\n await options[0].click();\n }\n\n /** Whether the autocomplete is open. */\n async isOpen(): Promise<boolean> {\n const panel = await this._getPanel();\n return !!panel && (await panel.hasClass(`mat-mdc-autocomplete-visible`));\n }\n\n /** Gets the panel associated with this autocomplete trigger. */\n private async _getPanel(): Promise<TestElement | null> {\n // Technically this is static, but it needs to be in a\n // function, because the autocomplete's panel ID can changed.\n return this._documentRootLocator.locatorForOptional(await this._getPanelSelector())();\n }\n\n /** Gets the selector that can be used to find the autocomplete trigger's panel. */\n protected async _getPanelSelector(): Promise<string> {\n return `#${await (await this.host()).getAttribute('aria-controls')}`;\n }\n}\n"],"names":[],"mappings":";;;;AAuBM,MAAO,sBAAuB,SAAQ,gBAAgB,CAAA;AAA5D,IAAA,WAAA,GAAA;;AACU,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC;KAuHlE;;aApHQ,IAAY,CAAA,YAAA,GAAG,+BAAH,CAAmC,EAAA;AAEtD;;;;;AAKG;AACH,IAAA,OAAO,IAAI,CAET,OAAA,GAAsC,EAAE,EAAA;AAExC,QAAA,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC;aACvC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,KAChD,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,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C1E;;AAGO,IAAA,MAAM,SAAS,GAAA;;;AAGrB,QAAA,OAAO,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC,EAAE,CAAC;KACvF;;AAGS,IAAA,MAAM,iBAAiB,GAAA;AAC/B,QAAA,OAAO,CAAI,CAAA,EAAA,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,YAAY,CAAC,eAAe,CAAC,EAAE,CAAC;KACtE;;;;;"}
1
+ {"version":3,"file":"testing.mjs","sources":["../../../../../../../src/material/autocomplete/testing/autocomplete-harness.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n ComponentHarness,\n ComponentHarnessConstructor,\n HarnessPredicate,\n TestElement,\n} from '@angular/cdk/testing';\nimport {\n MatOptgroupHarness,\n MatOptionHarness,\n OptgroupHarnessFilters,\n OptionHarnessFilters,\n} from '@angular/material/core/testing';\nimport {AutocompleteHarnessFilters} from './autocomplete-harness-filters';\n\nexport class MatAutocompleteHarness extends ComponentHarness {\n private _documentRootLocator = this.documentRootLocatorFactory();\n\n /** The selector for the host element of a `MatAutocomplete` instance. */\n static hostSelector = '.mat-mdc-autocomplete-trigger';\n\n /**\n * Gets a `HarnessPredicate` that can be used to search for an autocomplete with specific\n * attributes.\n * @param options Options for filtering which autocomplete instances are considered a match.\n * @return a `HarnessPredicate` configured with the given options.\n */\n static with<T extends MatAutocompleteHarness>(\n this: ComponentHarnessConstructor<T>,\n options: AutocompleteHarnessFilters = {},\n ): HarnessPredicate<T> {\n return new HarnessPredicate(this, options)\n .addOption('value', options.value, (harness, value) =>\n HarnessPredicate.stringMatches(harness.getValue(), value),\n )\n .addOption('disabled', options.disabled, async (harness, disabled) => {\n return (await harness.isDisabled()) === disabled;\n });\n }\n\n /** Gets the value of the autocomplete input. */\n async getValue(): Promise<string> {\n return (await this.host()).getProperty<string>('value');\n }\n\n /** Whether the autocomplete input is disabled. */\n async isDisabled(): Promise<boolean> {\n const disabled = (await this.host()).getAttribute('disabled');\n return coerceBooleanProperty(await disabled);\n }\n\n /** Focuses the autocomplete input. */\n async focus(): Promise<void> {\n return (await this.host()).focus();\n }\n\n /** Blurs the autocomplete input. */\n async blur(): Promise<void> {\n return (await this.host()).blur();\n }\n\n /** Whether the autocomplete input is focused. */\n async isFocused(): Promise<boolean> {\n return (await this.host()).isFocused();\n }\n\n /** Enters text into the autocomplete. */\n async enterText(value: string): Promise<void> {\n return (await this.host()).sendKeys(value);\n }\n\n /** Clears the input value. */\n async clear(): Promise<void> {\n return (await this.host()).clear();\n }\n\n /** Gets the options inside the autocomplete panel. */\n async getOptions(filters?: Omit<OptionHarnessFilters, 'ancestor'>): Promise<MatOptionHarness[]> {\n if (!(await this.isOpen())) {\n throw new Error('Unable to retrieve options for autocomplete. Autocomplete panel is closed.');\n }\n\n return this._documentRootLocator.locatorForAll(\n MatOptionHarness.with({\n ...(filters || {}),\n ancestor: await this._getPanelSelector(),\n } as OptionHarnessFilters),\n )();\n }\n\n /** Gets the option groups inside the autocomplete panel. */\n async getOptionGroups(\n filters?: Omit<OptgroupHarnessFilters, 'ancestor'>,\n ): Promise<MatOptgroupHarness[]> {\n if (!(await this.isOpen())) {\n throw new Error(\n 'Unable to retrieve option groups for autocomplete. Autocomplete panel is closed.',\n );\n }\n\n return this._documentRootLocator.locatorForAll(\n MatOptgroupHarness.with({\n ...(filters || {}),\n ancestor: await this._getPanelSelector(),\n } as OptgroupHarnessFilters),\n )();\n }\n\n /** Selects the first option matching the given filters. */\n async selectOption(filters: OptionHarnessFilters): Promise<void> {\n await this.focus(); // Focus the input to make sure the autocomplete panel is shown.\n const options = await this.getOptions(filters);\n if (!options.length) {\n throw Error(`Could not find a mat-option matching ${JSON.stringify(filters)}`);\n }\n await options[0].click();\n }\n\n /** Whether the autocomplete is open. */\n async isOpen(): Promise<boolean> {\n const panel = await this._getPanel();\n return !!panel && (await panel.hasClass(`mat-mdc-autocomplete-visible`));\n }\n\n /** Gets the panel associated with this autocomplete trigger. */\n private async _getPanel(): Promise<TestElement | null> {\n // Technically this is static, but it needs to be in a\n // function, because the autocomplete's panel ID can changed.\n return this._documentRootLocator.locatorForOptional(await this._getPanelSelector())();\n }\n\n /** Gets the selector that can be used to find the autocomplete trigger's panel. */\n protected async _getPanelSelector(): Promise<string> {\n return `#${await (await this.host()).getAttribute('aria-controls')}`;\n }\n}\n"],"names":[],"mappings":";;;;AAuBM,MAAO,sBAAuB,SAAQ,gBAAgB,CAAA;AAClD,IAAA,oBAAoB,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC;;AAGjE,IAAA,OAAO,YAAY,GAAG,+BAA+B,CAAC;AAEtD;;;;;AAKG;AACH,IAAA,OAAO,IAAI,CAET,OAAA,GAAsC,EAAE,EAAA;AAExC,QAAA,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC;aACvC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,KAChD,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAC1D;AACA,aAAA,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,OAAO,EAAE,QAAQ,KAAI;YACnE,OAAO,CAAC,MAAM,OAAO,CAAC,UAAU,EAAE,MAAM,QAAQ,CAAC;AACnD,SAAC,CAAC,CAAC;KACN;;AAGD,IAAA,MAAM,QAAQ,GAAA;AACZ,QAAA,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE,WAAW,CAAS,OAAO,CAAC,CAAC;KACzD;;AAGD,IAAA,MAAM,UAAU,GAAA;AACd,QAAA,MAAM,QAAQ,GAAG,CAAC,MAAM,IAAI,CAAC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