mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[CL-135] Migrate component library to standalone components (#12389)
* Migrate component library to standalone components * Fix tests
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { DialogRef, DIALOG_DATA } from "@angular/cdk/dialog";
|
||||
import { NgIf } from "@angular/common";
|
||||
import { Component, Inject } from "@angular/core";
|
||||
import { FormGroup } from "@angular/forms";
|
||||
import { FormGroup, ReactiveFormsModule } from "@angular/forms";
|
||||
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
|
||||
import { SimpleDialogOptions, SimpleDialogType, Translation } from "../..";
|
||||
import { BitSubmitDirective } from "../../../async-actions/bit-submit.directive";
|
||||
import { BitFormButtonDirective } from "../../../async-actions/form-button.directive";
|
||||
import { ButtonComponent } from "../../../button/button.component";
|
||||
import { SimpleDialogComponent, IconDirective } from "../simple-dialog.component";
|
||||
|
||||
const DEFAULT_ICON: Record<SimpleDialogType, string> = {
|
||||
primary: "bwi-business",
|
||||
@@ -26,6 +31,16 @@ const DEFAULT_COLOR: Record<SimpleDialogType, string> = {
|
||||
|
||||
@Component({
|
||||
templateUrl: "./simple-configurable-dialog.component.html",
|
||||
standalone: true,
|
||||
imports: [
|
||||
ReactiveFormsModule,
|
||||
BitSubmitDirective,
|
||||
SimpleDialogComponent,
|
||||
IconDirective,
|
||||
ButtonComponent,
|
||||
BitFormButtonDirective,
|
||||
NgIf,
|
||||
],
|
||||
})
|
||||
export class SimpleConfigurableDialogComponent {
|
||||
get iconClasses() {
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
import { NgIf } from "@angular/common";
|
||||
import { Component, ContentChild, Directive } from "@angular/core";
|
||||
|
||||
import { TypographyDirective } from "../../typography/typography.directive";
|
||||
import { fadeIn } from "../animations";
|
||||
import { DialogTitleContainerDirective } from "../directives/dialog-title-container.directive";
|
||||
|
||||
@Directive({ selector: "[bitDialogIcon]" })
|
||||
@Directive({
|
||||
selector: "[bitDialogIcon]",
|
||||
standalone: true,
|
||||
})
|
||||
export class IconDirective {}
|
||||
|
||||
@Component({
|
||||
selector: "bit-simple-dialog",
|
||||
templateUrl: "./simple-dialog.component.html",
|
||||
animations: [fadeIn],
|
||||
standalone: true,
|
||||
imports: [NgIf, DialogTitleContainerDirective, TypographyDirective],
|
||||
})
|
||||
export class SimpleDialogComponent {
|
||||
@ContentChild(IconDirective) icon!: IconDirective;
|
||||
|
||||
Reference in New Issue
Block a user