diff --git a/libs/tools/send/send-ui/src/send-form/send-form.mdx b/libs/tools/send/send-ui/src/send-form/send-form.mdx deleted file mode 100644 index d1297ee90c..0000000000 --- a/libs/tools/send/send-ui/src/send-form/send-form.mdx +++ /dev/null @@ -1,17 +0,0 @@ -import { Controls, Meta, Primary } from "@storybook/addon-docs"; - -import * as stories from "./send-form.stories"; - - - -# Send Form - -The send form is a re-usable form component that can be used to create, update, and clone sends. It -is configured via a `SendFormConfig` object that is passed to the component as a prop. The -`SendFormConfig` object can be created manually, or a `SendFormConfigService` can be used to create -it. A default implementation of the `SendFormConfigService` exists in the `@bitwarden/send-ui` -library. - - - - diff --git a/libs/tools/send/send-ui/src/send-form/send-form.stories.ts b/libs/tools/send/send-ui/src/send-form/send-form.stories.ts deleted file mode 100644 index 2c47bd6262..0000000000 --- a/libs/tools/send/send-ui/src/send-form/send-form.stories.ts +++ /dev/null @@ -1,134 +0,0 @@ -import { importProvidersFrom } from "@angular/core"; -import { action } from "@storybook/addon-actions"; -import { - applicationConfig, - componentWrapperDecorator, - Meta, - moduleMetadata, - StoryObj, -} from "@storybook/angular"; - -import { SendType } from "@bitwarden/common/tools/send/enums/send-type"; -import { Send } from "@bitwarden/common/tools/send/models/domain/send"; -import { SendView } from "@bitwarden/common/tools/send/models/view/send.view"; -import { AsyncActionsModule, ButtonModule, ToastService } from "@bitwarden/components"; -import { SendFormConfig } from "@bitwarden/send-ui"; -// FIXME: remove `/apps` import from `/libs` -// eslint-disable-next-line import/no-restricted-paths -import { PreloadedEnglishI18nModule } from "@bitwarden/web-vault/src/app/core/tests"; - -import { SendFormService } from "./abstractions/send-form.service"; -import { SendFormComponent } from "./components/send-form.component"; -import { SendFormModule } from "./send-form.module"; - -const defaultConfig: SendFormConfig = { - mode: "add", - sendType: SendType.Text, - areSendsAllowed: true, - originalSend: { - id: "123", - name: "Test Send", - notes: "Example notes", - } as unknown as Send, -}; - -class TestAddEditFormService implements SendFormService { - decryptSend(): Promise { - return Promise.resolve(defaultConfig.originalSend as any); - } - async saveSend(send: SendView, file: File | ArrayBuffer): Promise { - await new Promise((resolve) => setTimeout(resolve, 1000)); - return send; - } -} - -const actionsData = { - onSave: action("onSave"), -}; - -export default { - title: "Tools/Send Form", - component: SendFormComponent, - decorators: [ - moduleMetadata({ - imports: [SendFormModule, AsyncActionsModule, ButtonModule], - providers: [ - { - provide: SendFormService, - useClass: TestAddEditFormService, - }, - { - provide: ToastService, - useValue: { - showToast: action("showToast"), - }, - }, - ], - }), - componentWrapperDecorator( - (story) => `
${story}
`, - ), - applicationConfig({ - providers: [importProvidersFrom(PreloadedEnglishI18nModule)], - }), - ], - args: { - config: defaultConfig, - }, - argTypes: { - config: { - description: "The configuration object for the form.", - }, - }, -} as Meta; - -type Story = StoryObj; - -export const Default: Story = { - render: (args) => { - return { - props: { - onSave: actionsData.onSave, - ...args, - }, - template: /*html*/ ` - - - `, - }; - }, -}; - -export const Edit: Story = { - ...Default, - args: { - config: { - ...defaultConfig, - mode: "edit", - originalSend: defaultConfig.originalSend, - }, - }, -}; - -export const PartialEdit: Story = { - ...Default, - args: { - config: { - ...defaultConfig, - mode: "partial-edit", - originalSend: defaultConfig.originalSend, - }, - }, -}; - -export const SendsHaveBeenDisabledByPolicy: Story = { - ...Default, - args: { - config: { - ...defaultConfig, - mode: "add", - areSendsAllowed: false, - originalSend: defaultConfig.originalSend, - }, - }, -};