import * as React from "react" export const FieldContext = React.createContext<{ required?: boolean disabled?: boolean error?: string | boolean }>({}) function Wrapper(props: React.ComponentPropsWithoutRef<"div">) { const fieldContext = React.useContext(FieldContext) const { children, ...other } = props return ( <>
{children}
{typeof fieldContext?.error === "string" && (

{fieldContext?.error}

)} ) } type WrapperProps = React.ComponentPropsWithoutRef & { slotProps?: { root?: React.ComponentPropsWithoutRef<"div"> } } export const Field = React.forwardRef< HTMLDivElement, WrapperProps<"div"> & { required?: boolean disabled?: boolean error?: string | boolean } >(function Field(props, ref) { const { children, slotProps, required, disabled, error, ...other } = props return (
{children}
) }) export const FieldSet = React.forwardRef< HTMLFieldSetElement, WrapperProps<"fieldset"> & { required?: boolean disabled?: boolean error?: string | boolean } >(function FieldSet(props, ref) { const { children, slotProps, required, disabled, error, ...other } = props return (
{children}
) })