Skip to content

Commit

Permalink
fix(sankey): add missing motion typedefs and proptypes
Browse files Browse the repository at this point in the history
  • Loading branch information
wyze committed May 18, 2020
1 parent 354ef24 commit bc5489c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 5 additions & 8 deletions packages/sankey/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
* file that was distributed with this source code.
*/
import * as React from 'react'
import { Theme, CssMixBlendMode, Box } from '@nivo/core'
import { Theme, CssMixBlendMode, Box, Dimensions, MotionProps } from '@nivo/core'
import { OrdinalColorsInstruction, InheritedColorProp } from '@nivo/colors'
import { LegendProps } from '@nivo/legends'

declare module '@nivo/sankey' {
export class Sankey extends React.Component<Data & SankeyProps & Dimensions> {}
export class ResponsiveSankey extends React.Component<Data & SankeyProps> {}
interface SharedProps extends Data, MotionProps, SankeyProps {}

export class Sankey extends React.Component<SharedProps & Dimensions> {}
export class ResponsiveSankey extends React.Component<SharedProps> {}

export interface SankeyDataNode {
id: string | number
Expand Down Expand Up @@ -118,9 +120,4 @@ declare module '@nivo/sankey' {

legends: LegendProps[]
}>

interface Dimensions {
height: number
width: number
}
}
4 changes: 3 additions & 1 deletion packages/sankey/src/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/
import PropTypes from 'prop-types'
import { sankeyCenter, sankeyJustify, sankeyLeft, sankeyRight } from 'd3-sankey'
import { noop, blendModePropType } from '@nivo/core'
import { noop, blendModePropType, motionPropTypes } from '@nivo/core'
import { ordinalColorsPropType, inheritedColorPropType } from '@nivo/colors'
import { LegendPropShape } from '@nivo/legends'

Expand Down Expand Up @@ -90,6 +90,8 @@ export const SankeyPropTypes = {
PropTypes.func,
])
).isRequired,

...motionPropTypes,
}

export const SankeyDefaultProps = {
Expand Down

0 comments on commit bc5489c

Please sign in to comment.