2024-07-12 10:49:47 +08:00
|
|
|
import type { ReactNode } from 'react';
|
2024-06-21 11:42:21 +08:00
|
|
|
import type { QRProps } from '@rc-component/qrcode';
|
2023-07-17 23:43:32 +08:00
|
|
|
|
2024-07-12 10:49:47 +08:00
|
|
|
import type { Locale } from '../locale';
|
|
|
|
|
2024-06-21 11:42:21 +08:00
|
|
|
type ImageSettings = QRProps['imageSettings'];
|
2023-07-17 23:43:32 +08:00
|
|
|
|
2024-06-21 11:42:21 +08:00
|
|
|
export type { QRProps, ImageSettings };
|
2023-07-17 23:43:32 +08:00
|
|
|
|
|
|
|
export type QRPropsCanvas = QRProps & React.CanvasHTMLAttributes<HTMLCanvasElement>;
|
|
|
|
|
|
|
|
export type QRPropsSvg = QRProps & React.SVGAttributes<SVGSVGElement>;
|
|
|
|
|
2024-07-12 10:49:47 +08:00
|
|
|
export type QRStatus = 'active' | 'expired' | 'loading' | 'scanned';
|
|
|
|
|
|
|
|
export type StatusRenderInfo = {
|
|
|
|
status: Exclude<QRStatus, 'active'>;
|
|
|
|
locale: Locale['QRCode'];
|
|
|
|
onRefresh?: () => void;
|
|
|
|
};
|
|
|
|
|
2024-06-10 17:47:45 +08:00
|
|
|
export interface QRCodeProps extends QRProps, React.HTMLAttributes<HTMLDivElement> {
|
2024-06-21 11:42:21 +08:00
|
|
|
type?: 'canvas' | 'svg';
|
2023-07-17 23:43:32 +08:00
|
|
|
className?: string;
|
|
|
|
rootClassName?: string;
|
|
|
|
prefixCls?: string;
|
|
|
|
icon?: string;
|
2024-06-10 17:47:45 +08:00
|
|
|
iconSize?: number | { width: number; height: number };
|
2023-07-17 23:43:32 +08:00
|
|
|
bordered?: boolean;
|
|
|
|
errorLevel?: 'L' | 'M' | 'Q' | 'H';
|
2024-07-12 10:49:47 +08:00
|
|
|
status?: QRStatus;
|
2023-07-17 23:43:32 +08:00
|
|
|
onRefresh?: () => void;
|
2024-07-12 10:49:47 +08:00
|
|
|
statusRender?: (info: StatusRenderInfo) => ReactNode;
|
2023-07-17 23:43:32 +08:00
|
|
|
}
|