@angular/aria 22.0.0-next.7 → 22.0.0-next.8

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 (93) hide show
  1. package/fesm2022/_accordion-chunk.mjs +1 -1
  2. package/fesm2022/_click-event-manager-chunk.mjs +1 -1
  3. package/fesm2022/{_signal-like-chunk.mjs → _collection-chunk.mjs} +51 -2
  4. package/fesm2022/_collection-chunk.mjs.map +1 -0
  5. package/fesm2022/_deferred-content-chunk.mjs +6 -6
  6. package/fesm2022/_list-chunk.mjs +4 -1
  7. package/fesm2022/_list-chunk.mjs.map +1 -1
  8. package/fesm2022/_list-navigation-chunk.mjs +1 -1
  9. package/fesm2022/_list-typeahead-chunk.mjs +1 -1
  10. package/fesm2022/_menu-chunk.mjs +1 -1
  11. package/fesm2022/{_combobox-listbox-chunk.mjs → _option-chunk.mjs} +3 -50
  12. package/fesm2022/_option-chunk.mjs.map +1 -0
  13. package/fesm2022/_tabs-chunk.mjs +1 -1
  14. package/fesm2022/_toolbar-widget-group-chunk.mjs +1 -1
  15. package/fesm2022/_transforms-chunk.mjs +8 -0
  16. package/fesm2022/_transforms-chunk.mjs.map +1 -0
  17. package/fesm2022/{_combobox-tree-chunk.mjs → _tree-chunk.mjs} +3 -48
  18. package/fesm2022/_tree-chunk.mjs.map +1 -0
  19. package/fesm2022/_widget-chunk.mjs +36 -15
  20. package/fesm2022/_widget-chunk.mjs.map +1 -1
  21. package/fesm2022/accordion.mjs +28 -55
  22. package/fesm2022/accordion.mjs.map +1 -1
  23. package/fesm2022/aria.mjs +1 -1
  24. package/fesm2022/aria.mjs.map +1 -1
  25. package/fesm2022/combobox-testing.mjs +79 -0
  26. package/fesm2022/combobox-testing.mjs.map +1 -0
  27. package/fesm2022/combobox.mjs +273 -307
  28. package/fesm2022/combobox.mjs.map +1 -1
  29. package/fesm2022/grid-testing.mjs +8 -0
  30. package/fesm2022/grid-testing.mjs.map +1 -1
  31. package/fesm2022/grid.mjs +68 -87
  32. package/fesm2022/grid.mjs.map +1 -1
  33. package/fesm2022/listbox-testing.mjs +4 -0
  34. package/fesm2022/listbox-testing.mjs.map +1 -1
  35. package/fesm2022/listbox.mjs +184 -205
  36. package/fesm2022/listbox.mjs.map +1 -1
  37. package/fesm2022/menu-testing.mjs +11 -0
  38. package/fesm2022/menu-testing.mjs.map +1 -1
  39. package/fesm2022/menu.mjs +42 -66
  40. package/fesm2022/menu.mjs.map +1 -1
  41. package/fesm2022/private.mjs +19 -13
  42. package/fesm2022/private.mjs.map +1 -1
  43. package/fesm2022/tabs.mjs +78 -84
  44. package/fesm2022/tabs.mjs.map +1 -1
  45. package/fesm2022/toolbar-testing.mjs +5 -1
  46. package/fesm2022/toolbar-testing.mjs.map +1 -1
  47. package/fesm2022/toolbar.mjs +21 -31
  48. package/fesm2022/toolbar.mjs.map +1 -1
  49. package/fesm2022/tree-testing.mjs +12 -0
  50. package/fesm2022/tree-testing.mjs.map +1 -1
  51. package/fesm2022/tree.mjs +118 -146
  52. package/fesm2022/tree.mjs.map +1 -1
  53. package/package.json +6 -6
  54. package/types/_accordion-chunk.d.ts +2 -2
  55. package/types/_collection-chunk.d.ts +42 -0
  56. package/types/_expansion-chunk.d.ts +1 -1
  57. package/types/_grid-chunk.d.ts +9 -3
  58. package/types/_keyboard-event-manager-chunk.d.ts +1 -1
  59. package/types/_list-chunk.d.ts +1 -1
  60. package/types/_list-navigation-chunk.d.ts +1 -1
  61. package/types/_listbox-chunk.d.ts +1 -1
  62. package/types/_menu-chunk.d.ts +1 -1
  63. package/types/_tabs-chunk.d.ts +1 -1
  64. package/types/_toolbar-chunk.d.ts +1 -1
  65. package/types/_tree-chunk.d.ts +1 -1
  66. package/types/accordion.d.ts +7 -13
  67. package/types/combobox-testing.d.ts +63 -0
  68. package/types/combobox.d.ts +96 -193
  69. package/types/grid-testing.d.ts +4 -0
  70. package/types/grid.d.ts +101 -97
  71. package/types/listbox-testing.d.ts +25 -0
  72. package/types/listbox.d.ts +55 -60
  73. package/types/menu-testing.d.ts +6 -0
  74. package/types/menu.d.ts +17 -13
  75. package/types/private.d.ts +24 -138
  76. package/types/tabs.d.ts +69 -72
  77. package/types/toolbar-testing.d.ts +4 -0
  78. package/types/toolbar.d.ts +5 -6
  79. package/types/tree-testing.d.ts +8 -0
  80. package/types/tree.d.ts +7 -14
  81. package/fesm2022/_combobox-chunk.mjs +0 -478
  82. package/fesm2022/_combobox-chunk.mjs.map +0 -1
  83. package/fesm2022/_combobox-listbox-chunk.mjs.map +0 -1
  84. package/fesm2022/_combobox-tree-chunk.mjs.map +0 -1
  85. package/fesm2022/_element-chunk.mjs +0 -6
  86. package/fesm2022/_element-chunk.mjs.map +0 -1
  87. package/fesm2022/_signal-like-chunk.mjs.map +0 -1
  88. package/fesm2022/simple-combobox.mjs +0 -443
  89. package/fesm2022/simple-combobox.mjs.map +0 -1
  90. package/types/_combobox-chunk.d.ts +0 -224
  91. package/types/_element-chunk.d.ts +0 -10
  92. package/types/_signal-like-chunk.d.ts +0 -14
  93. package/types/simple-combobox.d.ts +0 -124
