1
0
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:
Vicki League
2025-07-16 08:39:37 -04:00
committed by GitHub
parent 97ec9a6339
commit 6811ea4c0b
124 changed files with 944 additions and 809 deletions

View File

@@ -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);
}
}