import { useWatch, type Control, type FieldPath, type FieldValues } from 'react-hook-form' import { FormControl, FormField, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from 'ui' import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout' import { BUILDING_OPTIONS, CAN_CODE_OPTIONS, ORG_SIZE_TYPES, SURVEY_ORG_KIND_OPTIONS, } from './OnboardingSurvey.constants' import { OnboardingSurveySelect } from './OnboardingSurveySelect' interface OnboardingSurveyFieldsProps { control: Control } // Expects the form to have the onboardingSurveySchema fields: kind, size, building and can_code export const OnboardingSurveyFields = ({ control, }: OnboardingSurveyFieldsProps) => { const kindField = 'kind' as FieldPath const sizeField = 'size' as FieldPath const buildingField = 'building' as FieldPath const canCodeField = 'can_code' as FieldPath const kind = useWatch({ control, name: kindField }) return (
( )} /> {kind === 'COMPANY' && ( ( )} /> )} ( )} /> ( )} />
) }