import { Meta, StoryObj, moduleMetadata } from "@storybook/angular"; import { I18nService } from "@bitwarden/common/abstractions/i18n.service"; import { ButtonModule } from "../../button"; import { IconButtonModule } from "../../icon-button"; import { SharedModule } from "../../shared"; import { TabsModule } from "../../tabs"; import { I18nMockService } from "../../utils/i18n-mock.service"; import { DialogCloseDirective } from "../directives/dialog-close.directive"; import { DialogTitleContainerDirective } from "../directives/dialog-title-container.directive"; import { DialogComponent } from "./dialog.component"; export default { title: "Component Library/Dialogs/Dialog", component: DialogComponent, decorators: [ moduleMetadata({ imports: [ButtonModule, SharedModule, IconButtonModule, TabsModule], declarations: [DialogTitleContainerDirective, DialogCloseDirective], providers: [ { provide: I18nService, useFactory: () => { return new I18nMockService({ close: "Close", }); }, }, ], }), ], args: { loading: false, dialogSize: "small", }, argTypes: { _disablePadding: { table: { disable: true, }, }, }, parameters: { design: { type: "figma", url: "https://www.figma.com/file/Zt3YSeb6E6lebAffrNLa0h/Tailwind-Component-Library", }, }, } as Meta; type Story = StoryObj; export const Default: Story = { render: (args: DialogComponent) => ({ props: args, template: ` {{title}} Dialog body text goes here. `, }), args: { dialogSize: "default", title: "Default", }, }; export const Small: Story = { ...Default, args: { dialogSize: "small", title: "Small", }, }; export const LongTitle: Story = { ...Default, args: { dialogSize: "small", title: "Long_Title_That_Should_Be_Truncated", }, }; export const Large: Story = { ...Default, args: { dialogSize: "large", title: "Large", }, }; export const Loading: Story = { ...Default, args: { dialogSize: "large", loading: true, title: "Loading", }, }; export const ScrollingContent: Story = { render: (args: DialogComponent) => ({ props: args, template: ` Scrolling Example Dialog body text goes here.
repeating lines of characters
end of sequence!
`, }), args: { dialogSize: "small", }, }; export const TabContent: Story = { render: (args) => ({ props: args, template: ` Tab Content Example First Tab Content Second Tab Content Third Tab Content `, }), args: { dialogSize: "large", disablePadding: true, }, parameters: { docs: { storyDescription: `An example of using the \`bitTabGroup\` component within the Dialog. The content padding should be disabled (via \`disablePadding\`) so that the tabs are flush against the dialog title.`, }, }, };