Skip to content

Commit

Permalink
feat(radar): improve @nivo/radar package
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Benitte authored and Raphaël Benitte committed Apr 17, 2019
1 parent 80b281c commit 96e60be
Show file tree
Hide file tree
Showing 17 changed files with 834 additions and 829 deletions.
5 changes: 2 additions & 3 deletions Makefile
Expand Up @@ -74,10 +74,9 @@ fmt-check: ##@0 global check if files were all formatted using prettier
"api/**/*.{js,ts,tsx}" \
"README.md"

test-all: ##@0 global run all checks/tests (packages, website & examples)
test: ##@0 global run all checks/tests (packages, website & examples)
@$(MAKE) fmt-check
@$(MAKE) packages-lint
@$(MAKE) packages-tslint
@$(MAKE) lint
@$(MAKE) packages-test

deploy-all: ##@0 global deploy website & storybook
Expand Down
8 changes: 8 additions & 0 deletions packages/bar/index.d.ts
@@ -1,3 +1,11 @@
/*
* This file is part of the nivo project.
*
* Copyright 2016-present, Raphaël Benitte.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import * as React from 'react'
import {
Dimensions,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/hooks/index.js
Expand Up @@ -6,6 +6,7 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
export * from './useCurveInterpolation'
export * from './useDimensions'
export * from './usePartialTheme'
export * from './useValueFormatter'
17 changes: 17 additions & 0 deletions packages/core/src/hooks/useCurveInterpolation.js
@@ -0,0 +1,17 @@
/*
* This file is part of the nivo project.
*
* Copyright 2016-present, Raphaël Benitte.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import { useMemo } from 'react'
import { curveFromProp } from '../props'

/**
* Transform d3 curve interpolation identifier
* to its corresponding interpolator.
*/
export const useCurveInterpolation = interpolation =>
useMemo(() => curveFromProp(interpolation), [interpolation])
57 changes: 57 additions & 0 deletions packages/radar/index.d.ts
@@ -0,0 +1,57 @@
/*
* This file is part of the nivo project.
*
* Copyright 2016-present, Raphaël Benitte.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import { Component } from 'react'
import { Box, MotionProps, Dimensions, Theme } from '@nivo/core'
import { OrdinalColorsInstruction, InheritedColorProp } from '@nivo/colors'
import { LegendProps } from '@nivo/legends'

declare module '@nivo/radar' {
interface CommonRadarProps<Datum = any> {
data: object[]
keys: Array<string | number>
indexBy: number | string | Function
maxValue?: 'auto' | Function

margin?: Box

curve?: string

borderWidth?: number
borderColor?: InheritedColorProp

gridLevels?: number
gridShape?: 'circular' | 'linear'
gridLabel?: Function
gridLabelOffset?: number

enableDots?: boolean
dotSymbol?: Function
dotSize?: number
dotColor?: InheritedColorProp
dotBorderWidth?: number
dotBorderColor?: InheritedColorProp
enableDotLabel?: boolean
dotLabel?: string | Function
dotLabelFormat?: string | Function
dotLabelYOffset?: number

colors?: OrdinalColorsInstruction
fillOpacity?: number

isInteractive?: boolean
tooltipFormat?: string | Function

legends: LegendProps[]
}

export type RadarProps = CommonRadarProps & MotionProps

export class Radar extends Component<RadarProps & Dimensions> {}
export class ResponsiveRadar extends Component<RadarProps> {}
}
4 changes: 2 additions & 2 deletions packages/radar/package.json
Expand Up @@ -19,6 +19,7 @@
"files": [
"README.md",
"LICENSE.md",
"index.d.ts",
"dist/"
],
"dependencies": {
Expand All @@ -29,8 +30,7 @@
"d3-scale": "^3.0.0",
"d3-shape": "^1.3.5",
"lodash": "^4.17.11",
"react-motion": "^0.5.2",
"recompose": "^0.30.0"
"react-motion": "^0.5.2"
},
"peerDependencies": {
"prop-types": ">= 15.5.10 < 16.0.0",
Expand Down

0 comments on commit 96e60be

Please sign in to comment.