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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/_adev_assets/aria-accordion.json +373 -0
  2. package/_adev_assets/aria-combobox.json +383 -0
  3. package/_adev_assets/aria-grid.json +647 -0
  4. package/_adev_assets/aria-listbox.json +511 -0
  5. package/_adev_assets/aria-menu.json +852 -0
  6. package/_adev_assets/aria-tabs.json +987 -0
  7. package/_adev_assets/aria-toolbar.json +696 -0
  8. package/_adev_assets/aria-tree.json +1071 -0
  9. package/fesm2022/_widget-chunk.mjs +949 -0
  10. package/fesm2022/_widget-chunk.mjs.map +1 -0
  11. package/fesm2022/accordion.mjs +372 -174
  12. package/fesm2022/accordion.mjs.map +1 -1
  13. package/fesm2022/aria.mjs +1 -2
  14. package/fesm2022/aria.mjs.map +1 -1
  15. package/fesm2022/combobox.mjs +308 -116
  16. package/fesm2022/combobox.mjs.map +1 -1
  17. package/fesm2022/grid.mjs +566 -0
  18. package/fesm2022/grid.mjs.map +1 -0
  19. package/fesm2022/listbox.mjs +384 -184
  20. package/fesm2022/listbox.mjs.map +1 -1
  21. package/fesm2022/menu.mjs +591 -0
  22. package/fesm2022/menu.mjs.map +1 -0
  23. package/fesm2022/private.mjs +2338 -0
  24. package/fesm2022/private.mjs.map +1 -0
  25. package/fesm2022/tabs.mjs +484 -276
  26. package/fesm2022/tabs.mjs.map +1 -1
  27. package/fesm2022/toolbar.mjs +366 -200
  28. package/fesm2022/toolbar.mjs.map +1 -1
  29. package/fesm2022/tree.mjs +515 -267
  30. package/fesm2022/tree.mjs.map +1 -1
  31. package/package.json +12 -12
  32. package/types/_grid-chunk.d.ts +608 -0
  33. package/types/accordion.d.ts +8 -8
  34. package/types/combobox.d.ts +20 -7
  35. package/types/grid.d.ts +120 -0
  36. package/types/listbox.d.ts +9 -7
  37. package/types/menu.d.ts +170 -0
  38. package/types/{ui-patterns.d.ts → private.d.ts} +555 -433
  39. package/types/tabs.d.ts +8 -8
  40. package/types/toolbar.d.ts +31 -28
  41. package/types/tree.d.ts +11 -9
  42. package/fesm2022/deferred-content.mjs +0 -60
  43. package/fesm2022/deferred-content.mjs.map +0 -1
  44. package/fesm2022/radio-group.mjs +0 -197
  45. package/fesm2022/radio-group.mjs.map +0 -1
  46. package/fesm2022/ui-patterns.mjs +0 -2504
  47. package/fesm2022/ui-patterns.mjs.map +0 -1
  48. package/types/deferred-content.d.ts +0 -38
  49. package/types/radio-group.d.ts +0 -82
@@ -1,218 +1,384 @@
1
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';
2
+ import { inject, ElementRef, signal, computed, input, booleanAttribute, afterRenderEffect, Directive, contentChildren } from '@angular/core';
3
+ import { ToolbarPattern, ToolbarWidgetPattern, ToolbarWidgetGroupPattern } from '@angular/aria/private';
4
4
  import { Directionality } from '@angular/cdk/bidi';
5
5
  import { _IdGenerator } from '@angular/cdk/a11y';
6
6
 
7
- /**
8
- * Sort directives by their document order.
9
- */
10
7
  function sortDirectives(a, b) {
11
- return (a.element().compareDocumentPosition(b.element()) & Node.DOCUMENT_POSITION_PRECEDING) > 0
12
- ? 1
13
- : -1;
8
+ return (a.element().compareDocumentPosition(b.element()) & Node.DOCUMENT_POSITION_PRECEDING) > 0 ? 1 : -1;
14
9
  }
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
10
  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));
