import { Refable, type Styleable } from "@trackunit/react-components"; import { MouseEventHandler, ReactElement } from "react"; /** * Shape of the colour indicator. `fill` is a solid circle for a block of colour. `solid line` is a * horizontal rule with an optional hollow-circle marker. `dashed line` is a reference series and * never has a marker. */ export type LegendItemIndicator = "fill" | "solid line" | "dashed line"; /** * Marker on a solid-line indicator. `emptyCircle` is the default hollow circle. Pass `none` only when * the reader should follow the trend rather than each sample. Dashed lines cannot take a symbol. */ export type LegendItemSymbol = "none" | "emptyCircle"; interface LegendItemBaseProps extends Refable, Styleable { label: string; count?: number; selected?: boolean; disabled?: boolean; onClick?: MouseEventHandler; onMouseEnter?: () => void; onMouseLeave?: () => void; color: string; className?: string; "data-testid"?: string; unit?: "%"; hideValue?: boolean; } interface LegendItemFillProps extends LegendItemBaseProps { /** * Filled colour block for field/sector bars and donut slices. This is the default indicator. * * @category primary */ indicator?: "fill"; } interface LegendItemSolidLineProps extends LegendItemBaseProps { /** * Solid line for a series whose individual data points are part of the reading, such as a * cumulative series. Defaults to a hollow circle marker. * * @category primary */ indicator: "solid line"; /** * Marker on a solid line. Defaults to a hollow circle. Pass `none` only when the reader should * follow the trend rather than each sample. Do not use a solid line with `symbol="none"` for * averages, targets, or comparisons — those use `indicator="dashed line"`. * * @category primary */ symbol?: LegendItemSymbol; } interface LegendItemDashedLineProps extends LegendItemBaseProps { /** * Dashed line for a reference or secondary series (average, target, comparison). Dashed lines * never have a symbol. * * @category primary */ indicator: "dashed line"; } export type LegendItemProps = LegendItemFillProps | LegendItemSolidLineProps | LegendItemDashedLineProps; /** * The LegendItem component is the standard chart legend row: a swatch, a label, and an optional count. * * ### When to use * - Fill for field/sector bars and donut slices * - Solid line with a hollow circle when individual data points are part of the reading * - Dashed line with no symbol for averages, targets, and comparisons * * @param {LegendItem} props - The props for the LegendItem component * @returns {ReactElement} LegendItem component */ export declare const LegendItem: ({ className, style, count, label, disabled, selected, onClick, color, "data-testid": dataTestId, onMouseEnter, onMouseLeave, unit, hideValue, ...indicatorProps }: LegendItemProps) => ReactElement; export {};