import { zodResolver } from '@hookform/resolvers/zod' import { Box, FileWarning } from 'lucide-react' import { useForm } from 'react-hook-form' import { Badge, Button, Checkbox_Shadcn_, Form_Shadcn_, FormControl_Shadcn_, FormField_Shadcn_, RadioGroup_Shadcn_, RadioGroupItem_Shadcn_, Select_Shadcn_, SelectContent_Shadcn_, SelectItem_Shadcn_, SelectTrigger_Shadcn_, SelectValue_Shadcn_, Separator, Switch, } from 'ui' import { z } from 'zod' import { Input } from '../DataInputs/Input' import { InfoTooltip } from '../InfoTooltip/InfoTooltip' import { FormItemLayout } from './FormItemLayout/FormItemLayout' /** * This is helper file for the FormLayout stories. */ const items = [ { id: 'recents', label: 'Recents', }, { id: 'home', label: 'Home', }, { id: 'applications', label: 'Applications', }, { id: 'desktop', label: 'Desktop', }, { id: 'downloads', label: 'Downloads', }, { id: 'documents', label: 'Documents', }, ] as const export const Page = () => { const FormSchema = z.object({ username: z.string().min(2, { message: 'Username must be at least 2 characters.', }), kevins_input: z.string().min(6, { message: 'Username must be at least 6 characters.', }), email: z .string({ required_error: 'Please select an email to display.', }) .email(), consistent_settings: z.boolean().default(false).optional(), switch_option: z.boolean().default(false).optional(), items: z.array(z.string()).refine((value) => value.some((item) => item), { message: 'You have to select at least one item.', }), type: z.enum(['all', 'mentions', 'none'], { required_error: 'You need to select a notification type.', }), }) const form = useForm>({ resolver: zodResolver(FormSchema), defaultValues: { username: '', items: ['recents', 'home'], }, }) function onSubmit(data: z.infer) { console.log(data) } const UserIcon = () => { return (
) } return (

Welcome

Please fill in the following

( You can also rename this later.} > } placeholder="mildtomato" {...field} /> )} /> ( )} /> (
m@example.com
UserIconm@google.com
m@support.com
)} /> ( } placeholder="Needs to be 6 long" {...field} /> )} /> ( Danger zone! } label="Use consistent settings" description="This is your public display name." layout="flex" > )} /> ( Please give me info} > {/*
Sidebar Select the items you want to display in the sidebar.
*/} {items.map((item) => ( { return ( { return checked ? field.onChange([...field.value, item.id]) : field.onChange(field.value?.filter((value) => value !== item.id)) }} /> ) }} /> ))} {/* */}
)} /> ( )} />
) }