'use client';

import { Input } from '@/components/ui/input';
import type { FieldConfig } from '@/types/invyone-component';

interface TextFieldProps {
  field: FieldConfig;
  value: any;
  onChange: (value: any) => void;
  mode: 'form' | 'search';
  disabled?: boolean;
  error?: string;
}

export function TextField({ field, value, onChange, mode, disabled, error }: TextFieldProps) {
  return (
    <Input
      type="text"
      value={value ?? ''}
      onChange={(e) => onChange(e.target.value)}
      placeholder={field.placeholder ?? field.label}
      disabled={disabled}
      className={`h-7 text-xs ${error ? 'border-destructive' : ''}`}
    />
  );
}
