import * as React from "react"; import { CropperProps } from "react-easy-crop"; import { StepperProps } from "../Stepper"; import { ViewProps } from "../View"; interface Crop { x: number; y: number; } interface CropAreaPixels { width: number; height: number; x: number; y: number; } interface ErrorMessagesProps { uploadingError?: string; } export interface ImageUploaderProps extends ViewProps { /** The component will fire onChange when an image is selected or deleted; * File is the File object of the selected image, which will be null if the image was deleted * Unless the defaultImage prop is set * */ onChange?: (evt: { target: { name: string; value: string | File; }; }) => void; value?: File | string; name?: string; uploadText?: React.ReactNode | string; uploadingText?: React.ReactNode | string; supportedFormatText?: React.ReactNode | string; allowCrop?: boolean; disableDelete?: boolean; cropConfig?: Partial void>>; stepperProps?: Partial; imageBackgroundSize?: React.CSSProperties["backgroundSize"]; imageViewProps?: React.CSSProperties; defaultImage?: string; /** Upload state view managed by external image upload request * */ isUploading?: boolean; zoomValue?: number; onZoomChange?: (value: number) => void; onReject?: (files: File[]) => void; maxSizeInBytes?: number; errorMessages?: ErrorMessagesProps; } interface State { file?: File; disabledClick?: boolean; preview?: string; crop: Crop; zoom: number; stepper: number; croppedAreaPixels?: CropAreaPixels; errorMessage?: boolean | string; } /** * A component to standardize the uploading of images. This component is used to select images only. Actual uploading is left to the discretion of the implementing code. A file object is provided onChange, and this is the object that should be used by the implementing code to upload to whatever image hosting service is required. */ declare class ImageUploader extends React.Component { static defaultProps: Partial; static getDerivedStateFromProps(nextProps: ImageUploaderProps, prevState: State): { preview: string; file?: undefined; } | { file: File; preview: string; }; timerId: number; private defaultCropState; constructor(props: ImageUploaderProps); setCrop: (values: Crop) => void; setZoom: (evt: React.ChangeEvent>) => void; handleZoomChange: (zoom: number) => void; roundNumber(value: number): number; setCroppedAreaPixels: (croppedArea: unknown, croppedAreaPixels: CropAreaPixels) => void; componentDidMount(): void; componentWillUnmount(): void; onChange(files: File[]): void; onBlur(): void; onReject(files: File[]): void; render(): JSX.Element; removeImage(): void; renderImage(open: () => void, isDragActive: boolean): JSX.Element; private doCrop; } export default ImageUploader;