/
index.d.ts
96 lines (78 loc) · 3 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
import * as React from 'react'
import { Dimensions, Box, MotionProps, ColorProps, Theme } from '@nivo/core'
import { AxisProps } from '@nivo/axes'
import { InheritedColorConfig } from '@nivo/colors'
import { BasicTooltipProps } from '@nivo/tooltip'
declare module '@nivo/heatmap' {
export interface HeatMapDatum {
[key: string]: string | number
}
export type HeatMapDatumWithColor = HeatMapDatum & {
color: string
}
export type IndexByFunc = (datum: HeatMapDatum) => string | number
export type LabelFormatter = (datum: HeatMapDatum, key: string) => string | number
export type ValueFormatter = (value: number) => string | number
export interface HeatMapData {
data: HeatMapDatum[]
indexBy?: string | IndexByFunc
keys?: string[]
minValue?: number | 'auto'
maxValue?: number | 'auto'
}
export type HeatMapCommonProps = ColorProps<HeatMapDatum> &
Partial<{
forceSquare: boolean
sizeVariation: number
margin: Box
padding: number
cellShape: 'rect' | 'circle' | React.StatelessComponent<any>
cellOpacity: number
cellBorderWidth: number
cellBorderColor: InheritedColorConfig<HeatMapDatumWithColor>
axisTop: AxisProps | null
axisRight: AxisProps | null
axisBottom: AxisProps | null
axisLeft: AxisProps | null
enableGridX: boolean
enableGridY: boolean
enableLabels: boolean
label: LabelFormatter
labelTextColor: InheritedColorConfig<HeatMapDatumWithColor>
isInteractive: boolean
hoverTarget: 'cell' | 'row' | 'column' | 'rowColumn'
cellHoverOpacity: number
cellHoverOthersOpacity: number
tooltipFormat: string | ValueFormatter
tooltip: React.StatelessComponent<BasicTooltipProps & NodeData>
theme: Theme
}>
export interface NodeData {
key: string
value: number
x: number
xKey: string | number
y: number
yKey: string | number
width: number
height: number
opacity: number
}
export type HeatMapSvgProps = HeatMapData &
HeatMapCommonProps &
MotionProps &
Partial<{
onClick: (datum: NodeData, event: React.MouseEvent<SVGGElement>) => void
}>
export class HeatMap extends React.Component<HeatMapSvgProps & Dimensions> {}
export class ResponsiveHeatMap extends React.Component<HeatMapSvgProps> {}
export type HeatMapCanvasProps = HeatMapData &
HeatMapCommonProps &
Partial<{
onClick: (datum: NodeData, event: React.MouseEvent<HTMLCanvasElement>) => void
pixelRatio: number
role: string
}>
export class HeatMapCanvas extends React.Component<HeatMapCanvasProps & Dimensions> {}
export class ResponsiveHeatMapCanvas extends React.Component<HeatMapCanvasProps> {}
}