|
| 1 | +import React, { ReactPropTypes } from 'react'; |
| 2 | + |
| 3 | +interface DetectedEnvironment { |
| 4 | + isMouseDetected: boolean; |
| 5 | + isTouchDetected: boolean; |
| 6 | +} |
| 7 | + |
| 8 | +interface ElementDimensions { |
| 9 | + width: number; |
| 10 | + height: number; |
| 11 | +} |
| 12 | + |
| 13 | +interface Position { |
| 14 | + x: number; |
| 15 | + y: number; |
| 16 | +} |
| 17 | + |
| 18 | +interface CursorPositionGeneratedProps { |
| 19 | + detectedEnvironment: DetectedEnvironment; |
| 20 | + elementDimensions: ElementDimensions; |
| 21 | + isActive: boolean; |
| 22 | + isPositionOutside: boolean; |
| 23 | + position: Position; |
| 24 | +} |
| 25 | + |
| 26 | +interface CursorPositionOptionsProps { |
| 27 | + // TODO: Make these more specific |
| 28 | + activationInteractionMouse?: string; |
| 29 | + activationInteractionTouch?: string; |
| 30 | + children: (CursorPositionOutputProps) => React.ReactElement<any> | null; |
| 31 | + className?: string; |
| 32 | + hoverDelayInMs?: number; |
| 33 | + isEnabled?: boolean; |
| 34 | + mapChildProps?: (CursorPositionGeneratedProps) => object; |
| 35 | + onActivationChanged?: ({isActive: boolean}) => void; |
| 36 | + onDetectedEnvironmentChanged?: (DetectedEnvironment) => void; |
| 37 | + onPositionChanged?: (CursorPositionGeneratedProps) => void; |
| 38 | + pressDurationInMs?: number; |
| 39 | + pressMoveThreshold?: number; |
| 40 | + shouldDecorateChildren?: boolean; |
| 41 | + shouldStopTouchMovePropagation?: boolean; |
| 42 | + style?: object; |
| 43 | + tapDurationInMs?: number; |
| 44 | + tapMoveThreshold?: number; |
| 45 | +} |
| 46 | + |
| 47 | +export interface CursorPositionOutputProps extends CursorPositionGeneratedProps { |
| 48 | + [property:string]: any; |
| 49 | +} |
| 50 | + |
| 51 | +export interface CursorPositionInputProps extends CursorPositionOptionsProps { |
| 52 | + [property:string]: any; |
| 53 | +} |
| 54 | + |
| 55 | +export declare class ReactCursorPosition extends React.Component<CursorPositionInputProps, any> { |
| 56 | +} |
0 commit comments