1 | import { default as React, PureComponent } from 'react';
|
2 | import { Ords, XYOrds, Crop, PixelCrop, PercentCrop } from './types';
|
3 |
|
4 | interface EVData {
|
5 | startClientX: number;
|
6 | startClientY: number;
|
7 | startCropX: number;
|
8 | startCropY: number;
|
9 | clientX: number;
|
10 | clientY: number;
|
11 | isResize: boolean;
|
12 | ord?: Ords;
|
13 | }
|
14 | interface Rectangle {
|
15 | x: number;
|
16 | y: number;
|
17 | width: number;
|
18 | height: number;
|
19 | }
|
20 | export interface ReactCropProps {
|
21 |
|
22 | ariaLabels?: {
|
23 | cropArea: string;
|
24 | nwDragHandle: string;
|
25 | nDragHandle: string;
|
26 | neDragHandle: string;
|
27 | eDragHandle: string;
|
28 | seDragHandle: string;
|
29 | sDragHandle: string;
|
30 | swDragHandle: string;
|
31 | wDragHandle: string;
|
32 | };
|
33 |
|
34 | aspect?: number;
|
35 |
|
36 | className?: string;
|
37 | |
38 |
|
39 | children?: React.ReactNode;
|
40 |
|
41 | circularCrop?: boolean;
|
42 |
|
43 | crop?: Crop;
|
44 |
|
45 | disabled?: boolean;
|
46 |
|
47 | locked?: boolean;
|
48 |
|
49 | keepSelection?: boolean;
|
50 |
|
51 | minWidth?: number;
|
52 |
|
53 | minHeight?: number;
|
54 |
|
55 | maxWidth?: number;
|
56 |
|
57 | maxHeight?: number;
|
58 |
|
59 | onChange: (crop: PixelCrop, percentageCrop: PercentCrop) => void;
|
60 |
|
61 | onComplete?: (crop: PixelCrop, percentageCrop: PercentCrop) => void;
|
62 |
|
63 | onDragStart?: (e: PointerEvent) => void;
|
64 |
|
65 | onDragEnd?: (e: PointerEvent) => void;
|
66 |
|
67 | renderSelectionAddon?: (state: ReactCropState) => React.ReactNode;
|
68 |
|
69 | ruleOfThirds?: boolean;
|
70 |
|
71 | style?: React.CSSProperties;
|
72 | }
|
73 | export interface ReactCropState {
|
74 | cropIsActive: boolean;
|
75 | newCropIsBeingDrawn: boolean;
|
76 | }
|
77 | export declare class ReactCrop extends PureComponent<ReactCropProps, ReactCropState> {
|
78 | static xOrds: string[];
|
79 | static yOrds: string[];
|
80 | static xyOrds: string[];
|
81 | static nudgeStep: number;
|
82 | static nudgeStepMedium: number;
|
83 | static nudgeStepLarge: number;
|
84 | static defaultProps: {
|
85 | ariaLabels: {
|
86 | cropArea: string;
|
87 | nwDragHandle: string;
|
88 | nDragHandle: string;
|
89 | neDragHandle: string;
|
90 | eDragHandle: string;
|
91 | seDragHandle: string;
|
92 | sDragHandle: string;
|
93 | swDragHandle: string;
|
94 | wDragHandle: string;
|
95 | };
|
96 | };
|
97 | get document(): Document;
|
98 | docMoveBound: boolean;
|
99 | mouseDownOnCrop: boolean;
|
100 | dragStarted: boolean;
|
101 | evData: EVData;
|
102 | componentRef: React.RefObject<HTMLDivElement>;
|
103 | mediaRef: React.RefObject<HTMLDivElement>;
|
104 | resizeObserver?: ResizeObserver;
|
105 | initChangeCalled: boolean;
|
106 | instanceId: string;
|
107 | state: ReactCropState;
|
108 | getBox(): Rectangle;
|
109 | componentDidUpdate(prevProps: ReactCropProps): void;
|
110 | componentWillUnmount(): void;
|
111 | bindDocMove(): void;
|
112 | unbindDocMove(): void;
|
113 | onCropPointerDown: (e: React.PointerEvent<HTMLDivElement>) => void;
|
114 | onComponentPointerDown: (e: React.PointerEvent<HTMLDivElement>) => void;
|
115 | onDocPointerMove: (e: PointerEvent) => void;
|
116 | onComponentKeyDown: (e: React.KeyboardEvent<HTMLDivElement>) => void;
|
117 | onHandlerKeyDown: (e: React.KeyboardEvent<HTMLDivElement>, ord: Ords) => void;
|
118 | onDocPointerDone: (e: PointerEvent) => void;
|
119 | onDragFocus: () => void;
|
120 | getCropStyle(): {
|
121 | top: string;
|
122 | left: string;
|
123 | width: string;
|
124 | height: string;
|
125 | } | undefined;
|
126 | dragCrop(): PixelCrop;
|
127 | getPointRegion(box: Rectangle, origOrd: Ords | undefined, minWidth: number, minHeight: number): XYOrds;
|
128 | resolveMinDimensions(box: Rectangle, aspect: number, minWidth?: number, minHeight?: number): number[];
|
129 | resizeCrop(): PixelCrop;
|
130 | renderCropSelection(): React.JSX.Element | undefined;
|
131 | makePixelCrop(box: Rectangle): PixelCrop;
|
132 | render(): React.JSX.Element;
|
133 | }
|
134 | export {};
|