@@ -1,65 +1,15 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, signal, Directive, ElementRef, contentChild, input, booleanAttribute, computed, afterRenderEffect, model, untracked } from '@angular/core';
3
- import { Directionality } from '@angular/cdk/bidi';
4
- import { DeferredContentAware, DeferredContent } from './_deferred-content-chunk.mjs';
5
- import { ComboboxPattern, ComboboxDialogPattern } from './_combobox-chunk.mjs';
6
- import { _IdGenerator } from '@angular/cdk/a11y';
7
- import './_signal-like-chunk.mjs';
8
- import '@angular/core/primitives/signals';
2
+ import { inject, Renderer2, ElementRef, signal, input, booleanAttribute, model, computed, afterRenderEffect, Directive, InjectionToken } from '@angular/core';
3
+ import * as i1 from '@angular/aria/private';
4
+ import { DeferredContentAware, tabIndexTransform, ComboboxPattern, DeferredContent, ComboboxPopupPattern } from '@angular/aria/private';
5
+ export { DeferredContent as ɵɵDeferredContent, DeferredContentAware as ɵɵDeferredContentAware } from './_deferred-content-chunk.mjs';
9
6
 
10
- const COMBOBOX = new InjectionToken('COMBOBOX');
11
-
12
- class ComboboxPopup {
13
- combobox = inject(COMBOBOX, {
14
- optional: true
15
- });
16
- _controls = signal(undefined, ...(ngDevMode ? [{
17
- debugName: "_controls"
18
- }] : []));
19
- static ɵfac = i0.ɵɵngDeclareFactory({
20
- minVersion: "12.0.0",
21
- version: "22.0.0-next.9",
22
- ngImport: i0,
23
- type: ComboboxPopup,
24
- deps: [],
25
- target: i0.ɵɵFactoryTarget.Directive
26
- });
27
- static ɵdir = i0.ɵɵngDeclareDirective({
28
- minVersion: "14.0.0",
29
- version: "22.0.0-next.9",
30
- type: ComboboxPopup,
31
- isStandalone: true,
32
- selector: "[ngComboboxPopup]",
33
- exportAs: ["ngComboboxPopup"],
34
- ngImport: i0
35
- });
36
- }
37
- i0.ɵɵngDeclareClassMetadata({
38
- minVersion: "12.0.0",
39
- version: "22.0.0-next.9",
40
- ngImport: i0,
41
- type: ComboboxPopup,
42
- decorators: [{
43
- type: Directive,
44
- args: [{
45
- selector: '[ngComboboxPopup]',
46
- exportAs: 'ngComboboxPopup'
47
- }]
48
- }]
49
- });
50
-
51
- class Combobox {
52
- textDirection = inject(Directionality).valueSignal.asReadonly();
7
+ class Combobox extends DeferredContentAware {
8
+ _renderer = inject(Renderer2);
53
9
  _elementRef = inject(ElementRef);
54
10
  element = this._elementRef.nativeElement;
55
- _deferredContentAware = inject(DeferredContentAware, {
56
- optional: true
57
- });
58
- popup = contentChild(ComboboxPopup, ...(ngDevMode ? [{
59
- debugName: "popup"
60
- }] : []));
61
- filterMode = input('manual', ...(ngDevMode ? [{
62
- debugName: "filterMode"
11
+ _popup = signal(undefined, ...(ngDevMode ? [{
12
+ debugName: "_popup"
63
13
  }] : []));
64
14
  disabled = input(false, {
65
15
  ...(ngDevMode ? {
@@ -67,144 +17,167 @@ class Combobox {
67
17
  } : {}),
68
18
  transform: booleanAttribute
69
19
  });
70
- readonly = input(false, {
20
+ softDisabled = input(true, {
71
21
  ...(ngDevMode ? {
72
- debugName: "readonly"
22
+ debugName: "softDisabled"
73
23
  } : {}),
74
24
  transform: booleanAttribute
75
25
  });
76
- firstMatch = input(undefined, ...(ngDevMode ? [{
77
- debugName: "firstMatch"
78
- }] : []));
79
- expanded = computed(() => this.alwaysExpanded() || this._pattern.expanded(), ...(ngDevMode ? [{
80
- debugName: "expanded"
81
- }] : []));
82
26
  alwaysExpanded = input(false, {
83
27
  ...(ngDevMode ? {
84
28
  debugName: "alwaysExpanded"
85
29
  } : {}),
86
30
  transform: booleanAttribute
87
31
  });
88
- inputElement = computed(() => this._pattern.inputs.inputEl(), ...(ngDevMode ? [{
89
- debugName: "inputElement"
32
+ tabIndex = input(undefined, {
33
+ ...(ngDevMode ? {
34
+ debugName: "tabIndex"
35
+ } : {}),
36
+ alias: 'tabindex',
37
+ transform: tabIndexTransform
38
+ });
39
+ expanded = model(false, ...(ngDevMode ? [{
40
+ debugName: "expanded"
41
+ }] : []));
42
+ value = model('', ...(ngDevMode ? [{
43
+ debugName: "value"
44
+ }] : []));
45
+ inlineSuggestion = input(undefined, ...(ngDevMode ? [{
46
+ debugName: "inlineSuggestion"
90
47
  }] : []));
91
48
  _pattern = new ComboboxPattern({
92
49
  ...this,
93
- textDirection: this.textDirection,
94
- disabled: this.disabled,
95
- readonly: this.readonly,
96
- inputValue: signal(''),
97
- inputEl: signal(undefined),
98
- containerEl: () => this._elementRef.nativeElement,
99
- popupControls: () => this.popup()?._controls()
50
+ element: () => this.element,
51
+ expandable: () => true,
52
+ popup: computed(() => this._popup()?._pattern)
100
53
  });
101
54
  constructor() {
55
+ super();
56
+ afterRenderEffect(() => this._pattern.keyboardEventRelayEffect());
57
+ afterRenderEffect(() => this._pattern.closePopupOnBlurEffect());
102
58
  afterRenderEffect(() => {
103
- if (this.alwaysExpanded()) {
104
- this._pattern.expanded.set(true);
105
- }
106
- });
107
- afterRenderEffect({
108
- write: () => {
109
- if (!this._deferredContentAware?.contentVisible() && (this._pattern.isFocused() || this.alwaysExpanded())) {
110
- this._deferredContentAware?.contentVisible.set(true);
111
- }
112
- }
59
+ this.contentVisible.set(this._pattern.isExpanded());
113
60
  });
61
+ if (this._pattern.isEditable()) {
62
+ afterRenderEffect(() => {
63
+ this._renderer.setProperty(this.element, 'value', this.value());
64
+ });
65
+ afterRenderEffect(() => {
66
+ this._pattern.highlightEffect();
67
+ });
68
+ }
114
69
  }
115
- open() {
116
- this._pattern.open({
117
- selected: true
118
- });
70
+ ngOnInit() {
71
+ if (this.alwaysExpanded()) {
72
+ this.expanded.set(true);
73
+ }
119
74
  }
120
- close() {
121
- this._pattern.close();
75
+ _registerPopup(popup) {
76
+ this._popup.set(popup);
77
+ }
78
+ _unregisterPopup() {
79
+ this._popup.set(undefined);
122
80
  }
123
81
  static ɵfac = i0.ɵɵngDeclareFactory({
124
82
  minVersion: "12.0.0",
125
- version: "22.0.0-next.9",
83
+ version: "22.0.0-next.10",
126
84
  ngImport: i0,
127
85
  type: Combobox,
128
86
  deps: [],
129
87
  target: i0.ɵɵFactoryTarget.Directive
130
88
  });
131
89
  static ɵdir = i0.ɵɵngDeclareDirective({
132
- minVersion: "17.2.0",
133
- version: "22.0.0-next.9",
90
+ minVersion: "17.1.0",
91
+ version: "22.0.0-next.10",
134
92
  type: Combobox,
135
93
  isStandalone: true,
136
94
  selector: "[ngCombobox]",
137
95
  inputs: {
138
- filterMode: {
139
- classPropertyName: "filterMode",
140
- publicName: "filterMode",
96
+ disabled: {
97
+ classPropertyName: "disabled",
98
+ publicName: "disabled",
141
99
  isSignal: true,
142
100
  isRequired: false,
143
101
  transformFunction: null
144
102
  },
145
- disabled: {
146
- classPropertyName: "disabled",
147
- publicName: "disabled",
103
+ softDisabled: {
104
+ classPropertyName: "softDisabled",
105
+ publicName: "softDisabled",
148
106
  isSignal: true,
149
107
  isRequired: false,
150
108
  transformFunction: null
151
109
  },
152
- readonly: {
153
- classPropertyName: "readonly",
154
- publicName: "readonly",
110
+ alwaysExpanded: {
111
+ classPropertyName: "alwaysExpanded",
112
+ publicName: "alwaysExpanded",
155
113
  isSignal: true,
156
114
  isRequired: false,
157
115
  transformFunction: null
158
116
  },
159
- firstMatch: {
160
- classPropertyName: "firstMatch",
161
- publicName: "firstMatch",
117
+ tabIndex: {
118
+ classPropertyName: "tabIndex",
119
+ publicName: "tabindex",
162
120
  isSignal: true,
163
121
  isRequired: false,
164
122
  transformFunction: null
165
123
  },
166
- alwaysExpanded: {
167
- classPropertyName: "alwaysExpanded",
168
- publicName: "alwaysExpanded",
124
+ expanded: {
125
+ classPropertyName: "expanded",
126
+ publicName: "expanded",
127
+ isSignal: true,
128
+ isRequired: false,
129
+ transformFunction: null
130
+ },
131
+ value: {
132
+ classPropertyName: "value",
133
+ publicName: "value",
134
+ isSignal: true,
135
+ isRequired: false,
136
+ transformFunction: null
137
+ },
138
+ inlineSuggestion: {
139
+ classPropertyName: "inlineSuggestion",
140
+ publicName: "inlineSuggestion",
169
141
  isSignal: true,
170
142
  isRequired: false,
171
143
  transformFunction: null
172
144
  }
173
145
  },
146
+ outputs: {
147
+ expanded: "expandedChange",
148
+ value: "valueChange"
149
+ },
174
150
  host: {
151
+ attributes: {
152
+ "role": "combobox"
153
+ },
175
154
  listeners: {
176
- "input": "_pattern.onInput($event)",
177
155
  "keydown": "_pattern.onKeydown($event)",
156
+ "focusin": "_pattern.onFocusin()",
157
+ "focusout": "_pattern.onFocusout($event)",
178
158
  "click": "_pattern.onClick($event)",
179
- "focusin": "_pattern.onFocusIn()",
180
- "focusout": "_pattern.onFocusOut($event)"
159
+ "input": "_pattern.onInput($event)"
181
160
  },
182
161
  properties: {
183
- "attr.data-expanded": "expanded()"
162
+ "attr.aria-autocomplete": "_pattern.autocomplete()",
163
+ "attr.aria-disabled": "_pattern.disabled()",
164
+ "attr.aria-expanded": "_pattern.isExpanded()",
165
+ "attr.aria-activedescendant": "_pattern.activeDescendant()",
166
+ "attr.aria-controls": "_pattern.popupId()",
167
+ "attr.aria-haspopup": "_pattern.popupType()",
168
+ "attr.tabindex": "disabled() && !softDisabled() ? -1 : (tabIndex() !== undefined ? tabIndex() : 0)",
169
+ "attr.disabled": "disabled() && !softDisabled() ? \"\" : null",
170
+ "attr.readonly": "disabled() && _pattern.isEditable() ? \"\" : null"
184
171
  }
185
172
  },
186
- providers: [{
187
- provide: COMBOBOX,
188
- useExisting: Combobox
189
- }],
190
- queries: [{
191
- propertyName: "popup",
192
- first: true,
193
- predicate: ComboboxPopup,
194
- descendants: true,
195
- isSignal: true
196
- }],
197
173
  exportAs: ["ngCombobox"],
198
- hostDirectives: [{
199
- directive: DeferredContentAware,
200
- inputs: ["preserveContent", "preserveContent"]
201
- }],
174
+ usesInheritance: true,
202
175
  ngImport: i0
203
176
  });
204
177
  }
205
178
  i0.ɵɵngDeclareClassMetadata({
206
179
  minVersion: "12.0.0",
207
- version: "22.0.0-next.9",
180
+ version: "22.0.0-next.10",
208
181
  ngImport: i0,
209
182
  type: Combobox,
210
183
  decorators: [{
@@ -212,315 +185,308 @@ i0.ɵɵngDeclareClassMetadata({
212
185
  args: [{
213
186
  selector: '[ngCombobox]',
214
187
  exportAs: 'ngCombobox',
215
- hostDirectives: [{
216
- directive: DeferredContentAware,
217
- inputs: ['preserveContent']
218
- }],
219
188
  host: {
220
- '[attr.data-expanded]': 'expanded()',
221
- '(input)': '_pattern.onInput($event)',
189
+ 'role': 'combobox',
190
+ '[attr.aria-autocomplete]': '_pattern.autocomplete()',
191
+ '[attr.aria-disabled]': '_pattern.disabled()',
192
+ '[attr.aria-expanded]': '_pattern.isExpanded()',
193
+ '[attr.aria-activedescendant]': '_pattern.activeDescendant()',
194
+ '[attr.aria-controls]': '_pattern.popupId()',
195
+ '[attr.aria-haspopup]': '_pattern.popupType()',
196
+ '[attr.tabindex]': 'disabled() && !softDisabled() ? -1 : (tabIndex() !== undefined ? tabIndex() : 0)',
197
+ '[attr.disabled]': 'disabled() && !softDisabled() ? "" : null',
198
+ '[attr.readonly]': 'disabled() && _pattern.isEditable() ? "" : null',
222
199
  '(keydown)': '_pattern.onKeydown($event)',
200
+ '(focusin)': '_pattern.onFocusin()',
201
+ '(focusout)': '_pattern.onFocusout($event)',
223
202
  '(click)': '_pattern.onClick($event)',
224
- '(focusin)': '_pattern.onFocusIn()',
225
- '(focusout)': '_pattern.onFocusOut($event)'
226
- },
227
- providers: [{
228
- provide: COMBOBOX,
229
- useExisting: Combobox
230
- }]
203
+ '(input)': '_pattern.onInput($event)'
204
+ }
231
205
  }]
232
206
  }],
233
207
  ctorParameters: () => [],
234
208
  propDecorators: {
235
- popup: [{
236
- type: i0.ContentChild,
237
- args: [i0.forwardRef(() => ComboboxPopup), {
238
- isSignal: true
209
+ disabled: [{
210
+ type: i0.Input,
211
+ args: [{
212
+ isSignal: true,
213
+ alias: "disabled",
214
+ required: false
239
215
  }]
240
216
  }],
241
- filterMode: [{
217
+ softDisabled: [{
242
218
  type: i0.Input,
243
219
  args: [{
244
220
  isSignal: true,
245
- alias: "filterMode",
221
+ alias: "softDisabled",
246
222
  required: false
247
223
  }]
248
224
  }],
249
- disabled: [{
225
+ alwaysExpanded: [{
250
226
  type: i0.Input,
251
227
  args: [{
252
228
  isSignal: true,
253
- alias: "disabled",
229
+ alias: "alwaysExpanded",
254
230
  required: false
255
231
  }]
256
232
  }],
257
- readonly: [{
233
+ tabIndex: [{
258
234
  type: i0.Input,
259
235
  args: [{
260
236
  isSignal: true,
261
- alias: "readonly",
237
+ alias: "tabindex",
262
238
  required: false
263
239
  }]
264
240
  }],
265
- firstMatch: [{
241
+ expanded: [{
266
242
  type: i0.Input,
267
243
  args: [{
268
244
  isSignal: true,
269
- alias: "firstMatch",
245
+ alias: "expanded",
270
246
  required: false
271
247
  }]
248
+ }, {
249
+ type: i0.Output,
250
+ args: ["expandedChange"]
272
251
  }],
273
- alwaysExpanded: [{
252
+ value: [{
274
253
  type: i0.Input,
275
254
  args: [{
276
255
  isSignal: true,
277
- alias: "alwaysExpanded",
256
+ alias: "value",
257
+ required: false
258
+ }]
259
+ }, {
260
+ type: i0.Output,
261
+ args: ["valueChange"]
262
+ }],
263
+ inlineSuggestion: [{
264
+ type: i0.Input,
265
+ args: [{
266
+ isSignal: true,
267
+ alias: "inlineSuggestion",
278
268
  required: false
279
269
  }]
280
270
  }]
281
271
  }
282
272
  });
283
273
 
284
- class ComboboxDialog {
285
- _elementRef = inject(ElementRef);
286
- element = this._elementRef.nativeElement;
287
- combobox = inject(Combobox);
288
- id = input(inject(_IdGenerator).getId('ng-combobox-dialog-', true), ...(ngDevMode ? [{
289
- debugName: "id"
274
+ const COMBOBOX_POPUP = new InjectionToken('COMBOBOX_POPUP');
275
+
276
+ class ComboboxPopup {
277
+ _deferredContent = inject(DeferredContent);
278
+ combobox = input.required(...(ngDevMode ? [{
279
+ debugName: "combobox"
290
280
  }] : []));
291
- _popup = inject(ComboboxPopup, {
292
- optional: true
293
- });
294
- _pattern = new ComboboxDialogPattern({
295
- id: this.id,
296
- element: () => this.element,
297
- combobox: this.combobox._pattern
281
+ _widget = signal(undefined, ...(ngDevMode ? [{
282
+ debugName: "_widget"
283
+ }] : []));
284
+ controlTarget = computed(() => this._widget()?.element, ...(ngDevMode ? [{
285
+ debugName: "controlTarget"
286
+ }] : []));
287
+ popupId = computed(() => this._widget()?.popupId(), ...(ngDevMode ? [{
288
+ debugName: "popupId"
289
+ }] : []));
290
+ activeDescendant = computed(() => this._widget()?.activeDescendant(), ...(ngDevMode ? [{
291
+ debugName: "activeDescendant"
292
+ }] : []));
293
+ popupType = input('listbox', ...(ngDevMode ? [{
294
+ debugName: "popupType"
295
+ }] : []));
296
+ _pattern = new ComboboxPopupPattern({
297
+ ...this
298
298
  });
299
- constructor() {
300
- if (this._popup) {
301
- this._popup._controls.set(this._pattern);
302
- }
303
- afterRenderEffect({
304
- write: () => {
305
- this.combobox._pattern.expanded() ? this.element.showModal() : this.element.close();
306
- }
307
- });
299
+ ngOnInit() {
300
+ this.combobox()._registerPopup(this);
301
+ this._deferredContent.deferredContentAware.set(this.combobox());
308
302
  }
309
- close() {
310
- this._popup?.combobox?._pattern.close();
303
+ ngOnDestroy() {
304
+ this.combobox()._unregisterPopup();
305
+ }
306
+ _registerWidget(widget) {
307
+ this._widget.set(widget);
308
+ }
309
+ _unregisterWidget() {
310
+ this._widget.set(undefined);
311
311
  }
312
312
  static ɵfac = i0.ɵɵngDeclareFactory({
313
313
  minVersion: "12.0.0",
314
- version: "22.0.0-next.9",
314
+ version: "22.0.0-next.10",
315
315
  ngImport: i0,
316
- type: ComboboxDialog,
316
+ type: ComboboxPopup,
317
317
  deps: [],
318
318
  target: i0.ɵɵFactoryTarget.Directive
319
319
  });
320
320
  static ɵdir = i0.ɵɵngDeclareDirective({
321
321
  minVersion: "17.1.0",
322
- version: "22.0.0-next.9",
323
- type: ComboboxDialog,
322
+ version: "22.0.0-next.10",
323
+ type: ComboboxPopup,
324
324
  isStandalone: true,
325
- selector: "dialog[ngComboboxDialog]",
325
+ selector: "ng-template[ngComboboxPopup]",
326
326
  inputs: {
327
- id: {
328
- classPropertyName: "id",
329
- publicName: "id",
327
+ combobox: {
328
+ classPropertyName: "combobox",
329
+ publicName: "combobox",
330
330
  isSignal: true,
331
- isRequired: false,
331
+ isRequired: true,
332
332
  transformFunction: null
333
- }
334
- },
335
- host: {
336
- listeners: {
337
- "keydown": "_pattern.onKeydown($event)",
338
- "click": "_pattern.onClick($event)"
339
333
  },
340
- properties: {
341
- "attr.data-open": "combobox._pattern.expanded()"
334
+ popupType: {
335
+ classPropertyName: "popupType",
336
+ publicName: "popupType",
337
+ isSignal: true,
338
+ isRequired: false,
339
+ transformFunction: null
342
340
  }
343
341
  },
344
- exportAs: ["ngComboboxDialog"],
342
+ providers: [{
343
+ provide: COMBOBOX_POPUP,
344
+ useExisting: ComboboxPopup
345
+ }],
346
+ exportAs: ["ngComboboxPopup"],
345
347
  hostDirectives: [{
346
- directive: ComboboxPopup
348
+ directive: i1.DeferredContent
347
349
  }],
348
350
  ngImport: i0
349
351
  });
350
352
  }
351
353
  i0.ɵɵngDeclareClassMetadata({
352
354
  minVersion: "12.0.0",
353
- version: "22.0.0-next.9",
355
+ version: "22.0.0-next.10",
354
356
  ngImport: i0,
355
- type: ComboboxDialog,
357
+ type: ComboboxPopup,
356
358
  decorators: [{
357
359
  type: Directive,
358
360
  args: [{
359
- selector: 'dialog[ngComboboxDialog]',
360
- exportAs: 'ngComboboxDialog',
361
- host: {
362
- '[attr.data-open]': 'combobox._pattern.expanded()',
363
- '(keydown)': '_pattern.onKeydown($event)',
364
- '(click)': '_pattern.onClick($event)'
365
- },
366
- hostDirectives: [ComboboxPopup]
361
+ selector: 'ng-template[ngComboboxPopup]',
362
+ exportAs: 'ngComboboxPopup',
363
+ hostDirectives: [DeferredContent],
364
+ providers: [{
365
+ provide: COMBOBOX_POPUP,
366
+ useExisting: ComboboxPopup
367
+ }]
367
368
  }]
368
369
  }],
369
- ctorParameters: () => [],
370
370
  propDecorators: {
371
- id: [{
371
+ combobox: [{
372
+ type: i0.Input,
373
+ args: [{
374
+ isSignal: true,
375
+ alias: "combobox",
376
+ required: true
377
+ }]
378
+ }],
379
+ popupType: [{
372
380
  type: i0.Input,
373
381
  args: [{
374
382
  isSignal: true,
375
- alias: "id",
383
+ alias: "popupType",
376
384
  required: false
377
385
  }]
378
386
  }]
379
387
  }
380
388
  });
381
389
 
382
- class ComboboxInput {
390
+ class ComboboxWidget {
383
391
  _elementRef = inject(ElementRef);
392
+ _popup = inject(COMBOBOX_POPUP);
384
393
  element = this._elementRef.nativeElement;
385
- combobox = inject(Combobox);
386
- value = model('', ...(ngDevMode ? [{
387
- debugName: "value"
394
+ popupId = signal(undefined, ...(ngDevMode ? [{
395
+ debugName: "popupId"
396
+ }] : []));
397
+ activeDescendant = input(undefined, ...(ngDevMode ? [{
398
+ debugName: "activeDescendant"
388
399
  }] : []));
400
+ _observer;
389
401
  constructor() {
390
- this.combobox._pattern.inputs.inputEl.set(this._elementRef.nativeElement);
391
- this.combobox._pattern.inputs.inputValue = this.value;
392
- const controls = this.combobox.popup()?._controls();
393
- if (controls instanceof ComboboxDialogPattern) {
394
- return;
395
- }
396
- afterRenderEffect({
397
- write: () => {
398
- this.value();
399
- controls?.items();
400
- untracked(() => this.combobox._pattern.onFilter());
402
+ const el = this.element;
403
+ this._observer = new MutationObserver(mutations => {
404
+ for (const mutation of mutations) {
405
+ if (mutation.attributeName === 'id') {
406
+ this.popupId.set(el.id);
407
+ }
401
408
  }
402
409
  });
410
+ this._observer.observe(el, {
411
+ attributes: true,
412
+ attributeFilter: ['id']
413
+ });
414
+ }
415
+ ngOnInit() {
416
+ this.popupId.set(this.element.id);
417
+ this._popup._registerWidget(this);
418
+ }
419
+ ngOnDestroy() {
420
+ this._observer?.disconnect();
421
+ this._popup._unregisterWidget();
422
+ }
423
+ onFocusin() {
424
+ this._popup._pattern.onFocusin();
425
+ }
426
+ onFocusout(event) {
427
+ this._popup._pattern.onFocusout(event);
403
428
  }
404
429
  static ɵfac = i0.ɵɵngDeclareFactory({
405
430
  minVersion: "12.0.0",
406
- version: "22.0.0-next.9",
431
+ version: "22.0.0-next.10",
407
432
  ngImport: i0,
408
- type: ComboboxInput,
433
+ type: ComboboxWidget,
409
434
  deps: [],
410
435
  target: i0.ɵɵFactoryTarget.Directive
411
436
  });
412
437
  static ɵdir = i0.ɵɵngDeclareDirective({
413
438
  minVersion: "17.1.0",
414
- version: "22.0.0-next.9",
415
- type: ComboboxInput,
439
+ version: "22.0.0-next.10",
440
+ type: ComboboxWidget,
416
441
  isStandalone: true,
417
- selector: "input[ngComboboxInput]",
442
+ selector: "[ngComboboxWidget]",
418
443
  inputs: {
419
- value: {
420
- classPropertyName: "value",
421
- publicName: "value",
444
+ activeDescendant: {
445
+ classPropertyName: "activeDescendant",
446
+ publicName: "activeDescendant",
422
447
  isSignal: true,
423
448
  isRequired: false,
424
449
  transformFunction: null
425
450
  }
426
451
  },
427
- outputs: {
428
- value: "valueChange"
429
- },
430
452
  host: {
431
- attributes: {
432
- "role": "combobox"
433
- },
434
- properties: {
435
- "value": "value()",
436
- "attr.aria-disabled": "combobox._pattern.disabled()",
437
- "attr.aria-expanded": "combobox._pattern.expanded()",
438
- "attr.aria-activedescendant": "combobox._pattern.activeDescendant()",
439
- "attr.aria-controls": "combobox._pattern.popupId()",
440
- "attr.aria-haspopup": "combobox._pattern.hasPopup()",
441
- "attr.aria-autocomplete": "combobox._pattern.autocomplete()",
442
- "attr.readonly": "combobox._pattern.readonly()"
453
+ listeners: {
454
+ "focusin": "onFocusin()",
455
+ "focusout": "onFocusout($event)"
443
456
  }
444
457
  },
445
- exportAs: ["ngComboboxInput"],
458
+ exportAs: ["ngComboboxWidget"],
446
459
  ngImport: i0
447
460
  });
448
461
  }
449
462
  i0.ɵɵngDeclareClassMetadata({
450
463
  minVersion: "12.0.0",
451
- version: "22.0.0-next.9",
464
+ version: "22.0.0-next.10",
452
465
  ngImport: i0,
453
- type: ComboboxInput,
466
+ type: ComboboxWidget,
454
467
  decorators: [{
455
468
  type: Directive,
456
469
  args: [{
457
- selector: 'input[ngComboboxInput]',
458
- exportAs: 'ngComboboxInput',
470
+ selector: '[ngComboboxWidget]',
471
+ exportAs: 'ngComboboxWidget',
459
472
  host: {
460
- 'role': 'combobox',
461
- '[value]': 'value()',
462
- '[attr.aria-disabled]': 'combobox._pattern.disabled()',
463
- '[attr.aria-expanded]': 'combobox._pattern.expanded()',
464
- '[attr.aria-activedescendant]': 'combobox._pattern.activeDescendant()',
465
- '[attr.aria-controls]': 'combobox._pattern.popupId()',
466
- '[attr.aria-haspopup]': 'combobox._pattern.hasPopup()',
467
- '[attr.aria-autocomplete]': 'combobox._pattern.autocomplete()',
468
- '[attr.readonly]': 'combobox._pattern.readonly()'
473
+ '(focusin)': 'onFocusin()',
474
+ '(focusout)': 'onFocusout($event)'
469
475
  }
470
476
  }]
471
477
  }],
472
478
  ctorParameters: () => [],
473
479
  propDecorators: {
474
- value: [{
480
+ activeDescendant: [{
475
481
  type: i0.Input,
476
482
  args: [{
477
483
  isSignal: true,
478
- alias: "value",
484
+ alias: "activeDescendant",
479
485
  required: false
480
486
  }]
481
- }, {
482
- type: i0.Output,
483
- args: ["valueChange"]
484
487
  }]
485
488
  }
486
489
  });
487
490
 
488
- class ComboboxPopupContainer {
489
- static ɵfac = i0.ɵɵngDeclareFactory({
490
- minVersion: "12.0.0",
491
- version: "22.0.0-next.9",
492
- ngImport: i0,
493
- type: ComboboxPopupContainer,
494
- deps: [],
495
- target: i0.ɵɵFactoryTarget.Directive
496
- });
497
- static ɵdir = i0.ɵɵngDeclareDirective({
498
- minVersion: "14.0.0",
499
- version: "22.0.0-next.9",
500
- type: ComboboxPopupContainer,
501
- isStandalone: true,
502
- selector: "ng-template[ngComboboxPopupContainer]",
503
- exportAs: ["ngComboboxPopupContainer"],
504
- hostDirectives: [{
505
- directive: DeferredContent
506
- }],
507
- ngImport: i0
508
- });
509
- }
510
- i0.ɵɵngDeclareClassMetadata({
511
- minVersion: "12.0.0",
512
- version: "22.0.0-next.9",
513
- ngImport: i0,
514
- type: ComboboxPopupContainer,
515
- decorators: [{
516
- type: Directive,
517
- args: [{
518
- selector: 'ng-template[ngComboboxPopupContainer]',
519
- exportAs: 'ngComboboxPopupContainer',
520
- hostDirectives: [DeferredContent]
521
- }]
522
- }]
523
- });
524
-
525
- export { Combobox, ComboboxDialog, ComboboxInput, ComboboxPopup, ComboboxPopupContainer, DeferredContent as ɵɵDeferredContent, DeferredContentAware as ɵɵDeferredContentAware };
491
+ export { Combobox, ComboboxPopup, ComboboxWidget };
526
492
  //# sourceMappingURL=combobox.mjs.map