// import { zodResolver } from '@hookform/resolvers/zod' // import { StoryContext, StoryObj } from '@storybook/react' // import { useForm } from 'react-hook-form' // import { // Button, // FormControl_Shadcn_, // FormField_Shadcn_, // FormItem_Shadcn_, // Form_Shadcn_, // PopoverContent_Shadcn_, // PopoverTrigger_Shadcn_, // Popover_Shadcn_, // SelectContent_Shadcn_, // SelectItem_Shadcn_, // SelectTrigger_Shadcn_, // SelectValue_Shadcn_, // Select_Shadcn_, // Calendar, // cn, // } from 'ui' // import { z } from 'zod' // import { transformSourceForm } from '../../lib/transformSource' // import { FormItemLayout } from './FormItemLayout' // import { Input } from '../../DataInputs/Input' // import { Calendar as CalendarIcon } from 'lucide-react' // import { format } from 'date-fns' // // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export // export default { // title: 'Form/FormItemLayout', // component: FormItemLayout, // decorators: [ // (Story: any) => { // return // }, // ], // parameters: { // // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout // layout: 'centered', // docs: { // // controls: { exclude: ['style'] }, // source: { // language: 'tsx', // transform: (code: string, StoryContext: StoryContext) => // transformSourceForm(code, StoryContext).replace('_c', 'FormInput'), // }, // }, // }, // // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs // tags: ['autodocs'], // // More on argTypes: https://storybook.js.org/docs/api/argtypes // // argTypes: {}, // } // type Story = StoryObj // export const Primary: Story = { // render: function Render(args) { // const formSchema = z.object({ // username: z.string().min(2, { // message: 'Username must be at least 2 characters.', // }), // }) // // 1. Define your form. // const form = useForm>({ // resolver: zodResolver(formSchema), // defaultValues: { // username: '', // }, // }) // // 2. Define a submit handler. // function onSubmit(values: z.infer) { // // Do something with the form values. // // ✅ This will be type-safe and validated. // console.log(values) // // action('form form.handleSubmit(onSubmit)')(values) // } // return ( // //
// ( // // // // // // )} // /> // // //
// ) // }, // args: { // label: 'Username', // description: 'this is the description', // labelOptional: 'optional', // }, // } // export const withSelect: Story = { // render: function Render(args) { // const FormSchema = z.object({ // email: z // .string({ // required_error: 'Please select an email to display.', // }) // .email(), // }) // const form = useForm>({ // resolver: zodResolver(FormSchema), // }) // // 2. Define a submit handler. // function onSubmit(values: z.infer) { // // Do something with the form values. // // ✅ This will be type-safe and validated. // console.log(values) // // action('form form.handleSubmit(onSubmit)')(values) // } // return ( // //
// ( // // // // // // // // // m@example.com // m@google.com // m@support.com // // // // )} // /> // // //
// ) // }, // args: { // label: 'Username', // description: 'this is the description', // labelOptional: 'optional', // }, // } // export const withLayoutChange: Story = { // render: function Render(args) { // const formSchema = z.object({ // username: z.string().min(2, { // message: 'Username must be at least 2 characters.', // }), // }) // // 1. Define your form. // const form = useForm>({ // resolver: zodResolver(formSchema), // defaultValues: { // username: '', // }, // }) // // 2. Define a submit handler. // function onSubmit(values: z.infer) { // // Do something with the form values. // // ✅ This will be type-safe and validated. // console.log(values) // // action('form form.handleSubmit(onSubmit)')(values) // } // return ( // //
// ( // // // // // // )} // /> // // //
// ) // }, // args: { // layout: 'horizontal', // label: 'Username', // description: 'this is the description', // labelOptional: 'optional', // }, // } // export const withCalendar: Story = { // render: function Render(args) { // const FormSchema = z.object({ // dob: z.date({ // required_error: 'A date of birth is required.', // }), // }) // const form = useForm>({ // resolver: zodResolver(FormSchema), // }) // // 2. Define a submit handler. // function onSubmit(values: z.infer) { // // Do something with the form values. // // ✅ This will be type-safe and validated. // console.log(values) // // action('form form.handleSubmit(onSubmit)')(values) // } // return ( // //
// ( // // // // // // // // // date > new Date() || date < new Date('1900-01-01')} // initialFocus // /> // // // // )} // /> // // //
// ) // }, // args: { // layout: 'vertical', // label: 'Date of birth', // description: 'Your date of birth is used to calculate your age.', // labelOptional: 'optional', // }, // }