Skip to content

Commit

Permalink
feat(voronoi): add TypeScript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Benitte authored and Raphaël Benitte committed Mar 26, 2019
1 parent c16ae70 commit b98f65a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
42 changes: 42 additions & 0 deletions packages/voronoi/index.d.ts
@@ -0,0 +1,42 @@
import * as React from 'react'
import { Dimensions, Box, Theme } from '@nivo/core'

declare module '@nivo/voronoi' {
export interface VoronoiDatum {
id: string | number
x: number
y: number
}

export type VoronoiDomain = [number, number]

export type VoronoiCustomLayer = (...args: any[]) => React.ReactNode

export interface VoronoiProps {
data: VoronoiDatum[]

xDomain?: VoronoiDomain
yDomain?: VoronoiDomain

layers?: Array<'links' | 'cells' | 'points' | 'bounds' | VoronoiCustomLayer>

theme?: Theme

margin?: Box

enableLinks?: boolean
linkLineWidth?: number
linkLineColor?: string

enableCells?: boolean
cellLineWidth?: number
cellLineColor?: string

enablePoints?: boolean
pointSize?: number
pointColor?: string
}

export class Voronoi extends React.Component<VoronoiProps & Dimensions> {}
export class ResponsiveVoroinoi extends React.Component<VoronoiProps> {}
}
4 changes: 3 additions & 1 deletion packages/voronoi/package.json
Expand Up @@ -16,10 +16,12 @@
],
"main": "./dist/nivo-voronoi.cjs.js",
"module": "./dist/nivo-voronoi.esm.js",
"typings": "./index.d.ts",
"files": [
"README.md",
"LICENSE.md",
"dist/"
"dist/",
"index.d.ts"
],
"dependencies": {
"@nivo/core": "0.54.0",
Expand Down

0 comments on commit b98f65a

Please sign in to comment.