1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-06 19:53:59 +00:00

revert dialog

This commit is contained in:
William Martin
2025-07-02 11:19:11 -04:00
parent 88dc962661
commit 42707c162f
4 changed files with 19 additions and 23 deletions

View File

@@ -22,7 +22,7 @@
noMargin
class="tw-text-main tw-mb-0 tw-truncate"
>
{{ title() }}
{{ title }}
@if (subtitle) {
<span class="tw-text-muted tw-font-normal tw-text-sm">
{{ subtitle }}
@@ -44,12 +44,12 @@
<div
class="tw-relative tw-flex-1 tw-flex tw-flex-col tw-overflow-hidden"
[ngClass]="{
'tw-min-h-60': loading(),
'tw-bg-background': background() === 'default',
'tw-bg-background-alt': background() === 'alt',
'tw-min-h-60': loading,
'tw-bg-background': background === 'default',
'tw-bg-background-alt': background === 'alt',
}"
>
@if (loading()) {
@if (loading) {
<div class="tw-absolute tw-flex tw-size-full tw-items-center tw-justify-center">
<i class="bwi bwi-spinner bwi-spin bwi-lg" [attr.aria-label]="'loading' | i18n"></i>
</div>
@@ -59,8 +59,8 @@
[ngClass]="{
'tw-p-4': !disablePadding && !isDrawer,
'tw-px-6 tw-py-4': !disablePadding && isDrawer,
'tw-overflow-y-auto': !loading(),
'tw-invisible tw-overflow-y-hidden': loading(),
'tw-overflow-y-auto': !loading,
'tw-invisible tw-overflow-y-hidden': loading,
}"
>
<ng-content select="[bitDialogContent]"></ng-content>

View File

@@ -4,7 +4,7 @@ import { CdkTrapFocus } from "@angular/cdk/a11y";
import { coerceBooleanProperty } from "@angular/cdk/coercion";
import { CdkScrollable } from "@angular/cdk/scrolling";
import { CommonModule } from "@angular/common";
import { Component, HostBinding, Input, inject, viewChild, input } from "@angular/core";
import { Component, HostBinding, Input, inject, viewChild } from "@angular/core";
import { I18nPipe } from "@bitwarden/ui-common";
@@ -40,32 +40,28 @@ export class DialogComponent {
protected bodyHasScrolledFrom = hasScrolledFrom(this.scrollableBody);
/** Background color */
readonly background = input<"default" | "alt">("default");
@Input()
background: "default" | "alt" = "default";
/**
* Dialog size, more complex dialogs should use large, otherwise default is fine.
*/
readonly dialogSize = input<"small" | "default" | "large">("default");
@Input() dialogSize: "small" | "default" | "large" = "default";
/**
* Title to show in the dialog's header
*/
readonly title = input<string>(undefined);
@Input() title: string;
/**
* Subtitle to show in the dialog's header
*/
// TODO: Skipped for migration because:
// This input is used in a control flow expression (e.g. `@if` or `*ngIf`)
// and migrating would break narrowing currently.
@Input() subtitle: string;
private _disablePadding = false;
/**
* Disable the built-in padding on the dialog, for use with tabbed dialogs.
*/
// TODO: Skipped for migration because:
// Accessor inputs cannot be migrated as they are too complex.
@Input() set disablePadding(value: boolean | "") {
this._disablePadding = coerceBooleanProperty(value);
}
@@ -76,7 +72,7 @@ export class DialogComponent {
/**
* Mark the dialog as loading which replaces the content with a spinner.
*/
readonly loading = input(false);
@Input() loading = false;
@HostBinding("class") get classes() {
// `tw-max-h-[90vh]` is needed to prevent dialogs from overlapping the desktop header
@@ -96,7 +92,7 @@ export class DialogComponent {
}
get width() {
switch (this.dialogSize()) {
switch (this.dialogSize) {
case "small": {
return "md:tw-max-w-sm";
}

View File

@@ -1,11 +1,11 @@
import { DialogRef } from "@angular/cdk/dialog";
import { Directive, HostBinding, HostListener, Optional, input } from "@angular/core";
import { Directive, HostBinding, HostListener, Input, Optional } from "@angular/core";
@Directive({
selector: "[bitDialogClose]",
})
export class DialogCloseDirective {
readonly dialogResult = input<any>(undefined, { alias: "bitDialogClose" });
@Input("bitDialogClose") dialogResult: any;
constructor(@Optional() public dialogRef: DialogRef) {}
@@ -20,6 +20,6 @@ export class DialogCloseDirective {
return;
}
this.dialogRef.close(this.dialogResult());
this.dialogRef.close(this.dialogResult);
}
}

View File

@@ -1,5 +1,5 @@
import { CdkDialogContainer, DialogRef } from "@angular/cdk/dialog";
import { Directive, HostBinding, OnInit, Optional, input } from "@angular/core";
import { Directive, HostBinding, Input, OnInit, Optional } from "@angular/core";
// Increments for each instance of this component
let nextId = 0;
@@ -10,7 +10,7 @@ let nextId = 0;
export class DialogTitleContainerDirective implements OnInit {
@HostBinding("id") id = `bit-dialog-title-${nextId++}`;
readonly simple = input(false);
@Input() simple = false;
constructor(@Optional() private dialogRef: DialogRef<any>) {}