11import React from 'react' ;
22import Resizable from '../lib/Resizable' ;
33import ResizableBox from '../lib/ResizableBox' ;
4+ import type { ResizeCallbackData } from '../lib/propTypes' ;
45import 'style-loader!css-loader!../css/styles.css' ;
56
6- /* global __VERSION__, __GIT_TAG__, __GIT_COMMIT__ */
7+ declare const __VERSION__ : string ;
8+ declare const __GIT_TAG__ : string ;
9+ declare const __GIT_COMMIT__ : string ;
710
811// Update the version badge in the header
912function updateVersionBadge ( ) {
@@ -23,7 +26,7 @@ if (typeof document !== 'undefined') {
2326 }
2427}
2528
26- const CustomResizeHandle = React . forwardRef ( ( props , ref ) => {
29+ const CustomResizeHandle = React . forwardRef < HTMLDivElement , React . HTMLAttributes < HTMLDivElement > & { handleAxis ?: string } > ( ( props , ref ) => {
2730 const { handleAxis, ...restProps } = props ;
2831 return (
2932 < div
@@ -34,8 +37,17 @@ const CustomResizeHandle = React.forwardRef((props, ref) => {
3437 ) ;
3538} ) ;
3639
37- export default class ExampleLayout extends React . Component < { } , { width : number , height : number } > {
38- state = {
40+ type State = {
41+ width : number ;
42+ height : number ;
43+ absoluteWidth : number ;
44+ absoluteHeight : number ;
45+ absoluteLeft : number ;
46+ absoluteTop : number ;
47+ } ;
48+
49+ export default class ExampleLayout extends React . Component < { } , State > {
50+ state : State = {
3951 width : 200 ,
4052 height : 200 ,
4153 absoluteWidth : 200 ,
@@ -49,12 +61,12 @@ export default class ExampleLayout extends React.Component<{}, {width: number, h
4961 } ;
5062
5163 // On top layout
52- onFirstBoxResize = ( event , { element , size, handle } ) => {
64+ onFirstBoxResize = ( _event : React . SyntheticEvent , { size} : ResizeCallbackData ) => {
5365 this . setState ( { width : size . width , height : size . height } ) ;
5466 } ;
5567
5668 // On bottom layout. Used to resize the center element around its flex parent.
57- onResizeAbsolute = ( event , { element , size, handle} ) => {
69+ onResizeAbsolute = ( _event : React . SyntheticEvent , { size, handle} : ResizeCallbackData ) => {
5870 this . setState ( ( state ) => {
5971 let newLeft = state . absoluteLeft ;
6072 let newTop = state . absoluteTop ;
0 commit comments