import { expect, userEvent, waitFor, within } from "storybook/test"; import type { Meta, StoryObj } from "@storybook/react-vite"; import { Button } from "../actions/Button"; import { InputText } from "../inputs/InputText"; import { View } from "../primitives/View"; import { Story } from "../story-components/Story"; import { Form } from "./Form"; import { FormField } from "./FormField"; interface SignInValues { email: string; } function validateEmail(value: string): string | undefined { return value.trim().length === 0 ? "Email is required." : undefined; } type ThisStory = StoryObj; export default { title: "alouette/Forms/Form", component: Form, parameters: { componentSubtitle: "Owns the react-hook-form instance and hands its control to render, so each field infers the form type from the control and its own value type from name. Renders whatever layout you pass to render — SimpleVForm standardizes the common column of fields + submit button case.", }, } satisfies Meta; export const FormStory: ThisStory = { name: "Form examples", render: () => ( defaultValues={{ email: "" }} render={({ control, submit }) => ( ( )} />