import { CardStack, CardStackContent, CardStackEntry, CardStackEntryContent, CardStackEntryDescription, CardStackEntryField, CardStackEntryTitle, } from "@executor-js/react/components/card-stack"; import { FreeformCombobox, type FreeformComboboxOption, } from "@executor-js/react/components/combobox"; import { Input } from "@executor-js/react/components/input"; import { IntegrationFavicon } from "@executor-js/react/components/integration-favicon"; import { IntegrationIdentityFieldRows, type IntegrationIdentity, } from "@executor-js/react/plugins/integration-identity"; export function OpenApiSourceDetailsFields(props: { readonly title: string; readonly description?: string; readonly identity: IntegrationIdentity; readonly baseUrl: string; readonly onBaseUrlChange: (value: string) => void; readonly baseUrlOptions?: readonly FreeformComboboxOption[]; readonly specUrl?: string; readonly onSpecUrlChange?: (value: string) => void; readonly faviconIcon?: string | null; readonly faviconUrl?: string; readonly namespaceReadOnly?: boolean; readonly specUrlDisabled?: boolean; readonly saveState?: "idle" | "saving" | "saved"; readonly baseUrlMissingMessage?: string; readonly footer?: string; }) { const baseUrlOptions = props.baseUrlOptions ?? []; return ( {(props.faviconIcon || props.faviconUrl) && ( )} {props.title} {props.description && ( {props.description} )} {props.saveState && props.saveState !== "idle" && ( {props.saveState === "saving" ? "Saving…" : "Saved"} )}
{baseUrlOptions.length > 0 ? ( ) : ( props.onBaseUrlChange((e.target as HTMLInputElement).value)} placeholder="https://api.example.com" className="font-mono text-sm" /> )} {props.baseUrlMissingMessage && !props.baseUrl && (

{props.baseUrlMissingMessage}

)}
{props.specUrl !== undefined && props.onSpecUrlChange && ( props.onSpecUrlChange?.((e.target as HTMLInputElement).value)} placeholder="https://api.example.com/openapi.json" className="font-mono text-sm" disabled={props.specUrlDisabled} /> )}
{props.footer && ( {props.footer} )}
); }