@angular/material 19.0.0-next.8 → 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 (229) hide show
  1. package/_index.scss +1 -2
  2. package/autocomplete/_autocomplete-theme.scss +37 -24
  3. package/autocomplete/index.d.ts +5 -6
  4. package/badge/_badge-theme.scss +38 -24
  5. package/bottom-sheet/_bottom-sheet-theme.scss +32 -20
  6. package/button/_button-theme.scss +229 -105
  7. package/button/_fab-theme.scss +95 -44
  8. package/button/_icon-button-theme.scss +38 -25
  9. package/button/index.d.ts +3 -3
  10. package/button-toggle/_button-toggle-theme.scss +62 -37
  11. package/card/_card-theme.scss +79 -38
  12. package/card/index.d.ts +2 -3
  13. package/checkbox/_checkbox-theme.scss +16 -10
  14. package/chips/_chips-theme.scss +64 -30
  15. package/core/_core-theme.scss +55 -37
  16. package/core/_core.scss +3 -6
  17. package/core/option/_optgroup-theme.scss +29 -18
  18. package/core/option/_option-theme.scss +34 -21
  19. package/core/ripple/_ripple-theme.scss +33 -21
  20. package/core/selection/pseudo-checkbox/_pseudo-checkbox-theme.scss +49 -23
  21. package/core/theming/_config-validation.scss +4 -4
  22. package/core/theming/_definition.scss +12 -2
  23. package/core/tokens/_m3-system.scss +86 -42
  24. package/core/tokens/_token-utils.scss +91 -34
  25. package/core/tokens/m2/mat/_badge.scss +12 -3
  26. package/core/tokens/m2/mdc/_radio.scss +1 -1
  27. package/core/tokens/m3/definitions/_md-comp-elevated-card.scss +1 -1
  28. package/core/tokens/m3/mat/_badge.scss +6 -3
  29. package/datepicker/_datepicker-theme.scss +53 -32
  30. package/datepicker/index.d.ts +33 -34
  31. package/dialog/_dialog-theme.scss +46 -23
  32. package/divider/_divider-theme.scss +28 -17
  33. package/expansion/_expansion-theme.scss +36 -24
  34. package/fesm2022/autocomplete/testing.mjs +2 -5
  35. package/fesm2022/autocomplete/testing.mjs.map +1 -1
  36. package/fesm2022/autocomplete.mjs +225 -148
  37. package/fesm2022/autocomplete.mjs.map +1 -1
  38. package/fesm2022/badge/testing.mjs +2 -5
  39. package/fesm2022/badge/testing.mjs.map +1 -1
  40. package/fesm2022/badge.mjs +45 -35
  41. package/fesm2022/badge.mjs.map +1 -1
  42. package/fesm2022/bottom-sheet/testing.mjs +1 -1
  43. package/fesm2022/bottom-sheet/testing.mjs.map +1 -1
  44. package/fesm2022/bottom-sheet.mjs +80 -58
  45. package/fesm2022/bottom-sheet.mjs.map +1 -1
  46. package/fesm2022/button/testing.mjs +2 -2
  47. package/fesm2022/button/testing.mjs.map +1 -1
  48. package/fesm2022/button-toggle/testing.mjs +4 -7
  49. package/fesm2022/button-toggle/testing.mjs.map +1 -1
  50. package/fesm2022/button-toggle.mjs +82 -45
  51. package/fesm2022/button-toggle.mjs.map +1 -1
  52. package/fesm2022/button.mjs +106 -79
  53. package/fesm2022/button.mjs.map +1 -1
  54. package/fesm2022/card/testing.mjs +3 -6
  55. package/fesm2022/card/testing.mjs.map +1 -1
  56. package/fesm2022/card.mjs +56 -69
  57. package/fesm2022/card.mjs.map +1 -1
  58. package/fesm2022/checkbox/testing.mjs +4 -7
  59. package/fesm2022/checkbox/testing.mjs.map +1 -1
  60. package/fesm2022/checkbox.mjs +104 -62
  61. package/fesm2022/checkbox.mjs.map +1 -1
  62. package/fesm2022/chips/testing.mjs +11 -14
  63. package/fesm2022/chips/testing.mjs.map +1 -1
  64. package/fesm2022/chips.mjs +322 -276
  65. package/fesm2022/chips.mjs.map +1 -1
  66. package/fesm2022/core/testing.mjs +5 -11
  67. package/fesm2022/core/testing.mjs.map +1 -1
  68. package/fesm2022/core.mjs +242 -187
  69. package/fesm2022/core.mjs.map +1 -1
  70. package/fesm2022/datepicker/testing.mjs +13 -22
  71. package/fesm2022/datepicker/testing.mjs.map +1 -1
  72. package/fesm2022/datepicker.mjs +827 -582
  73. package/fesm2022/datepicker.mjs.map +1 -1
  74. package/fesm2022/dialog/testing.mjs +15 -10
  75. package/fesm2022/dialog/testing.mjs.map +1 -1
  76. package/fesm2022/dialog.mjs +221 -156
  77. package/fesm2022/dialog.mjs.map +1 -1
  78. package/fesm2022/divider/testing.mjs +1 -1
  79. package/fesm2022/divider/testing.mjs.map +1 -1
  80. package/fesm2022/divider.mjs +10 -12
  81. package/fesm2022/divider.mjs.map +1 -1
  82. package/fesm2022/expansion/testing.mjs +7 -10
  83. package/fesm2022/expansion/testing.mjs.map +1 -1
  84. package/fesm2022/expansion.mjs +86 -80
  85. package/fesm2022/expansion.mjs.map +1 -1
  86. package/fesm2022/form-field/testing.mjs +12 -15
  87. package/fesm2022/form-field/testing.mjs.map +1 -1
  88. package/fesm2022/form-field.mjs +179 -132
  89. package/fesm2022/form-field.mjs.map +1 -1
  90. package/fesm2022/grid-list/testing.mjs +11 -17
  91. package/fesm2022/grid-list/testing.mjs.map +1 -1
  92. package/fesm2022/grid-list.mjs +75 -56
  93. package/fesm2022/grid-list.mjs.map +1 -1
  94. package/fesm2022/icon/testing.mjs +8 -8
  95. package/fesm2022/icon/testing.mjs.map +1 -1
  96. package/fesm2022/icon.mjs +66 -46
  97. package/fesm2022/icon.mjs.map +1 -1
  98. package/fesm2022/input/testing.mjs +3 -3
  99. package/fesm2022/input/testing.mjs.map +1 -1
  100. package/fesm2022/input.mjs +103 -72
  101. package/fesm2022/input.mjs.map +1 -1
  102. package/fesm2022/list/testing.mjs +21 -38
  103. package/fesm2022/list/testing.mjs.map +1 -1
  104. package/fesm2022/list.mjs +197 -195
  105. package/fesm2022/list.mjs.map +1 -1
  106. package/fesm2022/menu/testing.mjs +3 -6
  107. package/fesm2022/menu/testing.mjs.map +1 -1
  108. package/fesm2022/menu.mjs +178 -127
  109. package/fesm2022/menu.mjs.map +1 -1
  110. package/fesm2022/paginator/testing.mjs +10 -13
  111. package/fesm2022/paginator/testing.mjs.map +1 -1
  112. package/fesm2022/paginator.mjs +83 -58
  113. package/fesm2022/paginator.mjs.map +1 -1
  114. package/fesm2022/progress-bar/testing.mjs +1 -1
  115. package/fesm2022/progress-bar/testing.mjs.map +1 -1
  116. package/fesm2022/progress-bar.mjs +36 -35
  117. package/fesm2022/progress-bar.mjs.map +1 -1
  118. package/fesm2022/progress-spinner/testing.mjs +1 -1
  119. package/fesm2022/progress-spinner/testing.mjs.map +1 -1
  120. package/fesm2022/progress-spinner.mjs +28 -14
  121. package/fesm2022/progress-spinner.mjs.map +1 -1
  122. package/fesm2022/radio/testing.mjs +6 -12
  123. package/fesm2022/radio/testing.mjs.map +1 -1
  124. package/fesm2022/radio.mjs +123 -87
  125. package/fesm2022/radio.mjs.map +1 -1
  126. package/fesm2022/select/testing.mjs +6 -9
  127. package/fesm2022/select/testing.mjs.map +1 -1
  128. package/fesm2022/select.mjs +219 -182
  129. package/fesm2022/select.mjs.map +1 -1
  130. package/fesm2022/sidenav/testing.mjs +6 -6
  131. package/fesm2022/sidenav/testing.mjs.map +1 -1
  132. package/fesm2022/sidenav.mjs +136 -125
  133. package/fesm2022/sidenav.mjs.map +1 -1
  134. package/fesm2022/slide-toggle/testing.mjs +3 -6
  135. package/fesm2022/slide-toggle/testing.mjs.map +1 -1
  136. package/fesm2022/slide-toggle.mjs +77 -47
  137. package/fesm2022/slide-toggle.mjs.map +1 -1
  138. package/fesm2022/slider/testing.mjs +2 -2
  139. package/fesm2022/slider/testing.mjs.map +1 -1
  140. package/fesm2022/slider.mjs +262 -194
  141. package/fesm2022/slider.mjs.map +1 -1
  142. package/fesm2022/snack-bar/testing.mjs +4 -7
  143. package/fesm2022/snack-bar/testing.mjs.map +1 -1
  144. package/fesm2022/snack-bar.mjs +143 -111
  145. package/fesm2022/snack-bar.mjs.map +1 -1
  146. package/fesm2022/sort/testing.mjs +3 -6
  147. package/fesm2022/sort/testing.mjs.map +1 -1
  148. package/fesm2022/sort.mjs +94 -74
  149. package/fesm2022/sort.mjs.map +1 -1
  150. package/fesm2022/stepper/testing.mjs +4 -4
  151. package/fesm2022/stepper/testing.mjs.map +1 -1
  152. package/fesm2022/stepper.mjs +146 -113
  153. package/fesm2022/stepper.mjs.map +1 -1
  154. package/fesm2022/table/testing.mjs +13 -25
  155. package/fesm2022/table/testing.mjs.map +1 -1
  156. package/fesm2022/table.mjs +183 -194
  157. package/fesm2022/table.mjs.map +1 -1
  158. package/fesm2022/tabs/testing.mjs +5 -5
  159. package/fesm2022/tabs/testing.mjs.map +1 -1
  160. package/fesm2022/tabs.mjs +329 -251
  161. package/fesm2022/tabs.mjs.map +1 -1
  162. package/fesm2022/timepicker/testing.mjs +7 -16
  163. package/fesm2022/timepicker/testing.mjs.map +1 -1
  164. package/fesm2022/timepicker.mjs +160 -155
  165. package/fesm2022/timepicker.mjs.map +1 -1
  166. package/fesm2022/toolbar/testing.mjs +2 -5
  167. package/fesm2022/toolbar/testing.mjs.map +1 -1
  168. package/fesm2022/toolbar.mjs +26 -17
  169. package/fesm2022/toolbar.mjs.map +1 -1
  170. package/fesm2022/tooltip/testing.mjs +6 -9
  171. package/fesm2022/tooltip/testing.mjs.map +1 -1
  172. package/fesm2022/tooltip.mjs +97 -74
  173. package/fesm2022/tooltip.mjs.map +1 -1
  174. package/fesm2022/tree/testing.mjs +3 -6
  175. package/fesm2022/tree/testing.mjs.map +1 -1
  176. package/fesm2022/tree.mjs +57 -61
  177. package/fesm2022/tree.mjs.map +1 -1
  178. package/form-field/_form-field-theme.scss +114 -61
  179. package/form-field/index.d.ts +9 -10
  180. package/grid-list/_grid-list-theme.scss +25 -15
  181. package/icon/_icon-theme.scss +22 -14
  182. package/input/_input-theme.scss +18 -11
  183. package/list/_list-theme.scss +89 -47
  184. package/list/index.d.ts +20 -21
  185. package/menu/_menu-theme.scss +33 -21
  186. package/menu/index.d.ts +8 -9
  187. package/package.json +2 -2
  188. package/paginator/_paginator-theme.scss +39 -23
  189. package/prebuilt-themes/azure-blue.css +1 -1
  190. package/prebuilt-themes/cyan-orange.css +1 -1
  191. package/prebuilt-themes/deeppurple-amber.css +1 -1
  192. package/prebuilt-themes/indigo-pink.css +1 -1
  193. package/prebuilt-themes/magenta-violet.css +1 -1
  194. package/prebuilt-themes/pink-bluegrey.css +1 -1
  195. package/prebuilt-themes/purple-green.css +1 -1
  196. package/prebuilt-themes/rose-red.css +1 -1
  197. package/progress-bar/_progress-bar-theme.scss +20 -16
  198. package/progress-spinner/_progress-spinner-theme.scss +41 -25
  199. package/progress-spinner/index.d.ts +3 -4
  200. package/radio/_radio-theme.scss +60 -32
  201. package/radio/index.d.ts +2 -3
  202. package/schematics/collection.json +3 -3
  203. package/schematics/ng-add/index.js +1 -1
  204. package/schematics/ng-add/index.mjs +1 -1
  205. package/schematics/ng-add/theming/create-custom-theme.js +1 -6
  206. package/schematics/ng-add/theming/create-custom-theme.mjs +1 -6
  207. package/schematics/ng-generate/{m3-theme → theme-color}/index_bundled.js +480 -288
  208. package/schematics/ng-generate/theme-color/index_bundled.js.map +7 -0
  209. package/schematics/ng-generate/{m3-theme → theme-color}/schema.json +7 -13
  210. package/schematics/ng-update/index_bundled.js +6 -1
  211. package/schematics/ng-update/index_bundled.js.map +1 -1
  212. package/select/_select-theme.scss +38 -25
  213. package/select/index.d.ts +6 -7
  214. package/sidenav/_sidenav-theme.scss +28 -17
  215. package/slide-toggle/_slide-toggle-theme.scss +52 -28
  216. package/slider/_slider-theme.scss +62 -38
  217. package/snack-bar/_snack-bar-theme.scss +29 -17
  218. package/sort/_sort-theme.scss +33 -21
  219. package/stepper/_stepper-theme.scss +40 -27
  220. package/stepper/index.d.ts +14 -15
  221. package/table/_table-theme.scss +36 -23
  222. package/tabs/_tabs-theme.scss +97 -50
  223. package/tabs/index.d.ts +2 -2
  224. package/timepicker/_timepicker-theme.scss +37 -24
  225. package/toolbar/_toolbar-theme.scss +35 -22
  226. package/tooltip/_tooltip-theme.scss +18 -15
  227. package/tooltip/index.d.ts +5 -6
  228. package/tree/_tree-theme.scss +33 -21
  229. package/schematics/ng-generate/m3-theme/index_bundled.js.map +0 -7
