import * as React from 'react'; import * as LabelPrimitive from '@radix-ui/react-label'; import { Slot } from '@radix-ui/react-slot'; import { type ControllerProps, type FieldPath, type FieldValues } from 'react-hook-form'; /** * Root form provider and field controller layer for React Hook Form. * * @description * Wraps `react-hook-form` instances and provides the form context to all * child primitives (`FormField`, `FormControl`, `FormMessage`). Handles * field validation state, ARIA attributes, and error messaging automatically. * * @ai-rules * 1. Always initialize with `const form = useForm({ resolver: zodResolver(schema) })` before rendering. * 2. Do NOT create stateful inputs with `useState` if they are already inside a `