Skip to content

Commit

Permalink
feat(heatmap): init TypeScript definitions (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
hemanandr authored and Raphaël Benitte committed May 22, 2018
1 parent 49b7ffc commit 6c5432d
Showing 1 changed file with 99 additions and 0 deletions.
99 changes: 99 additions & 0 deletions packages/nivo-heatmap/index.d.ts
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;
}
}

0 comments on commit 6c5432d

Please sign in to comment.