import { CSSProperties, DragEvent } from 'react'; import { Area } from 'react-easy-crop'; import { ImagePickerValue } from '../types/ImagePicker.types.ts'; /** * Checks whether a picker value is a locally selected file. * * @param value The current picker value to narrow. * @returns `true` when `value` is a `File`. */ export declare const isImagePickerFile: (value: ImagePickerValue) => value is File; /** * Checks whether a drag event contains files rather than unrelated data. * * @param event The drag event emitted by the preview button. * @returns `true` when the event advertises files or contains at least one file. */ export declare const hasImagePickerFiles: (event: DragEvent) => boolean; /** * Resolves a CSS aspect-ratio value to the numeric ratio required by the * cropper. * * @param aspectRatio The CSS ratio, such as `16 / 9`, or a numeric ratio. * @returns The positive numeric ratio, or `undefined` for non-fixed values. */ export declare const resolveImagePickerAspectRatio: (aspectRatio: CSSProperties["aspectRatio"]) => number | undefined; /** * Tests a file against a native-style comma-separated `accept` value. * * MIME types, MIME wildcards such as `image/*`, and file extensions are * supported. An empty `accept` value accepts every file. * * @param file The file to validate. * @param accept The comma-separated accepted MIME types or extensions. * @returns `true` when the file matches at least one accepted value. */ export declare const acceptsImagePickerFile: (file: File, accept: string) => boolean; /** * Mirrors a local file value into the native file input so form submission and * validation stay consistent with the picker preview. * * URL and empty values clear the input. Local files are assigned through * `DataTransfer` when the browser supports it; unsupported environments leave * the input cleared. * * @param input The native file input to synchronize, if mounted. * @param value The current picker value. */ export declare const syncImagePickerInput: (input: HTMLInputElement | null, value: ImagePickerValue) => void; /** * Renders a crop area into a new local image file. * * The crop coordinates emitted by `react-easy-crop` are already expressed in * the source image's natural pixels, so no additional scale conversion is * needed before drawing to the canvas. * * @param file The original local image file. * @param cropAreaPixels The selected crop rectangle in source-image pixels. * @returns A new file with the original name and image MIME type. * @throws When the browser cannot load the image, create a canvas context, or * encode the cropped canvas. */ export declare const createImagePickerCroppedFile: (file: File, cropAreaPixels: Area) => Promise;