@@ -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,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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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 _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AAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAC/C,QAAA,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACnB,MAAM,KAAK,CAAC,CAAA,qCAAA,EAAwC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAE,CAAA,CAAC,CAAC;SAChF;AACD,QAAA,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;KAC1B;;AAGD,IAAA,MAAM,MAAM,GAAA;AACV,QAAA,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,EAAE,CAAC;AACrC,QAAA,OAAO,CAAC,CAAC,KAAK,KAAK,MAAM,KAAK,CAAC,QAAQ,CAAC,CAA8B,4BAAA,CAAA,CAAC,CAAC,CAAC;KAC1E;;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;;;;;"}
@@ -2,20 +2,20 @@ import * as i0 from '@angular/core';
2
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';
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
- import { DOCUMENT, CommonModule } from '@angular/common';
6
5
  import { ViewportRuler, CdkScrollableModule } from '@angular/cdk/scrolling';
7
6
  import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
8
7
  import { ActiveDescendantKeyManager, removeAriaReferencedId, addAriaReferencedId } from '@angular/cdk/a11y';
9
8
  import { Platform, _getEventTarget } from '@angular/cdk/platform';
10
9
  import { trigger, state, style, transition, group, animate } from '@angular/animations';
11
- import { Subscription, Subject, defer, merge, of, fromEvent, Observable } from 'rxjs';
10
+ import { Subscription, Subject, merge, of, defer, fromEvent, Observable } from 'rxjs';
12
11
  import { Directionality } from '@angular/cdk/bidi';
