-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(heatmap): init TypeScript definitions (#198)
- Loading branch information
Showing
1 changed file
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
declare module '@nivo/heatmap' { | ||
export class ResponsiveHeatMapCanvas extends React.Component<HeatMapTypes>{ | ||
|
||
} | ||
|
||
export class HeatMapCanvas extends React.Component<HeatMapTypes & Dimensions>{ | ||
|
||
} | ||
|
||
export class ResponsiveHeatMap extends React.Component<HeatMapTypes>{ | ||
|
||
} | ||
|
||
export class HeatMap extends React.Component<HeatMapTypes & Dimensions>{ | ||
|
||
} | ||
|
||
export type HeatMapTypes = { | ||
//data | ||
data: Array<object>; | ||
indexBy?: string | Function; | ||
keys?: Array<string>; | ||
|
||
minValue?: number | 'auto'; | ||
maxValue?: number | 'auto'; | ||
|
||
forceSquare?: boolean; | ||
sizeVariation?: number; | ||
padding?: number; | ||
|
||
//cells | ||
cellShape?: 'rect'| 'circle' | Function; | ||
cellOpacity?: number; | ||
cellBorderWidth?: number; | ||
cellBorderColor?: string | Function; | ||
|
||
//axes & grid | ||
axisTop?: Axis; | ||
axisRight?: Axis; | ||
axisBottom?: Axis; | ||
axisLeft?: Axis; | ||
enableGridX?: boolean; | ||
enableGridY?: boolean; | ||
|
||
//labels | ||
enableLabels?: boolean; | ||
labelTextColor?: string | Function; | ||
|
||
//theming | ||
colors?: string | Function | Array<string>; | ||
|
||
//interactivity | ||
isInteractive?: boolean; | ||
onClick?: Function; | ||
hoverTarget?: 'cell' | 'row' | 'column' | 'rowColumn'; | ||
cellHoverOpacity?: number; | ||
cellHoverOthersOpacity?: number; | ||
tooltipFormat?: string | Function; | ||
|
||
animate?: boolean; | ||
motionStiffness?: number; | ||
motionDamping?: number; | ||
margin?: Margin; | ||
} | ||
|
||
export type NodeData = { | ||
key: string; | ||
value: number; | ||
x: number; | ||
xKey: string | number; | ||
y: number; | ||
yKey: string | number; | ||
width: number; | ||
height: number; | ||
opacity: number; | ||
} | ||
|
||
export type Axis = { | ||
orient?: string; | ||
legend?: string; | ||
tickSize?: number; | ||
tickPadding?: number; | ||
tickRotation?: number; | ||
legendOffset?: number; | ||
legendPosition?: string; | ||
} | ||
|
||
export type Margin = { | ||
top?: number; | ||
right?: number; | ||
bottom?: number; | ||
left?: number; | ||
} | ||
|
||
interface Dimensions { | ||
width: number; | ||
height: number; | ||
} | ||
} |