Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/aria/private/toolbar/toolbar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function getToolbarPattern(
element,
items,
activeItem,
values: signal([]),
wrap: signal(inputs.wrap ?? true),
disabled: signal(inputs.disabled ?? false),
softDisabled: signal(inputs.softDisabled ?? true),
Expand Down
3 changes: 1 addition & 2 deletions src/aria/private/toolbar/toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {ToolbarWidgetPattern} from './toolbar-widget';
/** Represents the required inputs for a toolbar. */
export type ToolbarInputs<V> = Omit<
ListInputs<ToolbarWidgetPattern<V>, V>,
'multi' | 'typeaheadDelay' | 'values' | 'selectionMode' | 'focusMode'
'multi' | 'typeaheadDelay' | 'selectionMode' | 'focusMode'
> & {
/** A function that returns the toolbar item associated with a given element. */
getItem: (e: Element) => ToolbarWidgetPattern<V> | undefined;
Expand Down Expand Up @@ -160,7 +160,6 @@ export class ToolbarPattern<V> {
multi: () => true,
focusMode: () => 'roving',
selectionMode: () => 'explicit',
values: signal([] as V[]),
typeaheadDelay: () => 0, // Toolbar widgets do not support typeahead.
});
}
Expand Down
5 changes: 5 additions & 0 deletions src/aria/toolbar/toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
OnInit,
OnDestroy,
contentChildren,
model,
} from '@angular/core';
import {
ToolbarPattern,
Expand Down Expand Up @@ -108,6 +109,9 @@ export class Toolbar<V> {
/** Whether focus should wrap when navigating. */
readonly wrap = input(true, {transform: booleanAttribute});

/** The values of the selected widgets within the toolbar. */
readonly values = model<V[]>([]);

/** The toolbar UIPattern. */
readonly _pattern: ToolbarPattern<V> = new ToolbarPattern<V>({
...this,
Expand All @@ -116,6 +120,7 @@ export class Toolbar<V> {
textDirection: this.textDirection,
element: () => this._elementRef.nativeElement,
getItem: e => this._getItem(e),
values: this.values,
});

/** Whether the toolbar has received focus yet. */
Expand Down
Loading