@angular/material 21.0.0-next.1 → 21.0.0-next.3

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 (161) hide show
  1. package/autocomplete/index.d.ts +4 -27
  2. package/badge/index.d.ts +2 -3
  3. package/bottom-sheet/index.d.ts +4 -13
  4. package/button/index.d.ts +3 -10
  5. package/button-toggle/index.d.ts +3 -4
  6. package/button-toggle.d.d.ts +1 -7
  7. package/card/index.d.ts +2 -3
  8. package/checkbox/index.d.ts +3 -10
  9. package/chips/_m3-chip.scss +2 -5
  10. package/chips/index.d.ts +2 -3
  11. package/core/index.d.ts +1 -2
  12. package/core/tokens/_classes.scss +20 -16
  13. package/date-adapter.d.d.ts +1 -7
  14. package/datepicker/index.d.ts +6 -59
  15. package/dialog/index.d.ts +7 -30
  16. package/divider/index.d.ts +2 -3
  17. package/expansion/index.d.ts +5 -41
  18. package/fesm2022/autocomplete.mjs +10 -42
  19. package/fesm2022/autocomplete.mjs.map +1 -1
  20. package/fesm2022/badge.mjs +5 -6
  21. package/fesm2022/badge.mjs.map +1 -1
  22. package/fesm2022/bottom-sheet.mjs +6 -89
  23. package/fesm2022/bottom-sheet.mjs.map +1 -1
  24. package/fesm2022/button-toggle.mjs +10 -19
  25. package/fesm2022/button-toggle.mjs.map +1 -1
  26. package/fesm2022/button.mjs +11 -33
  27. package/fesm2022/button.mjs.map +1 -1
  28. package/fesm2022/card.mjs +6 -8
  29. package/fesm2022/card.mjs.map +1 -1
  30. package/fesm2022/checkbox.mjs +15 -25
  31. package/fesm2022/checkbox.mjs.map +1 -1
  32. package/fesm2022/chips.mjs +12 -13
  33. package/fesm2022/chips.mjs.map +1 -1
  34. package/fesm2022/core.mjs +3 -5
  35. package/fesm2022/core.mjs.map +1 -1
  36. package/fesm2022/date-formats.mjs +2 -10
  37. package/fesm2022/date-formats.mjs.map +1 -1
  38. package/fesm2022/datepicker.mjs +32 -185
  39. package/fesm2022/datepicker.mjs.map +1 -1
  40. package/fesm2022/dialog/testing.mjs +5 -6
  41. package/fesm2022/dialog/testing.mjs.map +1 -1
  42. package/fesm2022/dialog.mjs +882 -115
  43. package/fesm2022/dialog.mjs.map +1 -1
  44. package/fesm2022/divider.mjs +5 -7
  45. package/fesm2022/divider.mjs.map +1 -1
  46. package/fesm2022/expansion.mjs +8 -112
  47. package/fesm2022/expansion.mjs.map +1 -1
  48. package/fesm2022/form-field.mjs +19 -50
  49. package/fesm2022/form-field.mjs.map +1 -1
  50. package/fesm2022/grid-list.mjs +6 -11
  51. package/fesm2022/grid-list.mjs.map +1 -1
  52. package/fesm2022/icon-registry.mjs +2 -29
  53. package/fesm2022/icon-registry.mjs.map +1 -1
  54. package/fesm2022/icon.mjs +16 -24
  55. package/fesm2022/icon.mjs.map +1 -1
  56. package/fesm2022/input.mjs +6 -7
  57. package/fesm2022/input.mjs.map +1 -1
  58. package/fesm2022/line.mjs +5 -5
  59. package/fesm2022/line.mjs.map +1 -1
  60. package/fesm2022/list.mjs +6 -7
  61. package/fesm2022/list.mjs.map +1 -1
  62. package/fesm2022/menu.mjs +11 -162
  63. package/fesm2022/menu.mjs.map +1 -1
  64. package/fesm2022/option-module.mjs +5 -5
  65. package/fesm2022/option-module.mjs.map +1 -1
  66. package/fesm2022/option.mjs +2 -2
  67. package/fesm2022/option.mjs.map +1 -1
  68. package/fesm2022/paginator.mjs +7 -28
  69. package/fesm2022/paginator.mjs.map +1 -1
  70. package/fesm2022/progress-bar.mjs +19 -24
  71. package/fesm2022/progress-bar.mjs.map +1 -1
  72. package/fesm2022/progress-spinner.mjs +6 -16
  73. package/fesm2022/progress-spinner.mjs.map +1 -1
  74. package/fesm2022/pseudo-checkbox-module.mjs +5 -5
  75. package/fesm2022/pseudo-checkbox-module.mjs.map +1 -1
  76. package/fesm2022/radio.mjs +9 -18
  77. package/fesm2022/radio.mjs.map +1 -1
  78. package/fesm2022/ripple-module.mjs +5 -5
  79. package/fesm2022/ripple-module.mjs.map +1 -1
  80. package/fesm2022/ripple.mjs +2 -2
  81. package/fesm2022/ripple.mjs.map +1 -1
  82. package/fesm2022/select.mjs +1292 -90
  83. package/fesm2022/select.mjs.map +1 -1
  84. package/fesm2022/sidenav.mjs +9 -99
  85. package/fesm2022/sidenav.mjs.map +1 -1
  86. package/fesm2022/slide-toggle.mjs +5 -6
  87. package/fesm2022/slide-toggle.mjs.map +1 -1
  88. package/fesm2022/slider.mjs +7 -21
  89. package/fesm2022/slider.mjs.map +1 -1
  90. package/fesm2022/snack-bar.mjs +7 -101
  91. package/fesm2022/snack-bar.mjs.map +1 -1
  92. package/fesm2022/sort.mjs +7 -334
  93. package/fesm2022/sort.mjs.map +1 -1
  94. package/fesm2022/stepper.mjs +9 -180
  95. package/fesm2022/stepper.mjs.map +1 -1
  96. package/fesm2022/table.mjs +6 -8
  97. package/fesm2022/table.mjs.map +1 -1
  98. package/fesm2022/tabs.mjs +13 -175
  99. package/fesm2022/tabs.mjs.map +1 -1
  100. package/fesm2022/toolbar.mjs +5 -7
  101. package/fesm2022/toolbar.mjs.map +1 -1
  102. package/fesm2022/tooltip.mjs +21 -54
  103. package/fesm2022/tooltip.mjs.map +1 -1
  104. package/fesm2022/tooltip2.mjs +6 -33
  105. package/fesm2022/tooltip2.mjs.map +1 -1
  106. package/fesm2022/tree.mjs +6 -8
  107. package/fesm2022/tree.mjs.map +1 -1
  108. package/form-field/index.d.ts +2 -13
  109. package/form-field-module.d.d.ts +3 -3
  110. package/grid-list/index.d.ts +2 -3
  111. package/icon/index.d.ts +3 -4
  112. package/icon-module.d.d.ts +3 -9
  113. package/icon-registry.d.d.ts +2 -18
  114. package/input/index.d.ts +3 -4
  115. package/line.d.d.ts +2 -2
  116. package/list/index.d.ts +3 -4
  117. package/menu/index.d.ts +4 -45
  118. package/option-module.d.d.ts +2 -2
  119. package/package.json +2 -2
  120. package/paginator/index.d.ts +4 -5
  121. package/paginator.d.d.ts +2 -18
  122. package/prebuilt-themes/deeppurple-amber.css +1 -1
  123. package/prebuilt-themes/indigo-pink.css +1 -1
  124. package/prebuilt-themes/pink-bluegrey.css +1 -1
  125. package/prebuilt-themes/purple-green.css +1 -1
  126. package/progress-bar/index.d.ts +3 -10
  127. package/progress-spinner/index.d.ts +3 -4
  128. package/progress-spinner.d.d.ts +3 -9
  129. package/pseudo-checkbox-module.d.d.ts +2 -2
  130. package/radio/index.d.ts +3 -10
  131. package/ripple-module.d.d.ts +2 -2
  132. package/ripple.d.d.ts +3 -3
  133. package/schematics/ng-add/index.js +1 -1
  134. package/select/index.d.ts +438 -27
  135. package/sidenav/index.d.ts +4 -21
  136. package/slide-toggle/index.d.ts +2 -3
  137. package/slider/_m2-slider.scss +1 -0
  138. package/slider/_m3-slider.scss +5 -2
  139. package/slider/index.d.ts +2 -2
  140. package/snack-bar/index.d.ts +4 -20
  141. package/sort/index.d.ts +4 -36
  142. package/stepper/index.d.ts +6 -34
  143. package/table/index.d.ts +3 -4
  144. package/tabs/index.d.ts +3 -20
  145. package/timepicker/index.d.ts +2 -2
  146. package/toolbar/index.d.ts +2 -3
  147. package/tooltip/index.d.ts +302 -16
  148. package/tree/index.d.ts +2 -3
  149. package/common-module.d.d.ts +0 -44
  150. package/fesm2022/common-module.mjs +0 -42
  151. package/fesm2022/common-module.mjs.map +0 -1
  152. package/fesm2022/dialog-module.mjs +0 -891
  153. package/fesm2022/dialog-module.mjs.map +0 -1
  154. package/fesm2022/form-field-module.mjs +0 -39
  155. package/fesm2022/form-field-module.mjs.map +0 -1
  156. package/fesm2022/select-module.mjs +0 -1318
  157. package/fesm2022/select-module.mjs.map +0 -1
  158. package/fesm2022/tooltip-module.mjs +0 -24
  159. package/fesm2022/tooltip-module.mjs.map +0 -1
  160. package/select-module.d.d.ts +0 -456
  161. package/tooltip-module.d.d.ts +0 -329
@@ -1,108 +1,1310 @@
1
- export { MatOptgroup, MatOption } from './option.mjs';
1
+ import { _countGroupLabelsBeforeOption, _getOptionScrollPosition, MAT_OPTION_PARENT_COMPONENT, MatOption, MAT_OPTGROUP } from './option.mjs';
2
+ export { MatOptgroup } from './option.mjs';
3
+ import { MAT_FORM_FIELD, MatFormFieldControl } from './form-field2.mjs';
2
4
  export { MatError, MatFormField, MatHint, MatLabel, MatPrefix, MatSuffix } from './form-field2.mjs';
