@angular/aria 21.0.0-next.8 → 21.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) 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 +578 -0
  4. package/_adev_assets/aria-listbox.json +511 -0
  5. package/_adev_assets/aria-menu.json +752 -0
  6. package/_adev_assets/aria-radio-group.json +389 -0
  7. package/_adev_assets/aria-tabs.json +987 -0
  8. package/_adev_assets/aria-toolbar.json +717 -0
  9. package/_adev_assets/aria-tree.json +1067 -0
  10. package/fesm2022/_widget-chunk.mjs +827 -0
  11. package/fesm2022/_widget-chunk.mjs.map +1 -0
  12. package/fesm2022/accordion.mjs +371 -172
  13. package/fesm2022/accordion.mjs.map +1 -1
  14. package/fesm2022/aria.mjs +1 -2
  15. package/fesm2022/aria.mjs.map +1 -1
  16. package/fesm2022/combobox.mjs +304 -114
  17. package/fesm2022/combobox.mjs.map +1 -1
  18. package/fesm2022/deferred-content.mjs +89 -49
  19. package/fesm2022/deferred-content.mjs.map +1 -1
  20. package/fesm2022/grid.mjs +517 -0
  21. package/fesm2022/grid.mjs.map +1 -0
  22. package/fesm2022/listbox.mjs +384 -183
  23. package/fesm2022/listbox.mjs.map +1 -1
  24. package/fesm2022/menu.mjs +535 -0
  25. package/fesm2022/menu.mjs.map +1 -0
  26. package/fesm2022/private.mjs +2347 -0
  27. package/fesm2022/private.mjs.map +1 -0
  28. package/fesm2022/radio-group.mjs +320 -179
  29. package/fesm2022/radio-group.mjs.map +1 -1
  30. package/fesm2022/tabs.mjs +483 -274
  31. package/fesm2022/tabs.mjs.map +1 -1
  32. package/fesm2022/toolbar.mjs +330 -199
  33. package/fesm2022/toolbar.mjs.map +1 -1
  34. package/fesm2022/tree.mjs +511 -309
  35. package/fesm2022/tree.mjs.map +1 -1
  36. package/package.json +14 -6
  37. package/types/_grid-chunk.d.ts +546 -0
  38. package/types/accordion.d.ts +4 -4
  39. package/types/combobox.d.ts +18 -5
  40. package/types/deferred-content.d.ts +1 -0
  41. package/types/grid.d.ts +111 -0
  42. package/types/listbox.d.ts +6 -3
  43. package/types/menu.d.ts +158 -0
  44. package/types/{ui-patterns.d.ts → private.d.ts} +333 -133
  45. package/types/radio-group.d.ts +5 -3
  46. package/types/tabs.d.ts +4 -4
  47. package/types/toolbar.d.ts +4 -4
  48. package/types/tree.d.ts +17 -32
  49. package/fesm2022/ui-patterns.mjs +0 -2504
  50. package/fesm2022/ui-patterns.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/aria/grid/grid.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {_IdGenerator} from '@angular/cdk/a11y';\nimport {\n afterRenderEffect,\n booleanAttribute,\n computed,\n contentChild,\n contentChildren,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n Signal,\n} from '@angular/core';\nimport {GridPattern, GridRowPattern, GridCellPattern, GridCellWidgetPattern} from '../private';\n\n/** A directive that provides grid-based navigation and selection behavior. */\n@Directive({\n selector: '[ngGrid]',\n exportAs: 'ngGrid',\n host: {\n 'class': 'grid',\n 'role': 'grid',\n '[tabindex]': '_pattern.tabIndex()',\n '[attr.aria-disabled]': '_pattern.disabled()',\n '[attr.aria-activedescendant]': '_pattern.activeDescendant()',\n '(keydown)': '_pattern.onKeydown($event)',\n '(pointerdown)': '_pattern.onPointerdown($event)',\n '(pointermove)': '_pattern.onPointermove($event)',\n '(pointerup)': '_pattern.onPointerup($event)',\n '(focusin)': '_pattern.onFocusIn($event)',\n '(focusout)': '_pattern.onFocusOut($event)',\n },\n})\nexport class Grid {\n /** A reference to the host element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The rows that make up the grid. */\n private readonly _rows = contentChildren(GridRow);\n\n /** The UI patterns for the rows in the grid. */\n private readonly _rowPatterns: Signal<GridRowPattern[]> = computed(() =>\n this._rows().map(r => r._pattern),\n );\n\n /** The host native element. */\n readonly element = computed(() => this._elementRef.nativeElement);\n\n /** Whether selection is enabled for the grid. */\n readonly enableSelection = input(false, {transform: booleanAttribute});\n\n /** Whether the grid is disabled. */\n readonly disabled = input(false, {transform: booleanAttribute});\n\n /** Whether to skip disabled items during navigation. */\n readonly skipDisabled = input(true, {transform: booleanAttribute});\n\n /** The focus strategy used by the grid. */\n readonly focusMode = input<'roving' | 'activedescendant'>('roving');\n\n /** The wrapping behavior for keyboard navigation along the row axis. */\n readonly rowWrap = input<'continuous' | 'loop' | 'nowrap'>('loop');\n\n /** The wrapping behavior for keyboard navigation along the column axis. */\n readonly colWrap = input<'continuous' | 'loop' | 'nowrap'>('loop');\n\n /** The UI pattern for the grid. */\n readonly _pattern = new GridPattern({\n ...this,\n rows: this._rowPatterns,\n getCell: e => this._getCell(e),\n });\n\n constructor() {\n afterRenderEffect(() => this._pattern.resetStateEffect());\n afterRenderEffect(() => this._pattern.focusEffect());\n }\n\n /** Gets the cell pattern for a given element. */\n private _getCell(element: Element): GridCellPattern | undefined {\n const cellElement = element.closest('[ngGridCell]');\n if (cellElement === undefined) return;\n\n const widgetElement = element.closest('[ngGridCellWidget]');\n for (const row of this._rowPatterns()) {\n for (const cell of row.inputs.cells()) {\n if (\n cell.element() === cellElement ||\n (widgetElement !== undefined && cell.element() === widgetElement)\n ) {\n return cell;\n }\n }\n }\n return;\n }\n}\n\n/** A directive that represents a row in a grid. */\n@Directive({\n selector: '[ngGridRow]',\n exportAs: 'ngGridRow',\n host: {\n 'class': 'grid-row',\n '[attr.role]': 'role()',\n },\n})\nexport class GridRow {\n /** A reference to the host element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The cells that make up this row. */\n private readonly _cells = contentChildren(GridCell);\n\n /** The UI patterns for the cells in this row. */\n private readonly _cellPatterns: Signal<GridCellPattern[]> = computed(() =>\n this._cells().map(c => c._pattern),\n );\n\n /** The parent grid. */\n private readonly _grid = inject(Grid);\n\n /** The parent grid UI pattern. */\n readonly grid = computed(() => this._grid._pattern);\n\n /** The host native element. */\n readonly element = computed(() => this._elementRef.nativeElement);\n\n /** The ARIA role for the row. */\n readonly role = input<'row' | 'rowheader'>('row');\n\n /** The index of this row within the grid. */\n readonly rowIndex = input<number>();\n\n /** The UI pattern for the grid row. */\n readonly _pattern = new GridRowPattern({\n ...this,\n cells: this._cellPatterns,\n });\n}\n\n/** A directive that represents a cell in a grid. */\n@Directive({\n selector: '[ngGridCell]',\n exportAs: 'ngGridCell',\n host: {\n 'class': 'grid-cell',\n '[attr.role]': 'role()',\n '[attr.id]': '_pattern.id()',\n '[attr.rowspan]': '_pattern.rowSpan()',\n '[attr.colspan]': '_pattern.colSpan()',\n '[attr.data-active]': '_pattern.active()',\n '[attr.aria-disabled]': '_pattern.disabled()',\n '[attr.aria-rowspan]': '_pattern.rowSpan()',\n '[attr.aria-colspan]': '_pattern.colSpan()',\n '[attr.aria-rowindex]': '_pattern.ariaRowIndex()',\n '[attr.aria-colindex]': '_pattern.ariaColIndex()',\n '[attr.aria-selected]': '_pattern.ariaSelected()',\n '[tabindex]': '_pattern.tabIndex()',\n },\n})\nexport class GridCell {\n /** A reference to the host element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The widget contained within this cell, if any. */\n private readonly _widgets = contentChild(GridCellWidget);\n\n /** The UI pattern for the widget in this cell. */\n private readonly _widgetPattern: Signal<GridCellWidgetPattern | undefined> = computed(\n () => this._widgets()?._pattern,\n );\n\n /** The parent row. */\n private readonly _row = inject(GridRow);\n\n /** A unique identifier for the cell. */\n private readonly _id = inject(_IdGenerator).getId('ng-grid-cell-');\n\n /** The host native element. */\n readonly element = computed(() => this._elementRef.nativeElement);\n\n /** The ARIA role for the cell. */\n readonly role = input<'gridcell' | 'columnheader'>('gridcell');\n\n /** The number of rows the cell should span. */\n readonly rowSpan = input<number>(1);\n\n /** The number of columns the cell should span. */\n readonly colSpan = input<number>(1);\n\n /** The index of this cell's row within the grid. */\n readonly rowIndex = input<number>();\n\n /** The index of this cell's column within the grid. */\n readonly colIndex = input<number>();\n\n /** Whether the cell is disabled. */\n readonly disabled = input(false, {transform: booleanAttribute});\n\n /** Whether the cell is selected. */\n readonly selected = model<boolean>(false);\n\n /** Whether the cell is selectable. */\n readonly selectable = input<boolean>(true);\n\n /** The UI pattern for the grid cell. */\n readonly _pattern = new GridCellPattern({\n ...this,\n id: () => this._id,\n grid: this._row.grid,\n row: () => this._row._pattern,\n widget: this._widgetPattern,\n });\n}\n\n/** A directive that represents a widget inside a grid cell. */\n@Directive({\n selector: '[ngGridCellWidget]',\n exportAs: 'ngGridCellWidget',\n host: {\n 'class': 'grid-cell-widget',\n '[attr.data-active]': '_pattern.active()',\n '[tabindex]': '_pattern.tabIndex()',\n },\n})\nexport class GridCellWidget {\n /** A reference to the host element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The parent cell. */\n private readonly _cell = inject(GridCell);\n\n /** The host native element. */\n readonly element = computed(() => this._elementRef.nativeElement);\n\n /** Whether the widget is activated and the grid navigation should be paused. */\n readonly activate = model<boolean>(false);\n\n /** The UI pattern for the grid cell widget. */\n readonly _pattern = new GridCellWidgetPattern({\n ...this,\n cell: () => this._cell._pattern,\n });\n\n /** Focuses the widget. */\n focus(): void {\n this.element().focus();\n }\n}\n"],"names":["inject","ElementRef","contentChildren","GridRow","ngDevMode","debugName","nativeElement","enableSelection","input","transform","booleanAttribute","focusMode","rowWrap","colWrap","_pattern","GridPattern","rows","_rowPatterns","getCell","e","_getCell","constructor","afterRenderEffect","resetStateEffect","focusEffect","element","cellElement","closest","widgetElement","cell","undefined","ɵɵngDeclareFactory","minVersion","version","ɵɵngDeclareDirective","type","Grid","isStandalone","selector","inputs","classPropertyName","publicName","isSignal","isRequired","transformFunction","disabled","skipDisabled","host","attributes","listeners","properties","classAttribute","queries","propertyName","predicate","exportAs","ngImport","i0","args","ctorParameters","_cellPatterns","computed","_cells","map","c","_grid","rowIndex","cells","deps","target","ɵɵFactoryTarget","Directive","ɵdir","decorators","GridCellWidget","_row","role","selected","model","selectable","GridCellPattern","GridCell"],"mappings":";;;;;;aA8CwC,GAAAA,MAAA,CAAAC,UAAA,CAAA;OAuBkC,GAAAC,eAAA,CAAAC,OAAA,EAAA,IAAAC,SAAA,GAAA,CAAA;IAAAC,SAAA,EAAA;AAAA,GAAA,IAAA,EAAA,CAAA,CAAA;gFAGG,GAAA,CAAA;IAAAA,SAAA,EAAA;AAAA,GAAA,CAAA,GAAA,EAAA,CAAA,CAAA;2CAsB1C,CAAAC,aAAA,MAAAF,SAAA,GAAA,CAAA;IAAAC,SAAA,EAAA;AAAA,GAAA,CAAA,GAAA,EAAA,CAAA,CAAA;EAKzBE,eAAA,GAAAC,KAAA,CAAA,KAAA,EAAA,IAAAJ,SAAW,GAAA,CAAA;IAAAC,SAAA,EAAA,iBAAA;AAAAI,IAAAA,SAAA,EAAAC;AAAA,GAAA,CAAA,GAAA,CAAA;AAAAD,IAAAA,SAAA,EAAAC;AAAA,GAAA,CAAA,CAAA,CAAA;;aAGjB,EAAA,UAAA;AAAAD,IAAAA,SAAA,EAAAC;AAAA,GAAA,CAAA,GAAA,CAAA;AAAAD,IAAAA,SAAA,EAAAC;AAAA,GAAA,CAAA,CAAA,CAAA;;;;;;;EA7EOC,SAAA,GAAAH,KAAA,CAAA,QAAA,EAAA,IAAAJ,SAAA,GAAA,CAAA;IAAAC,SAAA,EAAA;AAAA,GAAA,CAAA,GAAA,EAAA,CAAA,CAAA;EAGTO,OAAA,GAAAJ,KAAA,CAAA,MAAA,EAAA,IAAAJ,SAAM,GAAA,CAAA;IAAAC,SAAA,EAAA;AAAA,GAAA,CAAA,GAAA,EAAA,CAAA,CAAA;EAGJQ,OAAA,GAAAL,KAAA,CAAA,MAAA,EAAA,IAAAJ,SAAA,GA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CAAA,GAAA,EAAA,CAAA,CAAA;oCAI5ByB,SAAA,EAAA;IAAAzB,SAAA,EAAA;AAAA,GAAA,CAAA,GAAA,EAAA,CAAA,CAAA;;;;;;;;;;EA5BLwE,QAAA,GAAAC,KAAA,CAAA,KAAA,EAAA,IAAA1E,SAAA,GAAA,CAAA;IAAAC,SAA8B,EAAA;AAAA,GAAA,CAAA,GAAA,EAAA,CAAA,CAAA;EAG5B0E,UAAA,GAAAvE,KAAA,CAAA,IAAA,EAAA,IAAAJ,SAAA,GAAA,CAAA;AAAAC,IAAAA,SAAA,EAA2B;AAAA,GAAA,CAAA,GAAA,EAAA,CAAA,CAAA;AAG5BS,EAAAA,QAAA,OAAAkE,eAAA,CAAA;IACF,GAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAhEY,WAAA,EAAA,eAAA;AAAA,QAAA,gBAAA,EAAA,oBAAA;;;;QAnBF,qBAAA,EAAA,oBAAA;AACT,QAAA,qBAAA,EAAA,oBAAA;AACA,QAAA,sBAAA,EAAsB,yBAAA;AACtB,QAAA,sBAAA,EAAM,yBAAA;AACJ,QAAA,sBAAA,EAAoB,yBAAA;AACpB,QAAA,YAAA,EAAA;;;;;AAKA,MAAA,cAAA,CAAA;AAEA,EAAA,WAAA,GAAA,MAAA,CAAA/E,UAAA,CAAA;AAEA,EAAA,KAAA,GAAA,MAAA,CAAAgF,QAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,200 +1,401 @@
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
8
  import '@angular/aria/deferred-content';
