import * as React from "react"; import { LoadDataParams, EmbeddableType, NativeType, Dataset, Measure, Dimension, Granularity, Time, TimeRange, DimensionOrMeasure, DimensionType, MeasureType, DimensionOrMeasureType, DefaultNativeType } from "@embeddable.com/core"; declare global { interface Window { __EMBEDDABLE_DEVTOOLS__?: { notifyPropsUpdated: (componentId: string, componentMeta: EmbeddedComponentMeta, oldProps: any, newProps: any) => void; notifyDataLoaded: (componentId: string, componentMeta: EmbeddedComponentMeta, result: LoadDataResultEvent) => void; notifyVariableUpdated: (componentId: string, componentMeta: EmbeddedComponentMeta, event: ReloadDatasetEvent, dataLoaders: Record) => void; }; } } export type WrapperProps = { propsUpdateListener: HTMLElement; componentId: string; clientContext: any; embeddableTheme: any; }; export type Config = { props?: (ownProps: Inputs, embeddableState: [ EmbeddableState, React.Dispatch> ], clientContext: any) => Props; events?: Record; }; export type EmbeddableEventHandler = (value: any) => any; type ReloadDatasetEvent = { datasetId: string; }; type LoadDataResultEvent = { isSuccess: boolean; componentId: string; propertyName: string; data?: any[]; error?: string; total?: number; }; type InputBase = { name: string; label: string; description?: string; defaultValue?: any; required?: boolean; category?: string; }; type BasicInput = InputBase & { type: Exclude; array?: boolean; config?: Record; }; type DimensionOrMeasureConfigBase = { dataset: string; [key: string]: any; }; type DimensionConfig = DimensionOrMeasureConfigBase & { hideGranularity?: boolean; }; type SubInput = InputBase & { type: EmbeddableType | DefaultNativeType; supportedTypes?: T[]; }; type SingleDimensionInput = InputBase & { type: "dimension"; array?: false; config: DimensionConfig; inputs?: SubInput[]; }; type SingleMeasureInput = InputBase & { type: "measure"; array?: false; config: DimensionOrMeasureConfigBase; inputs?: SubInput[]; }; type SingleDimensionOrMeasureInput = InputBase & { type: "dimensionOrMeasure"; array?: false; config: DimensionOrMeasureConfigBase; inputs?: SubInput[]; }; type ArrayDimensionInput = InputBase & { type: "dimension"; array: true; config: DimensionConfig; inputs?: SubInput[]; }; type ArrayMeasureInput = InputBase & { type: "measure"; array: true; config: DimensionOrMeasureConfigBase; inputs?: SubInput[]; }; type ArrayDimensionOrMeasureInput = InputBase & { type: "dimensionOrMeasure"; array: true; config: DimensionOrMeasureConfigBase; inputs?: SubInput[]; }; export type ComponentMetaInput = BasicInput | SingleDimensionInput | SingleMeasureInput | SingleDimensionOrMeasureInput | ArrayDimensionInput | ArrayMeasureInput | ArrayDimensionOrMeasureInput; export type EmbeddedComponentMeta = { name: string; label: string; description?: string; category?: string; classNames?: string[]; defaultWidth?: number; defaultHeight?: number; inputs?: ComponentMetaInput[]; events?: { name: string; label: string; properties?: { name: string; type: EmbeddableType | NativeType; array?: boolean; label?: string; }[]; }[]; variables?: { name: string; type: EmbeddableType | NativeType; array?: boolean; defaultValue?: unknown; inputs?: string[]; events?: { name: string; property: string; }[]; }[]; }; interface EmbeddableTypeMappings { dataset: Dataset; measure: Measure; dimension: Dimension; granularity: Granularity; string: string; number: number; boolean: boolean; time: Time; timeRange: TimeRange; dimensionOrMeasure: DimensionOrMeasure; } type MapInputType = Type extends EmbeddableType ? unknown : EmbeddableTypeMappings[Extract]; type MapInputs = { [Input in Meta["inputs"][number] as Input["name"]]: Input extends { array: true; } ? MapInputType[] : MapInputType; }; type EventItem = NonNullable[number]; type MapEventHandlers = Meta["events"] extends ReadonlyArray ? { [K in Meta["events"][number]["name"]]: () => void; } : {}; export type MetaWithOptionalEvents = Required> & Partial>; export type Inputs = MapInputs & MapEventHandlers; export declare function defineComponent(InnerComponent: React.ComponentType, meta: EmbeddedComponentMeta, config?: Config): { ({ propsUpdateListener, clientContext, embeddableTheme, ...props }: WrapperProps): React.JSX.Element; displayName: string; }; export {};