@angular/aria 21.0.0-next.9 → 21.0.0-rc.1

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 (49) hide show
  1. package/_adev_assets/aria-accordion.json +373 -0
  2. package/_adev_assets/aria-combobox.json +383 -0
  3. package/_adev_assets/aria-grid.json +647 -0
  4. package/_adev_assets/aria-listbox.json +511 -0
  5. package/_adev_assets/aria-menu.json +852 -0
  6. package/_adev_assets/aria-tabs.json +987 -0
  7. package/_adev_assets/aria-toolbar.json +696 -0
  8. package/_adev_assets/aria-tree.json +1071 -0
  9. package/fesm2022/_widget-chunk.mjs +949 -0
  10. package/fesm2022/_widget-chunk.mjs.map +1 -0
  11. package/fesm2022/accordion.mjs +372 -174
  12. package/fesm2022/accordion.mjs.map +1 -1
  13. package/fesm2022/aria.mjs +1 -2
  14. package/fesm2022/aria.mjs.map +1 -1
  15. package/fesm2022/combobox.mjs +308 -116
  16. package/fesm2022/combobox.mjs.map +1 -1
  17. package/fesm2022/grid.mjs +566 -0
  18. package/fesm2022/grid.mjs.map +1 -0
  19. package/fesm2022/listbox.mjs +384 -184
  20. package/fesm2022/listbox.mjs.map +1 -1
  21. package/fesm2022/menu.mjs +591 -0
  22. package/fesm2022/menu.mjs.map +1 -0
  23. package/fesm2022/private.mjs +2338 -0
  24. package/fesm2022/private.mjs.map +1 -0
  25. package/fesm2022/tabs.mjs +484 -276
  26. package/fesm2022/tabs.mjs.map +1 -1
  27. package/fesm2022/toolbar.mjs +366 -200
  28. package/fesm2022/toolbar.mjs.map +1 -1
  29. package/fesm2022/tree.mjs +515 -267
  30. package/fesm2022/tree.mjs.map +1 -1
  31. package/package.json +12 -12
  32. package/types/_grid-chunk.d.ts +608 -0
  33. package/types/accordion.d.ts +8 -8
  34. package/types/combobox.d.ts +20 -7
  35. package/types/grid.d.ts +120 -0
  36. package/types/listbox.d.ts +9 -7
  37. package/types/menu.d.ts +170 -0
  38. package/types/{ui-patterns.d.ts → private.d.ts} +555 -433
  39. package/types/tabs.d.ts +8 -8
  40. package/types/toolbar.d.ts +31 -28
  41. package/types/tree.d.ts +11 -9
  42. package/fesm2022/deferred-content.mjs +0 -60
  43. package/fesm2022/deferred-content.mjs.map +0 -1
  44. package/fesm2022/radio-group.mjs +0 -197
  45. package/fesm2022/radio-group.mjs.map +0 -1
  46. package/fesm2022/ui-patterns.mjs +0 -2504
  47. package/fesm2022/ui-patterns.mjs.map +0 -1
  48. package/types/deferred-content.d.ts +0 -38
  49. package/types/radio-group.d.ts +0 -82
@@ -1,200 +1,400 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { inject, computed, ElementRef, contentChildren, input, booleanAttribute, model, signal, afterRenderEffect, untracked, Directive } from '@angular/core';
3
- import { ComboboxListboxPattern, ListboxPattern, OptionPattern } from '@angular/aria/ui-patterns';
3
+ import { ComboboxListboxPattern, ListboxPattern, OptionPattern } from '@angular/aria/private';
4
4
  import { Directionality } from '@angular/cdk/bidi';
5
5
  import { toSignal } from '@angular/core/rxjs-interop';
6
6
  import { _IdGenerator } from '@angular/cdk/a11y';
7
7
  import { ComboboxPopup } from './combobox.mjs';
8
- import '@angular/aria/deferred-content';
9
8
 
