import { zodResolver } from '@hookform/resolvers/zod' import { useForm } from 'react-hook-form' import { Form, FormControl, FormField, Input, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from 'ui' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { z } from 'zod' const ORG_KIND_TYPES = { PERSONAL: 'Personal', EDUCATIONAL: 'Educational', STARTUP: 'Startup', AGENCY: 'Agency', COMPANY: 'Company', UNDISCLOSED: 'N/A', } const ORG_KIND_DEFAULT = 'PERSONAL' const ORG_SIZE_TYPES = { '1': '1 - 10', '10': '10 - 49', '50': '50 - 99', '100': '100 - 299', '300': 'More than 300', } interface Props { onSubmit: (values: NewMarketplaceOrgForm) => void } export const CREATE_AWS_MANAGED_ORG_FORM_ID = 'create-aws-managed-org-form' const FormSchema = z.object({ name: z.string().trim().min(1, 'Please provide an organization name'), kind: z.string(), size: z.string().optional(), }) export type NewMarketplaceOrgForm = z.infer const NewAwsMarketplaceOrgForm = ({ onSubmit }: Props) => { const form = useForm({ resolver: zodResolver(FormSchema as any), defaultValues: { name: '', kind: ORG_KIND_DEFAULT, }, }) const kind = form.watch('kind') return (
( <>
)} /> ( <>
)} /> {kind == 'COMPANY' && ( ( <>
)} /> )}
) } export default NewAwsMarketplaceOrgForm