forked from bokuweb/re-resizable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
118 lines (101 loc) · 2.61 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Type definitions for react-resizable-box 2.0
// Project: https://github.com/bokuweb/react-resizable-box
// Definitions by: Kalle Ott <https://github.com/kaoDev>
// Definitions: https://github.com/kaoDev/react-resizable-box
// TypeScript Version: 2.2
import * as React from 'react';
export interface ResizableState {
width?: number | string;
height?: number | string;
direction?: string;
original?: {
x: number,
y: number,
width: number,
height: number,
},
isResizing?: boolean;
}
export type Size = {
width: number;
height: number;
}
export type CSSSize = {
width: string;
height: string;
}
export type ResizeHandler = (
event: MouseEvent | TouchEvent,
dir: string,
refToElement: HTMLElement,
delta: Size,
) => void;
export type ResizeStartCallBack = (
e: React.MouseEvent<any> | React.TouchEvent<any>,
dir: string,
refToElement: HTMLElement,
delta: Size,
) => void;
export interface ResizableProps {
onResizeStop?: ResizeHandler;
onResizeStart?: ResizeStartCallBack;
onResize?: ResizeHandler;
style?: React.CSSProperties;
handleStyles?: {
top?: React.CSSProperties,
right?: React.CSSProperties,
bottom?: React.CSSProperties,
left?: React.CSSProperties,
topRight?: React.CSSProperties,
bottomRight?: React.CSSProperties,
bottomLeft?: React.CSSProperties,
topLeft?: React.CSSProperties,
},
handleClasses?: {
top?: string,
right?: string,
bottom?: string,
left?: string,
topRight?: string,
bottomRight?: string,
bottomLeft?: string,
topLeft?: string,
},
enable?: {
top: boolean,
right: boolean,
bottom: boolean,
left: boolean,
topRight: boolean,
bottomRight: boolean,
bottomLeft: boolean,
topLeft: boolean,
},
className?: string,
defaultSize?: {
width: string | number,
height: string | number,
},
size?: {
width: string | number,
height: string | number,
},
minWidth?: number | string,
minHeight?: number | string,
maxWidth?: number | string,
maxHeight?: number | string,
grid?: number[],
bounds?: 'parent' | 'window' | HTMLElement,
lockAspectRatio?: boolean,
}
export default class Resizable extends React.Component<ResizableProps, ResizableState> {
resizable: HTMLElement;
size: Size;
onTouchMove(event: React.TouchEvent<any>): void;
onMouseMove(event: MouseEvent | TouchEvent): void;
onMouseUp(event: MouseEvent | TouchEvent): void;
onResizeStart(event: React.TouchEvent<any> | React.MouseEvent<any>, direction: string): void
setSize(size: Size): void;
getBoxStyle(): CSSSize;
updateSize({ width, height }: Size): void;
}