@aveonline/ui-react
Version:
Home base for Aveonline design system - ecosystem react
61 lines (60 loc) • 2.17 kB
TypeScript
import { ReactElement, SVGProps } from 'react';
import { XAxisProps, YAxisProps, LegendProps, TooltipProps } from 'recharts';
import { Props } from 'recharts/types/cartesian/CartesianGrid';
declare type ColorBar = 'blue' | 'cyan' | 'purple' | 'dark-purple' | 'violet' | 'pink';
interface CellBar {
name: string;
group: number;
color: ColorBar;
}
interface TooltipItem {
key: string | number;
newKey: string | number;
}
interface MarginBar {
top: number;
right: number;
left: number;
bottom: number;
}
interface IPropsBar<T> {
data: T[];
cells: CellBar[];
isLoading?: boolean;
className?: string;
paintLastCellForKey?: Record<string, ColorBar>;
width?: number;
height?: number;
margin?: MarginBar;
xAxis?: XAxisProps;
yAxis?: YAxisProps;
legend?: LegendProps['payload'];
tooltipItems?: TooltipItem[];
customTooltip?: React.FC<TooltipProps<string | number | (string | number)[], string | number>>;
/**
* Controls the visibility and appearance of the cursor associated with the tooltip.
*
* - `true`: Displays the default cursor (a vertical line or overlay).
* - `false`: Disables the cursor.
* - `ReactElement`: A custom React component to render as the cursor.
* - `SVGProps<SVGElement>`: Customizes the cursor with specific SVG properties.
*
* Example:
* - `displayCursor={false}` disables the cursor.
* - `displayCursor={<CustomCursor />}` renders a custom cursor component.
*/
displayCursor?: boolean | ReactElement | SVGProps<SVGElement>;
/**
* Defines the corner radius for the bars.
* Can be a single value for all corners or an array specifying:
* [top-left, top-right, bottom-right, bottom-left].
*
* Example:
* - `cornerRadius={10}` applies a 10px radius to all corners.
* - `cornerRadius={[10, 10, 0, 0]}` applies a 10px radius to the top corners
* and keeps the bottom corners square.
*/
cornerRadius?: number | [number, number, number, number];
cartesianGrid?: Props;
}
export type { ColorBar, CellBar, TooltipItem, MarginBar, IPropsBar, TooltipProps };