diff --git a/packages/sunburst/index.d.ts b/packages/sunburst/index.d.ts deleted file mode 100644 index a7bc1d5d4..000000000 --- a/packages/sunburst/index.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -import * as React from 'react' -import { Dimensions, Box, ColorProps, MotionProps } from '@nivo/core' - -declare module '@nivo/sunburst' { - export interface SunburstDataNode { - // optional because it works without a color - // however it does throw a warning if no value is set and the value is requested - color?: string - // optional because it could have a different name given by the 'identity' property - id?: string - } - - export interface SunburstDataParentNode extends SunburstDataNode { - children: SunburstDataNode[] - } - - export interface SunburstDataLeafNode extends SunburstDataNode { - // optional because it could have a different name given by the 'value' property - value?: number - } - - export interface SunburstData { - data: SunburstDataParentNode - } - - export type SunburstProps = SunburstData & - Partial<{ - identity: string | ((node: SunburstDataNode) => string) - value: string | ((node: SunburstDataNode) => string) - childColor: string | ((node: SunburstDataNode) => string) - - borderWidth: number - borderColor: string - cornerRadius: number - margin: Box - - isInteractive: boolean - role: string - }> & - ColorProps & - MotionProps - - export class Sunburst extends React.Component {} - export class ResponsiveSunburst extends React.Component {} -} diff --git a/packages/sunburst/package.json b/packages/sunburst/package.json index f4837ea72..2f0ed7372 100644 --- a/packages/sunburst/package.json +++ b/packages/sunburst/package.json @@ -21,6 +21,7 @@ ], "main": "./dist/nivo-sunburst.cjs.js", "module": "./dist/nivo-sunburst.es.js", + "typings": "./dist/types/index.d.ts", "files": [ "README.md", "LICENSE.md", @@ -32,15 +33,15 @@ "d3-hierarchy": "^1.1.8", "d3-shape": "^1.3.5", "lodash": "^4.17.11", - "react-motion": "^0.5.2", "recompose": "^0.30.0" }, "devDependencies": { - "@nivo/core": "0.66.0" + "@nivo/core": "0.66.0", + "@types/d3-hierarchy": "^1.1.7", + "@types/d3-shape": "^1.3.5" }, "peerDependencies": { "@nivo/core": "0.66.0", - "prop-types": ">= 15.5.10 < 16.0.0", "react": ">= 16.8.4 < 18.0.0" }, "publishConfig": { diff --git a/packages/sunburst/src/ResponsiveSunburst.js b/packages/sunburst/src/ResponsiveSunburst.js deleted file mode 100644 index 418a9f4a9..000000000 --- a/packages/sunburst/src/ResponsiveSunburst.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 React from 'react' -import { ResponsiveWrapper } from '@nivo/core' -import Sunburst from './Sunburst' - -const ResponsiveSunburst = props => ( - - {({ width, height }) => } - -) - -export default ResponsiveSunburst diff --git a/packages/sunburst/src/ResponsiveSunburst.tsx b/packages/sunburst/src/ResponsiveSunburst.tsx new file mode 100644 index 000000000..435b22ccd --- /dev/null +++ b/packages/sunburst/src/ResponsiveSunburst.tsx @@ -0,0 +1,13 @@ +import React from 'react' +// @ts-ignore +import { ResponsiveWrapper } from '@nivo/core' +import Sunburst from './Sunburst' +import { SunburstSvgProps } from './types' + +export const ResponsiveSunburst = (props: Omit) => ( + + {({ width, height }: Required>) => ( + + )} + +) diff --git a/packages/sunburst/src/Sunburst.js b/packages/sunburst/src/Sunburst.tsx similarity index 58% rename from packages/sunburst/src/Sunburst.js rename to packages/sunburst/src/Sunburst.tsx index 17fdc6ac4..6ffebd631 100644 --- a/packages/sunburst/src/Sunburst.js +++ b/packages/sunburst/src/Sunburst.tsx @@ -1,41 +1,40 @@ -/* - * 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 React from 'react' -import PropTypes from 'prop-types' import sortBy from 'lodash/sortBy' import cloneDeep from 'lodash/cloneDeep' +// @ts-ignore import compose from 'recompose/compose' +// @ts-ignore import defaultProps from 'recompose/defaultProps' +// @ts-ignore import withPropsOnChange from 'recompose/withPropsOnChange' +// @ts-ignore import withProps from 'recompose/withProps' +// @ts-ignore import pure from 'recompose/pure' import { partition as Partition, hierarchy } from 'd3-hierarchy' import { arc } from 'd3-shape' import { - noop, + // @ts-ignore withTheme, + // @ts-ignore withDimensions, + // @ts-ignore getAccessorFor, + // @ts-ignore getLabelGenerator, - LegacyContainer, + // @ts-ignore + Container, + // @ts-ignore SvgWrapper, } from '@nivo/core' -import { - getOrdinalColorScale, - ordinalColorsPropType, - inheritedColorPropType, - getInheritedColorGenerator, -} from '@nivo/colors' +// @ts-ignore +import { getOrdinalColorScale, getInheritedColorGenerator } from '@nivo/colors' import SunburstLabels from './SunburstLabels' import SunburstArc from './SunburstArc' +import { defaultProps as defaultSunburstProps } from './props' +import { SunburstSvgProps, SunburstNode, TooltipHandlers } from './types' -const getAncestor = node => { +const getAncestor = (node: any): any => { if (node.depth === 1) return node if (node.parent) return getAncestor(node.parent) return node @@ -44,11 +43,11 @@ const getAncestor = node => { const Sunburst = ({ nodes, - margin, // eslint-disable-line react/prop-types + margin, centerX, centerY, - outerWidth, // eslint-disable-line react/prop-types - outerHeight, // eslint-disable-line react/prop-types + outerWidth, + outerHeight, arcGenerator, @@ -62,20 +61,23 @@ const Sunburst = ({ slicesLabelsTextColor, // theming - theme, // eslint-disable-line react/prop-types + theme, role, + // interactivity isInteractive, tooltipFormat, tooltip, + + // event handlers onClick, onMouseEnter, onMouseLeave, -}) => { +}: SunburstSvgProps & Required) => { return ( - - {({ showTooltip, hideTooltip }) => ( + + {({ showTooltip, hideTooltip }: TooltipHandlers) => ( ))} {enableSlicesLabels && ( @@ -118,111 +119,55 @@ const Sunburst = ({ )} - + ) } -Sunburst.propTypes = { - data: PropTypes.object.isRequired, - identity: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired, - getIdentity: PropTypes.func.isRequired, // computed - value: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired, - getValue: PropTypes.func.isRequired, // computed - nodes: PropTypes.array.isRequired, // computed - - partition: PropTypes.func.isRequired, // computed - - cornerRadius: PropTypes.number.isRequired, - arcGenerator: PropTypes.func.isRequired, // computed - - radius: PropTypes.number.isRequired, // computed - centerX: PropTypes.number.isRequired, // computed - centerY: PropTypes.number.isRequired, // computed - - colors: ordinalColorsPropType.isRequired, - borderWidth: PropTypes.number.isRequired, - borderColor: PropTypes.string.isRequired, - - childColor: inheritedColorPropType.isRequired, - - // slices labels - enableSlicesLabels: PropTypes.bool.isRequired, - getSliceLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), - slicesLabelsSkipAngle: PropTypes.number, - slicesLabelsTextColor: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), - - role: PropTypes.string.isRequired, - - isInteractive: PropTypes.bool, - tooltipFormat: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), - tooltip: PropTypes.func, - onClick: PropTypes.func.isRequired, - onMouseEnter: PropTypes.func.isRequired, - onMouseLeave: PropTypes.func.isRequired, -} - -export const SunburstDefaultProps = { - identity: 'id', - value: 'value', - - cornerRadius: 0, - - colors: { scheme: 'nivo' }, - borderWidth: 1, - borderColor: 'white', - - childColor: { from: 'color' }, - role: 'img', - - // slices labels - enableSlicesLabels: false, - sliceLabel: 'value', - slicesLabelsTextColor: 'theme', - - isInteractive: true, - onClick: noop, - onMouseEnter: noop, - onMouseLeave: noop, -} - const enhance = compose( - defaultProps(SunburstDefaultProps), + defaultProps(defaultSunburstProps), withTheme(), withDimensions(), - withPropsOnChange(['colors'], ({ colors }) => ({ + withPropsOnChange(['colors'], ({ colors }: Required) => ({ getColor: getOrdinalColorScale(colors, 'id'), })), - withProps(({ width, height }) => { + withProps(({ width, height }: Record) => { const radius = Math.min(width, height) / 2 const partition = Partition().size([2 * Math.PI, radius * radius]) return { radius, partition, centerX: width / 2, centerY: height / 2 } }), - withPropsOnChange(['cornerRadius'], ({ cornerRadius }) => ({ - arcGenerator: arc() + withPropsOnChange(['cornerRadius'], ({ cornerRadius }: { cornerRadius: number }) => ({ + arcGenerator: arc() .startAngle(d => d.x0) .endAngle(d => d.x1) .innerRadius(d => Math.sqrt(d.y0)) .outerRadius(d => Math.sqrt(d.y1)) .cornerRadius(cornerRadius), })), - withPropsOnChange(['identity'], ({ identity }) => ({ + withPropsOnChange(['identity'], ({ identity }: SunburstSvgProps) => ({ getIdentity: getAccessorFor(identity), })), - withPropsOnChange(['value'], ({ value }) => ({ + withPropsOnChange(['value'], ({ value }: SunburstSvgProps) => ({ getValue: getAccessorFor(value), })), - withPropsOnChange(['data', 'getValue'], ({ data, getValue }) => ({ - data: hierarchy(data).sum(getValue), + withPropsOnChange(['data', 'getValue'], ({ data, getValue }: Required) => ({ + data: hierarchy(data).sum(getValue as any), })), - withPropsOnChange(['childColor', 'theme'], ({ childColor, theme }) => ({ + withPropsOnChange(['childColor', 'theme'], ({ childColor, theme }: SunburstSvgProps) => ({ getChildColor: getInheritedColorGenerator(childColor, theme), })), withPropsOnChange( ['data', 'partition', 'getIdentity', 'getChildColor'], - ({ data, partition, getIdentity, getColor, childColor, getChildColor }) => { - const total = data.value + ({ + data, + partition, + getIdentity, + getColor, + childColor, + getChildColor, + }: Required) => { + const total = (data as any).value const nodes = sortBy(partition(cloneDeep(data)).descendants(), 'depth') nodes.forEach(node => { @@ -249,13 +194,13 @@ const enhance = compose( return { nodes } } ), - withPropsOnChange(['sliceLabel'], ({ sliceLabel }) => ({ + withPropsOnChange(['sliceLabel'], ({ sliceLabel }: SunburstSvgProps) => ({ getSliceLabel: getLabelGenerator(sliceLabel), })), pure ) -const enhancedSunburst = enhance(Sunburst) +const enhancedSunburst = (enhance(Sunburst as any) as unknown) as React.FC enhancedSunburst.displayName = 'Sunburst' export default enhancedSunburst diff --git a/packages/sunburst/src/SunburstArc.js b/packages/sunburst/src/SunburstArc.js deleted file mode 100644 index 69dfb6981..000000000 --- a/packages/sunburst/src/SunburstArc.js +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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 React from 'react' -import PropTypes from 'prop-types' -import compose from 'recompose/compose' -import withPropsOnChange from 'recompose/withPropsOnChange' -import pure from 'recompose/pure' -import { BasicTooltip } from '@nivo/tooltip' - -const SunburstArc = ({ - node, - path, - borderWidth, - borderColor, - showTooltip, - hideTooltip, - tooltip, - onClick, - onMouseEnter, - onMouseLeave, -}) => { - const handleTooltip = e => showTooltip(tooltip, e) - const handleMouseEnter = e => { - onMouseEnter(node.data, e) - showTooltip(tooltip, e) - } - const handleMouseLeave = e => { - onMouseLeave(node.data, e) - hideTooltip(e) - } - - return ( - - ) -} - -SunburstArc.propTypes = { - node: PropTypes.shape({ - data: PropTypes.shape({ - color: PropTypes.string.isRequired, - }).isRequired, - }).isRequired, - arcGenerator: PropTypes.func.isRequired, - path: PropTypes.string.isRequired, - borderWidth: PropTypes.number.isRequired, - borderColor: PropTypes.string.isRequired, - showTooltip: PropTypes.func.isRequired, - hideTooltip: PropTypes.func.isRequired, - onClick: PropTypes.func, - onMouseEnter: PropTypes.func, - onMouseLeave: PropTypes.func, - tooltipFormat: PropTypes.oneOfType([PropTypes.string, PropTypes.func]), - tooltip: PropTypes.func, - theme: PropTypes.object.isRequired, -} - -const enhance = compose( - withPropsOnChange(['node', 'arcGenerator'], ({ node, arcGenerator }) => ({ - path: arcGenerator(node), - })), - withPropsOnChange(['node', 'onClick'], ({ node, onClick }) => ({ - onClick: event => onClick(node.data, event), - })), - withPropsOnChange( - ['node', 'theme', 'tooltip', 'tooltipFormat'], - ({ node, theme, tooltip, tooltipFormat }) => ({ - tooltip: ( - - ), - }) - ), - pure -) - -export default enhance(SunburstArc) diff --git a/packages/sunburst/src/SunburstArc.tsx b/packages/sunburst/src/SunburstArc.tsx new file mode 100644 index 000000000..0d6f977b6 --- /dev/null +++ b/packages/sunburst/src/SunburstArc.tsx @@ -0,0 +1,80 @@ +import React from 'react' +// @ts-ignore +import compose from 'recompose/compose' +// @ts-ignore +import withPropsOnChange from 'recompose/withPropsOnChange' +// @ts-ignore +import pure from 'recompose/pure' +import { BasicTooltip } from '@nivo/tooltip' +import { SunburstArcProps } from './types' + +const SunburstArc = ({ + node, + path, + borderWidth, + borderColor, + showTooltip, + hideTooltip, + tooltip, + onClick, + onMouseEnter, + onMouseLeave, +}: SunburstArcProps & { + onClick: (event: React.MouseEvent) => void +}) => { + // @ts-ignore + const handleTooltip = e => showTooltip(tooltip, e) + const handleMouseEnter = (e: React.MouseEvent) => { + onMouseEnter?.(node.data, e) + // @ts-ignore + showTooltip(tooltip, e) + } + const handleMouseLeave = (e: React.MouseEvent) => { + onMouseLeave?.(node.data, e) + hideTooltip() + } + + return ( + + ) +} + +const enhance = compose( + withPropsOnChange(['node', 'arcGenerator'], ({ node, arcGenerator }: SunburstArcProps) => ({ + path: arcGenerator(node), + })), + withPropsOnChange(['node', 'onClick'], ({ node, onClick }: SunburstArcProps) => ({ + onClick: (event: React.MouseEvent) => + onClick?.(node.data, event), + })), + withPropsOnChange( + ['node', 'tooltip', 'tooltipFormat'], + ({ node, tooltip, tooltipFormat }: SunburstArcProps) => ({ + tooltip: ( + + ), + }) + ), + pure +) + +export default (enhance(SunburstArc as any) as unknown) as React.FC diff --git a/packages/sunburst/src/SunburstLabels.js b/packages/sunburst/src/SunburstLabels.tsx similarity index 61% rename from packages/sunburst/src/SunburstLabels.js rename to packages/sunburst/src/SunburstLabels.tsx index 8a675c009..28ced5c66 100644 --- a/packages/sunburst/src/SunburstLabels.js +++ b/packages/sunburst/src/SunburstLabels.tsx @@ -1,41 +1,20 @@ -/* - * 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 React, { Component, Fragment } from 'react' -import PropTypes from 'prop-types' -import { midAngle, positionFromAngle, radiansToDegrees, labelsThemePropType } from '@nivo/core' +import React, { Component } from 'react' +// @ts-ignore +import { midAngle, positionFromAngle, radiansToDegrees } from '@nivo/core' +import { SunburstLabelProps } from './types' const sliceStyle = { pointerEvents: 'none', -} - -export default class SunburstLabels extends Component { - static propTypes = { - nodes: PropTypes.arrayOf(PropTypes.shape({})).isRequired, - label: PropTypes.func.isRequired, - skipAngle: PropTypes.number.isRequired, - textColor: PropTypes.func.isRequired, - theme: PropTypes.shape({ - labels: labelsThemePropType.isRequired, - }).isRequired, - } - - static defaultProps = { - skipAngle: 0, - } +} as const +export default class SunburstLabels extends Component { render() { - const { nodes, label, skipAngle, textColor, theme } = this.props + const { nodes, label, skipAngle = 0, textColor, theme } = this.props - let centerRadius = false + let centerRadius: number return ( - + <> {nodes .filter(node => node.depth === 1) .map(node => { @@ -64,7 +43,7 @@ export default class SunburstLabels extends Component { @@ -73,7 +52,7 @@ export default class SunburstLabels extends Component { ) })} - + ) } } diff --git a/packages/sunburst/src/index.js b/packages/sunburst/src/index.js deleted file mode 100644 index b9a4b88b8..000000000 --- a/packages/sunburst/src/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/* - * 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. - */ -export { default as Sunburst } from './Sunburst' -export * from './Sunburst' -export { default as ResponsiveSunburst } from './ResponsiveSunburst' diff --git a/packages/sunburst/src/index.ts b/packages/sunburst/src/index.ts new file mode 100644 index 000000000..050fab2fa --- /dev/null +++ b/packages/sunburst/src/index.ts @@ -0,0 +1,4 @@ +export { default as Sunburst } from './Sunburst' +export * from './ResponsiveSunburst' +export * from './props' +export * from './types' diff --git a/packages/sunburst/src/props.ts b/packages/sunburst/src/props.ts new file mode 100644 index 000000000..9fed32728 --- /dev/null +++ b/packages/sunburst/src/props.ts @@ -0,0 +1,20 @@ +export const defaultProps = { + identity: 'id', + value: 'value', + + cornerRadius: 0, + + colors: { scheme: 'nivo' }, + borderWidth: 1, + borderColor: 'white', + + childColor: { from: 'color' }, + role: 'img', + + // slices labels + enableSlicesLabels: false, + sliceLabel: 'value', + slicesLabelsTextColor: 'theme', + + isInteractive: true, +} diff --git a/packages/sunburst/src/types.ts b/packages/sunburst/src/types.ts new file mode 100644 index 000000000..1b1c9f194 --- /dev/null +++ b/packages/sunburst/src/types.ts @@ -0,0 +1,131 @@ +import { OrdinalColorsInstruction, InheritedColorProp } from '@nivo/colors' +import { Theme, Dimensions, Box } from '@nivo/core' + +type NameAndColor = { + name: string + color: string +} + +// Pretty sure this should be generic.. loc is example from website +type DataLocation = NameAndColor & { + loc: number +} + +type DataChildren = NameAndColor & { + children: DataChildren[] | DataLocation[] +} + +type Data = NameAndColor & DataChildren + +export type SunburstNode = { + data: { + id: string + color: string + } + depth: number + x0: number + x1: number + y0: number + y1: number +} + +type CommonSunburstProps = { + data: Data + + identity: string | ((node: SunburstNode['data']) => string) + value: string | ((node: SunburstNode['data']) => number) + + margin: Box + + cornerRadius: number + + colors: OrdinalColorsInstruction + borderWidth: number + borderColor: string + + childColor: InheritedColorProp + + // slices labels + enableSlicesLabels: boolean + sliceLabel: string | ((node: SunburstNode['data']) => string) + + slicesLabelsSkipAngle?: number + slicesLabelsTextColor?: InheritedColorProp + + role: string + + theme: Theme + + isInteractive: boolean + tooltipFormat: (value: React.ReactText) => React.ReactText + tooltip: (payload: SunburstNode['data']) => JSX.Element + + onClick: ( + payload: SunburstNode['data'], + event: React.MouseEvent + ) => void + onMouseEnter: ( + payload: SunburstNode['data'], + event: React.MouseEvent + ) => void + onMouseLeave: ( + payload: SunburstNode['data'], + event: React.MouseEvent + ) => void +} + +type ComputedSunburstProps = { + identity: string | ((node: SunburstNode['data']) => string) + getIdentity: (node: SunburstNode['data']) => string // computed + + getValue: (node: SunburstNode['data']) => number // computed + + nodes: SunburstNode[] // computed + + partition: any // computed + + arcGenerator: (node: SunburstNode) => string // computed + + radius: number // computed + centerX: number // computed + centerY: number // computed + + outerWidth: number + outerHeight: number + + getColor: (payload: unknown) => string + getChildColor: (payload: unknown) => string + + getSliceLabel: (node: SunburstNode['data']) => string +} + +export type SunburstSvgProps = Dimensions & + Partial & + ComputedSunburstProps & { nodes: ComputedSunburstProps['nodes'] } + +export type SunburstArcProps = Pick< + SunburstSvgProps, + | 'tooltip' + | 'tooltipFormat' + | 'onClick' + | 'onMouseEnter' + | 'onMouseLeave' + | 'borderWidth' + | 'borderColor' +> & + Pick & + TooltipHandlers & { + node: SunburstNode + path?: string // computed + } + +export type SunburstLabelProps = Pick & { + label: SunburstSvgProps['getSliceLabel'] + skipAngle?: number + textColor: (payload: SunburstNode['data'], theme?: Theme) => string +} + +export type TooltipHandlers = { + showTooltip: (payload: JSX.Element, event: React.MouseEvent) => void + hideTooltip: () => void +} diff --git a/packages/sunburst/tsconfig.json b/packages/sunburst/tsconfig.json new file mode 100644 index 000000000..855b4b2b7 --- /dev/null +++ b/packages/sunburst/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.types.json", + "compilerOptions": { + "outDir": "./dist/types", + "rootDir": "./src" + }, + "include": ["src/**/*"] +} diff --git a/website/src/data/components/sunburst/props.js b/website/src/data/components/sunburst/props.js index 8d756505e..7ce84943a 100644 --- a/website/src/data/components/sunburst/props.js +++ b/website/src/data/components/sunburst/props.js @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -import { SunburstDefaultProps as defaults } from '@nivo/sunburst' +import { defaultProps } from '@nivo/sunburst' import { groupProperties } from '../../../lib/componentProperties' const props = [ @@ -70,7 +70,7 @@ const props = [ `, type: 'string | Function', required: false, - defaultValue: defaults.identity, + defaultValue: defaultProps.identity, }, { key: 'value', @@ -86,13 +86,13 @@ const props = [ `, type: 'string | Function', required: false, - defaultValue: defaults.value, + defaultValue: defaultProps.value, }, { key: 'colors', help: 'Defines how to compute node color.', required: false, - defaultValue: defaults.colors, + defaultValue: defaultProps.colors, controlType: 'ordinalColors', type: 'string | Function | string[]', group: 'Base', @@ -102,7 +102,7 @@ const props = [ help: 'Defines how to compute child nodes color.', type: 'string | object | Function', required: false, - defaultValue: defaults.childColor, + defaultValue: defaultProps.childColor, controlType: 'inheritedColor', group: 'Base', }, @@ -111,7 +111,7 @@ const props = [ help: 'Node border width.', type: 'number', required: false, - defaultValue: defaults.borderWidth, + defaultValue: defaultProps.borderWidth, controlType: 'lineWidth', group: 'Base', }, @@ -120,7 +120,7 @@ const props = [ help: 'Round node shape.', type: 'number', required: false, - defaultValue: defaults.cornerRadius, + defaultValue: defaultProps.cornerRadius, controlType: 'range', group: 'Base', controlOptions: { @@ -136,7 +136,7 @@ const props = [ help: 'Enable/disable interactivity.', type: '{boolean}', required: false, - defaultValue: defaults.isInteractive, + defaultValue: defaultProps.isInteractive, controlType: 'switch', group: 'Interactivity', }, diff --git a/yarn.lock b/yarn.lock index 614978626..da63cc7af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6015,6 +6015,11 @@ resolved "https://registry.yarnpkg.com/@types/d3-color/-/d3-color-2.0.0.tgz#febdfadade56e215a4c3f612fe3000d92999f5d5" integrity sha512-Bs0maTeU47rdZT+n42iQ0C4gnbnJlIDJkqHFtIsDx2tPPITDeoSdIrm+00UYXzegzArYC2GsG80eHNMwz08IAw== +"@types/d3-hierarchy@^1.1.7": + version "1.1.7" + resolved "https://registry.yarnpkg.com/@types/d3-hierarchy/-/d3-hierarchy-1.1.7.tgz#14a57b0539f8929015f8ad96490de50a16211040" + integrity sha512-fvht6DOYKzqmXjMb/+xfgkmrWM4SD7rMA/ZbM+gGwr9ZTuIDfky95J8CARtaJo/ExeWyS0xGVdL2gqno2zrQ0Q== + "@types/d3-path@^1": version "1.0.9" resolved "https://registry.yarnpkg.com/@types/d3-path/-/d3-path-1.0.9.tgz#73526b150d14cd96e701597cbf346cfd1fd4a58c" @@ -6032,6 +6037,13 @@ dependencies: "@types/d3-time" "*" +"@types/d3-shape@^1.3.5": + version "1.3.5" + resolved "https://registry.yarnpkg.com/@types/d3-shape/-/d3-shape-1.3.5.tgz#c0164c1be1429473016f855871d487f806c4e968" + integrity sha512-aPEax03owTAKynoK8ZkmkZEDZvvT4Y5pWgii4Jp4oQt0gH45j6siDl9gNDVC5kl64XHN2goN9jbYoHK88tFAcA== + dependencies: + "@types/d3-path" "^1" + "@types/d3-shape@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@types/d3-shape/-/d3-shape-2.0.0.tgz#61aa065726f3c2641aedc59c3603475ab11aeb2f"