| 31 | } |
| 32 | |
| 33 | export class ToolbarWidgetPattern implements ListFocusItem, ListNavigationItem { |
| 34 | /** A unique identifier for the widget. */ |
| 35 | readonly id = () => this.inputs.id(); |
| 36 | |
| 37 | /** The html element that should receive focus. */ |
| 38 | readonly element = () => this.inputs.element(); |
| 39 | |
| 40 | /** Whether the widget is disabled. */ |
| 41 | readonly disabled = () => this.inputs.disabled() || this.group()?.disabled() || false; |
| 42 | |
| 43 | /** A reference to the parent toolbar. */ |
| 44 | readonly group = () => this.inputs.group(); |
| 45 | |
| 46 | /** A reference to the toolbar containing the widget. */ |
| 47 | readonly toolbar = () => this.inputs.toolbar(); |
| 48 | |
| 49 | /** The tabindex of the widget. */ |
| 50 | readonly tabIndex = computed(() => this.toolbar().focusManager.getItemTabIndex(this)); |
| 51 | |
| 52 | /** The position of the widget within the toolbar. */ |
| 53 | readonly index = computed(() => this.toolbar().inputs.items().indexOf(this) ?? -1); |
| 54 | |
| 55 | /** Whether the widget is currently the active one (focused). */ |
| 56 | readonly active: SignalLike<boolean> = computed(() => this.toolbar().activeItem() === this); |
| 57 | |
| 58 | constructor(readonly inputs: ToolbarWidgetInputs) {} |
| 59 | } |
nothing calls this directly
no test coverage detected