@angular/aria 0.0.1 → 21.0.0-next.10
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.
- package/LICENSE +21 -0
- package/README.md +6 -0
- package/fesm2022/_widget-chunk.mjs +990 -0
- package/fesm2022/_widget-chunk.mjs.map +1 -0
- package/fesm2022/accordion.mjs +192 -0
- package/fesm2022/accordion.mjs.map +1 -0
- package/fesm2022/aria.mjs +7 -0
- package/fesm2022/aria.mjs.map +1 -0
- package/fesm2022/combobox.mjs +145 -0
- package/fesm2022/combobox.mjs.map +1 -0
- package/fesm2022/deferred-content.mjs +60 -0
- package/fesm2022/deferred-content.mjs.map +1 -0
- package/fesm2022/grid.mjs +213 -0
- package/fesm2022/grid.mjs.map +1 -0
- package/fesm2022/listbox.mjs +200 -0
- package/fesm2022/listbox.mjs.map +1 -0
- package/fesm2022/menu.mjs +302 -0
- package/fesm2022/menu.mjs.map +1 -0
- package/fesm2022/radio-group.mjs +197 -0
- package/fesm2022/radio-group.mjs.map +1 -0
- package/fesm2022/tabs.mjs +299 -0
- package/fesm2022/tabs.mjs.map +1 -0
- package/fesm2022/toolbar.mjs +218 -0
- package/fesm2022/toolbar.mjs.map +1 -0
- package/fesm2022/tree.mjs +288 -0
- package/fesm2022/tree.mjs.map +1 -0
- package/fesm2022/ui-patterns.mjs +2951 -0
- package/fesm2022/ui-patterns.mjs.map +1 -0
- package/package.json +86 -3
- package/types/_grid-chunk.d.ts +546 -0
- package/types/accordion.d.ts +92 -0
- package/types/aria.d.ts +6 -0
- package/types/combobox.d.ts +60 -0
- package/types/deferred-content.d.ts +38 -0
- package/types/grid.d.ts +111 -0
- package/types/listbox.d.ts +95 -0
- package/types/menu.d.ts +158 -0
- package/types/radio-group.d.ts +82 -0
- package/types/tabs.d.ts +156 -0
- package/types/toolbar.d.ts +113 -0
- package/types/tree.d.ts +135 -0
- package/types/ui-patterns.d.ts +1604 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/aria/combobox/combobox.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 {\n afterRenderEffect,\n contentChild,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n signal,\n untracked,\n WritableSignal,\n} from '@angular/core';\nimport {DeferredContent, DeferredContentAware} from '@angular/aria/deferred-content';\nimport {\n ComboboxPattern,\n ComboboxListboxControls,\n ComboboxTreeControls,\n} from '@angular/aria/ui-patterns';\nimport {Directionality} from '@angular/cdk/bidi';\nimport {toSignal} from '@angular/core/rxjs-interop';\n\n@Directive({\n selector: '[ngCombobox]',\n exportAs: 'ngCombobox',\n hostDirectives: [\n {\n directive: DeferredContentAware,\n inputs: ['preserveContent'],\n },\n ],\n host: {\n '[attr.data-expanded]': 'pattern.expanded()',\n '(input)': 'pattern.onInput($event)',\n '(keydown)': 'pattern.onKeydown($event)',\n '(pointerup)': 'pattern.onPointerup($event)',\n '(focusin)': 'pattern.onFocusIn()',\n '(focusout)': 'pattern.onFocusOut($event)',\n },\n})\nexport class Combobox<V> {\n /** The directionality (LTR / RTL) context for the application (or a subtree of it). */\n private readonly _directionality = inject(Directionality);\n\n /** A signal wrapper for directionality. */\n protected textDirection = toSignal(this._directionality.change, {\n initialValue: this._directionality.value,\n });\n\n /** The element that the combobox is attached to. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The DeferredContentAware host directive. */\n private readonly _deferredContentAware = inject(DeferredContentAware, {optional: true});\n\n /** The combobox popup. */\n readonly popup = contentChild<ComboboxPopup<V>>(ComboboxPopup);\n\n /** The filter mode for the combobox. */\n filterMode = input<'manual' | 'auto-select' | 'highlight'>('manual');\n\n /** Whether the combobox is focused. */\n readonly isFocused = signal(false);\n\n /** Whether the listbox has received focus yet. */\n private _hasBeenFocused = signal(false);\n\n /** Whether the combobox is disabled. */\n readonly disabled = input(false);\n\n /** Whether the combobox is read-only. */\n readonly readonly = input(false);\n\n /** The value of the first matching item in the popup. */\n readonly firstMatch = input<V | undefined>(undefined);\n\n /** The combobox ui pattern. */\n readonly pattern = new ComboboxPattern<any, V>({\n ...this,\n textDirection: this.textDirection,\n disabled: this.disabled,\n readonly: this.readonly,\n inputValue: signal(''),\n inputEl: signal(undefined),\n containerEl: () => this._elementRef.nativeElement,\n popupControls: () => this.popup()?.controls(),\n });\n\n constructor() {\n afterRenderEffect(() => {\n if (!this._deferredContentAware?.contentVisible() && this.pattern.isFocused()) {\n this._deferredContentAware?.contentVisible.set(true);\n }\n });\n\n afterRenderEffect(() => {\n if (!this._hasBeenFocused() && this.pattern.isFocused()) {\n this._hasBeenFocused.set(true);\n }\n });\n }\n}\n\n@Directive({\n selector: 'input[ngComboboxInput]',\n exportAs: 'ngComboboxInput',\n host: {\n 'role': 'combobox',\n '[value]': 'value()',\n '[attr.aria-expanded]': 'combobox.pattern.expanded()',\n '[attr.aria-activedescendant]': 'combobox.pattern.activedescendant()',\n '[attr.aria-controls]': 'combobox.pattern.popupId()',\n '[attr.aria-haspopup]': 'combobox.pattern.hasPopup()',\n '[attr.aria-autocomplete]': 'combobox.pattern.autocomplete()',\n },\n})\nexport class ComboboxInput {\n /** The element that the combobox is attached to. */\n private readonly _elementRef = inject<ElementRef<HTMLInputElement>>(ElementRef);\n\n /** The combobox that the input belongs to. */\n readonly combobox = inject(Combobox);\n\n /** The value of the input. */\n value = model<string>('');\n\n constructor() {\n (this.combobox.pattern.inputs.inputEl as WritableSignal<HTMLInputElement>).set(\n this._elementRef.nativeElement,\n );\n this.combobox.pattern.inputs.inputValue = this.value;\n\n /** Focuses & selects the first item in the combobox if the user changes the input value. */\n afterRenderEffect(() => {\n this.combobox.popup()?.controls()?.items();\n untracked(() => this.combobox.pattern.onFilter());\n });\n }\n}\n\n@Directive({\n selector: 'ng-template[ngComboboxPopupContainer]',\n exportAs: 'ngComboboxPopupContainer',\n hostDirectives: [DeferredContent],\n})\nexport class ComboboxPopupContainer {}\n\n@Directive({\n selector: '[ngComboboxPopup]',\n exportAs: 'ngComboboxPopup',\n})\nexport class ComboboxPopup<V> {\n /** The combobox that the popup belongs to. */\n readonly combobox = inject<Combobox<V>>(Combobox, {optional: true});\n\n /** The controls the popup exposes to the combobox. */\n readonly controls = signal<\n ComboboxListboxControls<any, V> | ComboboxTreeControls<any, V> | undefined\n >(undefined);\n}\n"],"names":[],"mappings":";;;;;;;;MA+Ca,QAAQ,CAAA;;AAEF,IAAA,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC;;IAG/C,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;AAC9D,QAAA,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK;AACzC,KAAA,CAAC;;AAGe,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;;IAGhC,qBAAqB,GAAG,MAAM,CAAC,oBAAoB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;;AAG9E,IAAA,KAAK,GAAG,YAAY,CAAmB,aAAa,iDAAC;;AAG9D,IAAA,UAAU,GAAG,KAAK,CAAyC,QAAQ,sDAAC;;AAG3D,IAAA,SAAS,GAAG,MAAM,CAAC,KAAK,qDAAC;;AAG1B,IAAA,eAAe,GAAG,MAAM,CAAC,KAAK,2DAAC;;AAG9B,IAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,oDAAC;;AAGvB,IAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,oDAAC;;AAGvB,IAAA,UAAU,GAAG,KAAK,CAAgB,SAAS,sDAAC;;IAG5C,OAAO,GAAG,IAAI,eAAe,CAAS;AAC7C,QAAA,GAAG,IAAI;QACP,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;AACv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A,EAAA,uCAAA,EAAA,QAAA,EAAA,CAAA,0BAAA,CAAA,EAAA,cAAA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,eAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;kGAAtB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBALlC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,uCAAuC;AACjD,oBAAA,QAAQ,EAAE,0BAA0B;oBACpC,cAAc,EAAE,CAAC,eAAe,CAAC;AAClC,iBAAA;;MAOY,aAAa,CAAA;;IAEf,QAAQ,GAAG,MAAM,CAAc,QAAQ,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;;AAG1D,IAAA,QAAQ,GAAG,MAAM,CAExB,SAAS,oDAAC;8GAPD,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;kGAAb,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,QAAA,EAAA,CAAA,iBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;kGAAb,aAAa,EAAA,UAAA,EAAA,CAAA;kBAJzB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,QAAQ,EAAE,iBAAiB;AAC5B,iBAAA;;;;;"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { signal, model, Directive, inject, TemplateRef, ViewContainerRef, afterRenderEffect } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A container directive controls the visibility of its content.
|
|
6
|
+
*/
|
|
7
|
+
class DeferredContentAware {
|
|
8
|
+
contentVisible = signal(false, ...(ngDevMode ? [{ debugName: "contentVisible" }] : []));
|
|
9
|
+
preserveContent = model(false, ...(ngDevMode ? [{ debugName: "preserveContent" }] : []));
|
|
10
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: DeferredContentAware, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
11
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: DeferredContentAware, isStandalone: true, inputs: { preserveContent: { classPropertyName: "preserveContent", publicName: "preserveContent", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { preserveContent: "preserveContentChange" }, ngImport: i0 });
|
|
12
|
+
}
|
|
13
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: DeferredContentAware, decorators: [{
|
|
14
|
+
type: Directive
|
|
15
|
+
}] });
|
|
16
|
+
/**
|
|
17
|
+
* DeferredContent loads/unloads the content based on the visibility.
|
|
18
|
+
* The visibilty signal is sent from a parent directive implements
|
|
19
|
+
* DeferredContentAware.
|
|
20
|
+
*
|
|
21
|
+
* Use this directive as a host directive. For example:
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* @Directive({
|
|
25
|
+
* selector: 'ng-template[AccordionContent]',
|
|
26
|
+
* hostDirectives: [DeferredContent],
|
|
27
|
+
* })
|
|
28
|
+
* class AccordionContent {}
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
class DeferredContent {
|
|
32
|
+
_deferredContentAware = inject(DeferredContentAware, { optional: true });
|
|
33
|
+
_templateRef = inject(TemplateRef);
|
|
34
|
+
_viewContainerRef = inject(ViewContainerRef);
|
|
35
|
+
_isRendered = false;
|
|
36
|
+
deferredContentAware = signal(this._deferredContentAware, ...(ngDevMode ? [{ debugName: "deferredContentAware" }] : []));
|
|
37
|
+
constructor() {
|
|
38
|
+
afterRenderEffect(() => {
|
|
39
|
+
if (this.deferredContentAware()?.contentVisible()) {
|
|
40
|
+
if (this._isRendered)
|
|
41
|
+
return;
|
|
42
|
+
this._viewContainerRef.clear();
|
|
43
|
+
this._viewContainerRef.createEmbeddedView(this._templateRef);
|
|
44
|
+
this._isRendered = true;
|
|
45
|
+
}
|
|
46
|
+
else if (!this.deferredContentAware()?.preserveContent()) {
|
|
47
|
+
this._viewContainerRef.clear();
|
|
48
|
+
this._isRendered = false;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: DeferredContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
53
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: DeferredContent, isStandalone: true, ngImport: i0 });
|
|
54
|
+
}
|
|
55
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: DeferredContent, decorators: [{
|
|
56
|
+
type: Directive
|
|
57
|
+
}], ctorParameters: () => [] });
|
|
58
|
+
|
|
59
|
+
export { DeferredContent, DeferredContentAware };
|
|
60
|
+
//# sourceMappingURL=deferred-content.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deferred-content.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/aria/deferred-content/deferred-content.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 {\n afterRenderEffect,\n Directive,\n inject,\n TemplateRef,\n signal,\n ViewContainerRef,\n model,\n} from '@angular/core';\n\n/**\n * A container directive controls the visibility of its content.\n */\n@Directive()\nexport class DeferredContentAware {\n readonly contentVisible = signal(false);\n readonly preserveContent = model(false);\n}\n\n/**\n * DeferredContent loads/unloads the content based on the visibility.\n * The visibilty signal is sent from a parent directive implements\n * DeferredContentAware.\n *\n * Use this directive as a host directive. For example:\n *\n * ```ts\n * @Directive({\n * selector: 'ng-template[AccordionContent]',\n * hostDirectives: [DeferredContent],\n * })\n * class AccordionContent {}\n * ```\n */\n@Directive()\nexport class DeferredContent {\n private readonly _deferredContentAware = inject(DeferredContentAware, {optional: true});\n private readonly _templateRef = inject(TemplateRef);\n private readonly _viewContainerRef = inject(ViewContainerRef);\n private _isRendered = false;\n\n readonly deferredContentAware = signal(this._deferredContentAware);\n\n constructor() {\n afterRenderEffect(() => {\n if (this.deferredContentAware()?.contentVisible()) {\n if (this._isRendered) return;\n this._viewContainerRef.clear();\n this._viewContainerRef.createEmbeddedView(this._templateRef);\n this._isRendered = true;\n } else if (!this.deferredContentAware()?.preserveContent()) {\n this._viewContainerRef.clear();\n this._isRendered = false;\n }\n });\n }\n}\n"],"names":[],"mappings":";;;AAkBA;;AAEG;MAEU,oBAAoB,CAAA;AACtB,IAAA,cAAc,GAAG,MAAM,CAAC,KAAK,0DAAC;AAC9B,IAAA,eAAe,GAAG,KAAK,CAAC,KAAK,2DAAC;8GAF5B,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;kGAApB,oBAAoB,EAAA,YAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,eAAA,EAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,eAAA,EAAA,uBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;kGAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC;;AAMD;;;;;;;;;;;;;;AAcG;MAEU,eAAe,CAAA;IACT,qBAAqB,GAAG,MAAM,CAAC,oBAAoB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC;AACtE,IAAA,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC;AAClC,IAAA,iBAAiB,GAAG,MAAM,CAAC,gBAAgB,CAAC;IACrD,WAAW,GAAG,KAAK;AAElB,IAAA,oBAAoB,GAAG,MAAM,CAAC,IAAI,CAAC,qBAAqB,gEAAC;AAElE,IAAA,WAAA,GAAA;QACE,iBAAiB,CAAC,MAAK;YACrB,IAAI,IAAI,CAAC,oBAAoB,EAAE,EAAE,cAAc,EAAE,EAAE;gBACjD,IAAI,IAAI,CAAC,WAAW;oBAAE;AACtB,gBAAA,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE;gBAC9B,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,IAAI,CAAC,YAAY,CAAC;AAC5D,gBAAA,IAAI,CAAC,WAAW,GAAG,IAAI;;iBAClB,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,eAAe,EAAE,EAAE;AAC1D,gBAAA,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE;AAC9B,gBAAA,IAAI,CAAC,WAAW,GAAG,KAAK;;AAE5B,SAAC,CAAC;;8GAnBO,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;kGAAf,eAAe,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;kGAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B;;;;;"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { _IdGenerator } from '@angular/cdk/a11y';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, ElementRef, contentChildren, computed, input, booleanAttribute, afterRenderEffect, Directive, contentChild, model } from '@angular/core';
|
|
4
|
+
import { GridPattern, GridRowPattern, GridCellPattern, GridCellWidgetPattern } from './_widget-chunk.mjs';
|
|
5
|
+
|
|
6
|
+
/** A directive that provides grid-based navigation and selection behavior. */
|
|
7
|
+
class Grid {
|
|
8
|
+
/** A reference to the host element. */
|
|
9
|
+
_elementRef = inject(ElementRef);
|
|
10
|
+
/** The rows that make up the grid. */
|
|
11
|
+
_rows = contentChildren(GridRow, ...(ngDevMode ? [{ debugName: "_rows" }] : []));
|
|
12
|
+
/** The UI patterns for the rows in the grid. */
|
|
13
|
+
_rowPatterns = computed(() => this._rows().map(r => r.pattern), ...(ngDevMode ? [{ debugName: "_rowPatterns" }] : []));
|
|
14
|
+
/** The host native element. */
|
|
15
|
+
element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{ debugName: "element" }] : []));
|
|
16
|
+
/** Whether selection is enabled for the grid. */
|
|
17
|
+
enableSelection = input(false, ...(ngDevMode ? [{ debugName: "enableSelection", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
18
|
+
/** Whether the grid is disabled. */
|
|
19
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
20
|
+
/** Whether to skip disabled items during navigation. */
|
|
21
|
+
skipDisabled = input(true, ...(ngDevMode ? [{ debugName: "skipDisabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
22
|
+
/** The focus strategy used by the grid. */
|
|
23
|
+
focusMode = input('roving', ...(ngDevMode ? [{ debugName: "focusMode" }] : []));
|
|
24
|
+
/** The wrapping behavior for keyboard navigation along the row axis. */
|
|
25
|
+
rowWrap = input('loop', ...(ngDevMode ? [{ debugName: "rowWrap" }] : []));
|
|
26
|
+
/** The wrapping behavior for keyboard navigation along the column axis. */
|
|
27
|
+
colWrap = input('loop', ...(ngDevMode ? [{ debugName: "colWrap" }] : []));
|
|
28
|
+
/** The UI pattern for the grid. */
|
|
29
|
+
pattern = new GridPattern({
|
|
30
|
+
...this,
|
|
31
|
+
rows: this._rowPatterns,
|
|
32
|
+
getCell: e => this._getCell(e),
|
|
33
|
+
});
|
|
34
|
+
constructor() {
|
|
35
|
+
afterRenderEffect(() => this.pattern.resetStateEffect());
|
|
36
|
+
afterRenderEffect(() => this.pattern.focusEffect());
|
|
37
|
+
}
|
|
38
|
+
/** Gets the cell pattern for a given element. */
|
|
39
|
+
_getCell(element) {
|
|
40
|
+
const cellElement = element.closest('[ngGridCell]');
|
|
41
|
+
if (cellElement === undefined)
|
|
42
|
+
return;
|
|
43
|
+
const widgetElement = element.closest('[ngGridCellWidget]');
|
|
44
|
+
for (const row of this._rowPatterns()) {
|
|
45
|
+
for (const cell of row.inputs.cells()) {
|
|
46
|
+
if (cell.element() === cellElement ||
|
|
47
|
+
(widgetElement !== undefined && cell.element() === widgetElement)) {
|
|
48
|
+
return cell;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Grid, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
55
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.2.0-next.2", type: Grid, isStandalone: true, selector: "[ngGrid]", inputs: { enableSelection: { classPropertyName: "enableSelection", publicName: "enableSelection", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", 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 }, rowWrap: { classPropertyName: "rowWrap", publicName: "rowWrap", isSignal: true, isRequired: false, transformFunction: null }, colWrap: { classPropertyName: "colWrap", publicName: "colWrap", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "grid" }, listeners: { "keydown": "pattern.onKeydown($event)", "pointerdown": "pattern.onPointerdown($event)", "pointermove": "pattern.onPointermove($event)", "pointerup": "pattern.onPointerup($event)", "focusin": "pattern.onFocusIn($event)", "focusout": "pattern.onFocusOut($event)" }, properties: { "tabindex": "pattern.tabIndex()", "attr.aria-disabled": "pattern.disabled()", "attr.aria-activedescendant": "pattern.activeDescendant()" }, classAttribute: "grid" }, queries: [{ propertyName: "_rows", predicate: GridRow, isSignal: true }], exportAs: ["ngGrid"], ngImport: i0 });
|
|
56
|
+
}
|
|
57
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Grid, decorators: [{
|
|
58
|
+
type: Directive,
|
|
59
|
+
args: [{
|
|
60
|
+
selector: '[ngGrid]',
|
|
61
|
+
exportAs: 'ngGrid',
|
|
62
|
+
host: {
|
|
63
|
+
'class': 'grid',
|
|
64
|
+
'role': 'grid',
|
|
65
|
+
'[tabindex]': 'pattern.tabIndex()',
|
|
66
|
+
'[attr.aria-disabled]': 'pattern.disabled()',
|
|
67
|
+
'[attr.aria-activedescendant]': 'pattern.activeDescendant()',
|
|
68
|
+
'(keydown)': 'pattern.onKeydown($event)',
|
|
69
|
+
'(pointerdown)': 'pattern.onPointerdown($event)',
|
|
70
|
+
'(pointermove)': 'pattern.onPointermove($event)',
|
|
71
|
+
'(pointerup)': 'pattern.onPointerup($event)',
|
|
72
|
+
'(focusin)': 'pattern.onFocusIn($event)',
|
|
73
|
+
'(focusout)': 'pattern.onFocusOut($event)',
|
|
74
|
+
},
|
|
75
|
+
}]
|
|
76
|
+
}], ctorParameters: () => [] });
|
|
77
|
+
/** A directive that represents a row in a grid. */
|
|
78
|
+
class GridRow {
|
|
79
|
+
/** A reference to the host element. */
|
|
80
|
+
_elementRef = inject(ElementRef);
|
|
81
|
+
/** The cells that make up this row. */
|
|
82
|
+
_cells = contentChildren(GridCell, ...(ngDevMode ? [{ debugName: "_cells" }] : []));
|
|
83
|
+
/** The UI patterns for the cells in this row. */
|
|
84
|
+
_cellPatterns = computed(() => this._cells().map(c => c.pattern), ...(ngDevMode ? [{ debugName: "_cellPatterns" }] : []));
|
|
85
|
+
/** The parent grid. */
|
|
86
|
+
_grid = inject(Grid);
|
|
87
|
+
/** The parent grid UI pattern. */
|
|
88
|
+
grid = computed(() => this._grid.pattern, ...(ngDevMode ? [{ debugName: "grid" }] : []));
|
|
89
|
+
/** The host native element. */
|
|
90
|
+
element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{ debugName: "element" }] : []));
|
|
91
|
+
/** The ARIA role for the row. */
|
|
92
|
+
role = input('row', ...(ngDevMode ? [{ debugName: "role" }] : []));
|
|
93
|
+
/** The index of this row within the grid. */
|
|
94
|
+
rowIndex = input(...(ngDevMode ? [undefined, { debugName: "rowIndex" }] : []));
|
|
95
|
+
/** The UI pattern for the grid row. */
|
|
96
|
+
pattern = new GridRowPattern({
|
|
97
|
+
...this,
|
|
98
|
+
cells: this._cellPatterns,
|
|
99
|
+
});
|
|
100
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: GridRow, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
101
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.2.0-next.2", type: GridRow, isStandalone: true, selector: "[ngGridRow]", inputs: { role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, rowIndex: { classPropertyName: "rowIndex", publicName: "rowIndex", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.role": "role()" }, classAttribute: "grid-row" }, queries: [{ propertyName: "_cells", predicate: GridCell, isSignal: true }], exportAs: ["ngGridRow"], ngImport: i0 });
|
|
102
|
+
}
|
|
103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: GridRow, decorators: [{
|
|
104
|
+
type: Directive,
|
|
105
|
+
args: [{
|
|
106
|
+
selector: '[ngGridRow]',
|
|
107
|
+
exportAs: 'ngGridRow',
|
|
108
|
+
host: {
|
|
109
|
+
'class': 'grid-row',
|
|
110
|
+
'[attr.role]': 'role()',
|
|
111
|
+
},
|
|
112
|
+
}]
|
|
113
|
+
}] });
|
|
114
|
+
/** A directive that represents a cell in a grid. */
|
|
115
|
+
class GridCell {
|
|
116
|
+
/** A reference to the host element. */
|
|
117
|
+
_elementRef = inject(ElementRef);
|
|
118
|
+
/** The widget contained within this cell, if any. */
|
|
119
|
+
_widgets = contentChild(GridCellWidget, ...(ngDevMode ? [{ debugName: "_widgets" }] : []));
|
|
120
|
+
/** The UI pattern for the widget in this cell. */
|
|
121
|
+
_widgetPattern = computed(() => this._widgets()?.pattern, ...(ngDevMode ? [{ debugName: "_widgetPattern" }] : []));
|
|
122
|
+
/** The parent row. */
|
|
123
|
+
_row = inject(GridRow);
|
|
124
|
+
/** A unique identifier for the cell. */
|
|
125
|
+
_id = inject(_IdGenerator).getId('ng-grid-cell-');
|
|
126
|
+
/** The host native element. */
|
|
127
|
+
element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{ debugName: "element" }] : []));
|
|
128
|
+
/** The ARIA role for the cell. */
|
|
129
|
+
role = input('gridcell', ...(ngDevMode ? [{ debugName: "role" }] : []));
|
|
130
|
+
/** The number of rows the cell should span. */
|
|
131
|
+
rowSpan = input(1, ...(ngDevMode ? [{ debugName: "rowSpan" }] : []));
|
|
132
|
+
/** The number of columns the cell should span. */
|
|
133
|
+
colSpan = input(1, ...(ngDevMode ? [{ debugName: "colSpan" }] : []));
|
|
134
|
+
/** The index of this cell's row within the grid. */
|
|
135
|
+
rowIndex = input(...(ngDevMode ? [undefined, { debugName: "rowIndex" }] : []));
|
|
136
|
+
/** The index of this cell's column within the grid. */
|
|
137
|
+
colIndex = input(...(ngDevMode ? [undefined, { debugName: "colIndex" }] : []));
|
|
138
|
+
/** Whether the cell is disabled. */
|
|
139
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
|
|
140
|
+
/** Whether the cell is selected. */
|
|
141
|
+
selected = model(false, ...(ngDevMode ? [{ debugName: "selected" }] : []));
|
|
142
|
+
/** Whether the cell is selectable. */
|
|
143
|
+
selectable = input(true, ...(ngDevMode ? [{ debugName: "selectable" }] : []));
|
|
144
|
+
/** The UI pattern for the grid cell. */
|
|
145
|
+
pattern = new GridCellPattern({
|
|
146
|
+
...this,
|
|
147
|
+
id: () => this._id,
|
|
148
|
+
grid: this._row.grid,
|
|
149
|
+
row: () => this._row.pattern,
|
|
150
|
+
widget: this._widgetPattern,
|
|
151
|
+
});
|
|
152
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: GridCell, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
153
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "20.2.0-next.2", type: GridCell, isStandalone: true, selector: "[ngGridCell]", inputs: { role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, rowSpan: { classPropertyName: "rowSpan", publicName: "rowSpan", isSignal: true, isRequired: false, transformFunction: null }, colSpan: { classPropertyName: "colSpan", publicName: "colSpan", isSignal: true, isRequired: false, transformFunction: null }, rowIndex: { classPropertyName: "rowIndex", publicName: "rowIndex", isSignal: true, isRequired: false, transformFunction: null }, colIndex: { classPropertyName: "colIndex", publicName: "colIndex", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, selectable: { classPropertyName: "selectable", publicName: "selectable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange" }, host: { properties: { "attr.role": "role()", "attr.id": "pattern.id()", "attr.rowspan": "pattern.rowSpan()", "attr.colspan": "pattern.colSpan()", "attr.data-active": "pattern.active()", "attr.aria-disabled": "pattern.disabled()", "attr.aria-rowspan": "pattern.rowSpan()", "attr.aria-colspan": "pattern.colSpan()", "attr.aria-rowindex": "pattern.ariaRowIndex()", "attr.aria-colindex": "pattern.ariaColIndex()", "attr.aria-selected": "pattern.ariaSelected()", "tabindex": "pattern.tabIndex()" }, classAttribute: "grid-cell" }, queries: [{ propertyName: "_widgets", first: true, predicate: GridCellWidget, descendants: true, isSignal: true }], exportAs: ["ngGridCell"], ngImport: i0 });
|
|
154
|
+
}
|
|
155
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: GridCell, decorators: [{
|
|
156
|
+
type: Directive,
|
|
157
|
+
args: [{
|
|
158
|
+
selector: '[ngGridCell]',
|
|
159
|
+
exportAs: 'ngGridCell',
|
|
160
|
+
host: {
|
|
161
|
+
'class': 'grid-cell',
|
|
162
|
+
'[attr.role]': 'role()',
|
|
163
|
+
'[attr.id]': 'pattern.id()',
|
|
164
|
+
'[attr.rowspan]': 'pattern.rowSpan()',
|
|
165
|
+
'[attr.colspan]': 'pattern.colSpan()',
|
|
166
|
+
'[attr.data-active]': 'pattern.active()',
|
|
167
|
+
'[attr.aria-disabled]': 'pattern.disabled()',
|
|
168
|
+
'[attr.aria-rowspan]': 'pattern.rowSpan()',
|
|
169
|
+
'[attr.aria-colspan]': 'pattern.colSpan()',
|
|
170
|
+
'[attr.aria-rowindex]': 'pattern.ariaRowIndex()',
|
|
171
|
+
'[attr.aria-colindex]': 'pattern.ariaColIndex()',
|
|
172
|
+
'[attr.aria-selected]': 'pattern.ariaSelected()',
|
|
173
|
+
'[tabindex]': 'pattern.tabIndex()',
|
|
174
|
+
},
|
|
175
|
+
}]
|
|
176
|
+
}] });
|
|
177
|
+
/** A directive that represents a widget inside a grid cell. */
|
|
178
|
+
class GridCellWidget {
|
|
179
|
+
/** A reference to the host element. */
|
|
180
|
+
_elementRef = inject(ElementRef);
|
|
181
|
+
/** The parent cell. */
|
|
182
|
+
_cell = inject(GridCell);
|
|
183
|
+
/** The host native element. */
|
|
184
|
+
element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{ debugName: "element" }] : []));
|
|
185
|
+
/** Whether the widget is activated and the grid navigation should be paused. */
|
|
186
|
+
activate = model(false, ...(ngDevMode ? [{ debugName: "activate" }] : []));
|
|
187
|
+
/** The UI pattern for the grid cell widget. */
|
|
188
|
+
pattern = new GridCellWidgetPattern({
|
|
189
|
+
...this,
|
|
190
|
+
cell: () => this._cell.pattern,
|
|
191
|
+
});
|
|
192
|
+
/** Focuses the widget. */
|
|
193
|
+
focus() {
|
|
194
|
+
this.element().focus();
|
|
195
|
+
}
|
|
196
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: GridCellWidget, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
197
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: GridCellWidget, isStandalone: true, selector: "[ngGridCellWidget]", inputs: { activate: { classPropertyName: "activate", publicName: "activate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activate: "activateChange" }, host: { properties: { "attr.data-active": "pattern.active()", "tabindex": "pattern.tabIndex()" }, classAttribute: "grid-cell-widget" }, exportAs: ["ngGridCellWidget"], ngImport: i0 });
|
|
198
|
+
}
|
|
199
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: GridCellWidget, decorators: [{
|
|
200
|
+
type: Directive,
|
|
201
|
+
args: [{
|
|
202
|
+
selector: '[ngGridCellWidget]',
|
|
203
|
+
exportAs: 'ngGridCellWidget',
|
|
204
|
+
host: {
|
|
205
|
+
'class': 'grid-cell-widget',
|
|
206
|
+
'[attr.data-active]': 'pattern.active()',
|
|
207
|
+
'[tabindex]': 'pattern.tabIndex()',
|
|
208
|
+
},
|
|
209
|
+
}]
|
|
210
|
+
}] });
|
|
211
|
+
|
|
212
|
+
export { Grid, GridCell, GridCellWidget, GridRow };
|
|
213
|
+
//# sourceMappingURL=grid.mjs.map
|
|
@@ -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 '../ui-patterns';\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":[],"mappings":";;;;;AAwBA;MAkBa,IAAI,CAAA;;AAEE,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;;AAGhC,IAAA,KAAK,GAAG,eAAe,CAAC,OAAO,iDAAC;;IAGhC,YAAY,GAA6B,QAAQ,CAAC,MACjE,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,cAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CACjC;;AAGQ,IAAA,OAAO,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,SAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAC;;AAGxD,IAAA,eAAe,GAAG,KAAK,CAAC,KAAK,mDAAG,SAAS,EAAE,gBAA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EAAA,UAAA,EAAA,oBAAA,EAAA,EAAA,cAAA,EAAA,kBAAA,EAAA,EAAA,QAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;kGAAd,cAAc,EAAA,UAAA,EAAA,CAAA;kBAT1B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,oBAAoB;AAC9B,oBAAA,QAAQ,EAAE,kBAAkB;AAC5B,oBAAA,IAAI,EAAE;AACJ,wBAAA,OAAO,EAAE,kBAAkB;AAC3B,wBAAA,oBAAoB,EAAE,kBAAkB;AACxC,wBAAA,YAAY,EAAE,oBAAoB;AACnC,qBAAA;AACF,iBAAA;;;;;"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
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';
|
|
4
|
+
import { Directionality } from '@angular/cdk/bidi';
|
|
5
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
6
|
+
import { _IdGenerator } from '@angular/cdk/a11y';
|
|
7
|
+
import { ComboboxPopup } from './combobox.mjs';
|
|
8
|
+
import '@angular/aria/deferred-content';
|
|
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
|
+
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,
|
|
33
|
+
});
|
|
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,
|
|
43
|
+
});
|
|
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 });
|
|
122
|
+
}
|
|
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. */
|
|
146
|
+
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 });
|
|
181
|
+
}
|
|
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
|
+
}] });
|
|
198
|
+
|
|
199
|
+
export { Listbox, Option };
|
|
200
|
+
//# sourceMappingURL=listbox.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listbox.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/aria/listbox/listbox.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 {\n afterRenderEffect,\n booleanAttribute,\n computed,\n contentChildren,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n signal,\n untracked,\n} from '@angular/core';\nimport {ComboboxListboxPattern, ListboxPattern, OptionPattern} from '@angular/aria/ui-patterns';\nimport {Directionality} from '@angular/cdk/bidi';\nimport {toSignal} from '@angular/core/rxjs-interop';\nimport {_IdGenerator} from '@angular/cdk/a11y';\nimport {ComboboxPopup} from '../combobox';\n\n/**\n * A listbox container.\n *\n * Listboxes are used to display a list of items for a user to select from. The Listbox is meant\n * to be used in conjunction with Option as follows:\n *\n * ```html\n * <ul ngListbox>\n * <li [value]=\"1\" ngOption>Item 1</li>\n * <li [value]=\"2\" ngOption>Item 2</li>\n * <li [value]=\"3\" ngOption>Item 3</li>\n * </ul>\n * ```\n */\n@Directive({\n selector: '[ngListbox]',\n exportAs: 'ngListbox',\n host: {\n 'role': 'listbox',\n 'class': 'ng-listbox',\n '[attr.id]': 'id()',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.aria-readonly]': 'pattern.readonly()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n '[attr.aria-orientation]': 'pattern.orientation()',\n '[attr.aria-multiselectable]': 'pattern.multi()',\n '[attr.aria-activedescendant]': 'pattern.activedescendant()',\n '(keydown)': 'pattern.onKeydown($event)',\n '(pointerdown)': 'pattern.onPointerdown($event)',\n '(focusin)': 'onFocus()',\n },\n hostDirectives: [{directive: ComboboxPopup}],\n})\nexport class Listbox<V> {\n /** A unique identifier for the listbox. */\n private readonly _generatedId = inject(_IdGenerator).getId('ng-listbox-');\n\n // TODO(wagnermaciel): https://github.com/angular/components/pull/30495#discussion_r1972601144.\n /** A unique identifier for the listbox. */\n protected id = computed(() => this._generatedId);\n\n /** A reference to the parent combobox popup, if one exists. */\n private readonly _popup = inject<ComboboxPopup<V>>(ComboboxPopup, {\n optional: true,\n });\n\n /** A reference to the listbox element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The directionality (LTR / RTL) context for the application (or a subtree of it). */\n private readonly _directionality = inject(Directionality);\n\n /** The Options nested inside of the Listbox. */\n private readonly _options = contentChildren(Option, {descendants: true});\n\n /** A signal wrapper for directionality. */\n protected textDirection = toSignal(this._directionality.change, {\n initialValue: this._directionality.value,\n });\n\n /** The Option UIPatterns of the child Options. */\n protected items = computed(() => this._options().map(option => option.pattern));\n\n /** Whether the list is vertically or horizontally oriented. */\n orientation = input<'vertical' | 'horizontal'>('vertical');\n\n /** Whether multiple items in the list can be selected at once. */\n multi = input(false, {transform: booleanAttribute});\n\n /** Whether focus should wrap when navigating. */\n wrap = input(true, {transform: booleanAttribute});\n\n /** Whether disabled items in the list should be skipped when navigating. */\n skipDisabled = input(true, {transform: booleanAttribute});\n\n /** The focus strategy used by the list. */\n focusMode = input<'roving' | 'activedescendant'>('roving');\n\n /** The selection strategy used by the list. */\n selectionMode = input<'follow' | 'explicit'>('follow');\n\n /** The amount of time before the typeahead search is reset. */\n typeaheadDelay = input<number>(0.5); // Picked arbitrarily.\n\n /** Whether the listbox is disabled. */\n disabled = input(false, {transform: booleanAttribute});\n\n /** Whether the listbox is readonly. */\n readonly = input(false, {transform: booleanAttribute});\n\n /** The values of the current selected items. */\n value = model<V[]>([]);\n\n /** The Listbox UIPattern. */\n pattern: ListboxPattern<V>;\n\n /** Whether the listbox has received focus yet. */\n private _hasFocused = signal(false);\n\n constructor() {\n const inputs = {\n ...this,\n id: this.id,\n items: this.items,\n activeItem: signal(undefined),\n textDirection: this.textDirection,\n element: () => this._elementRef.nativeElement,\n combobox: () => this._popup?.combobox?.pattern,\n };\n\n this.pattern = this._popup?.combobox\n ? new ComboboxListboxPattern<V>(inputs)\n : new ListboxPattern<V>(inputs);\n\n if (this._popup) {\n this._popup.controls.set(this.pattern as ComboboxListboxPattern<V>);\n }\n\n afterRenderEffect(() => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const violations = this.pattern.validate();\n for (const violation of violations) {\n console.error(violation);\n }\n }\n });\n\n afterRenderEffect(() => {\n if (!this._hasFocused()) {\n this.pattern.setDefaultState();\n }\n });\n\n // Ensure that if the active item is removed from\n // the list, the listbox updates it's focus state.\n afterRenderEffect(() => {\n const items = inputs.items();\n const activeItem = untracked(() => inputs.activeItem());\n\n if (!items.some(i => i === activeItem) && activeItem) {\n this.pattern.listBehavior.unfocus();\n }\n });\n\n // Ensure that the value is always in sync with the available options.\n afterRenderEffect(() => {\n const items = inputs.items();\n const value = untracked(() => this.value());\n\n if (items && value.some(v => !items.some(i => i.value() === v))) {\n this.value.set(value.filter(v => items.some(i => i.value() === v)));\n }\n });\n }\n\n onFocus() {\n this._hasFocused.set(true);\n }\n}\n\n/** A selectable option in a Listbox. */\n@Directive({\n selector: '[ngOption]',\n exportAs: 'ngOption',\n host: {\n 'role': 'option',\n 'class': 'ng-option',\n '[attr.data-active]': 'pattern.active()',\n '[attr.id]': 'pattern.id()',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.aria-selected]': 'pattern.selected()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n },\n})\nexport class Option<V> {\n /** A reference to the option element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The parent Listbox. */\n private readonly _listbox = inject(Listbox);\n\n /** A unique identifier for the option. */\n private readonly _generatedId = inject(_IdGenerator).getId('ng-option-');\n\n // TODO(wagnermaciel): https://github.com/angular/components/pull/30495#discussion_r1972601144.\n /** A unique identifier for the option. */\n protected id = computed(() => this._generatedId);\n\n // TODO(wagnermaciel): See if we want to change how we handle this since textContent is not\n // reactive. See https://github.com/angular/components/pull/30495#discussion_r1961260216.\n /** The text used by the typeahead search. */\n protected searchTerm = computed(() => this.label() ?? this.element().textContent);\n\n /** The parent Listbox UIPattern. */\n protected listbox = computed(() => this._listbox.pattern);\n\n /** A reference to the option element to be focused on navigation. */\n protected element = computed(() => this._elementRef.nativeElement);\n\n /** The value of the option. */\n value = input.required<V>();\n\n /** Whether an item is disabled. */\n disabled = input(false, {transform: booleanAttribute});\n\n /** The text used by the typeahead search. */\n label = input<string>();\n\n /** The Option UIPattern. */\n pattern = new OptionPattern<V>({\n ...this,\n id: this.id,\n value: this.value,\n listbox: this.listbox,\n element: this.element,\n searchTerm: this.searchTerm,\n });\n}\n"],"names":["i1.ComboboxPopup"],"mappings":";;;;;;;;;AA2BA;;;;;;;;;;;;;AAaG;MAoBU,OAAO,CAAA;;IAED,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;;;IAI/D,EAAE,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,YAAY,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,EAAA,IAAA,EAAA,CAAA,GAAA,EAAA,CAAA,CAAC;;AAG/B,IAAA,MAAM,GAAG,MAAM,CAAmB,aAAa,EAAE;AAChE,QAAA,QAAQ,EAAE,IAAI;AACf,KAAA,CAAC;;AAGe,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;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