11
+ _elementRef = inject(ElementRef);
12
+ _widgets = signal(new Set(), ...(ngDevMode ? [{
13
+ debugName: "_widgets"
14
+ }] : []));
15
+ textDirection = inject(Directionality).valueSignal;
16
+ items = computed(() => [...this._widgets()].sort(sortDirectives).map(widget => widget._pattern), ...(ngDevMode ? [{
17
+ debugName: "items"
18
+ }] : []));
19
+ orientation = input('horizontal', ...(ngDevMode ? [{
20
+ debugName: "orientation"
21
+ }] : []));
22
+ softDisabled = input(true, ...(ngDevMode ? [{
23
+ debugName: "softDisabled",
24
+ transform: booleanAttribute
25
+ }] : [{
26
+ transform: booleanAttribute
27
+ }]));
28
+ disabled = input(false, ...(ngDevMode ? [{
29
+ debugName: "disabled",
30
+ transform: booleanAttribute
31
+ }] : [{
32
+ transform: booleanAttribute
33
+ }]));
34
+ wrap = input(true, ...(ngDevMode ? [{
35
+ debugName: "wrap",
36
+ transform: booleanAttribute
37
+ }] : [{
38
+ transform: booleanAttribute
39
+ }]));
40
+ _pattern = new ToolbarPattern({
41
+ ...this,
42
+ activeItem: signal(undefined),
43
+ textDirection: this.textDirection,
44
+ element: () => this._elementRef.nativeElement,
45
+ getItem: e => this._getItem(e)
46
+ });
47
+ _hasBeenFocused = signal(false, ...(ngDevMode ? [{
48
+ debugName: "_hasBeenFocused"
49
+ }] : []));
50
+ constructor() {
51
+ afterRenderEffect(() => {
52
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
53
+ const violations = this._pattern.validate();
54
+ for (const violation of violations) {
55
+ console.error(violation);
89
56
  }
57
+ }
58
+ });
59
+ afterRenderEffect(() => {
60
+ if (!this._hasBeenFocused()) {
61
+ this._pattern.setDefaultState();
62
+ }
63
+ });
64
+ }
65
+ onFocus() {
66
+ this._hasBeenFocused.set(true);
67
+ }
68
+ register(widget) {
69
+ const widgets = this._widgets();
70
+ if (!widgets.has(widget)) {
71
+ widgets.add(widget);
72
+ this._widgets.set(new Set(widgets));
90
73
  }
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);
74
+ }
75
+ unregister(widget) {
76
+ const widgets = this._widgets();
77
+ if (widgets.delete(widget)) {
78
+ this._widgets.set(new Set(widgets));
96
79
  }
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 });
80
+ }
81
+ _getItem(element) {
82
+ const widgetTarget = element.closest('.ng-toolbar-widget');
83
+ return this.items().find(widget => widget.element() === widgetTarget);
84
+ }
85
+ static ɵfac = i0.ɵɵngDeclareFactory({
86
+ minVersion: "12.0.0",
87
+ version: "20.2.0-next.2",
88
+ ngImport: i0,
89
+ type: Toolbar,
90
+ deps: [],
91
+ target: i0.ɵɵFactoryTarget.Directive
92
+ });
93
+ static ɵdir = i0.ɵɵngDeclareDirective({
94
+ minVersion: "17.1.0",
95
+ version: "20.2.0-next.2",
96
+ type: Toolbar,
97
+ isStandalone: true,
98
+ selector: "[ngToolbar]",
99
+ inputs: {
100
+ orientation: {
101
+ classPropertyName: "orientation",
102
+ publicName: "orientation",
103
+ isSignal: true,
104
+ isRequired: false,
105
+ transformFunction: null
106
+ },
107
+ softDisabled: {
108
+ classPropertyName: "softDisabled",
109
+ publicName: "softDisabled",
110
+ isSignal: true,
111
+ isRequired: false,
112
+ transformFunction: null
113
+ },
114
+ disabled: {
115
+ classPropertyName: "disabled",
116
+ publicName: "disabled",
117
+ isSignal: true,
118
+ isRequired: false,
119
+ transformFunction: null
120
+ },
121
+ wrap: {
122
+ classPropertyName: "wrap",
123
+ publicName: "wrap",
124
+ isSignal: true,
125
+ isRequired: false,
126
+ transformFunction: null
127
+ }
128
+ },
129
+ host: {
130
+ attributes: {
131
+ "role": "toolbar"
132
+ },
133
+ listeners: {
134
+ "keydown": "_pattern.onKeydown($event)",
135
+ "click": "_pattern.onClick($event)",
136
+ "pointerdown": "_pattern.onPointerdown($event)",
137
+ "focusin": "onFocus()"
138
+ },
139
+ properties: {
140
+ "attr.tabindex": "_pattern.tabIndex()",
141
+ "attr.aria-disabled": "_pattern.disabled()",
142
+ "attr.aria-orientation": "_pattern.orientation()"
143
+ },
144
+ classAttribute: "ng-toolbar"
145
+ },
146
+ exportAs: ["ngToolbar"],
147
+ ngImport: i0
148
+ });
99
149
  }
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
- */
150
+ i0.ɵɵngDeclareClassMetadata({
151
+ minVersion: "12.0.0",
152
+ version: "20.2.0-next.2",
153
+ ngImport: i0,
154
+ type: Toolbar,
155
+ decorators: [{
156
+ type: Directive,
157
+ args: [{
158
+ selector: '[ngToolbar]',
159
+ exportAs: 'ngToolbar',
160
+ host: {
161
+ 'role': 'toolbar',
162
+ 'class': 'ng-toolbar',
163
+ '[attr.tabindex]': '_pattern.tabIndex()',
164
+ '[attr.aria-disabled]': '_pattern.disabled()',
165
+ '[attr.aria-orientation]': '_pattern.orientation()',
166
+ '(keydown)': '_pattern.onKeydown($event)',
167
+ '(click)': '_pattern.onClick($event)',
168
+ '(pointerdown)': '_pattern.onPointerdown($event)',
169
+ '(focusin)': 'onFocus()'
170
+ }
171
+ }]
172
+ }],
173
+ ctorParameters: () => []
174
+ });
123
175
  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 });
