diff --git a/libs/components/src/dialog/dialog/dialog.component.html b/libs/components/src/dialog/dialog/dialog.component.html index e084728348..6f38f3d64e 100644 --- a/libs/components/src/dialog/dialog/dialog.component.html +++ b/libs/components/src/dialog/dialog/dialog.component.html @@ -36,7 +36,9 @@ [ngClass]="{ 'tw-p-4': !disablePadding, 'tw-overflow-y-auto': !loading, - 'tw-invisible tw-overflow-y-hidden': loading + 'tw-invisible tw-overflow-y-hidden': loading, + 'tw-bg-background': background === 'default', + 'tw-bg-background-alt': background === 'alt' }" > diff --git a/libs/components/src/dialog/dialog/dialog.component.ts b/libs/components/src/dialog/dialog/dialog.component.ts index 6d188ab9df..b44216de7b 100644 --- a/libs/components/src/dialog/dialog/dialog.component.ts +++ b/libs/components/src/dialog/dialog/dialog.component.ts @@ -9,6 +9,10 @@ import { fadeIn } from "../animations"; animations: [fadeIn], }) export class DialogComponent { + /** Background color */ + @Input() + background: "default" | "alt" = "default"; + /** * Dialog size, more complex dialogs should use large, otherwise default is fine. */ diff --git a/libs/components/src/dialog/dialog/dialog.stories.ts b/libs/components/src/dialog/dialog/dialog.stories.ts index cada557ecd..ee377aa930 100644 --- a/libs/components/src/dialog/dialog/dialog.stories.ts +++ b/libs/components/src/dialog/dialog/dialog.stories.ts @@ -1,12 +1,19 @@ +import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from "@angular/forms"; import { NoopAnimationsModule } from "@angular/platform-browser/animations"; import { Meta, StoryObj, moduleMetadata } from "@storybook/angular"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; +import { BadgeModule } from "../../badge"; import { ButtonModule } from "../../button"; +import { CardComponent } from "../../card"; +import { FormFieldModule } from "../../form-field"; import { IconButtonModule } from "../../icon-button"; +import { InputModule } from "../../input"; +import { SectionComponent, SectionHeaderComponent } from "../../section"; import { SharedModule } from "../../shared"; import { TabsModule } from "../../tabs"; +import { TypographyModule } from "../../typography"; import { I18nMockService } from "../../utils/i18n-mock.service"; import { DialogModule } from "../dialog.module"; @@ -19,11 +26,20 @@ export default { moduleMetadata({ imports: [ DialogModule, + BadgeModule, ButtonModule, SharedModule, IconButtonModule, TabsModule, NoopAnimationsModule, + SectionComponent, + SectionHeaderComponent, + CardComponent, + TypographyModule, + FormsModule, + ReactiveFormsModule, + FormFieldModule, + InputModule, ], providers: [ { @@ -31,6 +47,7 @@ export default { useFactory: () => { return new I18nMockService({ close: "Close", + loading: "Loading", }); }, }, @@ -63,6 +80,9 @@ export const Default: Story = { props: args, template: ` + + Foobar + Dialog body text goes here. @@ -173,3 +193,79 @@ export const TabContent: Story = { }, }, }; + +export const WithCards: Story = { + render: (args: DialogComponent) => ({ + props: { + formObj: new FormGroup({ + name: new FormControl(""), + }), + ...args, + }, + template: /*html*/ ` +
+ + + + +

+ Foo +

+ +
+ + + Label + + Optional Hint + + + Label + + Optional Hint + + +
+ + +

+ Bar +

+ +
+ + + Label + + Optional Hint + + + Label + + Optional Hint + + +
+
+ + + + + +
+
+ `, + }), + args: { + dialogSize: "default", + title: "Default", + subtitle: "Subtitle", + }, +};