13
- import { ESCAPE, hasModifierKey, UP_ARROW, ENTER, DOWN_ARROW, TAB } from '@angular/cdk/keycodes';
12
+ import { hasModifierKey, ESCAPE, ENTER, UP_ARROW, DOWN_ARROW, TAB } from '@angular/cdk/keycodes';
14
13
  import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
15
14
  import { TemplatePortal } from '@angular/cdk/portal';
15
+ import { DOCUMENT } from '@angular/common';
16
16
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
17
17
  import { MAT_FORM_FIELD } from '@angular/material/form-field';
18
- import { startWith, switchMap, filter, map, tap, delay, take } from 'rxjs/operators';
18
+ import { filter, map, startWith, switchMap, tap, delay, take } from 'rxjs/operators';
19
19
 
20
20
  // Animation values come from
21
21
  // TODO(mmalerba): Ideally find a way to import the values from MDC's code.
@@ -40,6 +40,8 @@ const panelAnimation = trigger('panelAnimation', [
40
40
  let _uniqueAutocompleteIdCounter = 0;
41
41
  /** Event object that is emitted when an autocomplete option is selected. */
42
42
  class MatAutocompleteSelectedEvent {
43
+ source;
44
+ option;
43
45
  constructor(
44
46
  /** Reference to the autocomplete panel that emitted the event. */
45
47
  source,
@@ -65,15 +67,76 @@ function MAT_AUTOCOMPLETE_DEFAULT_OPTIONS_FACTORY() {
65
67
  }
66
68
  /** Autocomplete component. */
67
69
  class MatAutocomplete {
70
+ _changeDetectorRef = inject(ChangeDetectorRef);
71
+ _elementRef = inject(ElementRef);
72
+ _defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS);
73
+ _activeOptionChanges = Subscription.EMPTY;
74
+ /** Emits when the panel animation is done. Null if the panel doesn't animate. */
75
+ _animationDone = new EventEmitter();
76
+ /** Manages active item in option list based on key events. */
77
+ _keyManager;
78
+ /** Whether the autocomplete panel should be visible, depending on option length. */
79
+ showPanel = false;
68
80
  /** Whether the autocomplete panel is open. */
69
81
  get isOpen() {
70
82
  return this._isOpen && this.showPanel;
71
83
  }
84
+ _isOpen = false;
85
+ /** Latest trigger that opened the autocomplete. */
86
+ _latestOpeningTrigger;
72
87
  /** @docs-private Sets the theme color of the panel. */
73
88
  _setColor(value) {
74
89
  this._color = value;
75
90
  this._changeDetectorRef.markForCheck();
76
91
  }
92
+ /** @docs-private theme color of the panel */
93
+ _color;
94
+ // The @ViewChild query for TemplateRef here needs to be static because some code paths
95
+ // lead to the overlay being created before change detection has finished for this component.
96
+ // Notably, another component may trigger `focus` on the autocomplete-trigger.
97
+ /** @docs-private */
98
+ template;
99
+ /** Element for the panel containing the autocomplete options. */
100
+ panel;
101
+ /** Reference to all options within the autocomplete. */
102
+ options;
103
+ /** Reference to all option groups within the autocomplete. */
104
+ optionGroups;
105
+ /** Aria label of the autocomplete. */
106
+ ariaLabel;
107
+ /** Input that can be used to specify the `aria-labelledby` attribute. */
108
+ ariaLabelledby;
109
+ /** Function that maps an option's control value to its display value in the trigger. */
110
+ displayWith = null;
111
+ /**
112
+ * Whether the first option should be highlighted when the autocomplete panel is opened.
113
+ * Can be configured globally through the `MAT_AUTOCOMPLETE_DEFAULT_OPTIONS` token.
114
+ */
115
+ autoActiveFirstOption;
116
+ /** Whether the active option should be selected as the user is navigating. */
117
+ autoSelectActiveOption;
118
+ /**
119
+ * Whether the user is required to make a selection when they're interacting with the
120
+ * autocomplete. If the user moves away from the autocomplete without selecting an option from
121
+ * the list, the value will be reset. If the user opens the panel and closes it without
122
+ * interacting or selecting a value, the initial value will be kept.
123
+ */
124
+ requireSelection;
125
+ /**
126
+ * Specify the width of the autocomplete panel. Can be any CSS sizing value, otherwise it will
127
+ * match the width of its host.
128
+ */
129
+ panelWidth;
130
+ /** Whether ripples are disabled within the autocomplete panel. */
131
+ disableRipple;
132
+ /** Event that is emitted whenever an option from the list is selected. */
133
+ optionSelected = new EventEmitter();
134
+ /** Event that is emitted when the autocomplete panel is opened. */
135
+ opened = new EventEmitter();
136
+ /** Event that is emitted when the autocomplete panel is closed. */
137
+ closed = new EventEmitter();
138
+ /** Emits whenever an option is activated. */
139
+ optionActivated = new EventEmitter();
77
140
  /**
78
141
  * Takes classes set on the host mat-autocomplete element and applies them to the panel
79
142
  * inside the overlay container to allow for easy styling.
@@ -82,6 +145,7 @@ class MatAutocomplete {
82
145
  this._classList = value;
83
146
  this._elementRef.nativeElement.className = '';
84
147
  }
148
+ _classList;
85
149
  /** Whether checkmark indicator for single-selection options is hidden. */
86
150
  get hideSingleSelectionIndicator() {
87
151
  return this._hideSingleSelectionIndicator;
@@ -90,6 +154,7 @@ class MatAutocomplete {
90
154
  this._hideSingleSelectionIndicator = value;
91
155
  this._syncParentProperties();
92
156
  }
157
+ _hideSingleSelectionIndicator;
93
158
  /** Syncs the parent state with the individual options. */
94
159
  _syncParentProperties() {
95
160
  if (this.options) {
@@ -98,28 +163,14 @@ class MatAutocomplete {
98
163
  }
99
164
  }
100
165
  }
166
+ /** Unique ID to be used by autocomplete trigger's "aria-owns" property. */
167
+ id = `mat-autocomplete-${_uniqueAutocompleteIdCounter++}`;
168
+ /**
169
+ * Tells any descendant `mat-optgroup` to use the inert a11y pattern.
170
+ * @docs-private
171
+ */
172
+ inertGroups;
101
173
  constructor() {
102
- this._changeDetectorRef = inject(ChangeDetectorRef);
103
- this._elementRef = inject(ElementRef);
104
- this._defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS);
105
- this._activeOptionChanges = Subscription.EMPTY;
106
- /** Emits when the panel animation is done. Null if the panel doesn't animate. */
107
- this._animationDone = new EventEmitter();
108
- /** Whether the autocomplete panel should be visible, depending on option length. */
109
- this.showPanel = false;
110
- this._isOpen = false;
111
- /** Function that maps an option's control value to its display value in the trigger. */
112
- this.displayWith = null;
113
- /** Event that is emitted whenever an option from the list is selected. */
114
- this.optionSelected = new EventEmitter();
115
- /** Event that is emitted when the autocomplete panel is opened. */
116
- this.opened = new EventEmitter();
117
- /** Event that is emitted when the autocomplete panel is closed. */
118
- this.closed = new EventEmitter();
119
- /** Emits whenever an option is activated. */
120
- this.optionActivated = new EventEmitter();
121
- /** Unique ID to be used by autocomplete trigger's "aria-owns" property. */
122
- this.id = `mat-autocomplete-${_uniqueAutocompleteIdCounter++}`;
123
174
  const platform = inject(Platform);
124
175
  // TODO(crisbeto): the problem that the `inertGroups` option resolves is only present on
125
176
  // Safari using VoiceOver. We should occasionally check back to see whether the bug
@@ -196,14 +247,14 @@ class MatAutocomplete {
196
247
  _skipPredicate() {
197
248
  return false;
198
249
  }
199
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.8", ngImport: i0, type: MatAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
200
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.0.0-next.8", type: MatAutocomplete, isStandalone: true, selector: "mat-autocomplete", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], displayWith: "displayWith", autoActiveFirstOption: ["autoActiveFirstOption", "autoActiveFirstOption", booleanAttribute], autoSelectActiveOption: ["autoSelectActiveOption", "autoSelectActiveOption", booleanAttribute], requireSelection: ["requireSelection", "requireSelection", booleanAttribute], panelWidth: "panelWidth", disableRipple: ["disableRipple", "disableRipple", booleanAttribute], classList: ["class", "classList"], hideSingleSelectionIndicator: ["hideSingleSelectionIndicator", "hideSingleSelectionIndicator", booleanAttribute] }, outputs: { optionSelected: "optionSelected", opened: "opened", closed: "closed", optionActivated: "optionActivated" }, host: { classAttribute: "mat-mdc-autocomplete" }, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], queries: [{ propertyName: "options", predicate: MatOption, descendants: true }, { propertyName: "optionGroups", predicate: MAT_OPTGROUP, descendants: true }], viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true }], exportAs: ["matAutocomplete"], ngImport: i0, template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n [@panelAnimation]=\"isOpen ? 'visible' : 'hidden'\"\n (@panelAnimation.done)=\"_animationDone.next($event)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:static;border-radius:var(--mat-autocomplete-container-shape, var(--mat-app-corner-extra-small));box-shadow:var(--mat-autocomplete-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-autocomplete-background-color, var(--mat-app-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}mat-autocomplete{display:none}"], animations: [panelAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
250
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component });
251
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.0.0-next.10", type: MatAutocomplete, isStandalone: true, selector: "mat-autocomplete", inputs: { ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], displayWith: "displayWith", autoActiveFirstOption: ["autoActiveFirstOption", "autoActiveFirstOption", booleanAttribute], autoSelectActiveOption: ["autoSelectActiveOption", "autoSelectActiveOption", booleanAttribute], requireSelection: ["requireSelection", "requireSelection", booleanAttribute], panelWidth: "panelWidth", disableRipple: ["disableRipple", "disableRipple", booleanAttribute], classList: ["class", "classList"], hideSingleSelectionIndicator: ["hideSingleSelectionIndicator", "hideSingleSelectionIndicator", booleanAttribute] }, outputs: { optionSelected: "optionSelected", opened: "opened", closed: "closed", optionActivated: "optionActivated" }, host: { classAttribute: "mat-mdc-autocomplete" }, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], queries: [{ propertyName: "options", predicate: MatOption, descendants: true }, { propertyName: "optionGroups", predicate: MAT_OPTGROUP, descendants: true }], viewQueries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, static: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true }], exportAs: ["matAutocomplete"], ngImport: i0, template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n [@panelAnimation]=\"isOpen ? 'visible' : 'hidden'\"\n (@panelAnimation.done)=\"_animationDone.next($event)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:static;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}mat-autocomplete{display:none}"], animations: [panelAnimation], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
201
252
  }
202
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.8", ngImport: i0, type: MatAutocomplete, decorators: [{
253
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocomplete, decorators: [{
203
254
  type: Component,
204
255
  args: [{ selector: 'mat-autocomplete', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'matAutocomplete', host: {
205
256
  'class': 'mat-mdc-autocomplete',
206
- }, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], animations: [panelAnimation], standalone: true, template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n [@panelAnimation]=\"isOpen ? 'visible' : 'hidden'\"\n (@panelAnimation.done)=\"_animationDone.next($event)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:static;border-radius:var(--mat-autocomplete-container-shape, var(--mat-app-corner-extra-small));box-shadow:var(--mat-autocomplete-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-autocomplete-background-color, var(--mat-app-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}mat-autocomplete{display:none}"] }]
257
+ }, providers: [{ provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatAutocomplete }], animations: [panelAnimation], template: "<ng-template let-formFieldId=\"id\">\n <div\n class=\"mat-mdc-autocomplete-panel mdc-menu-surface mdc-menu-surface--open\"\n role=\"listbox\"\n [id]=\"id\"\n [class]=\"_classList\"\n [class.mat-mdc-autocomplete-visible]=\"showPanel\"\n [class.mat-mdc-autocomplete-hidden]=\"!showPanel\"\n [class.mat-primary]=\"_color === 'primary'\"\n [class.mat-accent]=\"_color === 'accent'\"\n [class.mat-warn]=\"_color === 'warn'\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby(formFieldId)\"\n [@panelAnimation]=\"isOpen ? 'visible' : 'hidden'\"\n (@panelAnimation.done)=\"_animationDone.next($event)\"\n #panel>\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["div.mat-mdc-autocomplete-panel{width:100%;max-height:256px;visibility:hidden;transform-origin:center top;overflow:auto;padding:8px 0;box-sizing:border-box;position:static;border-radius:var(--mat-autocomplete-container-shape, var(--mat-sys-corner-extra-small));box-shadow:var(--mat-autocomplete-container-elevation-shadow, 0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12));background-color:var(--mat-autocomplete-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-autocomplete-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-autocomplete-panel-above) div.mat-mdc-autocomplete-panel{border-top-left-radius:0;border-top-right-radius:0}.mat-mdc-autocomplete-panel-above div.mat-mdc-autocomplete-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:center bottom}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-visible{visibility:visible}div.mat-mdc-autocomplete-panel.mat-mdc-autocomplete-hidden{visibility:hidden;pointer-events:none}mat-autocomplete{display:none}"] }]
207
258
  }], ctorParameters: () => [], propDecorators: { template: [{
208
259
  type: ViewChild,
209
260
  args: [TemplateRef, { static: true }]
@@ -259,18 +310,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.8",
259
310
  * as a connection point for an autocomplete panel.
260
311
  */
261
312
  class MatAutocompleteOrigin {
262
- constructor() {
263
- this.elementRef = inject(ElementRef);
264
- }
265
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.8", ngImport: i0, type: MatAutocompleteOrigin, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
266
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0-next.8", type: MatAutocompleteOrigin, isStandalone: true, selector: "[matAutocompleteOrigin]", exportAs: ["matAutocompleteOrigin"], ngImport: i0 }); }
313
+ elementRef = inject(ElementRef);
314
+ constructor() { }
315
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteOrigin, deps: [], target: i0.ɵɵFactoryTarget.Directive });
316
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.0-next.10", type: MatAutocompleteOrigin, isStandalone: true, selector: "[matAutocompleteOrigin]", exportAs: ["matAutocompleteOrigin"], ngImport: i0 });
267
317
  }
268
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.8", ngImport: i0, type: MatAutocompleteOrigin, decorators: [{
318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteOrigin, decorators: [{
269
319
  type: Directive,
270
320
  args: [{
271
321
  selector: '[matAutocompleteOrigin]',
272
322
  exportAs: 'matAutocompleteOrigin',
273
- standalone: true,
274
323
  }]
275
324
  }], ctorParameters: () => [] });
