@angular/aria 0.0.0 → 21.0.0-next.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,299 @@
1
+ import * as i1 from '@angular/aria/deferred-content';
2
+ import { DeferredContentAware, DeferredContent } from '@angular/aria/deferred-content';
3
+ import { _IdGenerator } from '@angular/cdk/a11y';
4
+ import { Directionality } from '@angular/cdk/bidi';
5
+ import * as i0 from '@angular/core';
6
+ import { signal, computed, Directive, inject, ElementRef, linkedSignal, input, booleanAttribute, model, afterRenderEffect } from '@angular/core';
7
+ import { TabListPattern, TabPattern, TabPanelPattern } from '@angular/aria/ui-patterns';
8
+
9
+ /**
10
+ * Sort directives by their document order.
11
+ */
12
+ function sortDirectives(a, b) {
13
+ return (a.element().compareDocumentPosition(b.element()) & Node.DOCUMENT_POSITION_PRECEDING) > 0
14
+ ? 1
15
+ : -1;
16
+ }
17
+ /**
18
+ * A Tabs container.
19
+ *
20
+ * Represents a set of layered sections of content. The Tabs is a container meant to be used with
21
+ * TabList, Tab, and TabPanel as follows:
22
+ *
23
+ * ```html
24
+ * <div ngTabs>
25
+ * <ul ngTabList>
26
+ * <li ngTab value="tab1">Tab 1</li>
27
+ * <li ngTab value="tab2">Tab 2</li>
28
+ * <li ngTab value="tab3">Tab 3</li>
29
+ * </ul>
30
+ *
31
+ * <div ngTabPanel value="tab1">
32
+ * <ng-template ngTabContent>Tab content 1</ng-template>
33
+ * </div>
34
+ * <div ngTabPanel value="tab2">
35
+ * <ng-template ngTabContent>Tab content 2</ng-template>
36
+ * </div>
37
+ * <div ngTabPanel value="tab3">
38
+ * <ng-template ngTabContent>Tab content 3</ng-template>
39
+ * </div>
40
+ * ```
41
+ */
42
+ class Tabs {
43
+ /** The TabList nested inside of the container. */
44
+ _tablist = signal(undefined, ...(ngDevMode ? [{ debugName: "_tablist" }] : []));
45
+ /** The TabPanels nested inside of the container. */
46
+ _unorderedPanels = signal(new Set(), ...(ngDevMode ? [{ debugName: "_unorderedPanels" }] : []));
47
+ /** The Tab UIPattern of the child Tabs. */
48
+ tabs = computed(() => this._tablist()?.tabs(), ...(ngDevMode ? [{ debugName: "tabs" }] : []));
49
+ /** The TabPanel UIPattern of the child TabPanels. */
50
+ unorderedTabpanels = computed(() => [...this._unorderedPanels()].map(tabpanel => tabpanel.pattern), ...(ngDevMode ? [{ debugName: "unorderedTabpanels" }] : []));
51
+ register(child) {
52
+ if (child instanceof TabList) {
53
+ this._tablist.set(child);
54
+ }
55
+ if (child instanceof TabPanel) {
56
+ this._unorderedPanels().add(child);
57
+ this._unorderedPanels.set(new Set(this._unorderedPanels()));
58
+ }
59
+ }
60
+ deregister(child) {
61
+ if (child instanceof TabList) {
62
+ this._tablist.set(undefined);
63
+ }
64
+ if (child instanceof TabPanel) {
65
+ this._unorderedPanels().delete(child);
66
+ this._unorderedPanels.set(new Set(this._unorderedPanels()));
67
+ }
68
+ }
69
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Tabs, deps: [], target: i0.ɵɵFactoryTarget.Directive });
70
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: Tabs, isStandalone: true, selector: "[ngTabs]", host: { classAttribute: "ng-tabs" }, exportAs: ["ngTabs"], ngImport: i0 });
71
+ }
72
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Tabs, decorators: [{
73
+ type: Directive,
74
+ args: [{
75
+ selector: '[ngTabs]',
76
+ exportAs: 'ngTabs',
77
+ host: {
78
+ 'class': 'ng-tabs',
79
+ },
80
+ }]
81
+ }] });
82
+ /**
83
+ * A TabList container.
84
+ *
85
+ * Controls a list of Tab(s).
86
+ */
87
+ class TabList {
88
+ /** A reference to the tab list element. */
89
+ _elementRef = inject(ElementRef);
90
+ /** The parent Tabs. */
91
+ _tabs = inject(Tabs);
92
+ /** The Tabs nested inside of the TabList. */
93
+ _unorderedTabs = signal(new Set(), ...(ngDevMode ? [{ debugName: "_unorderedTabs" }] : []));
94
+ /** The internal tab selection state. */
95
+ _selection = linkedSignal(() => this.selectedTab() ? [this.selectedTab()] : []);
96
+ /** Text direction. */
97
+ textDirection = inject(Directionality).valueSignal;
98
+ /** The Tab UIPatterns of the child Tabs. */
99
+ tabs = computed(() => [...this._unorderedTabs()].sort(sortDirectives).map(tab => tab.pattern), ...(ngDevMode ? [{ debugName: "tabs" }] : []));
100
+ /** Whether the tablist is vertically or horizontally oriented. */
101
+ orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : []));
102
+ /** Whether focus should wrap when navigating. */
103
+ wrap = input(true, ...(ngDevMode ? [{ debugName: "wrap", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
104
+ /** Whether disabled items in the list should be skipped when navigating. */
105
+ skipDisabled = input(true, ...(ngDevMode ? [{ debugName: "skipDisabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
106
+ /** The focus strategy used by the tablist. */
107
+ focusMode = input('roving', ...(ngDevMode ? [{ debugName: "focusMode" }] : []));
108
+ /** The selection strategy used by the tablist. */
109
+ selectionMode = input('follow', ...(ngDevMode ? [{ debugName: "selectionMode" }] : []));
110
+ /** Whether the tablist is disabled. */
111
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
112
+ /** The current selected tab. */
113
+ selectedTab = model(...(ngDevMode ? [undefined, { debugName: "selectedTab" }] : []));
114
+ /** The TabList UIPattern. */
115
+ pattern = new TabListPattern({
116
+ ...this,
117
+ items: this.tabs,
118
+ value: this._selection,
119
+ activeItem: signal(undefined),
120
+ element: () => this._elementRef.nativeElement,
121
+ });
122
+ /** Whether the tree has received focus yet. */
123
+ _hasFocused = signal(false, ...(ngDevMode ? [{ debugName: "_hasFocused" }] : []));
124
+ constructor() {
125
+ afterRenderEffect(() => this.selectedTab.set(this._selection()[0]));
126
+ afterRenderEffect(() => {
127
+ if (!this._hasFocused()) {
128
+ this.pattern.setDefaultState();
129
+ }
130
+ });
131
+ }
132
+ onFocus() {
133
+ this._hasFocused.set(true);
134
+ }
135
+ ngOnInit() {
136
+ this._tabs.register(this);
137
+ }
138
+ ngOnDestroy() {
139
+ this._tabs.deregister(this);
140
+ }
141
+ register(child) {
142
+ this._unorderedTabs().add(child);
143
+ this._unorderedTabs.set(new Set(this._unorderedTabs()));
144
+ }
145
+ deregister(child) {
146
+ this._unorderedTabs().delete(child);
147
+ this._unorderedTabs.set(new Set(this._unorderedTabs()));
148
+ }
149
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: TabList, deps: [], target: i0.ɵɵFactoryTarget.Directive });
150
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: TabList, isStandalone: true, selector: "[ngTabList]", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", 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 }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, selectedTab: { classPropertyName: "selectedTab", publicName: "selectedTab", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedTab: "selectedTabChange" }, host: { attributes: { "role": "tablist" }, listeners: { "keydown": "pattern.onKeydown($event)", "pointerdown": "pattern.onPointerdown($event)", "focusin": "onFocus()" }, properties: { "attr.tabindex": "pattern.tabindex()", "attr.aria-disabled": "pattern.disabled()", "attr.aria-orientation": "pattern.orientation()", "attr.aria-activedescendant": "pattern.activedescendant()" }, classAttribute: "ng-tablist" }, exportAs: ["ngTabList"], ngImport: i0 });
151
+ }
152
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: TabList, decorators: [{
153
+ type: Directive,
154
+ args: [{
155
+ selector: '[ngTabList]',
156
+ exportAs: 'ngTabList',
157
+ host: {
158
+ 'role': 'tablist',
159
+ 'class': 'ng-tablist',
160
+ '[attr.tabindex]': 'pattern.tabindex()',
161
+ '[attr.aria-disabled]': 'pattern.disabled()',
162
+ '[attr.aria-orientation]': 'pattern.orientation()',
163
+ '[attr.aria-activedescendant]': 'pattern.activedescendant()',
164
+ '(keydown)': 'pattern.onKeydown($event)',
165
+ '(pointerdown)': 'pattern.onPointerdown($event)',
166
+ '(focusin)': 'onFocus()',
167
+ },
168
+ }]
169
+ }], ctorParameters: () => [] });
170
+ /** A selectable tab in a TabList. */
171
+ class Tab {
172
+ /** A reference to the tab element. */
173
+ _elementRef = inject(ElementRef);
174
+ /** The parent Tabs. */
175
+ _tabs = inject(Tabs);
176
+ /** The parent TabList. */
177
+ _tabList = inject(TabList);
178
+ /** A global unique identifier for the tab. */
179
+ _id = inject(_IdGenerator).getId('ng-tab-');
180
+ /** The host native element. */
181
+ element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{ debugName: "element" }] : []));
182
+ /** The parent TabList UIPattern. */
183
+ tablist = computed(() => this._tabList.pattern, ...(ngDevMode ? [{ debugName: "tablist" }] : []));
184
+ /** The TabPanel UIPattern associated with the tab */
185
+ tabpanel = computed(() => this._tabs.unorderedTabpanels().find(tabpanel => tabpanel.value() === this.value()), ...(ngDevMode ? [{ debugName: "tabpanel" }] : []));
186
+ /** Whether a tab is disabled. */
187
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
188
+ /** A local unique identifier for the tab. */
189
+ value = input.required(...(ngDevMode ? [{ debugName: "value" }] : []));
190
+ /** The Tab UIPattern. */
191
+ pattern = new TabPattern({
192
+ ...this,
193
+ id: () => this._id,
194
+ tablist: this.tablist,
195
+ tabpanel: this.tabpanel,
196
+ value: this.value,
197
+ });
198
+ ngOnInit() {
199
+ this._tabList.register(this);
200
+ }
201
+ ngOnDestroy() {
202
+ this._tabList.deregister(this);
203
+ }
204
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Tab, deps: [], target: i0.ɵɵFactoryTarget.Directive });
205
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: Tab, isStandalone: true, selector: "[ngTab]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "tab" }, properties: { "attr.data-active": "pattern.active()", "attr.id": "pattern.id()", "attr.tabindex": "pattern.tabindex()", "attr.aria-selected": "pattern.selected()", "attr.aria-disabled": "pattern.disabled()", "attr.aria-controls": "pattern.controls()" }, classAttribute: "ng-tab" }, exportAs: ["ngTab"], ngImport: i0 });
206
+ }
207
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Tab, decorators: [{
208
+ type: Directive,
209
+ args: [{
210
+ selector: '[ngTab]',
211
+ exportAs: 'ngTab',
212
+ host: {
213
+ 'role': 'tab',
214
+ 'class': 'ng-tab',
215
+ '[attr.data-active]': 'pattern.active()',
216
+ '[attr.id]': 'pattern.id()',
217
+ '[attr.tabindex]': 'pattern.tabindex()',
218
+ '[attr.aria-selected]': 'pattern.selected()',
219
+ '[attr.aria-disabled]': 'pattern.disabled()',
220
+ '[attr.aria-controls]': 'pattern.controls()',
221
+ },
222
+ }]
223
+ }] });
224
+ /**
225
+ * A TabPanel container for the resources of layered content associated with a tab.
226
+ *
227
+ * If a tabpanel is hidden due to its corresponding tab is not activated, the `inert` attribute
228
+ * will be applied to the tabpanel element to remove it from the accessibility tree and stop
229
+ * all the keyboard and pointer interactions. Note that this does not visually hide the tabpenl
230
+ * and a proper styling is required.
231
+ */
232
+ class TabPanel {
233
+ /** The DeferredContentAware host directive. */
234
+ _deferredContentAware = inject(DeferredContentAware);
235
+ /** The parent Tabs. */
236
+ _Tabs = inject(Tabs);
237
+ /** A global unique identifier for the tab. */
238
+ _id = inject(_IdGenerator).getId('ng-tabpanel-');
239
+ /** The Tab UIPattern associated with the tabpanel */
240
+ tab = computed(() => this._Tabs.tabs()?.find(tab => tab.value() === this.value()), ...(ngDevMode ? [{ debugName: "tab" }] : []));
241
+ /** A local unique identifier for the tabpanel. */
242
+ value = input.required(...(ngDevMode ? [{ debugName: "value" }] : []));
243
+ /** The TabPanel UIPattern. */
244
+ pattern = new TabPanelPattern({
245
+ ...this,
246
+ id: () => this._id,
247
+ tab: this.tab,
248
+ });
249
+ constructor() {
250
+ afterRenderEffect(() => this._deferredContentAware.contentVisible.set(!this.pattern.hidden()));
251
+ }
252
+ ngOnInit() {
253
+ this._Tabs.register(this);
254
+ }
255
+ ngOnDestroy() {
256
+ this._Tabs.deregister(this);
257
+ }
258
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: TabPanel, deps: [], target: i0.ɵɵFactoryTarget.Directive });
259
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: TabPanel, isStandalone: true, selector: "[ngTabPanel]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, host: { attributes: { "role": "tabpanel" }, properties: { "attr.id": "pattern.id()", "attr.tabindex": "pattern.tabindex()", "attr.inert": "pattern.hidden() ? true : null", "attr.aria-labelledby": "pattern.labelledBy()" }, classAttribute: "ng-tabpanel" }, exportAs: ["ngTabPanel"], hostDirectives: [{ directive: i1.DeferredContentAware, inputs: ["preserveContent", "preserveContent"] }], ngImport: i0 });
260
+ }
261
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: TabPanel, decorators: [{
262
+ type: Directive,
263
+ args: [{
264
+ selector: '[ngTabPanel]',
265
+ exportAs: 'ngTabPanel',
266
+ host: {
267
+ 'role': 'tabpanel',
268
+ 'class': 'ng-tabpanel',
269
+ '[attr.id]': 'pattern.id()',
270
+ '[attr.tabindex]': 'pattern.tabindex()',
271
+ '[attr.inert]': 'pattern.hidden() ? true : null',
272
+ '[attr.aria-labelledby]': 'pattern.labelledBy()',
273
+ },
274
+ hostDirectives: [
275
+ {
276
+ directive: DeferredContentAware,
277
+ inputs: ['preserveContent'],
278
+ },
279
+ ],
280
+ }]
281
+ }], ctorParameters: () => [] });
282
+ /**
283
+ * A TabContent container for the lazy-loaded content.
284
+ */
285
+ class TabContent {
286
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: TabContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
287
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: TabContent, isStandalone: true, selector: "ng-template[ngTabContent]", exportAs: ["ngTabContent"], hostDirectives: [{ directive: i1.DeferredContent }], ngImport: i0 });
288
+ }
289
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: TabContent, decorators: [{
290
+ type: Directive,
291
+ args: [{
292
+ selector: 'ng-template[ngTabContent]',
293
+ exportAs: 'ngTabContent',
294
+ hostDirectives: [DeferredContent],
295
+ }]
296
+ }] });
297
+
298
+ export { Tab, TabContent, TabList, TabPanel, Tabs };
299
+ //# sourceMappingURL=tabs.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/aria/tabs/tabs.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 {DeferredContent, DeferredContentAware} from '@angular/aria/deferred-content';\nimport {_IdGenerator} from '@angular/cdk/a11y';\nimport {Directionality} from '@angular/cdk/bidi';\nimport {\n booleanAttribute,\n computed,\n Directive,\n ElementRef,\n inject,\n input,\n model,\n linkedSignal,\n signal,\n Signal,\n afterRenderEffect,\n OnInit,\n OnDestroy,\n} from '@angular/core';\nimport {TabListPattern, TabPanelPattern, TabPattern} from '@angular/aria/ui-patterns';\n\ninterface HasElement {\n element: Signal<HTMLElement>;\n}\n\n/**\n * Sort directives by their document order.\n */\nfunction sortDirectives(a: HasElement, b: HasElement) {\n return (a.element().compareDocumentPosition(b.element()) & Node.DOCUMENT_POSITION_PRECEDING) > 0\n ? 1\n : -1;\n}\n\n/**\n * A Tabs container.\n *\n * Represents a set of layered sections of content. The Tabs is a container meant to be used with\n * TabList, Tab, and TabPanel as follows:\n *\n * ```html\n * <div ngTabs>\n * <ul ngTabList>\n * <li ngTab value=\"tab1\">Tab 1</li>\n * <li ngTab value=\"tab2\">Tab 2</li>\n * <li ngTab value=\"tab3\">Tab 3</li>\n * </ul>\n *\n * <div ngTabPanel value=\"tab1\">\n * <ng-template ngTabContent>Tab content 1</ng-template>\n * </div>\n * <div ngTabPanel value=\"tab2\">\n * <ng-template ngTabContent>Tab content 2</ng-template>\n * </div>\n * <div ngTabPanel value=\"tab3\">\n * <ng-template ngTabContent>Tab content 3</ng-template>\n * </div>\n * ```\n */\n@Directive({\n selector: '[ngTabs]',\n exportAs: 'ngTabs',\n host: {\n 'class': 'ng-tabs',\n },\n})\nexport class Tabs {\n /** The TabList nested inside of the container. */\n private readonly _tablist = signal<TabList | undefined>(undefined);\n\n /** The TabPanels nested inside of the container. */\n private readonly _unorderedPanels = signal(new Set<TabPanel>());\n\n /** The Tab UIPattern of the child Tabs. */\n tabs = computed(() => this._tablist()?.tabs());\n\n /** The TabPanel UIPattern of the child TabPanels. */\n unorderedTabpanels = computed(() =>\n [...this._unorderedPanels()].map(tabpanel => tabpanel.pattern),\n );\n\n register(child: TabList | TabPanel) {\n if (child instanceof TabList) {\n this._tablist.set(child);\n }\n\n if (child instanceof TabPanel) {\n this._unorderedPanels().add(child);\n this._unorderedPanels.set(new Set(this._unorderedPanels()));\n }\n }\n\n deregister(child: TabList | TabPanel) {\n if (child instanceof TabList) {\n this._tablist.set(undefined);\n }\n\n if (child instanceof TabPanel) {\n this._unorderedPanels().delete(child);\n this._unorderedPanels.set(new Set(this._unorderedPanels()));\n }\n }\n}\n\n/**\n * A TabList container.\n *\n * Controls a list of Tab(s).\n */\n@Directive({\n selector: '[ngTabList]',\n exportAs: 'ngTabList',\n host: {\n 'role': 'tablist',\n 'class': 'ng-tablist',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n '[attr.aria-orientation]': 'pattern.orientation()',\n '[attr.aria-activedescendant]': 'pattern.activedescendant()',\n '(keydown)': 'pattern.onKeydown($event)',\n '(pointerdown)': 'pattern.onPointerdown($event)',\n '(focusin)': 'onFocus()',\n },\n})\nexport class TabList implements OnInit, OnDestroy {\n /** A reference to the tab list element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The parent Tabs. */\n private readonly _tabs = inject(Tabs);\n\n /** The Tabs nested inside of the TabList. */\n private readonly _unorderedTabs = signal(new Set<Tab>());\n\n /** The internal tab selection state. */\n private readonly _selection = linkedSignal(() =>\n this.selectedTab() ? [this.selectedTab()!] : [],\n );\n\n /** Text direction. */\n readonly textDirection = inject(Directionality).valueSignal;\n\n /** The Tab UIPatterns of the child Tabs. */\n readonly tabs = computed(() =>\n [...this._unorderedTabs()].sort(sortDirectives).map(tab => tab.pattern),\n );\n\n /** Whether the tablist is vertically or horizontally oriented. */\n readonly orientation = input<'vertical' | 'horizontal'>('horizontal');\n\n /** Whether focus should wrap when navigating. */\n readonly wrap = input(true, {transform: booleanAttribute});\n\n /** Whether disabled items in the list should be skipped when navigating. */\n readonly skipDisabled = input(true, {transform: booleanAttribute});\n\n /** The focus strategy used by the tablist. */\n readonly focusMode = input<'roving' | 'activedescendant'>('roving');\n\n /** The selection strategy used by the tablist. */\n readonly selectionMode = input<'follow' | 'explicit'>('follow');\n\n /** Whether the tablist is disabled. */\n readonly disabled = input(false, {transform: booleanAttribute});\n\n /** The current selected tab. */\n readonly selectedTab = model<string | undefined>();\n\n /** The TabList UIPattern. */\n readonly pattern: TabListPattern = new TabListPattern({\n ...this,\n items: this.tabs,\n value: this._selection,\n activeItem: signal(undefined),\n element: () => this._elementRef.nativeElement,\n });\n\n /** Whether the tree has received focus yet. */\n private _hasFocused = signal(false);\n\n constructor() {\n afterRenderEffect(() => this.selectedTab.set(this._selection()[0]));\n\n afterRenderEffect(() => {\n if (!this._hasFocused()) {\n this.pattern.setDefaultState();\n }\n });\n }\n\n onFocus() {\n this._hasFocused.set(true);\n }\n\n ngOnInit() {\n this._tabs.register(this);\n }\n\n ngOnDestroy() {\n this._tabs.deregister(this);\n }\n\n register(child: Tab) {\n this._unorderedTabs().add(child);\n this._unorderedTabs.set(new Set(this._unorderedTabs()));\n }\n\n deregister(child: Tab) {\n this._unorderedTabs().delete(child);\n this._unorderedTabs.set(new Set(this._unorderedTabs()));\n }\n}\n\n/** A selectable tab in a TabList. */\n@Directive({\n selector: '[ngTab]',\n exportAs: 'ngTab',\n host: {\n 'role': 'tab',\n 'class': 'ng-tab',\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 '[attr.aria-controls]': 'pattern.controls()',\n },\n})\nexport class Tab implements HasElement, OnInit, OnDestroy {\n /** A reference to the tab element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The parent Tabs. */\n private readonly _tabs = inject(Tabs);\n\n /** The parent TabList. */\n private readonly _tabList = inject(TabList);\n\n /** A global unique identifier for the tab. */\n private readonly _id = inject(_IdGenerator).getId('ng-tab-');\n\n /** The host native element. */\n readonly element = computed(() => this._elementRef.nativeElement);\n\n /** The parent TabList UIPattern. */\n readonly tablist = computed(() => this._tabList.pattern);\n\n /** The TabPanel UIPattern associated with the tab */\n readonly tabpanel = computed(() =>\n this._tabs.unorderedTabpanels().find(tabpanel => tabpanel.value() === this.value()),\n );\n\n /** Whether a tab is disabled. */\n readonly disabled = input(false, {transform: booleanAttribute});\n\n /** A local unique identifier for the tab. */\n readonly value = input.required<string>();\n\n /** The Tab UIPattern. */\n readonly pattern: TabPattern = new TabPattern({\n ...this,\n id: () => this._id,\n tablist: this.tablist,\n tabpanel: this.tabpanel,\n value: this.value,\n });\n\n ngOnInit() {\n this._tabList.register(this);\n }\n\n ngOnDestroy() {\n this._tabList.deregister(this);\n }\n}\n\n/**\n * A TabPanel container for the resources of layered content associated with a tab.\n *\n * If a tabpanel is hidden due to its corresponding tab is not activated, the `inert` attribute\n * will be applied to the tabpanel element to remove it from the accessibility tree and stop\n * all the keyboard and pointer interactions. Note that this does not visually hide the tabpenl\n * and a proper styling is required.\n */\n@Directive({\n selector: '[ngTabPanel]',\n exportAs: 'ngTabPanel',\n host: {\n 'role': 'tabpanel',\n 'class': 'ng-tabpanel',\n '[attr.id]': 'pattern.id()',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.inert]': 'pattern.hidden() ? true : null',\n '[attr.aria-labelledby]': 'pattern.labelledBy()',\n },\n hostDirectives: [\n {\n directive: DeferredContentAware,\n inputs: ['preserveContent'],\n },\n ],\n})\nexport class TabPanel implements OnInit, OnDestroy {\n /** The DeferredContentAware host directive. */\n private readonly _deferredContentAware = inject(DeferredContentAware);\n\n /** The parent Tabs. */\n private readonly _Tabs = inject(Tabs);\n\n /** A global unique identifier for the tab. */\n private readonly _id = inject(_IdGenerator).getId('ng-tabpanel-');\n\n /** The Tab UIPattern associated with the tabpanel */\n readonly tab = computed(() => this._Tabs.tabs()?.find(tab => tab.value() === this.value()));\n\n /** A local unique identifier for the tabpanel. */\n readonly value = input.required<string>();\n\n /** The TabPanel UIPattern. */\n readonly pattern: TabPanelPattern = new TabPanelPattern({\n ...this,\n id: () => this._id,\n tab: this.tab,\n });\n\n constructor() {\n afterRenderEffect(() => this._deferredContentAware.contentVisible.set(!this.pattern.hidden()));\n }\n\n ngOnInit() {\n this._Tabs.register(this);\n }\n\n ngOnDestroy() {\n this._Tabs.deregister(this);\n }\n}\n\n/**\n * A TabContent container for the lazy-loaded content.\n */\n@Directive({\n selector: 'ng-template[ngTabContent]',\n exportAs: 'ngTabContent',\n hostDirectives: [DeferredContent],\n})\nexport class TabContent {}\n"],"names":[],"mappings":";;;;;;;;AAgCA;;AAEG;AACH,SAAS,cAAc,CAAC,CAAa,EAAE,CAAa,EAAA;AAClD,IAAA,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,2BAA2B,IAAI;AAC7F,UAAE;UACA,CAAC,CAAC;AACR;AAEA;;;;;;;;;;;;;;;;;;;;;;;;AAwBG;MAQU,IAAI,CAAA;;AAEE,IAAA,QAAQ,GAAG,MAAM,CAAsB,SAAS,oDAAC;;AAGjD,IAAA,gBAAgB,GAAG,MAAM,CAAC,IAAI,GAAG,EAAY,4DAAC;;AAG/D,IAAA,IAAI,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,gDAAC;;IAG9C,kBAAkB,GAAG,QAAQ,CAAC,MAC5B,CAAC,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO,CAAC,EAAA,IAAA,SAAA,GAAA,CAAA,EAAA,SAAA,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AA,EAAA,CAAA,EAAA,SAAA,EAAA,EAAA,CAAA,eAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;kGAAV,UAAU,EAAA,UAAA,EAAA,CAAA;kBALtB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,2BAA2B;AACrC,oBAAA,QAAQ,EAAE,cAAc;oBACxB,cAAc,EAAE,CAAC,eAAe,CAAC;AAClC,iBAAA;;;;;"}
@@ -0,0 +1,218 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, ElementRef, signal, computed, input, booleanAttribute, afterRenderEffect, Directive } from '@angular/core';
3
+ import { ToolbarPattern, ToolbarWidgetPattern, ToolbarWidgetGroupPattern } from '@angular/aria/ui-patterns';
4
+ import { Directionality } from '@angular/cdk/bidi';
5
+ import { _IdGenerator } from '@angular/cdk/a11y';
6
+
7
+ /**
8
+ * Sort directives by their document order.
9
+ */
10
+ function sortDirectives(a, b) {
11
+ return (a.element().compareDocumentPosition(b.element()) & Node.DOCUMENT_POSITION_PRECEDING) > 0
12
+ ? 1
13
+ : -1;
14
+ }
15
+ /**
16
+ * A toolbar widget container.
17
+ *
18
+ * Widgets such as radio groups or buttons are nested within a toolbar to allow for a single
19
+ * place of reference for focus and navigation. The Toolbar is meant to be used in conjunction
20
+ * with ToolbarWidget and RadioGroup as follows:
21
+ *
22
+ * ```html
23
+ * <div ngToolbar>
24
+ * <button ngToolbarWidget>Button</button>
25
+ * <div ngRadioGroup>
26
+ * <label ngRadioButton value="1">Option 1</label>
27
+ * <label ngRadioButton value="2">Option 2</label>
28
+ * <label ngRadioButton value="3">Option 3</label>
29
+ * </div>
30
+ * </div>
31
+ * ```
32
+ */
33
+ class Toolbar {
34
+ /** A reference to the toolbar element. */
35
+ _elementRef = inject(ElementRef);
36
+ /** The TabList nested inside of the container. */
37
+ _widgets = signal(new Set(), ...(ngDevMode ? [{ debugName: "_widgets" }] : []));
38
+ /** A signal wrapper for directionality. */
39
+ textDirection = inject(Directionality).valueSignal;
40
+ /** Sorted UIPatterns of the child widgets */
41
+ items = computed(() => [...this._widgets()].sort(sortDirectives).map(widget => widget.pattern), ...(ngDevMode ? [{ debugName: "items" }] : []));
42
+ /** Whether the toolbar is vertically or horizontally oriented. */
43
+ orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : []));
44
+ /** Whether disabled items in the group should be skipped when navigating. */
45
+ skipDisabled = input(false, ...(ngDevMode ? [{ debugName: "skipDisabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
46
+ /** Whether the toolbar is disabled. */
47
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
48
+ /** Whether focus should wrap when navigating. */
49
+ wrap = input(true, ...(ngDevMode ? [{ debugName: "wrap", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
50
+ /** The toolbar UIPattern. */
51
+ pattern = new ToolbarPattern({
52
+ ...this,
53
+ activeItem: signal(undefined),
54
+ textDirection: this.textDirection,
55
+ element: () => this._elementRef.nativeElement,
56
+ getItem: e => this._getItem(e),
57
+ });
58
+ /** Whether the toolbar has received focus yet. */
59
+ _hasFocused = signal(false, ...(ngDevMode ? [{ debugName: "_hasFocused" }] : []));
60
+ constructor() {
61
+ afterRenderEffect(() => {
62
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
63
+ const violations = this.pattern.validate();
64
+ for (const violation of violations) {
65
+ console.error(violation);
66
+ }
67
+ }
68
+ });
69
+ afterRenderEffect(() => {
70
+ if (!this._hasFocused()) {
71
+ this.pattern.setDefaultState();
72
+ }
73
+ });
74
+ }
75
+ onFocus() {
76
+ this._hasFocused.set(true);
77
+ }
78
+ register(widget) {
79
+ const widgets = this._widgets();
80
+ if (!widgets.has(widget)) {
81
+ widgets.add(widget);
82
+ this._widgets.set(new Set(widgets));
83
+ }
84
+ }
85
+ unregister(widget) {
86
+ const widgets = this._widgets();
87
+ if (widgets.delete(widget)) {
88
+ this._widgets.set(new Set(widgets));
89
+ }
90
+ }
91
+ /** Finds the toolbar item associated with a given element. */
92
+ _getItem(element) {
93
+ const widgetTarget = element.closest('.ng-toolbar-widget');
94
+ const groupTarget = element.closest('.ng-toolbar-widget-group');
95
+ return this.items().find(widget => widget.element() === widgetTarget || widget.element() === groupTarget);
96
+ }
97
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Toolbar, deps: [], target: i0.ɵɵFactoryTarget.Directive });
98
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: Toolbar, isStandalone: true, selector: "[ngToolbar]", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, skipDisabled: { classPropertyName: "skipDisabled", publicName: "skipDisabled", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, wrap: { classPropertyName: "wrap", publicName: "wrap", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "toolbar" }, listeners: { "keydown": "pattern.onKeydown($event)", "pointerdown": "pattern.onPointerdown($event)", "focusin": "onFocus()" }, properties: { "attr.tabindex": "pattern.tabindex()", "attr.aria-disabled": "pattern.disabled()", "attr.aria-orientation": "pattern.orientation()" }, classAttribute: "ng-toolbar" }, exportAs: ["ngToolbar"], ngImport: i0 });
99
+ }
100
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Toolbar, decorators: [{
101
+ type: Directive,
102
+ args: [{
103
+ selector: '[ngToolbar]',
104
+ exportAs: 'ngToolbar',
105
+ host: {
106
+ 'role': 'toolbar',
107
+ 'class': 'ng-toolbar',
108
+ '[attr.tabindex]': 'pattern.tabindex()',
109
+ '[attr.aria-disabled]': 'pattern.disabled()',
110
+ '[attr.aria-orientation]': 'pattern.orientation()',
111
+ '(keydown)': 'pattern.onKeydown($event)',
112
+ '(pointerdown)': 'pattern.onPointerdown($event)',
113
+ '(focusin)': 'onFocus()',
114
+ },
115
+ }]
116
+ }], ctorParameters: () => [] });
117
+ /**
118
+ * A widget within a toolbar.
119
+ *
120
+ * A widget is anything that is within a toolbar. It should be applied to any native HTML element
121
+ * that has the purpose of acting as a widget navigatable within a toolbar.
122
+ */
123
+ class ToolbarWidget {
124
+ /** A reference to the widget element. */
125
+ _elementRef = inject(ElementRef);
126
+ /** The parent Toolbar. */
127
+ _toolbar = inject(Toolbar);
128
+ /** A unique identifier for the widget. */
129
+ _generatedId = inject(_IdGenerator).getId('ng-toolbar-widget-');
130
+ /** A unique identifier for the widget. */
131
+ id = computed(() => this._generatedId, ...(ngDevMode ? [{ debugName: "id" }] : []));
132
+ /** The parent Toolbar UIPattern. */
133
+ toolbar = computed(() => this._toolbar.pattern, ...(ngDevMode ? [{ debugName: "toolbar" }] : []));
134
+ /** A reference to the widget element to be focused on navigation. */
135
+ element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{ debugName: "element" }] : []));
136
+ /** Whether the widget is disabled. */
137
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
138
+ /** Whether the widget is 'hard' disabled, which is different from `aria-disabled`. A hard disabled widget cannot receive focus. */
139
+ hardDisabled = computed(() => this.pattern.disabled() && this._toolbar.skipDisabled(), ...(ngDevMode ? [{ debugName: "hardDisabled" }] : []));
140
+ /** The ToolbarWidget UIPattern. */
141
+ pattern = new ToolbarWidgetPattern({
142
+ ...this,
143
+ id: this.id,
144
+ element: this.element,
145
+ disabled: computed(() => this._toolbar.disabled() || this.disabled()),
146
+ });
147
+ ngOnInit() {
148
+ this._toolbar.register(this);
149
+ }
150
+ ngOnDestroy() {
151
+ this._toolbar.unregister(this);
152
+ }
153
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: ToolbarWidget, deps: [], target: i0.ɵɵFactoryTarget.Directive });
154
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: ToolbarWidget, isStandalone: true, selector: "[ngToolbarWidget]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-active": "pattern.active()", "attr.tabindex": "pattern.tabindex()", "attr.inert": "hardDisabled() ? true : null", "attr.disabled": "hardDisabled() ? true : null", "attr.aria-disabled": "pattern.disabled()", "id": "pattern.id()" }, classAttribute: "ng-toolbar-widget" }, exportAs: ["ngToolbarWidget"], ngImport: i0 });
155
+ }
156
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: ToolbarWidget, decorators: [{
157
+ type: Directive,
158
+ args: [{
159
+ selector: '[ngToolbarWidget]',
160
+ exportAs: 'ngToolbarWidget',
161
+ host: {
162
+ 'class': 'ng-toolbar-widget',
163
+ '[attr.data-active]': 'pattern.active()',
164
+ '[attr.tabindex]': 'pattern.tabindex()',
165
+ '[attr.inert]': 'hardDisabled() ? true : null',
166
+ '[attr.disabled]': 'hardDisabled() ? true : null',
167
+ '[attr.aria-disabled]': 'pattern.disabled()',
168
+ '[id]': 'pattern.id()',
169
+ },
170
+ }]
171
+ }] });
172
+ /**
173
+ * A directive that groups toolbar widgets, used for more complex widgets like radio groups that
174
+ * have their own internal navigation.
175
+ */
176
+ class ToolbarWidgetGroup {
177
+ /** A reference to the widget element. */
178
+ _elementRef = inject(ElementRef);
179
+ /** The parent Toolbar. */
180
+ _toolbar = inject(Toolbar, { optional: true });
181
+ /** A unique identifier for the widget. */
182
+ _generatedId = inject(_IdGenerator).getId('ng-toolbar-widget-group-');
183
+ /** A unique identifier for the widget. */
184
+ id = computed(() => this._generatedId, ...(ngDevMode ? [{ debugName: "id" }] : []));
185
+ /** The parent Toolbar UIPattern. */
186
+ toolbar = computed(() => this._toolbar?.pattern, ...(ngDevMode ? [{ debugName: "toolbar" }] : []));
187
+ /** A reference to the widget element to be focused on navigation. */
188
+ element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{ debugName: "element" }] : []));
189
+ /** Whether the widget group is disabled. */
190
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled", transform: booleanAttribute }] : [{ transform: booleanAttribute }]));
191
+ /** The controls that can be performed on the widget group. */
192
+ controls = signal(undefined, ...(ngDevMode ? [{ debugName: "controls" }] : []));
193
+ /** The ToolbarWidgetGroup UIPattern. */
194
+ pattern = new ToolbarWidgetGroupPattern({
195
+ ...this,
196
+ id: this.id,
197
+ element: this.element,
198
+ });
199
+ ngOnInit() {
200
+ this._toolbar?.register(this);
201
+ }
202
+ ngOnDestroy() {
203
+ this._toolbar?.unregister(this);
204
+ }
205
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: ToolbarWidgetGroup, deps: [], target: i0.ɵɵFactoryTarget.Directive });
206
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.2.0-next.2", type: ToolbarWidgetGroup, isStandalone: true, inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.ng-toolbar-widget-group": "!!toolbar()" } }, ngImport: i0 });
207
+ }
208
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: ToolbarWidgetGroup, decorators: [{
209
+ type: Directive,
210
+ args: [{
211
+ host: {
212
+ '[class.ng-toolbar-widget-group]': '!!toolbar()',
213
+ },
214
+ }]
215
+ }] });
216
+
217
+ export { Toolbar, ToolbarWidget, ToolbarWidgetGroup };
218
+ //# sourceMappingURL=toolbar.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolbar.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/aria/toolbar/toolbar.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 ElementRef,\n inject,\n computed,\n input,\n booleanAttribute,\n signal,\n Signal,\n OnInit,\n OnDestroy,\n} from '@angular/core';\nimport {\n ToolbarPattern,\n ToolbarWidgetPattern,\n ToolbarWidgetGroupPattern,\n ToolbarWidgetGroupControls,\n} from '@angular/aria/ui-patterns';\nimport {Directionality} from '@angular/cdk/bidi';\nimport {_IdGenerator} from '@angular/cdk/a11y';\n\ninterface HasElement {\n element: Signal<HTMLElement>;\n}\n\n/**\n * Sort directives by their document order.\n */\nfunction sortDirectives(a: HasElement, b: HasElement) {\n return (a.element().compareDocumentPosition(b.element()) & Node.DOCUMENT_POSITION_PRECEDING) > 0\n ? 1\n : -1;\n}\n\n/**\n * A toolbar widget container.\n *\n * Widgets such as radio groups or buttons are nested within a toolbar to allow for a single\n * place of reference for focus and navigation. The Toolbar is meant to be used in conjunction\n * with ToolbarWidget and RadioGroup as follows:\n *\n * ```html\n * <div ngToolbar>\n * <button ngToolbarWidget>Button</button>\n * <div ngRadioGroup>\n * <label ngRadioButton value=\"1\">Option 1</label>\n * <label ngRadioButton value=\"2\">Option 2</label>\n * <label ngRadioButton value=\"3\">Option 3</label>\n * </div>\n * </div>\n * ```\n */\n@Directive({\n selector: '[ngToolbar]',\n exportAs: 'ngToolbar',\n host: {\n 'role': 'toolbar',\n 'class': 'ng-toolbar',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.aria-disabled]': 'pattern.disabled()',\n '[attr.aria-orientation]': 'pattern.orientation()',\n '(keydown)': 'pattern.onKeydown($event)',\n '(pointerdown)': 'pattern.onPointerdown($event)',\n '(focusin)': 'onFocus()',\n },\n})\nexport class Toolbar<V> {\n /** A reference to the toolbar element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The TabList nested inside of the container. */\n private readonly _widgets = signal(new Set<ToolbarWidget<V> | ToolbarWidgetGroup<V>>());\n\n /** A signal wrapper for directionality. */\n readonly textDirection = inject(Directionality).valueSignal;\n\n /** Sorted UIPatterns of the child widgets */\n readonly items = computed(() =>\n [...this._widgets()].sort(sortDirectives).map(widget => widget.pattern),\n );\n\n /** Whether the toolbar is vertically or horizontally oriented. */\n readonly orientation = input<'vertical' | 'horizontal'>('horizontal');\n\n /** Whether disabled items in the group should be skipped when navigating. */\n readonly skipDisabled = input(false, {transform: booleanAttribute});\n\n /** Whether the toolbar is disabled. */\n readonly disabled = input(false, {transform: booleanAttribute});\n\n /** Whether focus should wrap when navigating. */\n readonly wrap = input(true, {transform: booleanAttribute});\n\n /** The toolbar UIPattern. */\n readonly pattern: ToolbarPattern<V> = new ToolbarPattern<V>({\n ...this,\n activeItem: signal(undefined),\n textDirection: this.textDirection,\n element: () => this._elementRef.nativeElement,\n getItem: e => this._getItem(e),\n });\n\n /** Whether the toolbar has received focus yet. */\n private _hasFocused = signal(false);\n\n constructor() {\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\n onFocus() {\n this._hasFocused.set(true);\n }\n\n register(widget: ToolbarWidget<V> | ToolbarWidgetGroup<V>) {\n const widgets = this._widgets();\n if (!widgets.has(widget)) {\n widgets.add(widget);\n this._widgets.set(new Set(widgets));\n }\n }\n\n unregister(widget: ToolbarWidget<V> | ToolbarWidgetGroup<V>) {\n const widgets = this._widgets();\n if (widgets.delete(widget)) {\n this._widgets.set(new Set(widgets));\n }\n }\n\n /** Finds the toolbar item associated with a given element. */\n private _getItem(element: Element) {\n const widgetTarget = element.closest('.ng-toolbar-widget');\n const groupTarget = element.closest('.ng-toolbar-widget-group');\n return this.items().find(\n widget => widget.element() === widgetTarget || widget.element() === groupTarget,\n );\n }\n}\n\n/**\n * A widget within a toolbar.\n *\n * A widget is anything that is within a toolbar. It should be applied to any native HTML element\n * that has the purpose of acting as a widget navigatable within a toolbar.\n */\n@Directive({\n selector: '[ngToolbarWidget]',\n exportAs: 'ngToolbarWidget',\n host: {\n 'class': 'ng-toolbar-widget',\n '[attr.data-active]': 'pattern.active()',\n '[attr.tabindex]': 'pattern.tabindex()',\n '[attr.inert]': 'hardDisabled() ? true : null',\n '[attr.disabled]': 'hardDisabled() ? true : null',\n '[attr.aria-disabled]': 'pattern.disabled()',\n '[id]': 'pattern.id()',\n },\n})\nexport class ToolbarWidget<V> implements OnInit, OnDestroy {\n /** A reference to the widget element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The parent Toolbar. */\n private readonly _toolbar = inject(Toolbar);\n\n /** A unique identifier for the widget. */\n private readonly _generatedId = inject(_IdGenerator).getId('ng-toolbar-widget-');\n\n /** A unique identifier for the widget. */\n readonly id = computed(() => this._generatedId);\n\n /** The parent Toolbar UIPattern. */\n readonly toolbar = computed(() => this._toolbar.pattern);\n\n /** A reference to the widget element to be focused on navigation. */\n readonly element = computed(() => this._elementRef.nativeElement);\n\n /** Whether the widget is disabled. */\n readonly disabled = input(false, {transform: booleanAttribute});\n\n /** Whether the widget is 'hard' disabled, which is different from `aria-disabled`. A hard disabled widget cannot receive focus. */\n readonly hardDisabled = computed(() => this.pattern.disabled() && this._toolbar.skipDisabled());\n\n /** The ToolbarWidget UIPattern. */\n readonly pattern = new ToolbarWidgetPattern<V>({\n ...this,\n id: this.id,\n element: this.element,\n disabled: computed(() => this._toolbar.disabled() || this.disabled()),\n });\n\n ngOnInit() {\n this._toolbar.register(this);\n }\n\n ngOnDestroy() {\n this._toolbar.unregister(this);\n }\n}\n\n/**\n * A directive that groups toolbar widgets, used for more complex widgets like radio groups that\n * have their own internal navigation.\n */\n@Directive({\n host: {\n '[class.ng-toolbar-widget-group]': '!!toolbar()',\n },\n})\nexport class ToolbarWidgetGroup<V> implements OnInit, OnDestroy {\n /** A reference to the widget element. */\n private readonly _elementRef = inject(ElementRef);\n\n /** The parent Toolbar. */\n private readonly _toolbar = inject(Toolbar, {optional: true});\n\n /** A unique identifier for the widget. */\n private readonly _generatedId = inject(_IdGenerator).getId('ng-toolbar-widget-group-');\n\n /** A unique identifier for the widget. */\n readonly id = computed(() => this._generatedId);\n\n /** The parent Toolbar UIPattern. */\n readonly toolbar = computed(() => this._toolbar?.pattern);\n\n /** A reference to the widget element to be focused on navigation. */\n readonly element = computed(() => this._elementRef.nativeElement);\n\n /** Whether the widget group is disabled. */\n readonly disabled = input(false, {transform: booleanAttribute});\n\n /** The controls that can be performed on the widget group. */\n readonly controls = signal<ToolbarWidgetGroupControls | undefined>(undefined);\n\n /** The ToolbarWidgetGroup UIPattern. */\n readonly pattern = new ToolbarWidgetGroupPattern<V>({\n ...this,\n id: this.id,\n element: this.element,\n });\n\n ngOnInit() {\n this._toolbar?.register(this);\n }\n\n ngOnDestroy() {\n this._toolbar?.unregister(this);\n }\n}\n"],"names":[],"mappings":";;;;;;AAkCA;;AAEG;AACH,SAAS,cAAc,CAAC,CAAa,EAAE,CAAa,EAAA;AAClD,IAAA,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,2BAA2B,IAAI;AAC7F,UAAE;UACA,CAAC,CAAC;AACR;AAEA;;;;;;;;;;;;;;;;;AAiBG;MAeU,OAAO,CAAA;;AAED,IAAA,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC;;AAGhC,IAAA,QAAQ,GAAG,MAAM,CAAC,IAAI,GAAG,EAA4C,oDAAC;;AAG9E,IAAA,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,WAAW;;AAGlD,IAAA,KAAK,GAAG,QAAQ,CAAC,MACxB,CAAC,GAAG,IAAI,CAAC,QAAQ,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