'use client'; import { type ComponentRenderProps } from '@json-render/react'; import { useData, useFieldValidation } from '@json-render/react'; import { getByPath } from '@json-render/core'; export function TextField({ element }: ComponentRenderProps) { const { label, valuePath, placeholder, type, checks, validateOn } = element.props as { label: string; valuePath: string; placeholder?: string | null; type?: string | null; checks?: Array<{ fn: string; message: string }> | null; validateOn?: string | null; }; const { data, set } = useData(); const value = getByPath(data, valuePath) as string | undefined; const { errors, validate, touch } = useFieldValidation(valuePath, { checks: checks ?? undefined, validateOn: (validateOn as 'change' | 'blur' | 'submit') ?? 'blur', }); return (