{"name":"rhf-input-field","title":"RHF Input Field","description":"Text input field with React Hook Form integration.","type":"registry:ui","docs":"/components/rhf-input-field","categories":["forms"],"registryDependencies":["https://pb-ui-five.vercel.app/registry/rhf-base-controller","https://pb-ui-five.vercel.app/registry/input"],"dependencies":["react-hook-form"],"files":[{"path":"components/ui/rhf-inputs/input-field.tsx","target":"components/ui/rhf-inputs/input-field.tsx","type":"registry:ui","content":"\"use client\";\n\nimport { InputHTMLAttributes } from \"react\";\nimport { FieldValues } from \"react-hook-form\";\nimport { Input } from \"../input\";\nimport { BaseController, BaseControllerProps } from \"./base-controller\";\n\ntype FieldInputProps<T extends FieldValues> = Omit<\n  InputHTMLAttributes<HTMLInputElement>,\n  \"name\" | \"id\"\n> & {\n  maxLength?: number;\n} & Omit<BaseControllerProps<T>, \"children\">;\n\nexport function InputField<T extends FieldValues>({\n  control,\n  name,\n  label,\n  description,\n  maxLength,\n  disableFieldError = false,\n  required,\n  ...inputProps\n}: FieldInputProps<T>) {\n  return (\n    <BaseController\n      control={control}\n      name={name}\n      label={label}\n      required={required}\n      description={description}\n      disableFieldError={disableFieldError}\n    >\n      {({ field, fieldState, ariaDescribedBy }) => (\n        <div className=\"relative\">\n          <Input\n            id={field.name}\n            aria-invalid={!!fieldState.error}\n            aria-required={required}\n            aria-describedby={ariaDescribedBy}\n            {...field}\n            value={field.value ?? \"\"}\n            {...inputProps}\n            className={`${maxLength ? \"pr-16\" : \"\"} ${\n              inputProps.className || \"\"\n            }`}\n          />\n          {maxLength && (\n            <div className=\"top-1/2 right-3 absolute text-muted-foreground text-xs -translate-y-1/2 pointer-events-none\">\n              {(field.value || \"\").length}/{maxLength}\n            </div>\n          )}\n        </div>\n      )}\n    </BaseController>\n  );\n}\n"}]}