176
+ _elementRef = inject(ElementRef);
177
+ _toolbar = inject(Toolbar);
178
+ _generatedId = inject(_IdGenerator).getId('ng-toolbar-widget-', true);
179
+ id = input(this._generatedId, ...(ngDevMode ? [{
180
+ debugName: "id"
181
+ }] : []));
182
+ toolbar = computed(() => this._toolbar._pattern, ...(ngDevMode ? [{
183
+ debugName: "toolbar"
184
+ }] : []));
185
+ element = computed(() => this._elementRef.nativeElement, ...(ngDevMode ? [{
186
+ debugName: "element"
187
+ }] : []));
188
+ disabled = input(false, ...(ngDevMode ? [{
189
+ debugName: "disabled",
190
+ transform: booleanAttribute
191
+ }] : [{
192
+ transform: booleanAttribute
193
+ }]));
194
+ hardDisabled = computed(() => this._pattern.disabled() && !this._toolbar.softDisabled(), ...(ngDevMode ? [{
195
+ debugName: "hardDisabled"
196
+ }] : []));
197
+ _group = inject(ToolbarWidgetGroup, {
198
+ optional: true
199
+ });
200
+ value = input.required(...(ngDevMode ? [{
201
+ debugName: "value"
202
+ }] : []));
203
+ active = computed(() => this._pattern.active(), ...(ngDevMode ? [{
204
+ debugName: "active"
205
+ }] : []));
206
+ selected = () => this._pattern.selected();
207
+ group = () => this._group?._pattern;
208
+ _pattern = new ToolbarWidgetPattern({
209
+ ...this,
210
+ id: this.id,
211
+ value: this.value,
212
+ element: this.element
213
+ });
214
+ ngOnInit() {
215
+ this._toolbar.register(this);
216
+ }
217
+ ngOnDestroy() {
218
+ this._toolbar.unregister(this);
219
+ }
220
+ static ɵfac = i0.ɵɵngDeclareFactory({
221
+ minVersion: "12.0.0",
222
+ version: "20.2.0-next.2",
223
+ ngImport: i0,
224
+ type: ToolbarWidget,
225
+ deps: [],
226
+ target: i0.ɵɵFactoryTarget.Directive
227
+ });
228
+ static ɵdir = i0.ɵɵngDeclareDirective({
229
+ minVersion: "17.1.0",
230
+ version: "20.2.0-next.2",
231
+ type: ToolbarWidget,
232
+ isStandalone: true,
233
+ selector: "[ngToolbarWidget]",
234
+ inputs: {
235
+ id: {
236
+ classPropertyName: "id",
237
+ publicName: "id",
238
+ isSignal: true,
239
+ isRequired: false,
240
+ transformFunction: null
241
+ },
242
+ disabled: {
243
+ classPropertyName: "disabled",
244
+ publicName: "disabled",
245
+ isSignal: true,
246
+ isRequired: false,
247
+ transformFunction: null
248
+ },
249
+ value: {
250
+ classPropertyName: "value",
251
+ publicName: "value",
252
+ isSignal: true,
253
+ isRequired: true,
254
+ transformFunction: null
255
+ }
256
+ },
257
+ host: {
258
+ properties: {
259
+ "attr.data-active": "_pattern.active()",
260
+ "attr.tabindex": "_pattern.tabIndex()",
261
+ "attr.inert": "hardDisabled() ? true : null",
262
+ "attr.disabled": "hardDisabled() ? true : null",
263
+ "attr.aria-disabled": "_pattern.disabled()",
264
+ "id": "_pattern.id()"
265
+ },
266
+ classAttribute: "ng-toolbar-widget"
267
+ },
268
+ exportAs: ["ngToolbarWidget"],
269
+ ngImport: i0
270
+ });
155
271
  }
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
- */
272
+ i0.ɵɵngDeclareClassMetadata({
273
+ minVersion: "12.0.0",
274
+ version: "20.2.0-next.2",
275
+ ngImport: i0,
276
+ type: ToolbarWidget,
277
+ decorators: [{
278
+ type: Directive,
279
+ args: [{
280
+ selector: '[ngToolbarWidget]',
281
+ exportAs: 'ngToolbarWidget',
282
+ host: {
283
+ 'class': 'ng-toolbar-widget',
284
+ '[attr.data-active]': '_pattern.active()',
285
+ '[attr.tabindex]': '_pattern.tabIndex()',
286
+ '[attr.inert]': 'hardDisabled() ? true : null',
287
+ '[attr.disabled]': 'hardDisabled() ? true : null',
288
+ '[attr.aria-disabled]': '_pattern.disabled()',
289
+ '[id]': '_pattern.id()'
290
+ }
291
+ }]
292
+ }]
293
+ });
176
294
  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 });
