import { FileInputValue, FileUpload } from "@/components/FileUpload"; import { Input } from "@/components/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { CodeEditor } from "./components/CodeEditor"; import { AutoResizingTextarea } from "@/components/AutoResizingTextarea/AutoResizingTextarea"; import { WorkflowParameterValueType } from "./types/workflowTypes"; import { CredentialSelector } from "./components/CredentialSelector"; type Props = { type: WorkflowParameterValueType; value: unknown; onChange: (value: unknown) => void; }; function WorkflowParameterInput({ type, value, onChange }: Props) { if (type === "json") { return ( onChange(value)} value={ typeof value === "string" ? value : JSON.stringify(value, null, 2) } minHeight="96px" maxHeight="500px" /> ); } if (type === "string") { return ( onChange(e.target.value)} /> ); } if (type === "integer") { return ( { const val = e.target.value; // Return null for empty input, otherwise parse as integer onChange(val === "" ? null : parseInt(val, 10)); }} type="number" /> ); } if (type === "float") { return ( { const val = e.target.value; // Return null for empty input, otherwise parse as float onChange(val === "" ? null : parseFloat(val)); }} type="number" step="any" /> ); } if (type === "boolean") { return ( ); } if (type === "file_url") { return ( onChange(value)} /> ); } if (type === "credential_id") { const credentialId = value as string | null; return ( onChange(value)} /> ); } } export { WorkflowParameterInput };