-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
130 lines (101 loc) · 4.34 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
import * as React from 'react'
import { Dimensions, Theme, Box, BoxAlign } from '@nivo/core'
declare module '@nivo/geo' {
///////////////////////////////////////////////////////////////////////////
// Common
///////////////////////////////////////////////////////////////////////////
export type GeoProjectionType =
| 'azimuthalEqualArea'
| 'azimuthalEquidistant'
| 'gnomonic'
| 'orthographic'
| 'stereographic'
| 'equalEarth'
| 'equirectangular'
| 'mercator'
| 'transverseMercator'
| 'naturalEarth1'
type FeatureAccessor<F, T> = (feature: F) => T
interface CommonProps {
features: any[]
margin?: Partial<Box>
projectionType?: GeoProjectionType
projectionScale?: number
projectionTranslation?: [number, number]
projectionRotation?: [number, number, number]
enableGraticule?: boolean
graticuleLineWidth?: number
graticuleLineColor?: string
isInteractive?: boolean
theme?: Partial<Theme>
}
///////////////////////////////////////////////////////////////////////////
// GeoMap
///////////////////////////////////////////////////////////////////////////
export type GeoMapTooltip = React.FunctionComponent<{
feature: any
}>
export type GeoMapEventHandler = (feature: any, event: React.MouseEvent<any>) => void
interface GeoMapCommonProps extends CommonProps {
fillColor?: string | FeatureAccessor<any, string>
borderWidth?: number | FeatureAccessor<any, number>
borderColor?: string | FeatureAccessor<any, number>
onMouseEnter?: GeoMapEventHandler
onMouseMove?: GeoMapEventHandler
onMouseLeave?: GeoMapEventHandler
onClick?: GeoMapEventHandler
tooltip?: GeoMapTooltip
}
export interface GeoMapProps extends GeoMapCommonProps {}
export interface GeoMapCanvasProps extends GeoMapCommonProps {
pixelRatio?: number
}
export class GeoMap extends React.Component<GeoMapProps & Dimensions> {}
export class ResponsiveGeoMap extends React.Component<GeoMapProps> {}
export class GeoMapCanvas extends React.Component<GeoMapCanvasProps & Dimensions> {}
export class ResponsiveGeoMapCanvas extends React.Component<GeoMapCanvasProps> {}
///////////////////////////////////////////////////////////////////////////
// Choropleth
///////////////////////////////////////////////////////////////////////////
export interface ChoroplethBoundFeature {
label: string
value: number
formattedValue: 'string | number'
color: string
data: any
}
export type ChoroplethEventHandler = (
feature: ChoroplethBoundFeature,
event: React.MouseEvent<any>
) => void
export type ChoroplethTooltip = React.FunctionComponent<{
feature: ChoroplethBoundFeature
}>
type DatumMatcher = (...args: any[]) => boolean
interface ChoroplethCommonProps extends CommonProps {
data: any[]
domain: number[]
match?: string | DatumMatcher
label?: string | FeatureAccessor<any, string>
value?: string | FeatureAccessor<any, number>
valueFormat?: string | FeatureAccessor<any, string | number>
colors?: string | string[] | FeatureAccessor<any, string>
unknownColor?: string
fillColor?: string | FeatureAccessor<ChoroplethBoundFeature, string>
borderWidth?: number | FeatureAccessor<ChoroplethBoundFeature, number>
borderColor?: string | FeatureAccessor<ChoroplethBoundFeature, number>
tooltip?: ChoroplethTooltip
onMouseEnter?: ChoroplethEventHandler
onMouseMove?: ChoroplethEventHandler
onMouseLeave?: ChoroplethEventHandler
onClick?: ChoroplethEventHandler
}
export interface ChoroplethProps extends ChoroplethCommonProps {}
export interface ChoroplethCanvasProps extends ChoroplethCommonProps {
pixelRatio?: number
}
export class Choropleth extends React.Component<ChoroplethProps & Dimensions> {}
export class ResponsiveChoropleth extends React.Component<ChoroplethProps> {}
export class ChoroplethCanvas extends React.Component<ChoroplethCanvasProps & Dimensions> {}
export class ResponsiveChoroplethCanvas extends React.Component<ChoroplethCanvasProps> {}
}