import type { ReactElement } from 'react'; import type { ModalHeaderLayoutProps, ModalProps } from '../Modal'; import { ComponentOverridableForwardRefComponentPropsFactory } from '../utils/jsx-types'; import { CropArea, CropperComponent, CropperPropsBase } from './typings'; export type CropperModalProps = Omit & ModalHeaderLayoutProps & { /** * The text for the cancel button. */ cancelText?: ModalProps['cancelText']; /** * The text for the confirm button. * @default '確認' */ confirmText?: string; /** * Additional className for the cropper content wrapper. */ cropperContentClassName?: string; /** * Props for the CropperElement component. */ cropperProps?: CropperPropsBase; /** * Callback fired when the cancel button is clicked. */ onCancel?: () => void; /** * Callback fired when the confirm button is clicked. * Receives the cropping context with canvas, cropArea, and imageSrc. */ onConfirm?: (context: CropperModalConfirmContext) => void | Promise; /** * Whether to show the modal footer with confirm and cancel buttons. * @default true */ showModalFooter?: boolean; /** * Whether to show the modal header. * @default true */ showModalHeader?: boolean; /** * The title of the modal header. * @default '圖片裁切' */ title?: string; }; export interface CropperModalConfirmContext { canvas: HTMLCanvasElement | null; cropArea: CropArea | null; imageSrc?: string | File | Blob; } export type CropperModalResult = CropperModalConfirmContext; export type CropperModalOpenOptions = Omit; export type CropperProps = ComponentOverridableForwardRefComponentPropsFactory; /** * The react component for `mezzanine` cropper. */ declare const Cropper: import("react").ForwardRefExoticComponent, keyof CropperPropsBase> & CropperPropsBase, "component"> & { component?: CropperComponent | undefined; } & import("react").RefAttributes>; export type CropperModalType = ((props: CropperModalProps) => ReactElement | null) & { open: (options: CropperModalOpenOptions) => Promise; }; export declare const CropperModal: CropperModalType; export default Cropper;