276
325
 
@@ -312,104 +361,99 @@ const MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER = {
312
361
  };
313
362
  /** Base class with all of the `MatAutocompleteTrigger` functionality. */
314
363
  class MatAutocompleteTrigger {
315
- constructor() {
316
- this._element = inject(ElementRef);
317
- this._overlay = inject(Overlay);
318
- this._viewContainerRef = inject(ViewContainerRef);
319
- this._zone = inject(NgZone);
320
- this._changeDetectorRef = inject(ChangeDetectorRef);
321
- this._dir = inject(Directionality, { optional: true });
322
- this._formField = inject(MAT_FORM_FIELD, { optional: true, host: true });
323
- this._document = inject(DOCUMENT);
324
- this._viewportRuler = inject(ViewportRuler);
325
- this._defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, { optional: true });
326
- this._componentDestroyed = false;
327
- this._scrollStrategy = inject(MAT_AUTOCOMPLETE_SCROLL_STRATEGY);
328
- /** Whether or not the label state is being overridden. */
329
- this._manuallyFloatingLabel = false;
330
- /** Subscription to viewport size changes. */
331
- this._viewportSubscription = Subscription.EMPTY;
332
- /** Implements BreakpointObserver to be used to detect handset landscape */
333
- this._breakpointObserver = inject(BreakpointObserver);
334
- this._handsetLandscapeSubscription = Subscription.EMPTY;
335
- /**
336
- * Whether the autocomplete can open the next time it is focused. Used to prevent a focused,
337
- * closed autocomplete from being reopened if the user switches to another browser tab and then
338
- * comes back.
339
- */
340
- this._canOpenOnNextFocus = true;
341
- /** Stream of keyboard events that can close the panel. */
342
- this._closeKeyEventStream = new Subject();
343
- /**
344
- * Event handler for when the window is blurred. Needs to be an
345
- * arrow function in order to preserve the context.
346
- */
347
- this._windowBlurHandler = () => {
348
- // If the user blurred the window while the autocomplete is focused, it means that it'll be
349
- // refocused when they come back. In this case we want to skip the first focus event, if the
350
- // pane was closed, in order to avoid reopening it unintentionally.
351
- this._canOpenOnNextFocus =
352
- this._document.activeElement !== this._element.nativeElement || this.panelOpen;
353
- };
354
- /** `View -> model callback called when value changes` */
355
- this._onChange = () => { };
356
- /** `View -> model callback called when autocomplete has been touched` */
357
- this._onTouched = () => { };
358
- /**
359
- * Position of the autocomplete panel relative to the trigger element. A position of `auto`
360
- * will render the panel underneath the trigger if there is enough space for it to fit in
361
- * the viewport, otherwise the panel will be shown above it. If the position is set to
362
- * `above` or `below`, the panel will always be shown above or below the trigger. no matter
363
- * whether it fits completely in the viewport.
364
- */
365
- this.position = 'auto';
366
- /**
367
- * `autocomplete` attribute to be set on the input element.
368
- * @docs-private
369
- */
370
- this.autocompleteAttribute = 'off';
371
- this._initialized = new Subject();
372
- this._injector = inject(Injector);
373
- /** Class to apply to the panel when it's above the input. */
374
- this._aboveClass = 'mat-mdc-autocomplete-panel-above';
375
- this._overlayAttached = false;
376
- /** Stream of changes to the selection state of the autocomplete options. */
377
- this.optionSelections = defer(() => {
378
- const options = this.autocomplete ? this.autocomplete.options : null;
379
- if (options) {
380
- return options.changes.pipe(startWith(options), switchMap(() => merge(...options.map(option => option.onSelectionChange))));
381
- }
382
- // If there are any subscribers before `ngAfterViewInit`, the `autocomplete` will be undefined.
383
- // Return a stream that we'll replace with the real one once everything is in place.
384
- return this._initialized.pipe(switchMap(() => this.optionSelections));
385
- });
386
- /** Handles keyboard events coming from the overlay panel. */
387
- this._handlePanelKeydown = (event) => {
388
- // Close when pressing ESCAPE or ALT + UP_ARROW, based on the a11y guidelines.
389
- // See: https://www.w3.org/TR/wai-aria-practices-1.1/#textbox-keyboard-interaction
390
- if ((event.keyCode === ESCAPE && !hasModifierKey(event)) ||
391
- (event.keyCode === UP_ARROW && hasModifierKey(event, 'altKey'))) {
392
- // If the user had typed something in before we autoselected an option, and they decided
393
- // to cancel the selection, restore the input value to the one they had typed in.
394
- if (this._pendingAutoselectedOption) {
395
- this._updateNativeInputValue(this._valueBeforeAutoSelection ?? '');
396
- this._pendingAutoselectedOption = null;
397
- }
398
- this._closeKeyEventStream.next();
399
- this._resetActiveItem();
400
- // We need to stop propagation, otherwise the event will eventually
401
- // reach the input itself and cause the overlay to be reopened.
402
- event.stopPropagation();
403
- event.preventDefault();
404
- }
405
- };
406
- /**
407
- * Track which modal we have modified the `aria-owns` attribute of. When the combobox trigger is
408
- * inside an aria-modal, we apply aria-owns to the parent modal with the `id` of the options
409
- * panel. Track the modal we have changed so we can undo the changes on destroy.
410
- */
411
- this._trackedModal = null;
412
- }
364
+ _element = inject(ElementRef);
365
+ _overlay = inject(Overlay);
366
+ _viewContainerRef = inject(ViewContainerRef);
367
+ _zone = inject(NgZone);
368
+ _changeDetectorRef = inject(ChangeDetectorRef);
369
+ _dir = inject(Directionality, { optional: true });
370
+ _formField = inject(MAT_FORM_FIELD, { optional: true, host: true });
371
+ _document = inject(DOCUMENT);
372
+ _viewportRuler = inject(ViewportRuler);
373
+ _defaults = inject(MAT_AUTOCOMPLETE_DEFAULT_OPTIONS, { optional: true });
374
+ _overlayRef;
375
+ _portal;
376
+ _componentDestroyed = false;
377
+ _scrollStrategy = inject(MAT_AUTOCOMPLETE_SCROLL_STRATEGY);
378
+ _keydownSubscription;
379
+ _outsideClickSubscription;
380
+ /** Old value of the native input. Used to work around issues with the `input` event on IE. */
381
+ _previousValue;
382
+ /** Value of the input element when the panel was attached (even if there are no options). */
383
+ _valueOnAttach;
384
+ /** Value on the previous keydown event. */
385
+ _valueOnLastKeydown;
386
+ /** Strategy that is used to position the panel. */
387
+ _positionStrategy;
388
+ /** Whether or not the label state is being overridden. */
389
+ _manuallyFloatingLabel = false;
390
+ /** The subscription for closing actions (some are bound to document). */
391
+ _closingActionsSubscription;
392
+ /** Subscription to viewport size changes. */
393
+ _viewportSubscription = Subscription.EMPTY;
394
+ /** Implements BreakpointObserver to be used to detect handset landscape */
395
+ _breakpointObserver = inject(BreakpointObserver);
396
+ _handsetLandscapeSubscription = Subscription.EMPTY;
397
+ /**
398
+ * Whether the autocomplete can open the next time it is focused. Used to prevent a focused,
399
+ * closed autocomplete from being reopened if the user switches to another browser tab and then
400
+ * comes back.
401
+ */
402
+ _canOpenOnNextFocus = true;
403
+ /** Value inside the input before we auto-selected an option. */
404
+ _valueBeforeAutoSelection;
405
+ /**
406
+ * Current option that we have auto-selected as the user is navigating,
407
+ * but which hasn't been propagated to the model value yet.
408
+ */
409
+ _pendingAutoselectedOption;
410
+ /** Stream of keyboard events that can close the panel. */
411
+ _closeKeyEventStream = new Subject();
412
+ /**
413
+ * Event handler for when the window is blurred. Needs to be an
414
+ * arrow function in order to preserve the context.
415
+ */
416
+ _windowBlurHandler = () => {
417
+ // If the user blurred the window while the autocomplete is focused, it means that it'll be
418
+ // refocused when they come back. In this case we want to skip the first focus event, if the
419
+ // pane was closed, in order to avoid reopening it unintentionally.
420
+ this._canOpenOnNextFocus =
421
+ this._document.activeElement !== this._element.nativeElement || this.panelOpen;
422
+ };
423
+ /** `View -> model callback called when value changes` */
424
+ _onChange = () => { };
425
+ /** `View -> model callback called when autocomplete has been touched` */
426
+ _onTouched = () => { };
427
+ /** The autocomplete panel to be attached to this trigger. */
428
+ autocomplete;
429
+ /**
430
+ * Position of the autocomplete panel relative to the trigger element. A position of `auto`
431
+ * will render the panel underneath the trigger if there is enough space for it to fit in
432
+ * the viewport, otherwise the panel will be shown above it. If the position is set to
433
+ * `above` or `below`, the panel will always be shown above or below the trigger. no matter
434
+ * whether it fits completely in the viewport.
435
+ */
436
+ position = 'auto';
437
+ /**
438
+ * Reference relative to which to position the autocomplete panel.
439
+ * Defaults to the autocomplete trigger element.
440
+ */
441
+ connectedTo;
442
+ /**
443
+ * `autocomplete` attribute to be set on the input element.
444
+ * @docs-private
445
+ */
446
+ autocompleteAttribute = 'off';
447
+ /**
448
+ * Whether the autocomplete is disabled. When disabled, the element will
449
+ * act as a regular input and the user won't be able to open the panel.
450
+ */
451
+ autocompleteDisabled;
452
+ _initialized = new Subject();
453
+ _injector = inject(Injector);
454
+ constructor() { }
455
+ /** Class to apply to the panel when it's above the input. */
456
+ _aboveClass = 'mat-mdc-autocomplete-panel-above';
413
457
  ngAfterViewInit() {
414
458
  this._initialized.next();
415
459
  this._initialized.complete();
@@ -442,6 +486,7 @@ class MatAutocompleteTrigger {
442
486
  get panelOpen() {
443
487
  return this._overlayAttached && this.autocomplete.showPanel;
444
488
  }
489
+ _overlayAttached = false;
445
490
  /** Opens the autocomplete suggestion panel. */
446
491
  openPanel() {
447
492
  this._openPanelInternal();
@@ -508,6 +553,16 @@ class MatAutocompleteTrigger {
508
553
  // Normalize the output so we return a consistent type.
509
554
  map(event => (event instanceof MatOptionSelectionChange ? event : null)));
510
555
  }
556
+ /** Stream of changes to the selection state of the autocomplete options. */
557
+ optionSelections = defer(() => {
558
+ const options = this.autocomplete ? this.autocomplete.options : null;
559
+ if (options) {
560
+ return options.changes.pipe(startWith(options), switchMap(() => merge(...options.map(option => option.onSelectionChange))));
561
+ }
562
+ // If there are any subscribers before `ngAfterViewInit`, the `autocomplete` will be undefined.
563
+ // Return a stream that we'll replace with the real one once everything is in place.
564
+ return this._initialized.pipe(switchMap(() => this.optionSelections));
565
+ });
511
566
  /** The currently active option, coerced to MatOption type. */
512
567
  get activeOption() {
513
568
  if (this.autocomplete && this.autocomplete._keyManager) {
@@ -886,6 +941,26 @@ class MatAutocompleteTrigger {
886
941
  this._emitOpened();
887
942
  }
888
943
  }
944
+ /** Handles keyboard events coming from the overlay panel. */
945
+ _handlePanelKeydown = (event) => {
946
+ // Close when pressing ESCAPE or ALT + UP_ARROW, based on the a11y guidelines.
947
+ // See: https://www.w3.org/TR/wai-aria-practices-1.1/#textbox-keyboard-interaction
948
+ if ((event.keyCode === ESCAPE && !hasModifierKey(event)) ||
949
+ (event.keyCode === UP_ARROW && hasModifierKey(event, 'altKey'))) {
950
+ // If the user had typed something in before we autoselected an option, and they decided
951
+ // to cancel the selection, restore the input value to the one they had typed in.
952
+ if (this._pendingAutoselectedOption) {
953
+ this._updateNativeInputValue(this._valueBeforeAutoSelection ?? '');
954
+ this._pendingAutoselectedOption = null;
955
+ }
956
+ this._closeKeyEventStream.next();
957
+ this._resetActiveItem();
958
+ // We need to stop propagation, otherwise the event will eventually
959
+ // reach the input itself and cause the overlay to be reopened.
960
+ event.stopPropagation();
961
+ event.preventDefault();
962
+ }
963
+ };
889
964
  /** Updates the panel's visibility state and any trigger state tied to id. */
890
965
  _updatePanelState() {
891
966
  this.autocomplete._setVisibility();
@@ -1035,6 +1110,12 @@ class MatAutocompleteTrigger {
1035
1110
  }
1036
1111
  }
1037
1112
  }
1113
+ /**
1114
+ * Track which modal we have modified the `aria-owns` attribute of. When the combobox trigger is
1115
+ * inside an aria-modal, we apply aria-owns to the parent modal with the `id` of the options
1116
+ * panel. Track the modal we have changed so we can undo the changes on destroy.
1117
+ */
1118
+ _trackedModal = null;
1038
1119
  /**
1039
1120
  * If the autocomplete trigger is inside of an `aria-modal` element, connect
1040
1121
  * that modal to the options panel with `aria-owns`.
@@ -1081,10 +1162,10 @@ class MatAutocompleteTrigger {
1081
1162
  this._trackedModal = null;
1082
1163
  }
1083
1164
  }
1084
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.8", ngImport: i0, type: MatAutocompleteTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1085
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.0.0-next.8", type: MatAutocompleteTrigger, isStandalone: true, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: { autocomplete: ["matAutocomplete", "autocomplete"], position: ["matAutocompletePosition", "position"], connectedTo: ["matAutocompleteConnectedTo", "connectedTo"], autocompleteAttribute: ["autocomplete", "autocompleteAttribute"], autocompleteDisabled: ["matAutocompleteDisabled", "autocompleteDisabled", booleanAttribute] }, host: { listeners: { "focusin": "_handleFocus()", "blur": "_onTouched()", "input": "_handleInput($event)", "keydown": "_handleKeydown($event)", "click": "_handleClick()" }, properties: { "attr.autocomplete": "autocompleteAttribute", "attr.role": "autocompleteDisabled ? null : \"combobox\"", "attr.aria-autocomplete": "autocompleteDisabled ? null : \"list\"", "attr.aria-activedescendant": "(panelOpen && activeOption) ? activeOption.id : null", "attr.aria-expanded": "autocompleteDisabled ? null : panelOpen.toString()", "attr.aria-controls": "(autocompleteDisabled || !panelOpen) ? null : autocomplete?.id", "attr.aria-haspopup": "autocompleteDisabled ? null : \"listbox\"" }, classAttribute: "mat-mdc-autocomplete-trigger" }, providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR], exportAs: ["matAutocompleteTrigger"], usesOnChanges: true, ngImport: i0 }); }
1165
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1166
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.0.0-next.10", type: MatAutocompleteTrigger, isStandalone: true, selector: "input[matAutocomplete], textarea[matAutocomplete]", inputs: { autocomplete: ["matAutocomplete", "autocomplete"], position: ["matAutocompletePosition", "position"], connectedTo: ["matAutocompleteConnectedTo", "connectedTo"], autocompleteAttribute: ["autocomplete", "autocompleteAttribute"], autocompleteDisabled: ["matAutocompleteDisabled", "autocompleteDisabled", booleanAttribute] }, host: { listeners: { "focusin": "_handleFocus()", "blur": "_onTouched()", "input": "_handleInput($event)", "keydown": "_handleKeydown($event)", "click": "_handleClick()" }, properties: { "attr.autocomplete": "autocompleteAttribute", "attr.role": "autocompleteDisabled ? null : \"combobox\"", "attr.aria-autocomplete": "autocompleteDisabled ? null : \"list\"", "attr.aria-activedescendant": "(panelOpen && activeOption) ? activeOption.id : null", "attr.aria-expanded": "autocompleteDisabled ? null : panelOpen.toString()", "attr.aria-controls": "(autocompleteDisabled || !panelOpen) ? null : autocomplete?.id", "attr.aria-haspopup": "autocompleteDisabled ? null : \"listbox\"" }, classAttribute: "mat-mdc-autocomplete-trigger" }, providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR], exportAs: ["matAutocompleteTrigger"], usesOnChanges: true, ngImport: i0 });
1086
1167
  }
1087
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.8", ngImport: i0, type: MatAutocompleteTrigger, decorators: [{
1168
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteTrigger, decorators: [{
1088
1169
  type: Directive,
1089
1170
  args: [{
1090
1171
  selector: `input[matAutocomplete], textarea[matAutocomplete]`,
@@ -1107,7 +1188,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.8",
1107
1188
  },
1108
1189
  exportAs: 'matAutocompleteTrigger',
1109
1190
  providers: [MAT_AUTOCOMPLETE_VALUE_ACCESSOR],
1110
- standalone: true,
1111
1191
  }]
1112
1192
  }], ctorParameters: () => [], propDecorators: { autocomplete: [{
1113
1193
  type: Input,
@@ -1127,11 +1207,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.8",
1127
1207
  }] } });
1128
1208
 
1129
1209
  class MatAutocompleteModule {
1130
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.8", ngImport: i0, type: MatAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1131
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0-next.8", ngImport: i0, type: MatAutocompleteModule, imports: [OverlayModule,
1210
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1211
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteModule, imports: [OverlayModule,
1132
1212
  MatOptionModule,
1133
1213
  MatCommonModule,
1134
- CommonModule,
1135
1214
  MatAutocomplete,
1136
1215
  MatAutocompleteTrigger,
1137
1216
  MatAutocompleteOrigin], exports: [CdkScrollableModule,
@@ -1139,22 +1218,20 @@ class MatAutocompleteModule {
1139
1218
  MatOptionModule,
1140
1219
  MatCommonModule,
1141
1220
  MatAutocompleteTrigger,
1142
- MatAutocompleteOrigin] }); }
1143
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0-next.8", ngImport: i0, type: MatAutocompleteModule, providers: [MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER], imports: [OverlayModule,
1221
+ MatAutocompleteOrigin] });
1222
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteModule, providers: [MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER], imports: [OverlayModule,
1144
1223
  MatOptionModule,
1145
- MatCommonModule,
1146
- CommonModule, CdkScrollableModule,
1224
+ MatCommonModule, CdkScrollableModule,
1147
1225
  MatOptionModule,
1148
- MatCommonModule] }); }
1226
+ MatCommonModule] });
1149
1227
  }
1150
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.8", ngImport: i0, type: MatAutocompleteModule, decorators: [{
1228
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0-next.10", ngImport: i0, type: MatAutocompleteModule, decorators: [{
1151
1229
  type: NgModule,
1152
1230
  args: [{
1153
1231
  imports: [
1154
1232
  OverlayModule,
1155
1233
  MatOptionModule,
1156
1234
  MatCommonModule,
1157
- CommonModule,
1158
1235
  MatAutocomplete,
1159
1236
  MatAutocompleteTrigger,
1160
1237
  MatAutocompleteOrigin,