UNPKG

reaviz

Version:

Data Visualization using React

94 lines (93 loc) 2.49 kB
import { default as React, ReactElement, FC } from 'react'; import { Tooltip, TooltipProps } from 'reablocks'; import { SankeyLabel, SankeyLabelPosition, SankeyLabelProps } from '../SankeyLabel'; import { SankeyNodeExtra } from '../utils'; export interface SankeyNodeProps extends SankeyNodeExtra { /** * ID of the node. If not provided, the node's index will be used. */ id?: string; /** * Title of the node. */ title: string; /** * Color of the node. * * @default DEFAULT_COLOR */ color?: string; /** * Whether the element is active or not. Set internally by `Sankey`. * * @default false */ active: boolean; /** * Whether to animate the enter/update/exit. * * @default true */ animated: boolean; /** * Width of the chart. Set internally by `Sankey`. */ chartWidth?: number; /** * CSS class to apply. */ className?: string; /** * Whether the node is disabled. Set internally by `Sankey`. * * @default false */ disabled: boolean; /** * Label element. * * @default `<SankeyLabel />` */ label: ReactElement<SankeyLabelProps, typeof SankeyLabel>; /** * Label position. Set internally by `Sankey`. */ labelPosition?: SankeyLabelPosition; /** * Percentage of total width occupied by labels on * either side of the graph inside the container. * Set internally by `Sankey`. */ labelPadding?: number; /** * Opacity callback for the node. */ opacity: (active: boolean, disabled: boolean) => number; /** * CSS styles to apply. */ style?: React.StyleHTMLAttributes<SVGRectElement>; /** * Tooltip element. * * @default `<Tooltip followCursor modifiers={[offset(5)]} />` */ tooltip?: ReactElement<TooltipProps, typeof Tooltip> | null; /** * Width of the node. Set internally by `Sankey`. */ width?: number; /** * Event for when the node is clicked. */ onClick?: (event: React.MouseEvent<SVGRectElement>) => void; /** * Event for when the node has mouse enter. */ onMouseEnter?: (event: React.MouseEvent<SVGRectElement>) => void; /** * Event for when the node has mouse leave. */ onMouseLeave?: (event: React.MouseEvent<SVGRectElement>) => void; } export declare const SankeyNode: FC<Partial<SankeyNodeProps>>;