interface.d.ts 1.0 KB

1234567891011121314151617181920212223242526272829
  1. import type { ReactNode } from 'react';
  2. import type { QRProps } from '@rc-component/qrcode';
  3. import type { Locale } from '../locale';
  4. type ImageSettings = QRProps['imageSettings'];
  5. export type { QRProps, ImageSettings };
  6. export type QRPropsCanvas = QRProps & React.CanvasHTMLAttributes<HTMLCanvasElement>;
  7. export type QRPropsSvg = QRProps & React.SVGAttributes<SVGSVGElement>;
  8. export type QRStatus = 'active' | 'expired' | 'loading' | 'scanned';
  9. export type StatusRenderInfo = {
  10. status: Exclude<QRStatus, 'active'>;
  11. locale: Locale['QRCode'];
  12. onRefresh?: () => void;
  13. };
  14. export interface QRCodeProps extends QRProps, React.HTMLAttributes<HTMLDivElement> {
  15. type?: 'canvas' | 'svg';
  16. className?: string;
  17. rootClassName?: string;
  18. prefixCls?: string;
  19. icon?: string;
  20. iconSize?: number | {
  21. width: number;
  22. height: number;
  23. };
  24. bordered?: boolean;
  25. errorLevel?: 'L' | 'M' | 'Q' | 'H';
  26. status?: QRStatus;
  27. onRefresh?: () => void;
  28. statusRender?: (info: StatusRenderInfo) => ReactNode;
  29. }