1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

Tools - Prefer signal & change detection (#16941)

This commit is contained in:
Oscar Hinton
2025-10-21 15:49:22 +02:00
committed by GitHub
parent 6abaaa7b13
commit f23f3f87bd
66 changed files with 329 additions and 11 deletions

View File

@@ -17,6 +17,8 @@ export type PasswordStrengthScore = 0 | 1 | 2 | 3 | 4;
type SizeTypes = "small" | "default" | "large";
type BackgroundTypes = "danger" | "primary" | "success" | "warning";
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
@Component({
selector: "tools-password-strength",
templateUrl: "password-strength-v2.component.html",
@@ -27,24 +29,34 @@ export class PasswordStrengthV2Component implements OnChanges {
* The size (height) of the password strength component.
* Possible values are "default", "small" and "large".
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() size: SizeTypes = "default";
/**
* Determines whether to show the password strength score text on the progress bar or not.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() showText = false;
/**
* Optional email address which can be used as input for the password strength calculation
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() email: string;
/**
* Optional name which can be used as input for the password strength calculation
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() name: string;
/**
* Sets the password value and updates the password strength.
*
* @param value - password provided by the hosting component
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() set password(value: string) {
this.updatePasswordStrength(value);
}
@@ -55,11 +67,15 @@ export class PasswordStrengthV2Component implements OnChanges {
* The password strength score represents the strength of a password.
* It is emitted as an event when the password strength changes.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output() passwordStrengthScore = new EventEmitter<PasswordStrengthScore>();
/**
* Emits an event with the password score text and color.
*/
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output() passwordScoreTextWithColor = new EventEmitter<PasswordColorText>();
passwordScore: PasswordStrengthScore;

View File

@@ -56,11 +56,21 @@ interface DatePresetSelectOption {
@Directive()
export class AddEditComponent implements OnInit, OnDestroy {
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() sendId: string;
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-signals
@Input() type: SendType;
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output() onSavedSend = new EventEmitter<SendView>();
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output() onDeletedSend = new EventEmitter<SendView>();
// FIXME(https://bitwarden.atlassian.net/browse/CL-903): Migrate to Signals
// eslint-disable-next-line @angular-eslint/prefer-output-emitter-ref
@Output() onCancelled = new EventEmitter<SendView>();
deletionDatePresets: DatePresetSelectOption[] = [