import { DetailedHTMLProps, HTMLAttributes, ReactNode } from "react";
import { ISciChartSurfaceBase, SciChartSurface, TSurfaceDefinition } from "scichart";
/** Describes the core return type of a chart initialization function */
export interface IInitResult {
sciChartSurface: TSurface;
}
/**
* Describes the type of a chart initialization function
* @param rootElement the internal element that should be used to create a chart
* @returns a Promise with the initialization result object containing the created surface reference as `sciChartSurface` property
*/
export type TInitFunction = IInitResult> = (rootElement: string | HTMLDivElement) => Promise;
/** @ignore */
export type TDivProps = DetailedHTMLProps, HTMLDivElement>;
/** @ignore */
export type TCleanupCallback = () => void;
/** @ignore */
export interface IChartComponentPropsCore = IInitResult> extends TDivProps {
/** a component that would be rendered while the chart is being initialized */
fallback?: ReactNode | undefined;
/** a callback function used after the chart is initialized */
onInit?: (initResult: TInitResult) => TCleanupCallback | void;
/** a callback function used when the component with initialized chart is unmounted */
onDelete?: (initResult: TInitResult) => void;
/** a callback function used when the initialization function has thrown an error */
onInitError?: (err?: any) => void;
/** props passed to the inner container of the chart */
innerContainerProps?: TDivProps;
}
/** @ignore */
export type TChartComponentPropsWithInit> = IChartComponentPropsCore & {
/**
* An initialization function which should return surface instance created on the provided root element.
*/
initChart: TInitFunction;
config?: never;
};
type TChartComponentPropsWithConfig = IChartComponentPropsCore> & {
initChart?: never;
/**
* A string with chart definition or configuration object acceptable by SciChart Builder API
*/
config: string | TSurfaceDefinition;
};
/** Describes allowed properties for {@link SciChartReact} */
export type TChartComponentProps = IInitResult> = TChartComponentPropsWithInit | TChartComponentPropsWithConfig;
export type TResolvedReturnType any> = Awaited>;
export {};
//# sourceMappingURL=types.d.ts.map