mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
[CL-707] Migrate CL codebase to signals (#15340)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component, ElementRef, HostBinding, Input, Optional } from "@angular/core";
|
||||
import { Component, ElementRef, HostBinding, input, Optional } from "@angular/core";
|
||||
|
||||
import { FormControlComponent } from "./form-control.component";
|
||||
|
||||
@@ -12,6 +12,10 @@ let nextId = 0;
|
||||
selector: "bit-label",
|
||||
templateUrl: "label.component.html",
|
||||
imports: [CommonModule],
|
||||
host: {
|
||||
"[class]": "classList",
|
||||
"[id]": "id()",
|
||||
},
|
||||
})
|
||||
export class BitLabel {
|
||||
constructor(
|
||||
@@ -19,15 +23,19 @@ export class BitLabel {
|
||||
@Optional() private parentFormControl: FormControlComponent,
|
||||
) {}
|
||||
|
||||
@HostBinding("class") @Input() get classList() {
|
||||
return ["tw-inline-flex", "tw-gap-1", "tw-items-baseline", "tw-flex-row", "tw-min-w-0"];
|
||||
}
|
||||
readonly classList = [
|
||||
"tw-inline-flex",
|
||||
"tw-gap-1",
|
||||
"tw-items-baseline",
|
||||
"tw-flex-row",
|
||||
"tw-min-w-0",
|
||||
];
|
||||
|
||||
@HostBinding("title") get title() {
|
||||
return this.elementRef.nativeElement.textContent.trim();
|
||||
}
|
||||
|
||||
@HostBinding() @Input() id = `bit-label-${nextId++}`;
|
||||
readonly id = input(`bit-label-${nextId++}`);
|
||||
|
||||
get isInsideFormControl() {
|
||||
return !!this.parentFormControl;
|
||||
|
||||
Reference in New Issue
Block a user