10
- /**
11
- * A listbox container.
12
- *
13
- * Listboxes are used to display a list of items for a user to select from. The Listbox is meant
14
- * to be used in conjunction with Option as follows:
15
- *
16
- * ```html
17
- * <ul ngListbox>
18
- * <li [value]="1" ngOption>Item 1</li>
19
- * <li [value]="2" ngOption>Item 2</li>
20
- * <li [value]="3" ngOption>Item 3</li>
21
- * </ul>
22
- * ```
23
- */
24
9
  class Listbox {
25
- /** A unique identifier for the listbox. */
26
- _generatedId = inject(_IdGenerator).getId('ng-listbox-');
27
- // TODO(wagnermaciel): https://github.com/angular/components/pull/30495#discussion_r1972601144.
28
- /** A unique identifier for the listbox. */
29
- id = computed(() => this._generatedId, ...(ngDevMode ? [{ debugName: "id" }] : []));
30
- /** A reference to the parent combobox popup, if one exists. */
31
- _popup = inject(ComboboxPopup, {
32
- optional: true,
10
+ _generatedId = inject(_IdGenerator).getId('ng-listbox-', true);
11
+ id = computed(() => this._generatedId, ...(ngDevMode ? [{
12
+ debugName: "id"
13
+ }] : []));
14
+ _popup = inject(ComboboxPopup, {
15
+ optional: true
16
+ });
17
+ _elementRef = inject(ElementRef);
18
+ _directionality = inject(Directionality);
19
+ _options = contentChildren(Option, ...(ngDevMode ? [{
20
+ debugName: "_options",
21
+ descendants: true
22
+ }] : [{
23
+ descendants: true
24
+ }]));
25
+ textDirection = toSignal(this._directionality.change, {
26
+ initialValue: this._directionality.value
27
+ });
28
+ items = computed(() => this._options().map(option => option._pattern), ...(ngDevMode ? [{
29
+ debugName: "items"
30
+ }] : []));
31
+ orientation = input('vertical', ...(ngDevMode ? [{
32
+ debugName: "orientation"
33
+ }] : []));
34
+ multi = input(false, ...(ngDevMode ? [{
35
+ debugName: "multi",
36
+ transform: booleanAttribute
37
+ }] : [{
38
+ transform: booleanAttribute
39
+ }]));
40
+ wrap = input(true, ...(ngDevMode ? [{
41
+ debugName: "wrap",
42
+ transform: booleanAttribute
43
+ }] : [{
44
+ transform: booleanAttribute
45
+ }]));
46
+ softDisabled = input(true, ...(ngDevMode ? [{
47
+ debugName: "softDisabled",
48
+ transform: booleanAttribute
49
+ }] : [{
50
+ transform: booleanAttribute
51
+ }]));
52
+ focusMode = input('roving', ...(ngDevMode ? [{
53
+ debugName: "focusMode"
54
+ }] : []));
55
+ selectionMode = input('follow', ...(ngDevMode ? [{
56
+ debugName: "selectionMode"
57
+ }] : []));
58
+ typeaheadDelay = input(0.5, ...(ngDevMode ? [{
59
+ debugName: "typeaheadDelay"
60
+ }] : []));
61
+ disabled = input(false, ...(ngDevMode ? [{
62
+ debugName: "disabled",
63
+ transform: booleanAttribute
64
+ }] : [{
65
+ transform: booleanAttribute
66
+ }]));
67
+ readonly = input(false, ...(ngDevMode ? [{
68
+ debugName: "readonly",
69
+ transform: booleanAttribute
70
+ }] : [{
71
+ transform: booleanAttribute
72
+ }]));
73
+ value = model([], ...(ngDevMode ? [{
74
+ debugName: "value"
75
+ }] : []));
76
+ _pattern;
77
+ _hasFocused = signal(false, ...(ngDevMode ? [{
78
+ debugName: "_hasFocused"
79
+ }] : []));
80
+ constructor() {
81
+ const inputs = {
82
+ ...this,
83
+ id: this.id,
84
+ items: this.items,
85
+ activeItem: signal(undefined),
86
+ textDirection: this.textDirection,
87
+ element: () => this._elementRef.nativeElement,
88
+ combobox: () => this._popup?.combobox?._pattern
89
+ };
90
+ this._pattern = this._popup?.combobox ? new ComboboxListboxPattern(inputs) : new ListboxPattern(inputs);
91
+ if (this._popup) {
92
+ this._popup.controls.set(this._pattern);
93
+ }
94
+ afterRenderEffect(() => {
95
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
96
+ const violations = this._pattern.validate();
97
+ for (const violation of violations) {
98
+ console.error(violation);
99
+ }
100
+ }
33
101
  });
34
- /** A reference to the listbox element. */
35
- _elementRef = inject(ElementRef);
36
- /** The directionality (LTR / RTL) context for the application (or a subtree of it). */
37
- _directionality = inject(Directionality);
38
- /** The Options nested inside of the Listbox. */
39
- _options = contentChildren(Option, ...(ngDevMode ? [{ debugName: "_options", descendants: true }] : [{ descendants: true }]));
40
- /** A signal wrapper for directionality. */
41
- textDirection = toSignal(this._directionality.change, {
42
- initialValue: this._directionality.value,
102
+ afterRenderEffect(() => {
103
+ if (!this._hasFocused()) {
104
+ this._pattern.setDefaultState();
105
+ }
43
106
  });
44
- /** The Option UIPatterns of the child Options. */
45
- items = computed(() => this._options().map(option => option.pattern), ...(ngDevMode ? [{ debugName: "items" }] : []));
46
- /** Whether the list is vertically or horizontally oriented. */
47
- orientation = input('vertical', ...(ngDevMode ? [{ debugName: "orientation" }] : []));
48
- /** Whether multiple items in the list can be selected at once. */
49
- multi = input(false, ...(ngDevMode ? [{ debugName: "multi", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
50
- /** Whether focus should wrap when navigating. */
51
- wrap = input(true, ...(ngDevMode ? [{ debugName: "wrap", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
52
- /** Whether disabled items in the list should be skipped when navigating. */
53
- skipDisabled = input(true, ...(ngDevMode ? [{ debugName: "skipDisabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
54
- /** The focus strategy used by the list. */
55
- focusMode = input('roving', ...(ngDevMode ? [{ debugName: "focusMode" }] : []));
56
- /** The selection strategy used by the list. */
57
- selectionMode = input('follow', ...(ngDevMode ? [{ debugName: "selectionMode" }] : []));
58
- /** The amount of time before the typeahead search is reset. */
59
- typeaheadDelay = input(0.5, ...(ngDevMode ? [{ debugName: "typeaheadDelay" }] : [])); // Picked arbitrarily.
60
- /** Whether the listbox is disabled. */
61
- disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
62
- /** Whether the listbox is readonly. */
63
- readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
64
- /** The values of the current selected items. */
65
- value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
66
- /** The Listbox UIPattern. */
67
- pattern;
68
- /** Whether the listbox has received focus yet. */
69
- _hasFocused = signal(false, ...(ngDevMode ? [{ debugName: "_hasFocused" }] : []));
70
- constructor() {
71
- const inputs = {
72
- ...this,
73
- id: this.id,
74
- items: this.items,
75
- activeItem: signal(undefined),
76
- textDirection: this.textDirection,
77
- element: () => this._elementRef.nativeElement,
78
- combobox: () => this._popup?.combobox?.pattern,
79
- };
80
- this.pattern = this._popup?.combobox
81
- ? new ComboboxListboxPattern(inputs)
82
- : new ListboxPattern(inputs);
83
- if (this._popup) {
84
- this._popup.controls.set(this.pattern);
85
- }
86
- afterRenderEffect(() => {
87
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
88
- const violations = this.pattern.validate();
89
- for (const violation of violations) {
90
- console.error(violation);
91
- }
92
- }
93
- });
94
- afterRenderEffect(() => {
95
- if (!this._hasFocused()) {
96
- this.pattern.setDefaultState();
97
- }
98
- });
99
- // Ensure that if the active item is removed from
100
- // the list, the listbox updates it's focus state.
101
- afterRenderEffect(() => {
102
- const items = inputs.items();
103
- const activeItem = untracked(() => inputs.activeItem());
104
- if (!items.some(i => i === activeItem) && activeItem) {
105
- this.pattern.listBehavior.unfocus();
106
- }
107
- });
108
- // Ensure that the value is always in sync with the available options.
109
- afterRenderEffect(() => {
110
- const items = inputs.items();
111
- const value = untracked(() => this.value());
112
- if (items && value.some(v => !items.some(i => i.value() === v))) {
113
- this.value.set(value.filter(v => items.some(i => i.value() === v)));
114
- }
115
- });
116
- }
117
- onFocus() {
118
- this._hasFocused.set(true);
119
- }
120
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Listbox, deps: [], target: i0.ɵɵFactoryTarget.Directive });
121
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.2.0-next.2", type: Listbox, isStandalone: true, selector: "[ngListbox]", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, multi: { classPropertyName: "multi", publicName: "multi", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null }, skipDisabled: { classPropertyName: "skipDisabled", publicName: "skipDisabled", isSignal: true, isRequired: false, transformFunction: null }, focusMode: { classPropertyName: "focusMode", publicName: "focusMode", isSignal: true, isRequired: false, transformFunction: null }, selectionMode: { classPropertyName: "selectionMode", publicName: "selectionMode", isSignal: true, isRequired: false, transformFunction: null }, typeaheadDelay: { classPropertyName: "typeaheadDelay", publicName: "typeaheadDelay", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "listbox" }, listeners: { "keydown": "pattern.onKeydown($event)", "pointerdown": "pattern.onPointerdown($event)", "focusin": "onFocus()" }, properties: { "attr.id": "id()", "attr.tabindex": "pattern.tabindex()", "attr.aria-readonly": "pattern.readonly()", "attr.aria-disabled": "pattern.disabled()", "attr.aria-orientation": "pattern.orientation()", "attr.aria-multiselectable": "pattern.multi()", "attr.aria-activedescendant": "pattern.activedescendant()" }, classAttribute: "ng-listbox" }, queries: [{ propertyName: "_options", predicate: Option, descendants: true, isSignal: true }], exportAs: ["ngListbox"], hostDirectives: [{ directive: ComboboxPopup }], ngImport: i0 });
107
+ afterRenderEffect(() => {
108
+ const items = inputs.items();
109
+ const activeItem = untracked(() => inputs.activeItem());
110
+ if (!items.some(i => i === activeItem) && activeItem) {
111
+ this._pattern.listBehavior.unfocus();
112
+ }
113
+ });
114
+ afterRenderEffect(() => {
115
+ const items = inputs.items();
116
+ const value = untracked(() => this.value());
117
+ if (items && value.some(v => !items.some(i => i.value() === v))) {
118
+ this.value.set(value.filter(v => items.some(i => i.value() === v)));
119
+ }
120
+ });
121
+ }
122
+ onFocus() {
123
+ this._hasFocused.set(true);
124
+ }
125
+ scrollActiveItemIntoView(options = {
126
+ block: 'nearest'
127
+ }) {
128
+ this._pattern.inputs.activeItem()?.element()?.scrollIntoView(options);
129
+ }
130
+ static ɵfac = i0.ɵɵngDeclareFactory({
131
+ minVersion: "12.0.0",
132
+ version: "20.2.0-next.2",
133
+ ngImport: i0,
134
+ type: Listbox,
135
+ deps: [],
136
+ target: i0.ɵɵFactoryTarget.Directive
137
+ });
138
+ static ɵdir = i0.ɵɵngDeclareDirective({
139
+ minVersion: "17.2.0",
140
+ version: "20.2.0-next.2",
141
+ type: Listbox,
142
+ isStandalone: true,
143
+ selector: "[ngListbox]",
144
+ inputs: {
145
+ orientation: {
146
+ classPropertyName: "orientation",
147
+ publicName: "orientation",
148
+ isSignal: true,
149
+ isRequired: false,
150
+ transformFunction: null
151
+ },
152
+ multi: {
153
+ classPropertyName: "multi",
154
+ publicName: "multi",
155
+ isSignal: true,
156
+ isRequired: false,
157
+ transformFunction: null
158
+ },
159
+ wrap: {
160
+ classPropertyName: "wrap",
161
+ publicName: "wrap",
162
+ isSignal: true,
163
+ isRequired: false,
164
+ transformFunction: null
165
+ },
166
+ softDisabled: {
167
+ classPropertyName: "softDisabled",
168
+ publicName: "softDisabled",
169
+ isSignal: true,
170
+ isRequired: false,
171
+ transformFunction: null
172
+ },
173
+ focusMode: {
174
+ classPropertyName: "focusMode",
175
+ publicName: "focusMode",
176
+ isSignal: true,
177
+ isRequired: false,
178
+ transformFunction: null
179
+ },
180
+ selectionMode: {
181
+ classPropertyName: "selectionMode",
182
+ publicName: "selectionMode",
183
+ isSignal: true,
184
+ isRequired: false,
185
+ transformFunction: null
186
+ },
187
+ typeaheadDelay: {
188
+ classPropertyName: "typeaheadDelay",
189
+ publicName: "typeaheadDelay",
190
+ isSignal: true,
191
+ isRequired: false,
192
+ transformFunction: null
193
+ },
194
+ disabled: {
195
+ classPropertyName: "disabled",
196
+ publicName: "disabled",
197
+ isSignal: true,
198
+ isRequired: false,
199
+ transformFunction: null
200
+ },
201
+ readonly: {
202
+ classPropertyName: "readonly",
203
+ publicName: "readonly",
204
+ isSignal: true,
205
+ isRequired: false,
206
+ transformFunction: null
207
+ },
208
+ value: {
209
+ classPropertyName: "value",
210
+ publicName: "value",
211
+ isSignal: true,
212
+ isRequired: false,
213
+ transformFunction: null
214
+ }
215
+ },
216
+ outputs: {
217
+ value: "valueChange"
218
+ },
219
+ host: {
220
+ attributes: {
221
+ "role": "listbox"
222
+ },
223
+ listeners: {
224
+ "keydown": "_pattern.onKeydown($event)",
225
+ "pointerdown": "_pattern.onPointerdown($event)",
226
+ "focusin": "onFocus()"
227
+ },
228
+ properties: {
229
+ "attr.id": "id()",
230
+ "attr.tabindex": "_pattern.tabIndex()",
231
+ "attr.aria-readonly": "_pattern.readonly()",
232
+ "attr.aria-disabled": "_pattern.disabled()",
233
+ "attr.aria-orientation": "_pattern.orientation()",
234
+ "attr.aria-multiselectable": "_pattern.multi()",
235
+ "attr.aria-activedescendant": "_pattern.activeDescendant()"
236
+ },
237
+ classAttribute: "ng-listbox"
238
+ },
239
+ queries: [{
240
+ propertyName: "_options",
241
+ predicate: Option,
242
+ descendants: true,
243
+ isSignal: true
244
+ }],
245
+ exportAs: ["ngListbox"],
246
+ hostDirectives: [{
247
+ directive: ComboboxPopup
248
+ }],
249
+ ngImport: i0
250
+ });
122
251
  }
123
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Listbox, decorators: [{
124
- type: Directive,
125
- args: [{
126
- selector: '[ngListbox]',
127
- exportAs: 'ngListbox',
128
- host: {
129
- 'role': 'listbox',
130
- 'class': 'ng-listbox',
131
- '[attr.id]': 'id()',
132
- '[attr.tabindex]': 'pattern.tabindex()',
133
- '[attr.aria-readonly]': 'pattern.readonly()',
134
- '[attr.aria-disabled]': 'pattern.disabled()',
135
- '[attr.aria-orientation]': 'pattern.orientation()',
136
- '[attr.aria-multiselectable]': 'pattern.multi()',
137
- '[attr.aria-activedescendant]': 'pattern.activedescendant()',
138
- '(keydown)': 'pattern.onKeydown($event)',
139
- '(pointerdown)': 'pattern.onPointerdown($event)',
140
- '(focusin)': 'onFocus()',
141
- },
142
- hostDirectives: [{ directive: ComboboxPopup }],
143
- }]
144
- }], ctorParameters: () => [] });
145
- /** A selectable option in a Listbox. */
252
+ i0.ɵɵngDeclareClassMetadata({
253
+ minVersion: "12.0.0",
254
+ version: "20.2.0-next.2",
255
+ ngImport: i0,
256
+ type: Listbox,
257
+ decorators: [{
258
+ type: Directive,
259
+ args: [{
260
+ selector: '[ngListbox]',
261
+ exportAs: 'ngListbox',
262
+ host: {
263
+ 'role': 'listbox',
264
+ 'class': 'ng-listbox',
265
+ '[attr.id]': 'id()',
266
+ '[attr.tabindex]': '_pattern.tabIndex()',
267
+ '[attr.aria-readonly]': '_pattern.readonly()',
268
+ '[attr.aria-disabled]': '_pattern.disabled()',
269
+ '[attr.aria-orientation]': '_pattern.orientation()',
270
+ '[attr.aria-multiselectable]': '_pattern.multi()',
271
+ '[attr.aria-activedescendant]': '_pattern.activeDescendant()',
272
+ '(keydown)': '_pattern.onKeydown($event)',
273
+ '(pointerdown)': '_pattern.onPointerdown($event)',
274
+ '(focusin)': 'onFocus()'
275
+ },
276
+ hostDirectives: [{
277
+ directive: ComboboxPopup
278
+ }]
279
+ }]
280
+ }],
281
+ ctorParameters: () => []
282
+ });
146
283
  class Option {
147
- /** A reference to the option element. */
148
- _elementRef = inject(ElementRef);
149
- /** The parent Listbox. */
150
- _listbox = inject(Listbox);
151
- /** A unique identifier for the option. */
152
- _generatedId = inject(_IdGenerator).getId('ng-option-');
153
- // TODO(wagnermaciel): https://github.com/angular/components/pull/30495#discussion_r1972601144.
154
- /** A unique identifier for the option. */
155
- id = computed(() => this._generatedId, ...(ngDevMode ? [{ debugName: "id" }] : []));
156
- // TODO(wagnermaciel): See if we want to change how we handle this since textContent is not
157
- // reactive. See https://github.com/angular/components/pull/30495#discussion_r1961260216.
158
- /** The text used by the typeahead search. */
159
- searchTerm = computed(() => this.label() ?? this.element().textContent, ...(ngDevMode ? [{ debugName: "searchTerm" }] : []));
160
- /** The parent Listbox UIPattern. */
161
- listbox = computed(() => this._listbox.pattern, ...(ngDevMode ? [{ debugName: "listbox" }] : []));
162
- /** A reference to the option element to be focused on navigation. */
163
- element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{ debugName: "element" }] : []));
164
- /** The value of the option. */
165
- value = input.required(...(ngDevMode ? [{ debugName: "value" }] : []));
166
- /** Whether an item is disabled. */
167
- disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
168
- /** The text used by the typeahead search. */
169
- label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
170
- /** The Option UIPattern. */
171
- pattern = new OptionPattern({
172
- ...this,
173
- id: this.id,
174
- value: this.value,
175
- listbox: this.listbox,
176
- element: this.element,
177
- searchTerm: this.searchTerm,
178
- });
179
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Option, deps: [], target: i0.ɵɵFactoryTarget.Directive });
180
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: Option, isStandalone: true, selector: "[ngOption]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "option" }, properties: { "attr.data-active": "pattern.active()", "attr.id": "pattern.id()", "attr.tabindex": "pattern.tabindex()", "attr.aria-selected": "pattern.selected()", "attr.aria-disabled": "pattern.disabled()" }, classAttribute: "ng-option" }, exportAs: ["ngOption"], ngImport: i0 });
284
+ _elementRef = inject(ElementRef);
285
+ _listbox = inject(Listbox);
286
+ _generatedId = inject(_IdGenerator).getId('ng-option-', true);
287
+ id = computed(() => this._generatedId, ...(ngDevMode ? [{
288
+ debugName: "id"
289
+ }] : []));
290
+ searchTerm = computed(() => this.label() ?? this.element().textContent, ...(ngDevMode ? [{
291
+ debugName: "searchTerm"
292
+ }] : []));
293
+ listbox = computed(() => this._listbox._pattern, ...(ngDevMode ? [{
294
+ debugName: "listbox"
295
+ }] : []));
296
+ element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{
297
+ debugName: "element"
298
+ }] : []));
299
+ value = input.required(...(ngDevMode ? [{
300
+ debugName: "value"
301
+ }] : []));
302
+ disabled = input(false, ...(ngDevMode ? [{
303
+ debugName: "disabled",
304
+ transform: booleanAttribute
305
+ }] : [{
306
+ transform: booleanAttribute
307
+ }]));
308
+ label = input(...(ngDevMode ? [undefined, {
309
+ debugName: "label"
310
+ }] : []));
311
+ selected = computed(() => this._pattern.selected(), ...(ngDevMode ? [{
312
+ debugName: "selected"
313
+ }] : []));
314
+ _pattern = new OptionPattern({
315
+ ...this,
316
+ id: this.id,
317
+ value: this.value,
318
+ listbox: this.listbox,
319
+ element: this.element,
320
+ searchTerm: this.searchTerm
321
+ });
322
+ static ɵfac = i0.ɵɵngDeclareFactory({
323
+ minVersion: "12.0.0",
324
+ version: "20.2.0-next.2",
325
+ ngImport: i0,
326
+ type: Option,
327
+ deps: [],
328
+ target: i0.ɵɵFactoryTarget.Directive
329
+ });
330
+ static ɵdir = i0.ɵɵngDeclareDirective({
331
+ minVersion: "17.1.0",
332
+ version: "20.2.0-next.2",
333
+ type: Option,
334
+ isStandalone: true,
335
+ selector: "[ngOption]",
336
+ inputs: {
337
+ value: {
338
+ classPropertyName: "value",
339
+ publicName: "value",
340
+ isSignal: true,
341
+ isRequired: true,
342
+ transformFunction: null
343
+ },
344
+ disabled: {
345
+ classPropertyName: "disabled",
346
+ publicName: "disabled",
347
+ isSignal: true,
348
+ isRequired: false,
349
+ transformFunction: null
350
+ },
351
+ label: {
352
+ classPropertyName: "label",
353
+ publicName: "label",
354
+ isSignal: true,
355
+ isRequired: false,
356
+ transformFunction: null
357
+ }
358
+ },
359
+ host: {
360
+ attributes: {
361
+ "role": "option"
362
+ },
363
+ properties: {
364
+ "attr.data-active": "_pattern.active()",
365
+ "attr.id": "_pattern.id()",
366
+ "attr.tabindex": "_pattern.tabIndex()",
367
+ "attr.aria-selected": "_pattern.selected()",
368
+ "attr.aria-disabled": "_pattern.disabled()"
369
+ },
370
+ classAttribute: "ng-option"
371
+ },
372
+ exportAs: ["ngOption"],
373
+ ngImport: i0
374
+ });
181
375
  }
182
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Option, decorators: [{
183
- type: Directive,
184
- args: [{
185
- selector: '[ngOption]',
186
- exportAs: 'ngOption',
187
- host: {
188
- 'role': 'option',
189
- 'class': 'ng-option',
190
- '[attr.data-active]': 'pattern.active()',
191
- '[attr.id]': 'pattern.id()',
192
- '[attr.tabindex]': 'pattern.tabindex()',
193
- '[attr.aria-selected]': 'pattern.selected()',
194
- '[attr.aria-disabled]': 'pattern.disabled()',
195
- },
196
- }]
197
- }] });
376
+ i0.ɵɵngDeclareClassMetadata({
377
+ minVersion: "12.0.0",
378
+ version: "20.2.0-next.2",
379
+ ngImport: i0,
380
+ type: Option,
381
+ decorators: [{
382
+ type: Directive,
383
+ args: [{
384
+ selector: '[ngOption]',
385
+ exportAs: 'ngOption',
386
+ host: {
387
+ 'role': 'option',
388
+ 'class': 'ng-option',
389
+ '[attr.data-active]': '_pattern.active()',
390
+ '[attr.id]': '_pattern.id()',
391
+ '[attr.tabindex]': '_pattern.tabIndex()',
392
+ '[attr.aria-selected]': '_pattern.selected()',
393
+ '[attr.aria-disabled]': '_pattern.disabled()'
394
+ }
395
+ }]
396
+ }]
397
+ });
198
398
 
199
399
  export { Listbox, Option };
200
400
  //# sourceMappingURL=listbox.mjs.map