9
9
 
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
10
  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,
11
+ _generatedId = inject(_IdGenerator).getId('ng-listbox-');
12
+ id = computed(() => this._generatedId, ...(ngDevMode ? [{
13
+ debugName: "id"
14
+ }] : []));
15
+ _popup = inject(ComboboxPopup, {
16
+ optional: true
17
+ });
18
+ _elementRef = inject(ElementRef);
19
+ _directionality = inject(Directionality);
20
+ _options = contentChildren(Option, ...(ngDevMode ? [{
21
+ debugName: "_options",
22
+ descendants: true
23
+ }] : [{
24
+ descendants: true
25
+ }]));
26
+ textDirection = toSignal(this._directionality.change, {
27
+ initialValue: this._directionality.value
28
+ });
29
+ items = computed(() => this._options().map(option => option._pattern), ...(ngDevMode ? [{
30
+ debugName: "items"
31
+ }] : []));
32
+ orientation = input('vertical', ...(ngDevMode ? [{
33
+ debugName: "orientation"
34
+ }] : []));
35
+ multi = input(false, ...(ngDevMode ? [{
36
+ debugName: "multi",
37
+ transform: booleanAttribute
38
+ }] : [{
39
+ transform: booleanAttribute
40
+ }]));
41
+ wrap = input(true, ...(ngDevMode ? [{
42
+ debugName: "wrap",
43
+ transform: booleanAttribute
44
+ }] : [{
45
+ transform: booleanAttribute
46
+ }]));
47
+ skipDisabled = input(true, ...(ngDevMode ? [{
48
+ debugName: "skipDisabled",
49
+ transform: booleanAttribute
50
+ }] : [{
51
+ transform: booleanAttribute
52
+ }]));
53
+ focusMode = input('roving', ...(ngDevMode ? [{
54
+ debugName: "focusMode"
55
+ }] : []));
56
+ selectionMode = input('follow', ...(ngDevMode ? [{
57
+ debugName: "selectionMode"
58
+ }] : []));
59
+ typeaheadDelay = input(0.5, ...(ngDevMode ? [{
60
+ debugName: "typeaheadDelay"
61
+ }] : []));
62
+ disabled = input(false, ...(ngDevMode ? [{
63
+ debugName: "disabled",
64
+ transform: booleanAttribute
65
+ }] : [{
66
+ transform: booleanAttribute
67
+ }]));
68
+ readonly = input(false, ...(ngDevMode ? [{
69
+ debugName: "readonly",
70
+ transform: booleanAttribute
71
+ }] : [{
72
+ transform: booleanAttribute
73
+ }]));
74
+ value = model([], ...(ngDevMode ? [{
75
+ debugName: "value"
76
+ }] : []));
77
+ _pattern;
78
+ _hasFocused = signal(false, ...(ngDevMode ? [{
79
+ debugName: "_hasFocused"
80
+ }] : []));
81
+ constructor() {
82
+ const inputs = {
83
+ ...this,
84
+ id: this.id,
85
+ items: this.items,
86
+ activeItem: signal(undefined),
87
+ textDirection: this.textDirection,
88
+ element: () => this._elementRef.nativeElement,
89
+ combobox: () => this._popup?.combobox?._pattern
90
+ };
91
+ this._pattern = this._popup?.combobox ? new ComboboxListboxPattern(inputs) : new ListboxPattern(inputs);
92
+ if (this._popup) {
93
+ this._popup.controls.set(this._pattern);
94
+ }
95
+ afterRenderEffect(() => {
96
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
97
+ const violations = this._pattern.validate();
98
+ for (const violation of violations) {
99
+ console.error(violation);
100
+ }
101
+ }
33
102
  });
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,
103
+ afterRenderEffect(() => {
104
+ if (!this._hasFocused()) {
105
+ this._pattern.setDefaultState();
106
+ }
43
107
  });
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 });
108
+ afterRenderEffect(() => {
109
+ const items = inputs.items();
110
+ const activeItem = untracked(() => inputs.activeItem());
111
+ if (!items.some(i => i === activeItem) && activeItem) {
112
+ this._pattern.listBehavior.unfocus();
113
+ }
114
+ });
115
+ afterRenderEffect(() => {
116
+ const items = inputs.items();
117
+ const value = untracked(() => this.value());
118
+ if (items && value.some(v => !items.some(i => i.value() === v))) {
119
+ this.value.set(value.filter(v => items.some(i => i.value() === v)));
120
+ }
121
+ });
122
+ }
123
+ onFocus() {
124
+ this._hasFocused.set(true);
125
+ }
126
+ scrollActiveItemIntoView(options = {
127
+ block: 'nearest'
128
+ }) {
129
+ this._pattern.inputs.activeItem()?.element().scrollIntoView(options);
130
+ }
131
+ static ɵfac = i0.ɵɵngDeclareFactory({
132
+ minVersion: "12.0.0",
133
+ version: "20.2.0-next.2",
134
+ ngImport: i0,
135
+ type: Listbox,
136
+ deps: [],
137
+ target: i0.ɵɵFactoryTarget.Directive
138
+ });
139
+ static ɵdir = i0.ɵɵngDeclareDirective({
140
+ minVersion: "17.2.0",
141
+ version: "20.2.0-next.2",
142
+ type: Listbox,
143
+ isStandalone: true,
144
+ selector: "[ngListbox]",
145
+ inputs: {
146
+ orientation: {
147
+ classPropertyName: "orientation",
148
+ publicName: "orientation",
149
+ isSignal: true,
150
+ isRequired: false,
151
+ transformFunction: null
152
+ },
153
+ multi: {
154
+ classPropertyName: "multi",
155
+ publicName: "multi",
156
+ isSignal: true,
157
+ isRequired: false,
158
+ transformFunction: null
159
+ },
160
+ wrap: {
161
+ classPropertyName: "wrap",
162
+ publicName: "wrap",
163
+ isSignal: true,
164
+ isRequired: false,
165
+ transformFunction: null
166
+ },
167
+ skipDisabled: {
168
+ classPropertyName: "skipDisabled",
169
+ publicName: "skipDisabled",
170
+ isSignal: true,
171
+ isRequired: false,
172
+ transformFunction: null
173
+ },
174
+ focusMode: {
175
+ classPropertyName: "focusMode",
176
+ publicName: "focusMode",
177
+ isSignal: true,
178
+ isRequired: false,
179
+ transformFunction: null
180
+ },
181
+ selectionMode: {
182
+ classPropertyName: "selectionMode",
183
+ publicName: "selectionMode",
184
+ isSignal: true,
185
+ isRequired: false,
186
+ transformFunction: null
187
+ },
188
+ typeaheadDelay: {
189
+ classPropertyName: "typeaheadDelay",
190
+ publicName: "typeaheadDelay",
191
+ isSignal: true,
192
+ isRequired: false,
193
+ transformFunction: null
194
+ },
195
+ disabled: {
196
+ classPropertyName: "disabled",
197
+ publicName: "disabled",
198
+ isSignal: true,
199
+ isRequired: false,
200
+ transformFunction: null
201
+ },
202
+ readonly: {
203
+ classPropertyName: "readonly",
204
+ publicName: "readonly",
205
+ isSignal: true,
206
+ isRequired: false,
207
+ transformFunction: null
208
+ },
209
+ value: {
210
+ classPropertyName: "value",
211
+ publicName: "value",
212
+ isSignal: true,
213
+ isRequired: false,
214
+ transformFunction: null
215
+ }
216
+ },
217
+ outputs: {
218
+ value: "valueChange"
219
+ },
220
+ host: {
221
+ attributes: {
222
+ "role": "listbox"
223
+ },
224
+ listeners: {
225
+ "keydown": "_pattern.onKeydown($event)",
226
+ "pointerdown": "_pattern.onPointerdown($event)",
227
+ "focusin": "onFocus()"
228
+ },
229
+ properties: {
230
+ "attr.id": "id()",
231
+ "attr.tabindex": "_pattern.tabindex()",
232
+ "attr.aria-readonly": "_pattern.readonly()",
233
+ "attr.aria-disabled": "_pattern.disabled()",
234
+ "attr.aria-orientation": "_pattern.orientation()",
235
+ "attr.aria-multiselectable": "_pattern.multi()",
236
+ "attr.aria-activedescendant": "_pattern.activedescendant()"
237
+ },
238
+ classAttribute: "ng-listbox"
239
+ },
240
+ queries: [{
241
+ propertyName: "_options",
242
+ predicate: Option,
243
+ descendants: true,
244
+ isSignal: true
245
+ }],
246
+ exportAs: ["ngListbox"],
247
+ hostDirectives: [{
248
+ directive: ComboboxPopup
249
+ }],
250
+ ngImport: i0
251
+ });
122
252
  }
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. */
253
+ i0.ɵɵngDeclareClassMetadata({
254
+ minVersion: "12.0.0",
255
+ version: "20.2.0-next.2",
256
+ ngImport: i0,
257
+ type: Listbox,
258
+ decorators: [{
259
+ type: Directive,
260
+ args: [{
261
+ selector: '[ngListbox]',
262
+ exportAs: 'ngListbox',
263
+ host: {
264
+ 'role': 'listbox',
265
+ 'class': 'ng-listbox',
266
+ '[attr.id]': 'id()',
267
+ '[attr.tabindex]': '_pattern.tabindex()',
268
+ '[attr.aria-readonly]': '_pattern.readonly()',
269
+ '[attr.aria-disabled]': '_pattern.disabled()',
270
+ '[attr.aria-orientation]': '_pattern.orientation()',
271
+ '[attr.aria-multiselectable]': '_pattern.multi()',
272
+ '[attr.aria-activedescendant]': '_pattern.activedescendant()',
273
+ '(keydown)': '_pattern.onKeydown($event)',
274
+ '(pointerdown)': '_pattern.onPointerdown($event)',
275
+ '(focusin)': 'onFocus()'
276
+ },
277
+ hostDirectives: [{
278
+ directive: ComboboxPopup
279
+ }]
280
+ }]
281
+ }],
282
+ ctorParameters: () => []
283
+ });
146
284
  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 });