295
+ _toolbar = inject(Toolbar, {
296
+ optional: true
297
+ });
298
+ _widgets = contentChildren(ToolbarWidget, ...(ngDevMode ? [{
299
+ debugName: "_widgets",
300
+ descendants: true
301
+ }] : [{
302
+ descendants: true
303
+ }]));
304
+ toolbar = computed(() => this._toolbar?._pattern, ...(ngDevMode ? [{
305
+ debugName: "toolbar"
306
+ }] : []));
307
+ disabled = input(false, ...(ngDevMode ? [{
308
+ debugName: "disabled",
309
+ transform: booleanAttribute
310
+ }] : [{
311
+ transform: booleanAttribute
312
+ }]));
313
+ items = () => this._widgets().map(w => w._pattern);
314
+ multi = input(false, ...(ngDevMode ? [{
315
+ debugName: "multi",
316
+ transform: booleanAttribute
317
+ }] : [{
318
+ transform: booleanAttribute
319
+ }]));
320
+ _pattern = new ToolbarWidgetGroupPattern(this);
321
+ static ɵfac = i0.ɵɵngDeclareFactory({
322
+ minVersion: "12.0.0",
323
+ version: "20.2.0-next.2",
324
+ ngImport: i0,
325
+ type: ToolbarWidgetGroup,
326
+ deps: [],
327
+ target: i0.ɵɵFactoryTarget.Directive
328
+ });
329
+ static ɵdir = i0.ɵɵngDeclareDirective({
330
+ minVersion: "17.2.0",
331
+ version: "20.2.0-next.2",
332
+ type: ToolbarWidgetGroup,
333
+ isStandalone: true,
334
+ selector: "[ngToolbarWidgetGroup]",
335
+ inputs: {
336
+ disabled: {
337
+ classPropertyName: "disabled",
338
+ publicName: "disabled",
339
+ isSignal: true,
340
+ isRequired: false,
341
+ transformFunction: null
342
+ },
343
+ multi: {
344
+ classPropertyName: "multi",
345
+ publicName: "multi",
346
+ isSignal: true,
347
+ isRequired: false,
348
+ transformFunction: null
349
+ }
350
+ },
351
+ host: {
352
+ properties: {
353
+ "class.ng-toolbar-widget-group": "!!toolbar()"
354
+ }
355
+ },
356
+ queries: [{
357
+ propertyName: "_widgets",
358
+ predicate: ToolbarWidget,
359
+ descendants: true,
360
+ isSignal: true
361
+ }],
362
+ exportAs: ["ngToolbarWidgetGroup"],
363
+ ngImport: i0
364
+ });
207
365
  }
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
- }] });
366
+ i0.ɵɵngDeclareClassMetadata({
367
+ minVersion: "12.0.0",
368
+ version: "20.2.0-next.2",
369
+ ngImport: i0,
370
+ type: ToolbarWidgetGroup,
371
+ decorators: [{
372
+ type: Directive,
373
+ args: [{
374
+ selector: '[ngToolbarWidgetGroup]',
375
+ exportAs: 'ngToolbarWidgetGroup',
376
+ host: {
377
+ '[class.ng-toolbar-widget-group]': '!!toolbar()'
378
+ }
379
+ }]
380
+ }]
381
+ });
216
382
 
217
383
  export { Toolbar, ToolbarWidget, ToolbarWidgetGroup };
218
384
  //# sourceMappingURL=toolbar.mjs.map