forked from bokuweb/re-resizable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
139 lines (123 loc) Β· 3.19 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// Type definitions for re-resizable 4.6
// Project: https://github.com/bokuweb/re-resizable
// Definitions by: Kalle Ott <https://github.com/kaoDev>
// Definitions: https://github.com/kaoDev/re-resizable
// TypeScript Version: 2.9.1
import * as React from 'react';
export type ResizableDirection = 'top' | 'right' | 'bottom' | 'left' | 'topRight' | 'bottomRight' | 'bottomLeft' | 'topLeft';
export interface ResizableState {
width: number | string;
height: number | string;
direction?: ResizableDirection;
original?: {
x: number,
y: number,
width: number,
height: number,
},
isResizing?: boolean;
resizeCursor: string,
}
export type NumberSize = {
width: number;
height: number;
}
export type Size = {
width: string | number,
height: string | number,
};
export type CSSSize = {
width: string;
height: string;
}
export type HandleComponent = {
top?: React.ReactNode,
right?: React.ReactNode,
bottom?: React.ReactNode,
left?: React.ReactNode,
topRight?: React.ReactNode,
bottomRight?: React.ReactNode,
bottomLeft?: React.ReactNode,
topLeft?: React.ReactNode,
};
export type ResizeCallback = (
event: MouseEvent | TouchEvent,
direction: ResizableDirection,
elementRef: HTMLDivElement,
delta: NumberSize,
) => void;
export type ResizeStartCallback = (
e: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,
dir: ResizableDirection,
elementRef: HTMLDivElement,
delta: NumberSize,
) => void;
export interface ResizableProps extends React.HTMLAttributes<HTMLDivElement> {
onResizeStart?: ResizeStartCallback,
onResize?: ResizeCallback,
onResizeStop?: ResizeCallback,
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[],
snap?: {
x?: number[],
y?: number[],
},
bounds?: 'parent' | 'window' | HTMLElement,
lockAspectRatio?: boolean | number,
lockAspectRatioExtraWidth?: number,
lockAspectRatioExtraHeight?: number,
handleWrapperStyle?: React.CSSProperties,
handleWrapperClass?: string,
handleComponent?: HandleComponent,
}
export default class Resizable extends React.Component<ResizableProps, ResizableState> {
resizable: HTMLElement;
size: {
width: number,
height: number,
};
updateSize({ width, height }: Size): void;
}