/// import { Flex } from 'intergalactic/flex-box'; import { Intergalactic, Root } from 'intergalactic/core'; import Icon from 'intergalactic/icon'; import { Text } from 'intergalactic/typography'; import { LSize } from '../BaseLegend.type'; import { PatternsConfig } from '../../../Pattern'; /** * Key of chart data item */ export type LegendItemKey = string; export type LegendItem = { /** * One of keys from data set */ id: LegendItemKey; /** * Label for data item in Legend */ label: string; /** * Flag for selected data item */ checked: boolean; /** * Color of data item */ color: string; /** * Icon before label */ icon?: typeof Icon; /** * Additional info with sub-label or count */ additionalInfo?: { label: string; } | { count: number; }; patternKey?: string; /** Enables patterns symbols that enhances charts accessibility */ patterns?: PatternsConfig; }; export type LegendItemProps = LegendItem & { /** * Size for legend item */ size: LSize; /** * Shape of data item on Legend panel */ shape: ShapeType; /** * Handler for select/deselect legend item. * !Need to redefine onClick, because we don't have `event` in it. * @deprecated */ onClick?: () => void; /** Enables patterns symbols that enhances charts accessibility */ patterns?: PatternsConfig; /** * Handler for select/deselect legend item */ onChangeLegendItem: (id: LegendItemKey, checked: boolean) => void; }; export type ShapeProps = LegendItem & ({ size: LSize; shape: Exclude; } | { size: LSize; shape: Extract; onChange: (checked: boolean, e?: React.SyntheticEvent) => void; 'aria-labelledby'?: string; }); export declare const StaticShapes: readonly ["Circle", "Line", "Square", "Pattern"]; export type ShapeType = 'Checkbox' | typeof StaticShapes[number]; export type LegendItemType = Intergalactic.Component> & { Shape: Intergalactic.Component>; Icon: Intergalactic.Component>; Label: Intergalactic.Component>>; AdditionalLabel: Intergalactic.Component>; Count: Intergalactic.Component>; };