mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 08:43:33 +00:00
[CL-707] Migrate CL codebase to signals (#15340)
This commit is contained in:
@@ -3,8 +3,9 @@ import {
|
||||
Component,
|
||||
EventEmitter,
|
||||
HostBinding,
|
||||
Input,
|
||||
Output,
|
||||
input,
|
||||
model,
|
||||
} from "@angular/core";
|
||||
|
||||
let nextId = 0;
|
||||
@@ -17,18 +18,18 @@ export class ToggleGroupComponent<TValue = unknown> {
|
||||
private id = nextId++;
|
||||
name = `bit-toggle-group-${this.id}`;
|
||||
|
||||
@Input({ transform: booleanAttribute }) fullWidth?: boolean;
|
||||
@Input() selected?: TValue;
|
||||
readonly fullWidth = input<boolean, unknown>(undefined, { transform: booleanAttribute });
|
||||
readonly selected = model<TValue>();
|
||||
@Output() selectedChange = new EventEmitter<TValue>();
|
||||
|
||||
@HostBinding("attr.role") role = "radiogroup";
|
||||
@HostBinding("class")
|
||||
get classList() {
|
||||
return ["tw-flex"].concat(this.fullWidth ? ["tw-w-full", "[&>*]:tw-flex-1"] : []);
|
||||
return ["tw-flex"].concat(this.fullWidth() ? ["tw-w-full", "[&>*]:tw-flex-1"] : []);
|
||||
}
|
||||
|
||||
onInputInteraction(value: TValue) {
|
||||
this.selected = value;
|
||||
this.selected.set(value);
|
||||
this.selectedChange.emit(value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user