import { Size } from "@dt/core-ui"; import { IImageViewer } from "../../../ImageViewer/Models"; /** * Props for the ImageGalleryDropdown component. * Defines the configuration and behavior of the preset images dropdown control. */ export declare type ImageGalleryDropdownProps = { /** The image viewer instance that this dropdown is associated with */ viewer: IImageViewer; /** * Configuration for preset images - either a simple array of image URLs * or a complex configuration object with categories and metadata */ imageGallery?: string[] | ImageGalleryConfig; /** Whether the dropdown control is enabled and interactive */ enabled?: boolean; /** * Callback function called when an image is selected from the dropdown * @param image - The selected image data including URL, dimensions, and metadata */ onImageSelect?: (image: SelectedPresetImage) => void; /** * Callback function called when the user chooses to select a custom image * (usually through a file dialog) */ onCustomImageSelect?: () => void; /** Visual size of the dropdown button */ size?: Size; /** Whether the dropdown menu should open upwards instead of downwards */ dropup?: boolean; }; /** * Represents a selected preset image with its properties. * This data is passed to the onImageSelect callback when an image is chosen. */ export declare type SelectedPresetImage = { /** The URL of the selected image */ url: string; /** Optional display label for the image */ label?: string; }; /** * Configuration object for preset images. * Allows organizing images into categories with default settings. */ export declare type ImageGalleryConfig = { /** Array of categories to organize preset images */ categories?: PresetImageCategory[]; /** Whether to maintain aspect ratio when resizing images */ maintainAspectRatio?: boolean; }; /** * Represents a category of preset images. * Categories help organize images into logical groups in the dropdown. */ export declare type PresetImageCategory = { /** Display name of the category */ name: string; /** Array of image items belonging to this category */ items: PresetImageItem[]; /** Optional icon URL or identifier for the category */ icon?: string; }; /** * Represents an individual preset image item with metadata. * Each item defines one image that can be selected from the dropdown. */ export declare type PresetImageItem = { /** * URL of the image resource. * Supported image formats: JPEG, PNG, GIF, WebP, SVG, BMP */ url: string; /** Display label for the image (defaults to filename if not provided) */ label?: string; /** Optional description or tooltip for the image */ description?: string; /** Optional tags for filtering and searching images */ tags?: string[]; }; /** * Internal state for the ImageGalleryDropdown component. * Manages cached images, loading state, and current selection. */ export declare type ImageGalleryDropdownState = { /** Array of cached image data for performance optimization */ cachedImages: CachedImageData[]; /** URL of the currently selected image, if any */ selectedImageUrl?: string; /** Whether images are currently being loaded */ isLoading: boolean; isOpened?: boolean; }; /** * Internal data structure for cached image information. * Used to optimize performance by preloading and storing image data. */ export declare type CachedImageData = { /** Original URL of the image */ url: string; /** Normalized URL used as deduplication key */ normalizedUrl: string; /** If loaded image satisfies internal validation rules (MIME, file format) */ isValid: boolean; /** Display label for the image */ label: string; /** Preloaded HTMLImageElement or null if not yet loaded */ element: HTMLImageElement | null; /** Category name this image belongs to */ category?: string; };