// Type definitions for react-simple-maps 1.0 // Project: https://github.com/zcreativelabs/react-simple-maps#readme // Definitions by: Novikov Mihail // Andrej Mihajlov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import { GeoPath, GeoProjection } from 'd3-geo'; import { Feature } from 'geojson'; import * as React from 'react'; export type Point = [number, number]; export interface ProjectionConfig { scale?: number; xOffset?: number; yOffset?: number; rotate?: [number, number, number]; precision?: number; } export type ProjectionFunction = (width: number, height: number, config: ProjectionConfig) => GeoProjection; export interface ComposableMapProps extends React.SVGAttributes { /** * @default 800 */ width?: number; /** * @default 600 */ height?: number; /** * @default "geoEqualEarth" */ projection?: string | ProjectionFunction; /** * @default {} */ projectionConfig?: ProjectionConfig; } export interface Position { x: number; y: number; last: Point; zoom: number; dragging: boolean; zooming: boolean; } export interface ZoomableGroupProps extends React.SVGAttributes { /** * @default [0, 0] */ center?: Point; /** * @default 1 */ zoom?: number; /** * @default 1 */ minZoom?: number; /** * @default 5 */ maxZoom?: number; /** * @default 0.025 */ zoomSensitivity?: number; /** * @default false */ disablePanning?: boolean; /** * @default false */ disableZooming?: boolean; onMoveStart?: (event: any, position: Position) => void; onMoveEnd?: (event: any, position: Position) => void; onZoomStart?: (event: any, position: Position) => void; onZoomEnd?: (event: any, position: Position) => void; } interface GeographiesChildrenArgument { geographies: any[]; path: GeoPath; projection: GeoProjection; } export interface GeographiesProps extends React.SVGAttributes { parseGeographies?: (features: Array>) => Array>; geography?: string | Record | string[]; children?: (data: GeographiesChildrenArgument) => void; } export interface GeographyProps extends Pick, Exclude, 'style'>> { geography?: any; style?: { default?: React.CSSProperties; hover?: React.CSSProperties; pressed?: React.CSSProperties; }; onMouseEnter?: (event: React.MouseEvent) => void; onMouseLeave?: (event: React.MouseEvent) => void; onMouseDown?: (event: React.MouseEvent) => void; onMouseUp?: (event: React.MouseEvent) => void; onFocus?: (event: React.FocusEvent) => void; onBlur?: (event: React.FocusEvent) => void; } export interface MarkerProps extends Pick, Exclude, 'style'>> { coordinates?: Point; style?: { default?: React.CSSProperties; hover?: React.CSSProperties; pressed?: React.CSSProperties; }; onMouseEnter?: (event: React.MouseEvent) => void; onMouseLeave?: (event: React.MouseEvent) => void; onMouseDown?: (event: React.MouseEvent) => void; onMouseUp?: (event: React.MouseEvent) => void; onFocus?: (event: React.FocusEvent) => void; onBlur?: (event: React.FocusEvent) => void; } export interface AnnotationProps extends React.SVGProps { subject?: Point; connectorProps: React.SVGProps; /** * @default 30 */ dx?: number | string; /** * @default 30 */ dy?: number | string; /** * @default 0 */ curve?: number; } export interface GraticuleProps extends React.SVGProps { /** * @default [10, 10] */ step?: Point; /** * @default "currentcolor" */ stroke?: string; /** * @default "transparent" */ fill?: string; } export interface LineProps extends Pick, Exclude, 'from' | 'to'>> { /** * @default [0, 0] */ from?: Point; /** * @default [0, 0] */ to?: Point; /** * @default [[0, 0], [0, 0]] */ coordinates?: Point[]; /** * @default "currentcolor" */ stroke?: string; /** * @default 3 */ strokeWidth?: number | string; /** * @default "transparent" */ fill?: string; } interface SphereProps extends React.SVGProps { /** * @default "rsm-sphere" */ id: string; /** * @default "transparent" */ fill: string; /** * @default "currentcolor" */ stroke: string; /** * @default 0.5 */ strokeWidth: number; } declare const ComposableMap: React.FunctionComponent; declare const ZoomableGroup: React.FunctionComponent; declare const Geographies: React.FunctionComponent; declare const Geography: React.FunctionComponent; declare const Marker: React.FunctionComponent; declare const Annotation: React.FunctionComponent; declare const Graticule: React.FunctionComponent; declare const Line: React.FunctionComponent; declare const Sphere: React.FunctionComponent; export { ComposableMap, ZoomableGroup, Geographies, Geography, Marker, Annotation, Graticule, Line, Sphere };