import { FormsModule, ReactiveFormsModule, FormControl, FormGroup } from "@angular/forms"; import { Meta, StoryObj, moduleMetadata } from "@storybook/angular"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nMockService } from "../utils/i18n-mock.service"; import { RadioButtonModule } from "./radio-button.module"; import { RadioGroupComponent } from "./radio-group.component"; export default { title: "Component Library/Form/Radio Button", component: RadioGroupComponent, decorators: [ moduleMetadata({ imports: [FormsModule, ReactiveFormsModule, RadioButtonModule], providers: [ { provide: I18nService, useFactory: () => { return new I18nMockService({ required: "required", inputRequired: "Input is required.", inputEmail: "Input is not an email-address.", }); }, }, ], }), ], parameters: { design: { type: "figma", url: "https://www.figma.com/file/Zt3YSeb6E6lebAffrNLa0h/Tailwind-Component-Library?node-id=3930%3A16850&t=xXPx6GJYsJfuMQPE-4", }, }, } as Meta; type Story = StoryObj; export const Inline: Story = { render: () => ({ props: { formObj: new FormGroup({ radio: new FormControl(0), }), }, template: `
Group of radio buttons First Second Third
`, }), }; export const Block: Story = { render: () => ({ props: { formObj: new FormGroup({ radio: new FormControl(0), }), }, template: `
Group of radio buttons First This is a hint for the first option Second This is a hint for the second option Third This is a hint for the third option
`, }), };