import { CSSProperties, FC, ReactNode } from 'react'; import { CropperProps } from 'react-easy-crop'; import { PropsWithClassName } from '../../lib/types/props'; /** Why an {@link ImageCropper} cannot work with the given image. */ export interface ImageCropperError { /** * `"load"` — the image itself could not be loaded. `"crop"` — the image is * displayed, but reading it into a canvas to produce the cropped file failed * (a cross-origin image without CORS headers, for example). */ reason: "load" | "crop"; /** Technical message, meant for logging — not for display. */ message: string; } export interface ImageCropperProps extends PropsWithClassName, Partial> { /** The image file to crop. */ image?: File | string; /** Callback on crop complete. */ onCropComplete?: (croppedImage: File) => void; /** * Callback when the image cannot be cropped, because it failed to load or * could not be read. */ onError?: (error: ImageCropperError) => void; /** * View that is shown instead of the cropper when the image cannot be cropped. * Defaults to a localized error message. */ errorView?: ReactNode; /** The width of the component. @default 300 */ width?: CSSProperties["width"]; /** The height of the component. @default 300 */ height?: CSSProperties["height"]; /** The aspect ratio of the crop shape. */ aspectRatio?: number; } /** * @flr-generate all * @flowStatus new */ export declare const ImageCropper: FC; export default ImageCropper;