import type { CanvasHTMLAttributes, MutableRefObject, ReactNode } from 'react'; import type { Chart, ChartType, ChartData, ChartOptions, DefaultDataPoint, Plugin, UpdateMode } from 'chart.js'; export type ForwardedRef = ((instance: T | null) => void) | MutableRefObject | null; export interface ChartProps, TLabel = unknown> extends CanvasHTMLAttributes { /** * Chart.js chart type */ type: TType; /** * The data object that is passed into the Chart.js chart * @see https://www.chartjs.org/docs/latest/getting-started/ */ data: ChartData; /** * The options object that is passed into the Chart.js chart * @see https://www.chartjs.org/docs/latest/general/options.html * @default {} */ options?: ChartOptions; /** * The plugins array that is passed into the Chart.js chart * @see https://www.chartjs.org/docs/latest/developers/plugins.html * @default [] */ plugins?: Plugin[]; /** * Teardown and redraw chart on every update * @default false */ redraw?: boolean; /** * Key name to identificate dataset * @default 'label' */ datasetIdKey?: string; /** * A fallback for when the canvas cannot be rendered. Can be used for accessible chart descriptions * @see https://www.chartjs.org/docs/latest/general/accessibility.html * @default null * @todo Replace with `children` prop. */ fallbackContent?: ReactNode; /** * A mode string to indicate transition configuration should be used. * @see https://www.chartjs.org/docs/latest/developers/api.html#update-mode */ updateMode?: UpdateMode; } /** * @todo Replace `undefined` with `null` */ export type ChartJSOrUndefined, TLabel = unknown> = Chart | undefined; export type BaseChartComponent = , TLabel = unknown>(props: ChartProps & { ref?: ForwardedRef>; }) => JSX.Element; export type TypedChartComponent = , TLabel = unknown>(props: Omit, 'type'> & { ref?: ForwardedRef>; }) => JSX.Element; //# sourceMappingURL=types.d.ts.map