3
- export { MAT_SELECT_CONFIG, MAT_SELECT_SCROLL_STRATEGY, MAT_SELECT_SCROLL_STRATEGY_PROVIDER, MAT_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY, MAT_SELECT_TRIGGER, MatSelect, MatSelectChange, MatSelectModule, MatSelectTrigger } from './select-module.mjs';
4
- import '@angular/cdk/a11y';
5
- import '@angular/cdk/keycodes';
6
- import '@angular/core';
7
- import 'rxjs';
5
+ import { createRepositionScrollStrategy, CdkConnectedOverlay, CdkOverlayOrigin, OverlayModule } from '@angular/cdk/overlay';
6
+ import * as i0 from '@angular/core';
7
+ import { InjectionToken, inject, Injector, ChangeDetectorRef, ElementRef, Renderer2, signal, EventEmitter, HostAttributeToken, booleanAttribute, numberAttribute, Component, ViewEncapsulation, ChangeDetectionStrategy, ContentChildren, ContentChild, Input, ViewChild, Output, Directive, NgModule } from '@angular/core';
8
+ import { ViewportRuler, CdkScrollableModule } from '@angular/cdk/scrolling';
9
+ import { _IdGenerator, LiveAnnouncer, removeAriaReferencedId, addAriaReferencedId, ActiveDescendantKeyManager } from '@angular/cdk/a11y';
10
+ import { Directionality, BidiModule } from '@angular/cdk/bidi';
11
+ import { SelectionModel } from '@angular/cdk/collections';
12
+ import { hasModifierKey, ENTER, SPACE, A, ESCAPE, DOWN_ARROW, UP_ARROW, LEFT_ARROW, RIGHT_ARROW } from '@angular/cdk/keycodes';
13
+ import { NgControl, Validators, NgForm, FormGroupDirective } from '@angular/forms';
14
+ import { Subject, defer, merge } from 'rxjs';
15
+ import { startWith, switchMap, filter, map, takeUntil, take } from 'rxjs/operators';
16
+ import { NgClass } from '@angular/common';
17
+ import { _animationsDisabled } from './animation.mjs';
18
+ import { ErrorStateMatcher } from './error-options.mjs';
19
+ import { _ErrorStateTracker } from './error-state.mjs';
20
+ import { MatOptionModule } from './option-module.mjs';
21
+ import { MatFormFieldModule } from './form-field.mjs';
8
22
  import './ripple.mjs';
9
23
  import '@angular/cdk/platform';
10
24
  import '@angular/cdk/coercion';
11
25
  import '@angular/cdk/private';
12
- import './animation.mjs';
13
- import '@angular/cdk/layout';
14
26
  import './pseudo-checkbox.mjs';
15
27
  import './structural-styles.mjs';
16
- import '@angular/cdk/bidi';
17
- import '@angular/common';
18
- import 'rxjs/operators';
19
28
  import '@angular/cdk/observers/private';
20
- import '@angular/cdk/overlay';
21
- import '@angular/cdk/scrolling';
22
- import '@angular/cdk/collections';
23
- import '@angular/forms';
24
- import './error-options.mjs';
25
- import './error-state.mjs';
26
- import './option-module.mjs';
29
+ import '@angular/cdk/layout';
27
30
  import './ripple-module.mjs';
28
- import './common-module.mjs';
29
31
  import './pseudo-checkbox-module.mjs';
30
- import './form-field-module.mjs';
31
32
  import '@angular/cdk/observers';
32
33
 
34
+ // Note that these have been copied over verbatim from
35
+ // `material/select` so that we don't have to expose them publicly.
33
36
  /**
34
- * The following are all the animations for the mat-select component, with each
35
- * const containing the metadata for one animation.
36
- *
37
- * The values below match the implementation of the AngularJS Material mat-select animation.
37
+ * Returns an exception to be thrown when attempting to change a select's `multiple` option
38
+ * after initialization.
38
39
  * @docs-private
39
- * @deprecated No longer used, will be removed.
40
- * @breaking-change 21.0.0
41
40
  */
