import { ReactNode } from 'react'; /** * One image returned by the host's search, shown as a tile in the gallery. The * host maps whatever provider it uses (Pexels, Unsplash, its own DAM…) onto this * shape. Only {@link ImageSearchResult.url} is committed to the form's * `imageUrl`; the rest drives the picker UI. */ export interface ImageSearchResult { /** Stable id from the source (e.g. the Pexels photo id). Used as the React key. */ id: string; /** Small preview URL for the grid tile (keeps the gallery light). */ thumbUrl: string; /** Full-size URL written to `imageUrl` when the tile is picked. */ url: string; /** Optional alt text / description for accessibility. */ alt?: string; /** Optional attribution line (e.g. "Photo by Jane Doe on Pexels"). */ credit?: string; } /** * Host integration for the image gallery. `search` is called with the author's * query and resolves with matching images; the host owns the provider and its * API key (proxy Pexels server-side rather than shipping a key to the browser). * `enabled` is simply "a handler was wired" — without it the builder keeps the * plain Image URL field and shows the "gallery coming soon" chip. Mirrors the * custom-fields / mailing-lists providers. * * `defaults` is what the gallery shows before the author has typed anything: the * results of a preload the host asked for via the element's `preloadGallery()`. * Empty unless the host called it, in which case the gallery keeps its "search * to get started" prompt. */ export interface ImageSearchApi { search?: (query: string) => Promise; defaults: ImageSearchResult[]; enabled: boolean; /** The last search, kept so reopening the gallery doesn't start from nothing. */ session: SearchSession; setSession: (next: SearchSession) => void; } /** * What the gallery was showing when it was last closed. Living here rather than * in the gallery's own state is what makes it survive: the provider sits above * everything that unmounts, so closing the picker or selecting another card * doesn't throw the search away. `searched` is the query `results` belong to, * which is how reopening knows it already has them and can skip the refetch. */ export interface SearchSession { query: string; results: ImageSearchResult[]; searched: string; } export declare function ImageSearchProvider({ search, defaults, children, }: { search?: (query: string) => Promise; defaults?: ImageSearchResult[]; children: ReactNode; }): import("react").JSX.Element; export declare function useImageSearch(): ImageSearchApi;