// Adapted from Untitled UI React (MIT). See THIRD_PARTY_NOTICES.md. import { useId, useState, type ComponentProps } from "react"; export interface InputFileProps extends Omit< ComponentProps<"input">, "type" | "children" > { label: string; description?: string; error?: string; buttonLabel?: string; inputClassName?: string; onFilesChange?: (files: FileList | null) => void; } export function InputFile({ label, description, error, buttonLabel = "Choose files", id, className = "", inputClassName = "", onChange, onFilesChange, multiple, disabled, "aria-describedby": describedBy, ...props }: InputFileProps) { const generatedId = useId(); const inputId = id ?? generatedId; const hint = error ?? description; const hintId = `${inputId}-hint`; const [fileNames, setFileNames] = useState(""); return (
{hint}
)}