285
+ _elementRef = inject(ElementRef);
286
+ _listbox = inject(Listbox);
287
+ _generatedId = inject(_IdGenerator).getId('ng-option-');
288
+ id = computed(() => this._generatedId, ...(ngDevMode ? [{
289
+ debugName: "id"
290
+ }] : []));
291
+ searchTerm = computed(() => this.label() ?? this.element().textContent, ...(ngDevMode ? [{
292
+ debugName: "searchTerm"
293
+ }] : []));
294
+ listbox = computed(() => this._listbox._pattern, ...(ngDevMode ? [{
295
+ debugName: "listbox"
296
+ }] : []));
297
+ element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{
298
+ debugName: "element"
299
+ }] : []));
300
+ value = input.required(...(ngDevMode ? [{
301
+ debugName: "value"
302
+ }] : []));
303
+ disabled = input(false, ...(ngDevMode ? [{
304
+ debugName: "disabled",
305
+ transform: booleanAttribute
306
+ }] : [{
307
+ transform: booleanAttribute
308
+ }]));
309
+ label = input(...(ngDevMode ? [undefined, {
310
+ debugName: "label"
311
+ }] : []));
312
+ selected = computed(() => this._pattern.selected(), ...(ngDevMode ? [{
313
+ debugName: "selected"
314
+ }] : []));
315
+ _pattern = new OptionPattern({
316
+ ...this,
317
+ id: this.id,
318
+ value: this.value,
319
+ listbox: this.listbox,
320
+ element: this.element,
321
+ searchTerm: this.searchTerm
322
+ });
323
+ static ɵfac = i0.ɵɵngDeclareFactory({
324
+ minVersion: "12.0.0",
325
+ version: "20.2.0-next.2",
326
+ ngImport: i0,
327
+ type: Option,
328
+ deps: [],
329
+ target: i0.ɵɵFactoryTarget.Directive
330
+ });
331
+ static ɵdir = i0.ɵɵngDeclareDirective({
332
+ minVersion: "17.1.0",
333
+ version: "20.2.0-next.2",
334
+ type: Option,
335
+ isStandalone: true,
336
+ selector: "[ngOption]",
337
+ inputs: {
338
+ value: {
339
+ classPropertyName: "value",
340
+ publicName: "value",
341
+ isSignal: true,
342
+ isRequired: true,
343
+ transformFunction: null
344
+ },
345
+ disabled: {
346
+ classPropertyName: "disabled",
347
+ publicName: "disabled",
348
+ isSignal: true,
349
+ isRequired: false,
350
+ transformFunction: null
351
+ },
352
+ label: {
353
+ classPropertyName: "label",
354
+ publicName: "label",
355
+ isSignal: true,
356
+ isRequired: false,
357
+ transformFunction: null
358
+ }
359
+ },
360
+ host: {
361
+ attributes: {
362
+ "role": "option"
363
+ },
364
+ properties: {
365
+ "attr.data-active": "_pattern.active()",
366
+ "attr.id": "_pattern.id()",
367
+ "attr.tabindex": "_pattern.tabindex()",
368
+ "attr.aria-selected": "_pattern.selected()",
369
+ "attr.aria-disabled": "_pattern.disabled()"
370
+ },
371
+ classAttribute: "ng-option"
372
+ },
373
+ exportAs: ["ngOption"],
374
+ ngImport: i0
375
+ });
181
376
  }
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
- }] });
377
+ i0.ɵɵngDeclareClassMetadata({
378
+ minVersion: "12.0.0",
379
+ version: "20.2.0-next.2",
380
+ ngImport: i0,
381
+ type: Option,
382
+ decorators: [{
383
+ type: Directive,
384
+ args: [{
385
+ selector: '[ngOption]',
386
+ exportAs: 'ngOption',
387
+ host: {
388
+ 'role': 'option',
389
+ 'class': 'ng-option',
390
+ '[attr.data-active]': '_pattern.active()',
391
+ '[attr.id]': '_pattern.id()',
392
+ '[attr.tabindex]': '_pattern.tabindex()',
393
+ '[attr.aria-selected]': '_pattern.selected()',
394
+ '[attr.aria-disabled]': '_pattern.disabled()'
395
+ }
396
+ }]
397
+ }]
398
+ });
198
399
 
199
400
  export { Listbox, Option };
200
401
  //# sourceMappingURL=listbox.mjs.map