import { Eye, EyeOff } from "lucide-react";
import type { ReactNode } from "react";
import { useState } from "react";
import { Button } from "@/components/ui/button";
import { DialogFooter } from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Spinner } from "@/components/ui/spinner";
interface ApiBaseUrlFieldProps {
value: string;
onChange: (value: string) => void;
/** Placeholder, typically the provider's prefilled default base URL. */
placeholder?: string;
hint?: ReactNode;
}
/** Shared API Base URL input. The prefilled default is passed in via `value`. */
export function ApiBaseUrlField({ value, onChange, placeholder, hint }: ApiBaseUrlFieldProps) {
return (
onChange(event.target.value)}
placeholder={placeholder || "https://api.example.com/v1"}
/>
{hint ?
{hint}
: null}
);
}
interface ApiKeyFieldProps {
value: string;
onChange: (value: string) => void;
label?: string;
placeholder?: string;
}
/** Shared masked API Key input. */
export function ApiKeyField({
value,
onChange,
label = "API Key",
placeholder = "API key",
}: ApiKeyFieldProps) {
const [showApiKey, setShowApiKey] = useState(false);
return (
);
}
interface ConnectFormFooterProps {
onCancel: () => void;
onSubmit: () => void;
canSubmit: boolean;
isPending: boolean;
}
/** Shared Cancel / Connect footer for every provider connect form. */
export function ConnectFormFooter({
onCancel,
onSubmit,
canSubmit,
isPending,
}: ConnectFormFooterProps) {
return (
);
}