1
1
import * as React from "react" ;
2
2
import { createStore } from "./core" ;
3
- import { ISpaceProps , ISpaceStore , ISpaceDefinition , IPositionalProps , ResizeType , CenterType } from "./core-types" ;
3
+ import { ISpaceProps , ISpaceStore , ISpaceDefinition , IPositionalProps , ResizeType , CenterType , ICommonProps } from "./core-types" ;
4
4
import { coalesce , shortuuid } from "./core-utils" ;
5
5
import { ResizeSensor } from "css-element-queries" ;
6
6
import * as PropTypes from "prop-types" ;
@@ -30,10 +30,6 @@ export const commonProps = {
30
30
onTouchEnd : PropTypes . func ,
31
31
} ;
32
32
33
- export interface IReactSpacesOptions {
34
- debug ?: boolean
35
- }
36
-
37
33
export interface IReactEvents {
38
34
onClick ?: ( event : React . MouseEvent < HTMLElement , MouseEvent > ) => void ;
39
35
onDoubleClick ?: ( event : React . MouseEvent < HTMLElement , MouseEvent > ) => void ;
@@ -46,6 +42,15 @@ export interface IReactEvents {
46
42
onTouchEnd ?: ( event : React . TouchEvent < HTMLElement > ) => void ;
47
43
}
48
44
45
+ export interface IReactSpaceProps extends ISpaceProps , IReactEvents {
46
+ style ?: React . CSSProperties ;
47
+ as ?: keyof React . ReactDOM | React . ComponentType < ICommonProps > ;
48
+ }
49
+
50
+ export interface IReactSpacesOptions {
51
+ debug ?: boolean ;
52
+ }
53
+
49
54
export function useForceUpdate ( ) {
50
55
const [ , setTick ] = React . useState ( 0 ) ;
51
56
const update = React . useCallback ( ( ) => {
@@ -54,7 +59,7 @@ export function useForceUpdate() {
54
59
return update ;
55
60
}
56
61
57
- export function useSpace ( props : ISpaceProps ) {
62
+ export function useSpace ( props : IReactSpaceProps ) {
58
63
const store = currentStore ;
59
64
const update = useForceUpdate ( ) ;
60
65
const parent = React . useContext ( ParentContext ) ;
@@ -179,6 +184,6 @@ export function useSpaceResizeHandles(store: ISpaceStore, space: ISpaceDefinitio
179
184
}
180
185
181
186
return {
182
- mouseHandles
187
+ mouseHandles,
183
188
} ;
184
189
}
0 commit comments