42
- const matSelectAnimations = {
43
- // Represents
44
- // trigger('transformPanel', [
45
- // state(
46
- // 'void',
47
- // style({
48
- // opacity: 0,
49
- // transform: 'scale(1, 0.8)',
50
- // }),
51
- // ),
52
- // transition(
53
- // 'void => showing',
54
- // animate(
55
- // '120ms cubic-bezier(0, 0, 0.2, 1)',
56
- // style({
57
- // opacity: 1,
58
- // transform: 'scale(1, 1)',
59
- // }),
60
- // ),
61
- // ),
62
- // transition('* => void', animate('100ms linear', style({opacity: 0}))),
63
- // ])
64
- /** This animation transforms the select's overlay panel on and off the page. */
65
- transformPanel: {
66
- type: 7,
67
- name: 'transformPanel',
68
- definitions: [
69
- {
70
- type: 0,
71
- name: 'void',
72
- styles: {
73
- type: 6,
74
- styles: { opacity: 0, transform: 'scale(1, 0.8)' },
75
- offset: null,
76
- },
77
- },
78
- {
79
- type: 1,
80
- expr: 'void => showing',
81
- animation: {
82
- type: 4,
83
- styles: {
84
- type: 6,
85
- styles: { opacity: 1, transform: 'scale(1, 1)' },
86
- offset: null,
87
- },
88
- timings: '120ms cubic-bezier(0, 0, 0.2, 1)',
89
- },
90
- options: null,
91
- },
92
- {
93
- type: 1,
94
- expr: '* => void',
95
- animation: {
96
- type: 4,
97
- styles: { type: 6, styles: { opacity: 0 }, offset: null },
98
- timings: '100ms linear',
99
- },
100
- options: null,
101
- },
102
- ],
103
- options: {},
41
+ function getMatSelectDynamicMultipleError() {
42
+ return Error('Cannot change `multiple` mode of select after initialization.');
43
+ }
44
+ /**
45
+ * Returns an exception to be thrown when attempting to assign a non-array value to a select
46
+ * in `multiple` mode. Note that `undefined` and `null` are still valid values to allow for
47
+ * resetting the value.
48
+ * @docs-private
49
+ */
50
+ function getMatSelectNonArrayValueError() {
51
+ return Error('Value must be an array in multiple-selection mode.');
52
+ }
53
+ /**
54
+ * Returns an exception to be thrown when assigning a non-function value to the comparator
55
+ * used to determine if a value corresponds to an option. Note that whether the function
56
+ * actually takes two values and returns a boolean is not checked.
57
+ */
58
+ function getMatSelectNonFunctionValueError() {
59
+ return Error('`compareWith` must be a function.');
60
+ }
61
+
62
+ /** Injection token that determines the scroll handling while a select is open. */
63
+ const MAT_SELECT_SCROLL_STRATEGY = new InjectionToken('mat-select-scroll-strategy', {
64
+ providedIn: 'root',
65
+ factory: () => {
66
+ const injector = inject(Injector);
67
+ return () => createRepositionScrollStrategy(injector);
104
68
  },
105
- };
69
+ });
70
+ /** Injection token that can be used to provide the default options the select module. */
71
+ const MAT_SELECT_CONFIG = new InjectionToken('MAT_SELECT_CONFIG');
72
+ /**
73
+ * Injection token that can be used to reference instances of `MatSelectTrigger`. It serves as
74
+ * alternative token to the actual `MatSelectTrigger` class which could cause unnecessary
75
+ * retention of the class and its directive metadata.
76
+ */
77
+ const MAT_SELECT_TRIGGER = new InjectionToken('MatSelectTrigger');
78
+ /** Change event object that is emitted when the select value has changed. */
79
+ class MatSelectChange {
80
+ source;
81
+ value;
82
+ constructor(
83
+ /** Reference to the select that emitted the change event. */
84
+ source,
85
+ /** Current value of the select that emitted the event. */
86
+ value) {
87
+ this.source = source;
88
+ this.value = value;
89
+ }
90
+ }
91
+ class MatSelect {
92
+ _viewportRuler = inject(ViewportRuler);
93
+ _changeDetectorRef = inject(ChangeDetectorRef);
94
+ _elementRef = inject(ElementRef);
95
+ _dir = inject(Directionality, { optional: true });
96
+ _idGenerator = inject(_IdGenerator);
97
+ _renderer = inject(Renderer2);
98
+ _parentFormField = inject(MAT_FORM_FIELD, { optional: true });
99
+ ngControl = inject(NgControl, { self: true, optional: true });
100
+ _liveAnnouncer = inject(LiveAnnouncer);
101
+ _defaultOptions = inject(MAT_SELECT_CONFIG, { optional: true });
102
+ _animationsDisabled = _animationsDisabled();
103
+ _initialized = new Subject();
104
+ _cleanupDetach;
105
+ /** All of the defined select options. */
106
+ options;
107
+ // TODO(crisbeto): this is only necessary for the non-MDC select, but it's technically a
108
+ // public API so we have to keep it. It should be deprecated and removed eventually.
109
+ /** All of the defined groups of options. */
110
+ optionGroups;
111
+ /** User-supplied override of the trigger element. */
112
+ customTrigger;
113
+ /**
114
+ * This position config ensures that the top "start" corner of the overlay
115
+ * is aligned with with the top "start" of the origin by default (overlapping
116
+ * the trigger completely). If the panel cannot fit below the trigger, it
117
+ * will fall back to a position above the trigger.
118
+ */
119
+ _positions = [
120
+ {
121
+ originX: 'start',
122
+ originY: 'bottom',
123
+ overlayX: 'start',
124
+ overlayY: 'top',
125
+ },
126
+ {
127
+ originX: 'end',
128
+ originY: 'bottom',
129
+ overlayX: 'end',
130
+ overlayY: 'top',
131
+ },
132
+ {
133
+ originX: 'start',
134
+ originY: 'top',
135
+ overlayX: 'start',
136
+ overlayY: 'bottom',
137
+ panelClass: 'mat-mdc-select-panel-above',
138
+ },
139
+ {
140
+ originX: 'end',
141
+ originY: 'top',
142
+ overlayX: 'end',
143
+ overlayY: 'bottom',
144
+ panelClass: 'mat-mdc-select-panel-above',
145
+ },
146
+ ];
147
+ /** Scrolls a particular option into the view. */
148
+ _scrollOptionIntoView(index) {
149
+ const option = this.options.toArray()[index];
150
+ if (option) {
151
+ const panel = this.panel.nativeElement;
152
+ const labelCount = _countGroupLabelsBeforeOption(index, this.options, this.optionGroups);
153
+ const element = option._getHostElement();
154
+ if (index === 0 && labelCount === 1) {
155
+ // If we've got one group label before the option and we're at the top option,
156
+ // scroll the list to the top. This is better UX than scrolling the list to the
157
+ // top of the option, because it allows the user to read the top group's label.
158
+ panel.scrollTop = 0;
159
+ }
160
+ else {
161
+ panel.scrollTop = _getOptionScrollPosition(element.offsetTop, element.offsetHeight, panel.scrollTop, panel.offsetHeight);
162
+ }
163
+ }
164
+ }
165
+ /** Called when the panel has been opened and the overlay has settled on its final position. */
166
+ _positioningSettled() {
167
+ this._scrollOptionIntoView(this._keyManager.activeItemIndex || 0);
168
+ }
169
+ /** Creates a change event object that should be emitted by the select. */
170
+ _getChangeEvent(value) {
171
+ return new MatSelectChange(this, value);
172
+ }
173
+ /** Factory function used to create a scroll strategy for this select. */
174
+ _scrollStrategyFactory = inject(MAT_SELECT_SCROLL_STRATEGY);
175
+ /** Whether or not the overlay panel is open. */
176
+ _panelOpen = false;
177
+ /** Comparison function to specify which option is displayed. Defaults to object equality. */
178
+ _compareWith = (o1, o2) => o1 === o2;
179
+ /** Unique id for this input. */
180
+ _uid = this._idGenerator.getId('mat-select-');
181
+ /** Current `aria-labelledby` value for the select trigger. */
182
+ _triggerAriaLabelledBy = null;
183
+ /**
184
+ * Keeps track of the previous form control assigned to the select.
185
+ * Used to detect if it has changed.
186
+ */
187
+ _previousControl;
188
+ /** Emits whenever the component is destroyed. */
189
+ _destroy = new Subject();
190
+ /** Tracks the error state of the select. */
191
+ _errorStateTracker;
192
+ /**
193
+ * Emits whenever the component state changes and should cause the parent
194
+ * form-field to update. Implemented as part of `MatFormFieldControl`.
195
+ * @docs-private
196
+ */
197
+ stateChanges = new Subject();
198
+ /**
199
+ * Disable the automatic labeling to avoid issues like #27241.
200
+ * @docs-private
201
+ */
202
+ disableAutomaticLabeling = true;
203
+ /**
204
+ * Implemented as part of MatFormFieldControl.
205
+ * @docs-private
206
+ */
207
+ userAriaDescribedBy;
208
+ /** Deals with the selection logic. */
209
+ _selectionModel;
210
+ /** Manages keyboard events for options in the panel. */
211
+ _keyManager;
212
+ /** Ideal origin for the overlay panel. */
213
+ _preferredOverlayOrigin;
214
+ /** Width of the overlay panel. */
215
+ _overlayWidth;
216
+ /** `View -> model callback called when value changes` */
217
+ _onChange = () => { };
218
+ /** `View -> model callback called when select has been touched` */
219
+ _onTouched = () => { };
220
+ /** ID for the DOM node containing the select's value. */
221
+ _valueId = this._idGenerator.getId('mat-select-value-');
222
+ /** Strategy that will be used to handle scrolling while the select panel is open. */
223
+ _scrollStrategy;
224
+ _overlayPanelClass = this._defaultOptions?.overlayPanelClass || '';
225
+ /** Whether the select is focused. */
226
+ get focused() {
227
+ return this._focused || this._panelOpen;
228
+ }
229
+ _focused = false;
230
+ /** A name for this control that can be used by `mat-form-field`. */
231
+ controlType = 'mat-select';
232
+ /** Trigger that opens the select. */
233
+ trigger;
234
+ /** Panel containing the select options. */
235
+ panel;
236
+ /** Overlay pane containing the options. */
237
+ _overlayDir;
238
+ /** Classes to be passed to the select panel. Supports the same syntax as `ngClass`. */
239
+ panelClass;
240
+ /** Whether the select is disabled. */
241
+ disabled = false;
242
+ /** Whether ripples in the select are disabled. */
243
+ get disableRipple() {
244
+ return this._disableRipple();
245
+ }
246
+ set disableRipple(value) {
247
+ this._disableRipple.set(value);
248
+ }
249
+ _disableRipple = signal(false, ...(ngDevMode ? [{ debugName: "_disableRipple" }] : []));
250
+ /** Tab index of the select. */
251
+ tabIndex = 0;
252
+ /** Whether checkmark indicator for single-selection options is hidden. */
253
+ get hideSingleSelectionIndicator() {
254
+ return this._hideSingleSelectionIndicator;
255
+ }
256
+ set hideSingleSelectionIndicator(value) {
257
+ this._hideSingleSelectionIndicator = value;
258
+ this._syncParentProperties();
259
+ }
260
+ _hideSingleSelectionIndicator = this._defaultOptions?.hideSingleSelectionIndicator ?? false;
261
+ /** Placeholder to be shown if no value has been selected. */
262
+ get placeholder() {
263
+ return this._placeholder;
264
+ }
265
+ set placeholder(value) {
266
+ this._placeholder = value;
267
+ this.stateChanges.next();
268
+ }
269
+ _placeholder;
270
+ /** Whether the component is required. */
271
+ get required() {
272
+ return this._required ?? this.ngControl?.control?.hasValidator(Validators.required) ?? false;
273
+ }
274
+ set required(value) {
275
+ this._required = value;
276
+ this.stateChanges.next();
277
+ }
278
+ _required;
279
+ /** Whether the user should be allowed to select multiple options. */
280
+ get multiple() {
281
+ return this._multiple;
282
+ }
283
+ set multiple(value) {
284
+ if (this._selectionModel && (typeof ngDevMode === 'undefined' || ngDevMode)) {
285
+ throw getMatSelectDynamicMultipleError();
286
+ }
287
+ this._multiple = value;
288
+ }
289
+ _multiple = false;
290
+ /** Whether to center the active option over the trigger. */
291
+ disableOptionCentering = this._defaultOptions?.disableOptionCentering ?? false;
292
+ /**
293
+ * Function to compare the option values with the selected values. The first argument
294
+ * is a value from an option. The second is a value from the selection. A boolean
295
+ * should be returned.
296
+ */
297
+ get compareWith() {
298
+ return this._compareWith;
299
+ }
300
+ set compareWith(fn) {
301
+ if (typeof fn !== 'function' && (typeof ngDevMode === 'undefined' || ngDevMode)) {
302
+ throw getMatSelectNonFunctionValueError();
303
+ }
304
+ this._compareWith = fn;
305
+ if (this._selectionModel) {
306
+ // A different comparator means the selection could change.
307
+ this._initializeSelection();
308
+ }
309
+ }
310
+ /** Value of the select control. */
311
+ get value() {
312
+ return this._value;
313
+ }
314
+ set value(newValue) {
315
+ const hasAssigned = this._assignValue(newValue);
316
+ if (hasAssigned) {
317
+ this._onChange(newValue);
318
+ }
319
+ }
320
+ _value;
321
+ /** Aria label of the select. */
322
+ ariaLabel = '';
323
+ /** Input that can be used to specify the `aria-labelledby` attribute. */
324
+ ariaLabelledby;
325
+ /** Object used to control when error messages are shown. */
326
+ get errorStateMatcher() {
327
+ return this._errorStateTracker.matcher;
328
+ }
329
+ set errorStateMatcher(value) {
330
+ this._errorStateTracker.matcher = value;
331
+ }
332
+ /** Time to wait in milliseconds after the last keystroke before moving focus to an item. */
333
+ typeaheadDebounceInterval;
334
+ /**
335
+ * Function used to sort the values in a select in multiple mode.
336
+ * Follows the same logic as `Array.prototype.sort`.
337
+ */
338
+ sortComparator;
339
+ /** Unique id of the element. */
340
+ get id() {
341
+ return this._id;
342
+ }
343
+ set id(value) {
344
+ this._id = value || this._uid;
345
+ this.stateChanges.next();
346
+ }
347
+ _id;
348
+ /** Whether the select is in an error state. */
349
+ get errorState() {
350
+ return this._errorStateTracker.errorState;
351
+ }
352
+ set errorState(value) {
353
+ this._errorStateTracker.errorState = value;
354
+ }
355
+ /**
356
+ * Width of the panel. If set to `auto`, the panel will match the trigger width.
357
+ * If set to null or an empty string, the panel will grow to match the longest option's text.
358
+ */
359
+ panelWidth = this._defaultOptions && typeof this._defaultOptions.panelWidth !== 'undefined'
360
+ ? this._defaultOptions.panelWidth
361
+ : 'auto';
362
+ /**
363
+ * By default selecting an option with a `null` or `undefined` value will reset the select's
364
+ * value. Enable this option if the reset behavior doesn't match your requirements and instead
365
+ * the nullable options should become selected. The value of this input can be controlled app-wide
366
+ * using the `MAT_SELECT_CONFIG` injection token.
367
+ */
368
+ canSelectNullableOptions = this._defaultOptions?.canSelectNullableOptions ?? false;
369
+ /** Combined stream of all of the child options' change events. */
370
+ optionSelectionChanges = defer(() => {
371
+ const options = this.options;
372
+ if (options) {
373
+ return options.changes.pipe(startWith(options), switchMap(() => merge(...options.map(option => option.onSelectionChange))));
374
+ }
375
+ return this._initialized.pipe(switchMap(() => this.optionSelectionChanges));
376
+ });
377
+ /** Event emitted when the select panel has been toggled. */
378
+ openedChange = new EventEmitter();
379
+ /** Event emitted when the select has been opened. */
380
+ _openedStream = this.openedChange.pipe(filter(o => o), map(() => { }));
381
+ /** Event emitted when the select has been closed. */
382
+ _closedStream = this.openedChange.pipe(filter(o => !o), map(() => { }));
383
+ /** Event emitted when the selected value has been changed by the user. */
384
+ selectionChange = new EventEmitter();
385
+ /**
386
+ * Event that emits whenever the raw value of the select changes. This is here primarily
387
+ * to facilitate the two-way binding for the `value` input.
388
+ * @docs-private
389
+ */
390
+ valueChange = new EventEmitter();
391
+ constructor() {
392
+ const defaultErrorStateMatcher = inject(ErrorStateMatcher);
393
+ const parentForm = inject(NgForm, { optional: true });
394
+ const parentFormGroup = inject(FormGroupDirective, { optional: true });
395
+ const tabIndex = inject(new HostAttributeToken('tabindex'), { optional: true });
396
+ if (this.ngControl) {
397
+ // Note: we provide the value accessor through here, instead of
398
+ // the `providers` to avoid running into a circular import.
399
+ this.ngControl.valueAccessor = this;
400
+ }
401
+ // Note that we only want to set this when the defaults pass it in, otherwise it should
402
+ // stay as `undefined` so that it falls back to the default in the key manager.
403
+ if (this._defaultOptions?.typeaheadDebounceInterval != null) {
404
+ this.typeaheadDebounceInterval = this._defaultOptions.typeaheadDebounceInterval;
405
+ }
406
+ this._errorStateTracker = new _ErrorStateTracker(defaultErrorStateMatcher, this.ngControl, parentFormGroup, parentForm, this.stateChanges);
407
+ this._scrollStrategy = this._scrollStrategyFactory();
408
+ this.tabIndex = tabIndex == null ? 0 : parseInt(tabIndex) || 0;
409
+ // Force setter to be called in case id was not specified.
410
+ this.id = this.id;
411
+ }
412
+ ngOnInit() {
413
+ this._selectionModel = new SelectionModel(this.multiple);
414
+ this.stateChanges.next();
415
+ this._viewportRuler
416
+ .change()
417
+ .pipe(takeUntil(this._destroy))
418
+ .subscribe(() => {
419
+ if (this.panelOpen) {
420
+ this._overlayWidth = this._getOverlayWidth(this._preferredOverlayOrigin);
421
+ this._changeDetectorRef.detectChanges();
422
+ }
423
+ });
424
+ }
425
+ ngAfterContentInit() {
426
+ this._initialized.next();
427
+ this._initialized.complete();
428
+ this._initKeyManager();
429
+ this._selectionModel.changed.pipe(takeUntil(this._destroy)).subscribe(event => {
430
+ event.added.forEach(option => option.select());
431
+ event.removed.forEach(option => option.deselect());
432
+ });
433
+ this.options.changes.pipe(startWith(null), takeUntil(this._destroy)).subscribe(() => {
434
+ this._resetOptions();
435
+ this._initializeSelection();
436
+ });
437
+ }
438
+ ngDoCheck() {
439
+ const newAriaLabelledby = this._getTriggerAriaLabelledby();
440
+ const ngControl = this.ngControl;
441
+ // We have to manage setting the `aria-labelledby` ourselves, because part of its value
442
+ // is computed as a result of a content query which can cause this binding to trigger a
443
+ // "changed after checked" error.
444
+ if (newAriaLabelledby !== this._triggerAriaLabelledBy) {
445
+ const element = this._elementRef.nativeElement;
446
+ this._triggerAriaLabelledBy = newAriaLabelledby;
447
+ if (newAriaLabelledby) {
448
+ element.setAttribute('aria-labelledby', newAriaLabelledby);
449
+ }
450
+ else {
451
+ element.removeAttribute('aria-labelledby');
452
+ }
453
+ }
454
+ if (ngControl) {
455
+ // The disabled state might go out of sync if the form group is swapped out. See #17860.
456
+ if (this._previousControl !== ngControl.control) {
457
+ if (this._previousControl !== undefined &&
458
+ ngControl.disabled !== null &&
459
+ ngControl.disabled !== this.disabled) {
460
+ this.disabled = ngControl.disabled;
461
+ }
462
+ this._previousControl = ngControl.control;
463
+ }
464
+ this.updateErrorState();
465
+ }
466
+ }
467
+ ngOnChanges(changes) {
468
+ // Updating the disabled state is handled by the input, but we need to additionally let
469
+ // the parent form field know to run change detection when the disabled state changes.
470
+ if (changes['disabled'] || changes['userAriaDescribedBy']) {
471
+ this.stateChanges.next();
472
+ }
473
+ if (changes['typeaheadDebounceInterval'] && this._keyManager) {
474
+ this._keyManager.withTypeAhead(this.typeaheadDebounceInterval);
475
+ }
476
+ }
477
+ ngOnDestroy() {
478
+ this._cleanupDetach?.();
479
+ this._keyManager?.destroy();
480
+ this._destroy.next();
481
+ this._destroy.complete();
482
+ this.stateChanges.complete();
483
+ this._clearFromModal();
484
+ }
485
+ /** Toggles the overlay panel open or closed. */
486
+ toggle() {
487
+ this.panelOpen ? this.close() : this.open();
488
+ }
489
+ /** Opens the overlay panel. */
490
+ open() {
491
+ if (!this._canOpen()) {
492
+ return;
493
+ }
494
+ // It's important that we read this as late as possible, because doing so earlier will
495
+ // return a different element since it's based on queries in the form field which may
496
+ // not have run yet. Also this needs to be assigned before we measure the overlay width.
497
+ if (this._parentFormField) {
498
+ this._preferredOverlayOrigin = this._parentFormField.getConnectedOverlayOrigin();
499
+ }
500
+ this._cleanupDetach?.();
501
+ this._overlayWidth = this._getOverlayWidth(this._preferredOverlayOrigin);
502
+ this._applyModalPanelOwnership();
503
+ this._panelOpen = true;
504
+ this._overlayDir.positionChange.pipe(take(1)).subscribe(() => {
505
+ this._changeDetectorRef.detectChanges();
506
+ this._positioningSettled();
507
+ });
508
+ this._overlayDir.attachOverlay();
509
+ this._keyManager.withHorizontalOrientation(null);
510
+ this._highlightCorrectOption();
511
+ this._changeDetectorRef.markForCheck();
512
+ // Required for the MDC form field to pick up when the overlay has been opened.
513
+ this.stateChanges.next();
514
+ // Simulate the animation event before we moved away from `@angular/animations`.
515
+ Promise.resolve().then(() => this.openedChange.emit(true));
516
+ }
517
+ /**
518
+ * Track which modal we have modified the `aria-owns` attribute of. When the combobox trigger is
519
+ * inside an aria-modal, we apply aria-owns to the parent modal with the `id` of the options
520
+ * panel. Track the modal we have changed so we can undo the changes on destroy.
521
+ */
522
+ _trackedModal = null;
523
+ /**
524
+ * If the autocomplete trigger is inside of an `aria-modal` element, connect
525
+ * that modal to the options panel with `aria-owns`.
526
+ *
527
+ * For some browser + screen reader combinations, when navigation is inside
528
+ * of an `aria-modal` element, the screen reader treats everything outside
529
+ * of that modal as hidden or invisible.
530
+ *
531
+ * This causes a problem when the combobox trigger is _inside_ of a modal, because the
532
+ * options panel is rendered _outside_ of that modal, preventing screen reader navigation
533
+ * from reaching the panel.
534
+ *
535
+ * We can work around this issue by applying `aria-owns` to the modal with the `id` of
536
+ * the options panel. This effectively communicates to assistive technology that the
537
+ * options panel is part of the same interaction as the modal.
538
+ *
539
+ * At time of this writing, this issue is present in VoiceOver.
540
+ * See https://github.com/angular/components/issues/20694
541
+ */
542
+ _applyModalPanelOwnership() {
543
+ // TODO(http://github.com/angular/components/issues/26853): consider de-duplicating this with
544
+ // the `LiveAnnouncer` and any other usages.
545
+ //
546
+ // Note that the selector here is limited to CDK overlays at the moment in order to reduce the
547
+ // section of the DOM we need to look through. This should cover all the cases we support, but
548
+ // the selector can be expanded if it turns out to be too narrow.
549
+ const modal = this._elementRef.nativeElement.closest('body > .cdk-overlay-container [aria-modal="true"]');
550
+ if (!modal) {
551
+ // Most commonly, the autocomplete trigger is not inside a modal.
552
+ return;
553
+ }
554
+ const panelId = `${this.id}-panel`;
555
+ if (this._trackedModal) {
556
+ removeAriaReferencedId(this._trackedModal, 'aria-owns', panelId);
557
+ }
558
+ addAriaReferencedId(modal, 'aria-owns', panelId);
559
+ this._trackedModal = modal;
560
+ }
561
+ /** Clears the reference to the listbox overlay element from the modal it was added to. */
562
+ _clearFromModal() {
563
+ if (!this._trackedModal) {
564
+ // Most commonly, the autocomplete trigger is not used inside a modal.
565
+ return;
566
+ }
567
+ const panelId = `${this.id}-panel`;
568
+ removeAriaReferencedId(this._trackedModal, 'aria-owns', panelId);
569
+ this._trackedModal = null;
570
+ }
571
+ /** Closes the overlay panel and focuses the host element. */
572
+ close() {
573
+ if (this._panelOpen) {
574
+ this._panelOpen = false;
575
+ this._exitAndDetach();
576
+ this._keyManager.withHorizontalOrientation(this._isRtl() ? 'rtl' : 'ltr');
577
+ this._changeDetectorRef.markForCheck();
578
+ this._onTouched();
579
+ // Required for the MDC form field to pick up when the overlay has been closed.
580
+ this.stateChanges.next();
581
+ // Simulate the animation event before we moved away from `@angular/animations`.
582
+ Promise.resolve().then(() => this.openedChange.emit(false));
583
+ }
584
+ }
585
+ /** Triggers the exit animation and detaches the overlay at the end. */
586
+ _exitAndDetach() {
587
+ if (this._animationsDisabled || !this.panel) {
588
+ this._detachOverlay();
589
+ return;
590
+ }
591
+ this._cleanupDetach?.();
592
+ this._cleanupDetach = () => {
593
+ cleanupEvent();
594
+ clearTimeout(exitFallbackTimer);
595
+ this._cleanupDetach = undefined;
596
+ };
597
+ const panel = this.panel.nativeElement;
598
+ const cleanupEvent = this._renderer.listen(panel, 'animationend', (event) => {
599
+ if (event.animationName === '_mat-select-exit') {
600
+ this._cleanupDetach?.();
601
+ this._detachOverlay();
602
+ }
603
+ });
604
+ // Since closing the overlay depends on the animation, we have a fallback in case the panel
605
+ // doesn't animate. This can happen in some internal tests that do `* {animation: none}`.
606
+ const exitFallbackTimer = setTimeout(() => {
607
+ this._cleanupDetach?.();
608
+ this._detachOverlay();
609
+ }, 200);
610
+ panel.classList.add('mat-select-panel-exit');
611
+ }
612
+ /** Detaches the current overlay directive. */
613
+ _detachOverlay() {
614
+ this._overlayDir.detachOverlay();
615
+ // Some of the overlay detachment logic depends on change detection.
616
+ // Mark for check to ensure that things get picked up in a timely manner.
617
+ this._changeDetectorRef.markForCheck();
618
+ }
619
+ /**
620
+ * Sets the select's value. Part of the ControlValueAccessor interface
621
+ * required to integrate with Angular's core forms API.
622
+ *
623
+ * @param value New value to be written to the model.
624
+ */
625
+ writeValue(value) {
626
+ this._assignValue(value);
627
+ }
628
+ /**
629
+ * Saves a callback function to be invoked when the select's value
630
+ * changes from user input. Part of the ControlValueAccessor interface
631
+ * required to integrate with Angular's core forms API.
632
+ *
633
+ * @param fn Callback to be triggered when the value changes.
634
+ */
635
+ registerOnChange(fn) {
636
+ this._onChange = fn;
637
+ }
638
+ /**
639
+ * Saves a callback function to be invoked when the select is blurred
640
+ * by the user. Part of the ControlValueAccessor interface required
641
+ * to integrate with Angular's core forms API.
642
+ *
643
+ * @param fn Callback to be triggered when the component has been touched.
644
+ */
645
+ registerOnTouched(fn) {
646
+ this._onTouched = fn;
647
+ }
648
+ /**
649
+ * Disables the select. Part of the ControlValueAccessor interface required
650
+ * to integrate with Angular's core forms API.
651
+ *
652
+ * @param isDisabled Sets whether the component is disabled.
653
+ */
654
+ setDisabledState(isDisabled) {
655
+ this.disabled = isDisabled;
656
+ this._changeDetectorRef.markForCheck();
657
+ this.stateChanges.next();
658
+ }
659
+ /** Whether or not the overlay panel is open. */
660
+ get panelOpen() {
661
+ return this._panelOpen;
662
+ }
663
+ /** The currently selected option. */
664
+ get selected() {
665
+ return this.multiple ? this._selectionModel?.selected || [] : this._selectionModel?.selected[0];
666
+ }
667
+ /** The value displayed in the trigger. */
668
+ get triggerValue() {
669
+ if (this.empty) {
670
+ return '';
671
+ }
672
+ if (this._multiple) {
673
+ const selectedOptions = this._selectionModel.selected.map(option => option.viewValue);
674
+ if (this._isRtl()) {
675
+ selectedOptions.reverse();
676
+ }
677
+ // TODO(crisbeto): delimiter should be configurable for proper localization.
678
+ return selectedOptions.join(', ');
679
+ }
680
+ return this._selectionModel.selected[0].viewValue;
681
+ }
682
+ /** Refreshes the error state of the select. */
683
+ updateErrorState() {
684
+ this._errorStateTracker.updateErrorState();
685
+ }
686
+ /** Whether the element is in RTL mode. */
687
+ _isRtl() {
688
+ return this._dir ? this._dir.value === 'rtl' : false;
689
+ }
690
+ /** Handles all keydown events on the select. */
691
+ _handleKeydown(event) {
692
+ if (!this.disabled) {
693
+ this.panelOpen ? this._handleOpenKeydown(event) : this._handleClosedKeydown(event);
694
+ }
695
+ }
696
+ /** Handles keyboard events while the select is closed. */
697
+ _handleClosedKeydown(event) {
698
+ const keyCode = event.keyCode;
699
+ const isArrowKey = keyCode === DOWN_ARROW ||
700
+ keyCode === UP_ARROW ||
701
+ keyCode === LEFT_ARROW ||
702
+ keyCode === RIGHT_ARROW;
703
+ const isOpenKey = keyCode === ENTER || keyCode === SPACE;
704
+ const manager = this._keyManager;
705
+ // Open the select on ALT + arrow key to match the native <select>
706
+ if ((!manager.isTyping() && isOpenKey && !hasModifierKey(event)) ||
707
+ ((this.multiple || event.altKey) && isArrowKey)) {
708
+ event.preventDefault(); // prevents the page from scrolling down when pressing space
709
+ this.open();
710
+ }
711
+ else if (!this.multiple) {
712
+ const previouslySelectedOption = this.selected;
713
+ manager.onKeydown(event);
714
+ const selectedOption = this.selected;
715
+ // Since the value has changed, we need to announce it ourselves.
716
+ if (selectedOption && previouslySelectedOption !== selectedOption) {
717
+ // We set a duration on the live announcement, because we want the live element to be
718
+ // cleared after a while so that users can't navigate to it using the arrow keys.
719
+ this._liveAnnouncer.announce(selectedOption.viewValue, 10000);
720
+ }
721
+ }
722
+ }
723
+ /** Handles keyboard events when the selected is open. */
724
+ _handleOpenKeydown(event) {
725
+ const manager = this._keyManager;
726
+ const keyCode = event.keyCode;
727
+ const isArrowKey = keyCode === DOWN_ARROW || keyCode === UP_ARROW;
728
+ const isTyping = manager.isTyping();
729
+ if (isArrowKey && event.altKey) {
730
+ // Close the select on ALT + arrow key to match the native <select>
731
+ event.preventDefault();
732
+ this.close();
733
+ // Don't do anything in this case if the user is typing,
734
+ // because the typing sequence can include the space key.
735
+ }
736
+ else if (!isTyping &&
737
+ (keyCode === ENTER || keyCode === SPACE) &&
738
+ manager.activeItem &&
739
+ !hasModifierKey(event)) {
740
+ event.preventDefault();
741
+ manager.activeItem._selectViaInteraction();
742
+ }
743
+ else if (!isTyping && this._multiple && keyCode === A && event.ctrlKey) {
744
+ event.preventDefault();
745
+ const hasDeselectedOptions = this.options.some(opt => !opt.disabled && !opt.selected);
746
+ this.options.forEach(option => {
747
+ if (!option.disabled) {
748
+ hasDeselectedOptions ? option.select() : option.deselect();
749
+ }
750
+ });
751
+ }
752
+ else {
753
+ const previouslyFocusedIndex = manager.activeItemIndex;
754
+ manager.onKeydown(event);
755
+ if (this._multiple &&
756
+ isArrowKey &&
757
+ event.shiftKey &&
758
+ manager.activeItem &&
759
+ manager.activeItemIndex !== previouslyFocusedIndex) {
760
+ manager.activeItem._selectViaInteraction();
761
+ }
762
+ }
763
+ }
764
+ /** Handles keyboard events coming from the overlay. */
765
+ _handleOverlayKeydown(event) {
766
+ // TODO(crisbeto): prior to #30363 this was being handled inside the overlay directive, but we
767
+ // need control over the animation timing so we do it manually. We should remove the `keydown`
768
+ // listener from `.mat-mdc-select-panel` and handle all the events here. That may cause
769
+ // further test breakages so it's left for a follow-up.
770
+ if (event.keyCode === ESCAPE && !hasModifierKey(event)) {
771
+ event.preventDefault();
772
+ this.close();
773
+ }
774
+ }
775
+ _onFocus() {
776
+ if (!this.disabled) {
777
+ this._focused = true;
778
+ this.stateChanges.next();
779
+ }
780
+ }
781
+ /**
782
+ * Calls the touched callback only if the panel is closed. Otherwise, the trigger will
783
+ * "blur" to the panel when it opens, causing a false positive.
784
+ */
785
+ _onBlur() {
786
+ this._focused = false;
787
+ this._keyManager?.cancelTypeahead();
788
+ if (!this.disabled && !this.panelOpen) {
789
+ this._onTouched();
790
+ this._changeDetectorRef.markForCheck();
791
+ this.stateChanges.next();
792
+ }
793
+ }
794
+ /** Returns the theme to be used on the panel. */
795
+ _getPanelTheme() {
796
+ return this._parentFormField ? `mat-${this._parentFormField.color}` : '';
797
+ }
798
+ /** Whether the select has a value. */
799
+ get empty() {
800
+ return !this._selectionModel || this._selectionModel.isEmpty();
801
+ }
802
+ _initializeSelection() {
803
+ // Defer setting the value in order to avoid the "Expression
804
+ // has changed after it was checked" errors from Angular.
805
+ Promise.resolve().then(() => {
806
+ if (this.ngControl) {
807
+ this._value = this.ngControl.value;
808
+ }
809
+ this._setSelectionByValue(this._value);
810
+ this.stateChanges.next();
811
+ });
812
+ }
813
+ /**
814
+ * Sets the selected option based on a value. If no option can be
815
+ * found with the designated value, the select trigger is cleared.
816
+ */
817
+ _setSelectionByValue(value) {
818
+ this.options.forEach(option => option.setInactiveStyles());
819
+ this._selectionModel.clear();
820
+ if (this.multiple && value) {
821
+ if (!Array.isArray(value) && (typeof ngDevMode === 'undefined' || ngDevMode)) {
822
+ throw getMatSelectNonArrayValueError();
823
+ }
824
+ value.forEach((currentValue) => this._selectOptionByValue(currentValue));
825
+ this._sortValues();
826
+ }
827
+ else {
828
+ const correspondingOption = this._selectOptionByValue(value);
829
+ // Shift focus to the active item. Note that we shouldn't do this in multiple
830
+ // mode, because we don't know what option the user interacted with last.
831
+ if (correspondingOption) {
832
+ this._keyManager.updateActiveItem(correspondingOption);
833
+ }
834
+ else if (!this.panelOpen) {
835
+ // Otherwise reset the highlighted option. Note that we only want to do this while
836
+ // closed, because doing it while open can shift the user's focus unnecessarily.
837
+ this._keyManager.updateActiveItem(-1);
838
+ }
839
+ }
840
+ this._changeDetectorRef.markForCheck();
841
+ }
842
+ /**
843
+ * Finds and selects and option based on its value.
844
+ * @returns Option that has the corresponding value.
845
+ */
846
+ _selectOptionByValue(value) {
847
+ const correspondingOption = this.options.find((option) => {
848
+ // Skip options that are already in the model. This allows us to handle cases
849
+ // where the same primitive value is selected multiple times.
850
+ if (this._selectionModel.isSelected(option)) {
851
+ return false;
852
+ }
853
+ try {
854
+ // Treat null as a special reset value.
855
+ return ((option.value != null || this.canSelectNullableOptions) &&
856
+ this._compareWith(option.value, value));
857
+ }
858
+ catch (error) {
859
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
860
+ // Notify developers of errors in their comparator.
861
+ console.warn(error);
862
+ }
863
+ return false;
864
+ }
865
+ });
866
+ if (correspondingOption) {
867
+ this._selectionModel.select(correspondingOption);
868
+ }
869
+ return correspondingOption;
870
+ }
871
+ /** Assigns a specific value to the select. Returns whether the value has changed. */
872
+ _assignValue(newValue) {
873
+ // Always re-assign an array, because it might have been mutated.
874
+ if (newValue !== this._value || (this._multiple && Array.isArray(newValue))) {
875
+ if (this.options) {
876
+ this._setSelectionByValue(newValue);
877
+ }
878
+ this._value = newValue;
879
+ return true;
880
+ }
881
+ return false;
882
+ }
883
+ // `skipPredicate` determines if key manager should avoid putting a given option in the tab
884
+ // order. Allow disabled list items to receive focus via keyboard to align with WAI ARIA
885
+ // recommendation.
886
+ //
887
+ // Normally WAI ARIA's instructions are to exclude disabled items from the tab order, but it
888
+ // makes a few exceptions for compound widgets.
889
+ //
890
+ // From [Developing a Keyboard Interface](
891
+ // https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/):
892
+ // "For the following composite widget elements, keep them focusable when disabled: Options in a
893
+ // Listbox..."
894
+ //
895
+ // The user can focus disabled options using the keyboard, but the user cannot click disabled
896
+ // options.
897
+ _skipPredicate = (option) => {
898
+ if (this.panelOpen) {
899
+ // Support keyboard focusing disabled options in an ARIA listbox.
900
+ return false;
901
+ }
902
+ // When the panel is closed, skip over disabled options. Support options via the UP/DOWN arrow
903
+ // keys on a closed select. ARIA listbox interaction pattern is less relevant when the panel is
904
+ // closed.
905
+ return option.disabled;
906
+ };
907
+ /** Gets how wide the overlay panel should be. */
908
+ _getOverlayWidth(preferredOrigin) {
909
+ if (this.panelWidth === 'auto') {
910
+ const refToMeasure = preferredOrigin instanceof CdkOverlayOrigin
911
+ ? preferredOrigin.elementRef
912
+ : preferredOrigin || this._elementRef;
913
+ return refToMeasure.nativeElement.getBoundingClientRect().width;
914
+ }
915
+ return this.panelWidth === null ? '' : this.panelWidth;
916
+ }
917
+ /** Syncs the parent state with the individual options. */
918
+ _syncParentProperties() {
919
+ if (this.options) {
920
+ for (const option of this.options) {
921
+ option._changeDetectorRef.markForCheck();
922
+ }
923
+ }
924
+ }
925
+ /** Sets up a key manager to listen to keyboard events on the overlay panel. */
926
+ _initKeyManager() {
927
+ this._keyManager = new ActiveDescendantKeyManager(this.options)
928
+ .withTypeAhead(this.typeaheadDebounceInterval)
929
+ .withVerticalOrientation()
930
+ .withHorizontalOrientation(this._isRtl() ? 'rtl' : 'ltr')
931
+ .withHomeAndEnd()
932
+ .withPageUpDown()
933
+ .withAllowedModifierKeys(['shiftKey'])
934
+ .skipPredicate(this._skipPredicate);
935
+ this._keyManager.tabOut.subscribe(() => {
936
+ if (this.panelOpen) {
937
+ // Select the active item when tabbing away. This is consistent with how the native
938
+ // select behaves. Note that we only want to do this in single selection mode.
939
+ if (!this.multiple && this._keyManager.activeItem) {
940
+ this._keyManager.activeItem._selectViaInteraction();
941
+ }
942
+ // Restore focus to the trigger before closing. Ensures that the focus
943
+ // position won't be lost if the user got focus into the overlay.
944
+ this.focus();
945
+ this.close();
946
+ }
947
+ });
948
+ this._keyManager.change.subscribe(() => {
949
+ if (this._panelOpen && this.panel) {
950
+ this._scrollOptionIntoView(this._keyManager.activeItemIndex || 0);
951
+ }
952
+ else if (!this._panelOpen && !this.multiple && this._keyManager.activeItem) {
953
+ this._keyManager.activeItem._selectViaInteraction();
954
+ }
955
+ });
956
+ }
957
+ /** Drops current option subscriptions and IDs and resets from scratch. */
958
+ _resetOptions() {
959
+ const changedOrDestroyed = merge(this.options.changes, this._destroy);
960
+ this.optionSelectionChanges.pipe(takeUntil(changedOrDestroyed)).subscribe(event => {
961
+ this._onSelect(event.source, event.isUserInput);
962
+ if (event.isUserInput && !this.multiple && this._panelOpen) {
963
+ this.close();
964
+ this.focus();
965
+ }
966
+ });
967
+ // Listen to changes in the internal state of the options and react accordingly.
968
+ // Handles cases like the labels of the selected options changing.
969
+ merge(...this.options.map(option => option._stateChanges))
970
+ .pipe(takeUntil(changedOrDestroyed))
971
+ .subscribe(() => {
972
+ // `_stateChanges` can fire as a result of a change in the label's DOM value which may
973
+ // be the result of an expression changing. We have to use `detectChanges` in order
974
+ // to avoid "changed after checked" errors (see #14793).
975
+ this._changeDetectorRef.detectChanges();
976
+ this.stateChanges.next();
977
+ });
978
+ }
979
+ /** Invoked when an option is clicked. */
980
+ _onSelect(option, isUserInput) {
981
+ const wasSelected = this._selectionModel.isSelected(option);
982
+ if (!this.canSelectNullableOptions && option.value == null && !this._multiple) {
983
+ option.deselect();
984
+ this._selectionModel.clear();
985
+ if (this.value != null) {
986
+ this._propagateChanges(option.value);
987
+ }
988
+ }
989
+ else {
990
+ if (wasSelected !== option.selected) {
991
+ option.selected
992
+ ? this._selectionModel.select(option)
993
+ : this._selectionModel.deselect(option);
994
+ }
995
+ if (isUserInput) {
996
+ this._keyManager.setActiveItem(option);
997
+ }
998
+ if (this.multiple) {
999
+ this._sortValues();
1000
+ if (isUserInput) {
1001
+ // In case the user selected the option with their mouse, we
1002
+ // want to restore focus back to the trigger, in order to
1003
+ // prevent the select keyboard controls from clashing with
1004
+ // the ones from `mat-option`.
1005
+ this.focus();
1006
+ }
1007
+ }
1008
+ }
1009
+ if (wasSelected !== this._selectionModel.isSelected(option)) {
1010
+ this._propagateChanges();
1011
+ }
1012
+ this.stateChanges.next();
1013
+ }
1014
+ /** Sorts the selected values in the selected based on their order in the panel. */
1015
+ _sortValues() {
1016
+ if (this.multiple) {
1017
+ const options = this.options.toArray();
1018
+ this._selectionModel.sort((a, b) => {
1019
+ return this.sortComparator
1020
+ ? this.sortComparator(a, b, options)
1021
+ : options.indexOf(a) - options.indexOf(b);
1022
+ });
1023
+ this.stateChanges.next();
1024
+ }
1025
+ }
1026
+ /** Emits change event to set the model value. */
1027
+ _propagateChanges(fallbackValue) {
1028
+ let valueToEmit;
1029
+ if (this.multiple) {
1030
+ valueToEmit = this.selected.map(option => option.value);
1031
+ }
1032
+ else {
1033
+ valueToEmit = this.selected ? this.selected.value : fallbackValue;
1034
+ }
1035
+ this._value = valueToEmit;
1036
+ this.valueChange.emit(valueToEmit);
1037
+ this._onChange(valueToEmit);
1038
+ this.selectionChange.emit(this._getChangeEvent(valueToEmit));
1039
+ this._changeDetectorRef.markForCheck();
1040
+ }
1041
+ /**
1042
+ * Highlights the selected item. If no option is selected, it will highlight
1043
+ * the first *enabled* option.
1044
+ */
1045
+ _highlightCorrectOption() {
1046
+ if (this._keyManager) {
1047
+ if (this.empty) {
1048
+ // Find the index of the first *enabled* option. Avoid calling `_keyManager.setActiveItem`
1049
+ // because it activates the first option that passes the skip predicate, rather than the
1050
+ // first *enabled* option.
1051
+ let firstEnabledOptionIndex = -1;
1052
+ for (let index = 0; index < this.options.length; index++) {
1053
+ const option = this.options.get(index);
1054
+ if (!option.disabled) {
1055
+ firstEnabledOptionIndex = index;
1056
+ break;
1057
+ }
1058
+ }
1059
+ this._keyManager.setActiveItem(firstEnabledOptionIndex);
1060
+ }
1061
+ else {
1062
+ this._keyManager.setActiveItem(this._selectionModel.selected[0]);
1063
+ }
1064
+ }
1065
+ }
1066
+ /** Whether the panel is allowed to open. */
1067
+ _canOpen() {
1068
+ return !this._panelOpen && !this.disabled && this.options?.length > 0 && !!this._overlayDir;
1069
+ }
1070
+ /** Focuses the select element. */
1071
+ focus(options) {
1072
+ this._elementRef.nativeElement.focus(options);
1073
+ }
1074
+ /** Gets the aria-labelledby for the select panel. */
1075
+ _getPanelAriaLabelledby() {
1076
+ if (this.ariaLabel) {
1077
+ return null;
1078
+ }
1079
+ const labelId = this._parentFormField?.getLabelId() || null;
1080
+ const labelExpression = labelId ? labelId + ' ' : '';
1081
+ return this.ariaLabelledby ? labelExpression + this.ariaLabelledby : labelId;
1082
+ }
1083
+ /** Determines the `aria-activedescendant` to be set on the host. */
1084
+ _getAriaActiveDescendant() {
1085
+ if (this.panelOpen && this._keyManager && this._keyManager.activeItem) {
1086
+ return this._keyManager.activeItem.id;
1087
+ }
1088
+ return null;
1089
+ }
1090
+ /** Gets the aria-labelledby of the select component trigger. */
1091
+ _getTriggerAriaLabelledby() {
1092
+ if (this.ariaLabel) {
1093
+ return null;
1094
+ }
1095
+ let value = this._parentFormField?.getLabelId() || '';
1096
+ if (this.ariaLabelledby) {
1097
+ value += ' ' + this.ariaLabelledby;
1098
+ }
1099
+ // The value should not be used for the trigger's aria-labelledby,
1100
+ // but this currently "breaks" accessibility tests since they complain
1101
+ // there is no aria-labelledby. This is because they are not setting an
1102
+ // appropriate label on the form field or select.
1103
+ // TODO: remove this conditional after fixing clients by ensuring their
1104
+ // selects have a label applied.
1105
+ if (!value) {
1106
+ value = this._valueId;
1107
+ }
1108
+ return value;
1109
+ }
1110
+ /**
1111
+ * Implemented as part of MatFormFieldControl.
1112
+ * @docs-private
1113
+ */
1114
+ get describedByIds() {
1115
+ const element = this._elementRef.nativeElement;
1116
+ const existingDescribedBy = element.getAttribute('aria-describedby');
1117
+ return existingDescribedBy?.split(' ') || [];
1118
+ }
1119
+ /**
1120
+ * Implemented as part of MatFormFieldControl.
1121
+ * @docs-private
1122
+ */
1123
+ setDescribedByIds(ids) {
1124
+ if (ids.length) {
1125
+ this._elementRef.nativeElement.setAttribute('aria-describedby', ids.join(' '));
1126
+ }
1127
+ else {
1128
+ this._elementRef.nativeElement.removeAttribute('aria-describedby');
1129
+ }
1130
+ }
1131
+ /**
1132
+ * Implemented as part of MatFormFieldControl.
1133
+ * @docs-private
1134
+ */
1135
+ onContainerClick() {
1136
+ this.focus();
1137
+ this.open();
1138
+ }
1139
+ /**
1140
+ * Implemented as part of MatFormFieldControl.
1141
+ * @docs-private
1142
+ */
1143
+ get shouldLabelFloat() {
1144
+ // Since the panel doesn't overlap the trigger, we
1145
+ // want the label to only float when there's a value.
1146
+ return this.panelOpen || !this.empty || (this.focused && !!this.placeholder);
1147
+ }
1148
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatSelect, deps: [], target: i0.ɵɵFactoryTarget.Component });
1149
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.2.0-next.2", type: MatSelect, isStandalone: true, selector: "mat-select", inputs: { userAriaDescribedBy: ["aria-describedby", "userAriaDescribedBy"], panelClass: "panelClass", disabled: ["disabled", "disabled", booleanAttribute], disableRipple: ["disableRipple", "disableRipple", booleanAttribute], tabIndex: ["tabIndex", "tabIndex", (value) => (value == null ? 0 : numberAttribute(value))], hideSingleSelectionIndicator: ["hideSingleSelectionIndicator", "hideSingleSelectionIndicator", booleanAttribute], placeholder: "placeholder", required: ["required", "required", booleanAttribute], multiple: ["multiple", "multiple", booleanAttribute], disableOptionCentering: ["disableOptionCentering", "disableOptionCentering", booleanAttribute], compareWith: "compareWith", value: "value", ariaLabel: ["aria-label", "ariaLabel"], ariaLabelledby: ["aria-labelledby", "ariaLabelledby"], errorStateMatcher: "errorStateMatcher", typeaheadDebounceInterval: ["typeaheadDebounceInterval", "typeaheadDebounceInterval", numberAttribute], sortComparator: "sortComparator", id: "id", panelWidth: "panelWidth", canSelectNullableOptions: ["canSelectNullableOptions", "canSelectNullableOptions", booleanAttribute] }, outputs: { openedChange: "openedChange", _openedStream: "opened", _closedStream: "closed", selectionChange: "selectionChange", valueChange: "valueChange" }, host: { attributes: { "role": "combobox", "aria-haspopup": "listbox" }, listeners: { "keydown": "_handleKeydown($event)", "focus": "_onFocus()", "blur": "_onBlur()" }, properties: { "attr.id": "id", "attr.tabindex": "disabled ? -1 : tabIndex", "attr.aria-controls": "panelOpen ? id + \"-panel\" : null", "attr.aria-expanded": "panelOpen", "attr.aria-label": "ariaLabel || null", "attr.aria-required": "required.toString()", "attr.aria-disabled": "disabled.toString()", "attr.aria-invalid": "errorState", "attr.aria-activedescendant": "_getAriaActiveDescendant()", "class.mat-mdc-select-disabled": "disabled", "class.mat-mdc-select-invalid": "errorState", "class.mat-mdc-select-required": "required", "class.mat-mdc-select-empty": "empty", "class.mat-mdc-select-multiple": "multiple" }, classAttribute: "mat-mdc-select" }, providers: [
1150
+ { provide: MatFormFieldControl, useExisting: MatSelect },
1151
+ { provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatSelect },
1152
+ ], queries: [{ propertyName: "customTrigger", first: true, predicate: MAT_SELECT_TRIGGER, descendants: true }, { propertyName: "options", predicate: MatOption, descendants: true }, { propertyName: "optionGroups", predicate: MAT_OPTGROUP, descendants: true }], viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true }, { propertyName: "panel", first: true, predicate: ["panel"], descendants: true }, { propertyName: "_overlayDir", first: true, predicate: CdkConnectedOverlay, descendants: true }], exportAs: ["matSelect"], usesOnChanges: true, ngImport: i0, template: "<div cdk-overlay-origin\n class=\"mat-mdc-select-trigger\"\n (click)=\"open()\"\n #fallbackOverlayOrigin=\"cdkOverlayOrigin\"\n #trigger>\n\n <div class=\"mat-mdc-select-value\" [attr.id]=\"_valueId\">\n @if (empty) {\n <span class=\"mat-mdc-select-placeholder mat-mdc-select-min-line\">{{placeholder}}</span>\n } @else {\n <span class=\"mat-mdc-select-value-text\">\n @if (customTrigger) {\n <ng-content select=\"mat-select-trigger\"></ng-content>\n } @else {\n <span class=\"mat-mdc-select-min-line\">{{triggerValue}}</span>\n }\n </span>\n }\n </div>\n\n <div class=\"mat-mdc-select-arrow-wrapper\">\n <div class=\"mat-mdc-select-arrow\">\n <!-- Use an inline SVG, because it works better than a CSS triangle in high contrast mode. -->\n <svg viewBox=\"0 0 24 24\" width=\"24px\" height=\"24px\" focusable=\"false\" aria-hidden=\"true\">\n <path d=\"M7 10l5 5 5-5z\"/>\n </svg>\n </div>\n </div>\n</div>\n\n<ng-template\n cdk-connected-overlay\n cdkConnectedOverlayLockPosition\n cdkConnectedOverlayHasBackdrop\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n [cdkConnectedOverlayDisableClose]=\"true\"\n [cdkConnectedOverlayPanelClass]=\"_overlayPanelClass\"\n [cdkConnectedOverlayScrollStrategy]=\"_scrollStrategy\"\n [cdkConnectedOverlayOrigin]=\"_preferredOverlayOrigin || fallbackOverlayOrigin\"\n [cdkConnectedOverlayPositions]=\"_positions\"\n [cdkConnectedOverlayWidth]=\"_overlayWidth\"\n [cdkConnectedOverlayFlexibleDimensions]=\"true\"\n (detach)=\"close()\"\n (backdropClick)=\"close()\"\n (overlayKeydown)=\"_handleOverlayKeydown($event)\">\n <div\n #panel\n role=\"listbox\"\n tabindex=\"-1\"\n class=\"mat-mdc-select-panel mdc-menu-surface mdc-menu-surface--open {{ _getPanelTheme() }}\"\n [class.mat-select-panel-animations-enabled]=\"!_animationsDisabled\"\n [attr.id]=\"id + '-panel'\"\n [attr.aria-multiselectable]=\"multiple\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby()\"\n [ngClass]=\"panelClass\"\n (keydown)=\"_handleKeydown($event)\">\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["@keyframes _mat-select-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}@keyframes _mat-select-exit{from{opacity:1}to{opacity:0}}.mat-mdc-select{display:inline-block;width:100%;outline:none;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:var(--mat-select-enabled-trigger-text-color, var(--mat-sys-on-surface));font-family:var(--mat-select-trigger-text-font, var(--mat-sys-body-large-font));line-height:var(--mat-select-trigger-text-line-height, var(--mat-sys-body-large-line-height));font-size:var(--mat-select-trigger-text-size, var(--mat-sys-body-large-size));font-weight:var(--mat-select-trigger-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-select-trigger-text-tracking, var(--mat-sys-body-large-tracking))}div.mat-mdc-select-panel{box-shadow:var(--mat-select-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))}.mat-mdc-select-disabled{color:var(--mat-select-disabled-trigger-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-select-disabled .mat-mdc-select-placeholder{color:var(--mat-select-disabled-trigger-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-select-trigger{display:inline-flex;align-items:center;cursor:pointer;position:relative;box-sizing:border-box;width:100%}.mat-mdc-select-disabled .mat-mdc-select-trigger{-webkit-user-select:none;user-select:none;cursor:default}.mat-mdc-select-value{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mat-mdc-select-value-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mat-mdc-select-arrow-wrapper{height:24px;flex-shrink:0;display:inline-flex;align-items:center}.mat-form-field-appearance-fill .mdc-text-field--no-label .mat-mdc-select-arrow-wrapper{transform:none}.mat-mdc-form-field .mat-mdc-select.mat-mdc-select-invalid .mat-mdc-select-arrow,.mat-form-field-invalid:not(.mat-form-field-disabled) .mat-mdc-form-field-infix::after{color:var(--mat-select-invalid-arrow-color, var(--mat-sys-error))}.mat-mdc-select-arrow{width:10px;height:5px;position:relative;color:var(--mat-select-enabled-arrow-color, var(--mat-sys-on-surface-variant))}.mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--mat-select-focused-arrow-color, var(--mat-sys-primary))}.mat-mdc-form-field .mat-mdc-select.mat-mdc-select-disabled .mat-mdc-select-arrow{color:var(--mat-select-disabled-arrow-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-select-arrow svg{fill:currentColor;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}@media(forced-colors: active){.mat-mdc-select-arrow svg{fill:CanvasText}.mat-mdc-select-disabled .mat-mdc-select-arrow svg{fill:GrayText}}div.mat-mdc-select-panel{width:100%;max-height:275px;outline:0;overflow:auto;padding:8px 0;border-radius:4px;box-sizing:border-box;position:relative;background-color:var(--mat-select-panel-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-select-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-select-panel-above) div.mat-mdc-select-panel{border-top-left-radius:0;border-top-right-radius:0;transform-origin:top center}.mat-mdc-select-panel-above div.mat-mdc-select-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:bottom center}.mat-select-panel-animations-enabled{animation:_mat-select-enter 120ms cubic-bezier(0, 0, 0.2, 1)}.mat-select-panel-animations-enabled.mat-select-panel-exit{animation:_mat-select-exit 100ms linear}.mat-mdc-select-placeholder{transition:color 400ms 133.3333333333ms cubic-bezier(0.25, 0.8, 0.25, 1);color:var(--mat-select-placeholder-text-color, var(--mat-sys-on-surface-variant))}.mat-mdc-form-field:not(.mat-form-field-animations-enabled) .mat-mdc-select-placeholder,._mat-animation-noopable .mat-mdc-select-placeholder{transition:none}.mat-form-field-hide-placeholder .mat-mdc-select-placeholder{color:rgba(0,0,0,0);-webkit-text-fill-color:rgba(0,0,0,0);transition:none;display:block}.mat-mdc-form-field-type-mat-select:not(.mat-form-field-disabled) .mat-mdc-text-field-wrapper{cursor:pointer}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-fill .mat-mdc-floating-label{max-width:calc(100% - 18px)}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-fill .mdc-floating-label--float-above{max-width:calc(100%/0.75 - 24px)}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-outline .mdc-notched-outline__notch{max-width:calc(100% - 60px)}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-outline .mdc-text-field--label-floating .mdc-notched-outline__notch{max-width:calc(100% - 24px)}.mat-mdc-select-min-line:empty::before{content:\" \";white-space:pre;width:1px;display:inline-block;visibility:hidden}.mat-form-field-appearance-fill .mat-mdc-select-arrow-wrapper{transform:var(--mat-select-arrow-transform, translateY(-8px))}\n"], dependencies: [{ kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1153
+ }
1154
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatSelect, decorators: [{
1155
+ type: Component,
1156
+ args: [{ selector: 'mat-select', exportAs: 'matSelect', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
1157
+ 'role': 'combobox',
1158
+ 'aria-haspopup': 'listbox',
1159
+ 'class': 'mat-mdc-select',
1160
+ '[attr.id]': 'id',
1161
+ '[attr.tabindex]': 'disabled ? -1 : tabIndex',
1162
+ '[attr.aria-controls]': 'panelOpen ? id + "-panel" : null',
1163
+ '[attr.aria-expanded]': 'panelOpen',
1164
+ '[attr.aria-label]': 'ariaLabel || null',
1165
+ '[attr.aria-required]': 'required.toString()',
1166
+ '[attr.aria-disabled]': 'disabled.toString()',
1167
+ '[attr.aria-invalid]': 'errorState',
1168
+ '[attr.aria-activedescendant]': '_getAriaActiveDescendant()',
1169
+ '[class.mat-mdc-select-disabled]': 'disabled',
1170
+ '[class.mat-mdc-select-invalid]': 'errorState',
1171
+ '[class.mat-mdc-select-required]': 'required',
1172
+ '[class.mat-mdc-select-empty]': 'empty',
1173
+ '[class.mat-mdc-select-multiple]': 'multiple',
1174
+ '(keydown)': '_handleKeydown($event)',
1175
+ '(focus)': '_onFocus()',
1176
+ '(blur)': '_onBlur()',
1177
+ }, providers: [
1178
+ { provide: MatFormFieldControl, useExisting: MatSelect },
1179
+ { provide: MAT_OPTION_PARENT_COMPONENT, useExisting: MatSelect },
1180
+ ], imports: [CdkOverlayOrigin, CdkConnectedOverlay, NgClass], template: "<div cdk-overlay-origin\n class=\"mat-mdc-select-trigger\"\n (click)=\"open()\"\n #fallbackOverlayOrigin=\"cdkOverlayOrigin\"\n #trigger>\n\n <div class=\"mat-mdc-select-value\" [attr.id]=\"_valueId\">\n @if (empty) {\n <span class=\"mat-mdc-select-placeholder mat-mdc-select-min-line\">{{placeholder}}</span>\n } @else {\n <span class=\"mat-mdc-select-value-text\">\n @if (customTrigger) {\n <ng-content select=\"mat-select-trigger\"></ng-content>\n } @else {\n <span class=\"mat-mdc-select-min-line\">{{triggerValue}}</span>\n }\n </span>\n }\n </div>\n\n <div class=\"mat-mdc-select-arrow-wrapper\">\n <div class=\"mat-mdc-select-arrow\">\n <!-- Use an inline SVG, because it works better than a CSS triangle in high contrast mode. -->\n <svg viewBox=\"0 0 24 24\" width=\"24px\" height=\"24px\" focusable=\"false\" aria-hidden=\"true\">\n <path d=\"M7 10l5 5 5-5z\"/>\n </svg>\n </div>\n </div>\n</div>\n\n<ng-template\n cdk-connected-overlay\n cdkConnectedOverlayLockPosition\n cdkConnectedOverlayHasBackdrop\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n [cdkConnectedOverlayDisableClose]=\"true\"\n [cdkConnectedOverlayPanelClass]=\"_overlayPanelClass\"\n [cdkConnectedOverlayScrollStrategy]=\"_scrollStrategy\"\n [cdkConnectedOverlayOrigin]=\"_preferredOverlayOrigin || fallbackOverlayOrigin\"\n [cdkConnectedOverlayPositions]=\"_positions\"\n [cdkConnectedOverlayWidth]=\"_overlayWidth\"\n [cdkConnectedOverlayFlexibleDimensions]=\"true\"\n (detach)=\"close()\"\n (backdropClick)=\"close()\"\n (overlayKeydown)=\"_handleOverlayKeydown($event)\">\n <div\n #panel\n role=\"listbox\"\n tabindex=\"-1\"\n class=\"mat-mdc-select-panel mdc-menu-surface mdc-menu-surface--open {{ _getPanelTheme() }}\"\n [class.mat-select-panel-animations-enabled]=\"!_animationsDisabled\"\n [attr.id]=\"id + '-panel'\"\n [attr.aria-multiselectable]=\"multiple\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"_getPanelAriaLabelledby()\"\n [ngClass]=\"panelClass\"\n (keydown)=\"_handleKeydown($event)\">\n <ng-content></ng-content>\n </div>\n</ng-template>\n", styles: ["@keyframes _mat-select-enter{from{opacity:0;transform:scaleY(0.8)}to{opacity:1;transform:none}}@keyframes _mat-select-exit{from{opacity:1}to{opacity:0}}.mat-mdc-select{display:inline-block;width:100%;outline:none;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:var(--mat-select-enabled-trigger-text-color, var(--mat-sys-on-surface));font-family:var(--mat-select-trigger-text-font, var(--mat-sys-body-large-font));line-height:var(--mat-select-trigger-text-line-height, var(--mat-sys-body-large-line-height));font-size:var(--mat-select-trigger-text-size, var(--mat-sys-body-large-size));font-weight:var(--mat-select-trigger-text-weight, var(--mat-sys-body-large-weight));letter-spacing:var(--mat-select-trigger-text-tracking, var(--mat-sys-body-large-tracking))}div.mat-mdc-select-panel{box-shadow:var(--mat-select-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))}.mat-mdc-select-disabled{color:var(--mat-select-disabled-trigger-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-select-disabled .mat-mdc-select-placeholder{color:var(--mat-select-disabled-trigger-text-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-select-trigger{display:inline-flex;align-items:center;cursor:pointer;position:relative;box-sizing:border-box;width:100%}.mat-mdc-select-disabled .mat-mdc-select-trigger{-webkit-user-select:none;user-select:none;cursor:default}.mat-mdc-select-value{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mat-mdc-select-value-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mat-mdc-select-arrow-wrapper{height:24px;flex-shrink:0;display:inline-flex;align-items:center}.mat-form-field-appearance-fill .mdc-text-field--no-label .mat-mdc-select-arrow-wrapper{transform:none}.mat-mdc-form-field .mat-mdc-select.mat-mdc-select-invalid .mat-mdc-select-arrow,.mat-form-field-invalid:not(.mat-form-field-disabled) .mat-mdc-form-field-infix::after{color:var(--mat-select-invalid-arrow-color, var(--mat-sys-error))}.mat-mdc-select-arrow{width:10px;height:5px;position:relative;color:var(--mat-select-enabled-arrow-color, var(--mat-sys-on-surface-variant))}.mat-mdc-form-field.mat-focused .mat-mdc-select-arrow{color:var(--mat-select-focused-arrow-color, var(--mat-sys-primary))}.mat-mdc-form-field .mat-mdc-select.mat-mdc-select-disabled .mat-mdc-select-arrow{color:var(--mat-select-disabled-arrow-color, color-mix(in srgb, var(--mat-sys-on-surface) 38%, transparent))}.mat-mdc-select-arrow svg{fill:currentColor;position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}@media(forced-colors: active){.mat-mdc-select-arrow svg{fill:CanvasText}.mat-mdc-select-disabled .mat-mdc-select-arrow svg{fill:GrayText}}div.mat-mdc-select-panel{width:100%;max-height:275px;outline:0;overflow:auto;padding:8px 0;border-radius:4px;box-sizing:border-box;position:relative;background-color:var(--mat-select-panel-background-color, var(--mat-sys-surface-container))}@media(forced-colors: active){div.mat-mdc-select-panel{outline:solid 1px}}.cdk-overlay-pane:not(.mat-mdc-select-panel-above) div.mat-mdc-select-panel{border-top-left-radius:0;border-top-right-radius:0;transform-origin:top center}.mat-mdc-select-panel-above div.mat-mdc-select-panel{border-bottom-left-radius:0;border-bottom-right-radius:0;transform-origin:bottom center}.mat-select-panel-animations-enabled{animation:_mat-select-enter 120ms cubic-bezier(0, 0, 0.2, 1)}.mat-select-panel-animations-enabled.mat-select-panel-exit{animation:_mat-select-exit 100ms linear}.mat-mdc-select-placeholder{transition:color 400ms 133.3333333333ms cubic-bezier(0.25, 0.8, 0.25, 1);color:var(--mat-select-placeholder-text-color, var(--mat-sys-on-surface-variant))}.mat-mdc-form-field:not(.mat-form-field-animations-enabled) .mat-mdc-select-placeholder,._mat-animation-noopable .mat-mdc-select-placeholder{transition:none}.mat-form-field-hide-placeholder .mat-mdc-select-placeholder{color:rgba(0,0,0,0);-webkit-text-fill-color:rgba(0,0,0,0);transition:none;display:block}.mat-mdc-form-field-type-mat-select:not(.mat-form-field-disabled) .mat-mdc-text-field-wrapper{cursor:pointer}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-fill .mat-mdc-floating-label{max-width:calc(100% - 18px)}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-fill .mdc-floating-label--float-above{max-width:calc(100%/0.75 - 24px)}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-outline .mdc-notched-outline__notch{max-width:calc(100% - 60px)}.mat-mdc-form-field-type-mat-select.mat-form-field-appearance-outline .mdc-text-field--label-floating .mdc-notched-outline__notch{max-width:calc(100% - 24px)}.mat-mdc-select-min-line:empty::before{content:\" \";white-space:pre;width:1px;display:inline-block;visibility:hidden}.mat-form-field-appearance-fill .mat-mdc-select-arrow-wrapper{transform:var(--mat-select-arrow-transform, translateY(-8px))}\n"] }]
1181
+ }], ctorParameters: () => [], propDecorators: { options: [{
1182
+ type: ContentChildren,
1183
+ args: [MatOption, { descendants: true }]
1184
+ }], optionGroups: [{
1185
+ type: ContentChildren,
1186
+ args: [MAT_OPTGROUP, { descendants: true }]
1187
+ }], customTrigger: [{
1188
+ type: ContentChild,
1189
+ args: [MAT_SELECT_TRIGGER]
1190
+ }], userAriaDescribedBy: [{
1191
+ type: Input,
1192
+ args: ['aria-describedby']
1193
+ }], trigger: [{
1194
+ type: ViewChild,
1195
+ args: ['trigger']
1196
+ }], panel: [{
1197
+ type: ViewChild,
1198
+ args: ['panel']
1199
+ }], _overlayDir: [{
1200
+ type: ViewChild,
1201
+ args: [CdkConnectedOverlay]
1202
+ }], panelClass: [{
1203
+ type: Input
1204
+ }], disabled: [{
1205
+ type: Input,
1206
+ args: [{ transform: booleanAttribute }]
1207
+ }], disableRipple: [{
1208
+ type: Input,
1209
+ args: [{ transform: booleanAttribute }]
1210
+ }], tabIndex: [{
1211
+ type: Input,
1212
+ args: [{
1213
+ transform: (value) => (value == null ? 0 : numberAttribute(value)),
1214
+ }]
1215
+ }], hideSingleSelectionIndicator: [{
1216
+ type: Input,
1217
+ args: [{ transform: booleanAttribute }]
1218
+ }], placeholder: [{
1219
+ type: Input
1220
+ }], required: [{
1221
+ type: Input,
1222
+ args: [{ transform: booleanAttribute }]
1223
+ }], multiple: [{
1224
+ type: Input,
1225
+ args: [{ transform: booleanAttribute }]
1226
+ }], disableOptionCentering: [{
1227
+ type: Input,
1228
+ args: [{ transform: booleanAttribute }]
1229
+ }], compareWith: [{
1230
+ type: Input
1231
+ }], value: [{
1232
+ type: Input
1233
+ }], ariaLabel: [{
1234
+ type: Input,
1235
+ args: ['aria-label']
1236
+ }], ariaLabelledby: [{
1237
+ type: Input,
1238
+ args: ['aria-labelledby']
1239
+ }], errorStateMatcher: [{
1240
+ type: Input
1241
+ }], typeaheadDebounceInterval: [{
1242
+ type: Input,
1243
+ args: [{ transform: numberAttribute }]
1244
+ }], sortComparator: [{
1245
+ type: Input
1246
+ }], id: [{
1247
+ type: Input
1248
+ }], panelWidth: [{
1249
+ type: Input
1250
+ }], canSelectNullableOptions: [{
1251
+ type: Input,
1252
+ args: [{ transform: booleanAttribute }]
1253
+ }], openedChange: [{
1254
+ type: Output
1255
+ }], _openedStream: [{
1256
+ type: Output,
1257
+ args: ['opened']
1258
+ }], _closedStream: [{
1259
+ type: Output,
1260
+ args: ['closed']
1261
+ }], selectionChange: [{
1262
+ type: Output
1263
+ }], valueChange: [{
1264
+ type: Output
1265
+ }] } });
1266
+ /**
1267
+ * Allows the user to customize the trigger that is displayed when the select has a value.
1268
+ */
1269
+ class MatSelectTrigger {
1270
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatSelectTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1271
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: MatSelectTrigger, isStandalone: true, selector: "mat-select-trigger", providers: [{ provide: MAT_SELECT_TRIGGER, useExisting: MatSelectTrigger }], ngImport: i0 });
1272
+ }
1273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatSelectTrigger, decorators: [{
1274
+ type: Directive,
1275
+ args: [{
1276
+ selector: 'mat-select-trigger',
1277
+ providers: [{ provide: MAT_SELECT_TRIGGER, useExisting: MatSelectTrigger }],
1278
+ }]
1279
+ }] });
1280
+
1281
+ class MatSelectModule {
1282
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatSelectModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1283
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatSelectModule, imports: [OverlayModule, MatOptionModule, MatSelect, MatSelectTrigger], exports: [BidiModule,
1284
+ CdkScrollableModule,
1285
+ MatFormFieldModule,
1286
+ MatSelect,
1287
+ MatSelectTrigger,
1288
+ MatOptionModule] });
1289
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatSelectModule, imports: [OverlayModule, MatOptionModule, BidiModule,
1290
+ CdkScrollableModule,
1291
+ MatFormFieldModule,
1292
+ MatOptionModule] });
1293
+ }
1294
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatSelectModule, decorators: [{
1295
+ type: NgModule,
1296
+ args: [{
1297
+ imports: [OverlayModule, MatOptionModule, MatSelect, MatSelectTrigger],
1298
+ exports: [
1299
+ BidiModule,
1300
+ CdkScrollableModule,
1301
+ MatFormFieldModule,
1302
+ MatSelect,
1303
+ MatSelectTrigger,
1304
+ MatOptionModule,
1305
+ ],
1306
+ }]
1307
+ }] });
106
1308
 
107
- export { matSelectAnimations };
1309
+ export { MAT_SELECT_CONFIG, MAT_SELECT_SCROLL_STRATEGY, MAT_SELECT_TRIGGER, MatOption, MatSelect, MatSelectChange, MatSelectModule, MatSelectTrigger };
108
1310
  //# sourceMappingURL=select.mjs.map