import React, { CSSProperties, PropsWithChildren } from 'react';
import { Component } from '../../shared-logic/src/Component/types';
import { DataSet } from '../../shared-logic/src/DataSet/types';
import { FeatureToggles } from '../../shared-logic/src/FeatureToggle/types';
import { PreparedQuery, Query } from '../../shared-logic/src/Query/types';
import { Result } from '../../shared-logic/src/Result/types';
import { QueryEngineConfig, QueryEngineEndpoint } from '../../shared-logic/src/QueryEngineConfig/types';
import { identityCallback as identityCallbackImported, loadDataSetsCallback as loadDataSetsCallbackImported, loadQueryEngineConfigCallback as loadQueryEngineConfigCallbackImported, loadDataCallback as loadDataCallbackImported } from '../../shared-logic/src/Callbacks/types';
import { PivotConfig as PivotConfigImported } from '../../shared-logic/src/PivotConfig/types';
import { DataPanelSection } from '../../shared-logic/src/DataPanelConfig/types';
import { FormatPanelSection } from '../../shared-logic/src/FormatPanelConfig/types';
import { Dashboard } from '../../shared-logic/src/Dashboard/types';
import { AdditionalFilter, FilterConfig, MultiSelectFilter, NumericFilter } from '../../shared-logic/src/AdditionalFilter/types';
import { QueryAttributes } from '../../shared-logic/src/QueryAttributes/types';
import { GlobalFilterViewProps } from './components/GlobalFilters/types';
import { api } from '../../shared-logic/src/api';
import { CustomView as CustomViewType } from '../../shared-logic/src/CustomView/types';
import { runQueriesCallback as runQueriesCallbackImported } from '../../shared-logic/src/api/queryEngine/getRunQueriesCallback';
import { SavingState } from '../../shared-logic/src/VizzlyState';
import { DataType } from '../../shared-logic/src/Field/types';
declare global {
    var disableViewCheck: boolean;
    var disableResizing: boolean;
}
export type { VizzlyTheming } from '../../shared-logic/src/Theme/types';
export declare namespace VizzlyComponents {
    export type EffectiveAxisBounds = {
        x?: {
            min: number | null;
            max: number | null;
        };
        y?: {
            min: number | null;
            max: number | null;
        };
        yDual?: {
            min: number | null;
            max: number | null;
        };
    };
    export type ApiConfig = {
        host: string;
        authToken?: string;
        useCookieAuth?: boolean;
        mock?: ReturnType<typeof api>;
    };
    export type BuilderAttributes<AttributesType> = {
        attributes: AttributesType;
        dataSet: DataSet;
        setAttributes: (attrs: AttributesType) => void;
        queries: Query[];
        results: Result[];
    };
    export type ManagePartialAttributes<AttributesType> = {
        attributes: AttributesType;
        dataSet: DataSet;
        setPartialAttributes: (attrs: Partial<AttributesType>) => void;
    };
    export type PivotConfig = PivotConfigImported;
    export namespace ComponentOverrides {
        type CustomView = CustomViewType;
        namespace Props {
            type PickDataSet = {
                previewDataSetId: string;
                dataSets: DataSet[];
                setPreviewDataSetId: (dataSetId: string) => void;
                onSelectDataSet: (dataSetId: string) => void;
                previewResult: Result | null;
            };
            type Select = {
                subtle?: boolean;
                dynamicWidth?: boolean;
                options: SelectOptions[];
                isLoading?: boolean;
                /** Pass in the index of the options. */
                selected: number | null;
                /** When invoking the onChange callback pass in the index of the option you want to select. */
                onChange: (index: number | null) => void;
                placeholder?: string;
                canBeCleared?: boolean;
                selectedLabelPrefix?: string;
                error?: boolean;
                anchorOptionsLeft?: boolean;
                setSelectOptionsAreOpen: (isOpen: boolean) => void;
                selectOptionsAreOpen: boolean;
                rightAligned?: boolean;
                id?: string;
            };
            type SavingDashboardProps = {
                saving: SavingState;
            };
            /**
             * Represents the input props for a DateTimeRangeInputChange event.
             * It can contain either a non-null object with start and end properties,
             * or a null value.
             */
            type DateTimeRangeInputChangeProps = {
                /** Returns the combined Date and Time for the Start value */
                start: Date | null;
                /** Returns the combined Date and Time for the End value */
                end: Date | null;
            } | QueryAttributes.Filter[][] | null;
            type DateTimeRangeInput = {
                onChange: (values: DateTimeRangeInputChangeProps) => void;
                onClear: () => void;
                type?: 'date' | 'date_time';
                startDate?: Date;
                endDate?: Date;
                startTime?: string | null;
                endTime?: string | null;
                prefix?: boolean;
                label?: string;
                fixedWidth?: number;
            };
            type SelectOptions = {
                label: string | number | Function;
                value: any;
                subText?: string;
                testId?: string;
                icon?: JSX.Element;
                title?: boolean;
            };
            type Button = PropsWithChildren<{
                primary?: boolean;
                secondary?: boolean;
                disabled?: boolean;
                readonly?: boolean;
                onClick?: () => Promise<boolean> | void;
                onMouseEnter?: () => Promise<boolean> | boolean | void;
                error?: boolean;
                isLoading?: boolean;
                success?: boolean;
                suppressed?: boolean;
                type?: 'button' | 'submit';
                icon?: ButtonIcon;
            }>;
            type ButtonIcon = {
                Icon: () => JSX.Element;
                showLabel?: boolean;
            };
            type DateTimeInput = {
                value: string | undefined;
                onChange: (newDate: Date | null) => void;
                testId?: string;
                error?: boolean;
            };
            type ManageGlobalFilters = {
                dataSets: DataSet[];
                removeGlobalFilter: (index: number) => void;
                globalFilters: Dashboard['globalFilters'];
                setGlobalFilters: (globalFilters: Dashboard['globalFilters']) => void;
                queryEngineConfig: QueryEngineConfig;
                setFieldForGlobalFilter: (globalFilterIndex: number, dataSetId: string, fieldId: string | null) => void;
            };
            namespace ComponentOptions {
                type CellOption = {
                    purpose: string;
                    renderIcon: () => React.ReactNode;
                    onClick: () => void;
                    testId?: string;
                };
            }
            type ComponentOptions = {
                cellOptions: ComponentOptions.CellOption[];
                onClose: () => void;
            };
            type SectionProps<Section extends DataPanelSection | FormatPanelSection = DataPanelSection | FormatPanelSection> = EditorSectionProps<Component.Attributes> & {
                section: Section;
            };
            type AdvancedFilter = PropsWithChildren<{
                filterIndex: number;
                filter: MultiSelectFilter | NumericFilter;
                dataSets: DataSet[];
                onChange: (filter: MultiSelectFilter | NumericFilter) => void;
                showClearBtn?: boolean;
                type: Omit<DataType, 'date_time'>;
                onOpenChange?: (open: boolean) => void;
            }>;
        }
        type Props<Rest> = Rest & {
            activeDevToolHighlight: boolean;
            onClickWithDevToolCheck: (onClick?: (e: any) => Promise<boolean> | void) => (e: any) => Promise<boolean> | void;
        };
        type renderGlobalFiltersViewComponent = (props: GlobalFilterViewProps) => JSX.Element | null;
        type renderManageGlobalFilters = (props: Props.ManageGlobalFilters) => JSX.Element | null;
        type renderButtonComponent = (props: Props.Button) => JSX.Element;
        type renderAdvancedFilter = (props: Props.AdvancedFilter) => JSX.Element;
        type renderDateTimeInput = (props: Props.DateTimeInput) => JSX.Element;
        type renderSelectComponent = (props: Props.Select) => JSX.Element;
        type renderDateTimeRangeInput = (props: Props.DateTimeRangeInput) => JSX.Element;
        type renderComponentOptions = (props: Props.ComponentOptions) => JSX.Element | null;
        type renderSavingComponent = (props: {
            saving: boolean;
        }) => JSX.Element | null;
        type renderLoading = (props: {}) => JSX.Element | string | null;
        type renderUndoIcon = (props: {}) => JSX.Element | string;
        type renderCompletedIcon = (props: {}) => JSX.Element | string;
        type renderInProgressIcon = (props: {}) => JSX.Element | string;
        type DeleteIconProps = {
            purpose: 'removeComponentFromDashboard' | 'removeCellFromDashboard' | 'removeFilter' | 'removeRow' | 'removeComponentFromLibrary';
        };
        type renderDeleteIcon = (props: DeleteIconProps) => JSX.Element | string;
        type PlusIconProps = {
            fill?: CSSProperties['fill'];
        };
        type renderPlusIcon = (props: PlusIconProps) => JSX.Element | string;
        type renderCloseIcon = (props: {}) => JSX.Element | string;
        type renderTagIcon = (props: {}) => JSX.Element | string;
        type renderCheckIcon = (props: {}) => JSX.Element | string;
        type renderSwitchIcon = (props: {}) => JSX.Element | string;
        type renderResetIcon = (props: {}) => JSX.Element | string;
        type renderPresentIcon = (props: {}) => JSX.Element | string;
        type renderFullscreenIcon = (props: {}) => JSX.Element | string;
        type renderArrowUpIcon = (props: {}) => JSX.Element | string;
        type renderArrowDownIcon = (props: {}) => JSX.Element | string;
        type renderDocumentDuplicateIcon = (props: {}) => JSX.Element | string;
        type renderClipboardDocumentIcon = (props: {}) => JSX.Element | string;
        type ErrorProps = {
            fill?: CSSProperties['fill'];
        };
        type renderErrorIcon = (props: ErrorProps) => JSX.Element | string;
        type DrilldownIconProps = {
            fill?: CSSProperties['fill'];
            width?: number;
            height?: number;
        };
        type renderDrilldownIcon = (props: DrilldownIconProps) => JSX.Element | string;
        type renderEditIcon = (props: {}) => JSX.Element | string;
        type renderDownloadIcon = (props: {}) => JSX.Element | string;
        type renderComponentOptionsMenuIcon = (props: {}) => JSX.Element | string;
        type renderMergeCellIcon = (props: {}) => JSX.Element | string;
        type renderSplitCellIcon = (props: {}) => JSX.Element | string;
        type FilterIconProps = {
            active: boolean;
        };
        type renderFilterIcon = (props: {
            active: boolean;
        }) => JSX.Element | string;
        type renderReportIcon = (props: {}) => JSX.Element | string;
        type renderParametersIcon = (props: {}) => JSX.Element | string;
        type renderInsertRowBelowIcon = (props: {}) => JSX.Element | string;
        type renderInsertRowAboveIcon = (props: {}) => JSX.Element | string;
        type renderAppendCellIcon = (props: {}) => JSX.Element | string;
        type renderLibraryIcon = (props: {}) => JSX.Element | string;
        type renderCreateComponentIcon = (props: {}) => JSX.Element | string;
        type renderCogIcon = (props: {}) => JSX.Element | string;
        type AccordionIconProps = {
            isOpen: boolean;
        };
        type renderAccordionIcon = (props: AccordionIconProps) => JSX.Element | string;
        type renderSendIcon = (props: {
            width?: number;
            height?: number;
        }) => JSX.Element | string;
        type renderStopIcon = (props: {
            width?: number;
            height?: number;
        }) => JSX.Element | string;
        type UserIconProps = {
            width?: number;
            height?: number;
            color?: CSSProperties['color'];
        };
        type renderUserIcon = (props: UserIconProps) => JSX.Element | string;
        type renderAIChatIcon = (props: {}) => JSX.Element | string;
        type renderAIIcon = (props: {}) => JSX.Element | string;
        type renderCodeIcon = (props: {}) => JSX.Element | string;
        type renderThumbsUpSelectedIcon = (props: {
            width?: number;
            height?: number;
        }) => JSX.Element | string;
        type renderThumbsUpUnselectedIcon = (props: {
            width?: number;
            height?: number;
        }) => JSX.Element | string;
        type renderThumbsDownUnselectedIcon = (props: {
            width?: number;
            height?: number;
        }) => JSX.Element | string;
        type renderThumbsDownSelectedIcon = (props: {
            width?: number;
            height?: number;
        }) => JSX.Element | string;
        type renderSelectIcon = (props: {
            width?: number;
            height?: number;
        }) => JSX.Element | string;
        type renderBackButtonArrowIcon = (props: {
            width?: number;
            height?: number;
        }) => JSX.Element | string;
    }
    export type ComponentOverrides = {
        renderLoadingComponent: ComponentOverrides.renderLoading | null;
        /**
         * @deprecated This property is being deprecated. You can now use the Theme API, see {@link https://docs.vizzly.co/dashboard/properties/theme}.
         */
        renderManageGlobalFilters?: ComponentOverrides.renderManageGlobalFilters | null;
        renderSelectComponent: ComponentOverrides.renderSelectComponent | null;
        renderButtonComponent: ComponentOverrides.renderButtonComponent | null;
        renderAdvancedFilter: ComponentOverrides.renderAdvancedFilter | null;
        renderDateTimeInput: ComponentOverrides.renderDateTimeInput | null;
        renderDateTimeRangeInput: ComponentOverrides.renderDateTimeRangeInput | null;
        renderSavingComponent: ComponentOverrides.renderSavingComponent | null;
        /**
         * @deprecated This property is being deprecated. You can now use the Theme API, for information see {@link https://docs.vizzly.co/dashboard/properties/theme}.
         */
        renderComponentOptions?: ComponentOverrides.renderComponentOptions | null;
        /**
         * @deprecated This property is being deprecated. You can now use the Theme API, see {@link https://docs.vizzly.co/dashboard/properties/theme}.
         */
        renderGlobalFiltersViewComponent?: ComponentOverrides.renderGlobalFiltersViewComponent | null;
        /**
         * @deprecated This property is being deprecated.
         */
        renderPickComponentTypeComponent?: never;
        /**
         * @deprecated This property is being deprecated.
         */
        renderUndoIcon?: ComponentOverrides.renderUndoIcon | null;
        /**
         * @deprecated This property is being deprecated.
         */
        renderCompletedIcon?: ComponentOverrides.renderCompletedIcon | null;
        /**
         * @deprecated This property is being deprecated.
         */
        renderInProgressIcon?: ComponentOverrides.renderInProgressIcon | null;
        renderDeleteIcon: ComponentOverrides.renderDeleteIcon | null;
        /**
         * @deprecated This property is being deprecated.
         */
        renderPlusIcon?: ComponentOverrides.renderPlusIcon | null;
        renderCheckIcon?: ComponentOverrides.renderCheckIcon | null;
        renderDocumentDuplicateIcon?: ComponentOverrides.renderDocumentDuplicateIcon | null;
        renderClipboardDocumentIcon?: ComponentOverrides.renderClipboardDocumentIcon | null;
        renderTagIcon: ComponentOverrides.renderTagIcon | null;
        renderCloseIcon: ComponentOverrides.renderCloseIcon | null;
        renderResetIcon: ComponentOverrides.renderResetIcon | null;
        renderFilterIcon: ComponentOverrides.renderFilterIcon | null;
        renderReportIcon: ComponentOverrides.renderReportIcon | null;
        renderParametersIcon: ComponentOverrides.renderParametersIcon | null;
        renderEditIcon: ComponentOverrides.renderEditIcon | null;
        renderDrilldownIcon: ComponentOverrides.renderDrilldownIcon | null;
        renderLockedIcon: ComponentOverrides.renderEditIcon | null;
        renderComponentOptionsMenuIcon: ComponentOverrides.renderComponentOptionsMenuIcon | null;
        /**
         * @deprecated This property is being deprecated.
         */
        renderMergeCellIcon?: ComponentOverrides.renderComponentOptionsMenuIcon | null;
        /**
         * @deprecated This property is being deprecated.
         */
        renderSplitCellIcon?: ComponentOverrides.renderSplitCellIcon | null;
        renderDownloadIcon: ComponentOverrides.renderDownloadIcon | null;
        /**
         * @deprecated This property is being deprecated.
         */
        renderInsertRowBelowIcon?: ComponentOverrides.renderInsertRowBelowIcon | null;
        /**
         * @deprecated This property is being deprecated.
         */
        renderInsertRowAboveIcon?: ComponentOverrides.renderInsertRowAboveIcon | null;
        /**
         * @deprecated This property is being deprecated.
         */
        renderAppendCellIcon?: ComponentOverrides.renderAppendCellIcon | null;
        renderLibraryIcon: ComponentOverrides.renderLibraryIcon | null;
        /**
         * @deprecated This property is being deprecated.
         */
        renderCreateComponentIcon?: ComponentOverrides.renderCreateComponentIcon | null;
        renderAccordionIcon: ComponentOverrides.renderAccordionIcon | null;
        renderSendIcon: ComponentOverrides.renderSendIcon | null;
        renderStopIcon: ComponentOverrides.renderStopIcon | null;
        renderUserIcon: ComponentOverrides.renderUserIcon | null;
        renderAIChatIcon: ComponentOverrides.renderAIChatIcon | null;
        renderAIIcon: ComponentOverrides.renderAIChatIcon | null;
        renderThumbsUpUnselectedIcon: ComponentOverrides.renderThumbsUpUnselectedIcon | null;
        renderThumbsUpSelectedIcon: ComponentOverrides.renderThumbsUpSelectedIcon | null;
        renderThumbsDownUnselectedIcon: ComponentOverrides.renderThumbsDownUnselectedIcon | null;
        renderThumbsDownSelectedIcon: ComponentOverrides.renderThumbsDownSelectedIcon | null;
        renderSelectIcon: ComponentOverrides.renderSelectIcon | null;
        renderBackButtonArrowIcon: ComponentOverrides.renderBackButtonArrowIcon | null;
        renderSwitchIcon: ComponentOverrides.renderSwitchIcon | null;
        renderPresentIcon: ComponentOverrides.renderPresentIcon | null;
        renderFullscreenIcon: ComponentOverrides.renderFullscreenIcon | null;
        renderCodeIcon: ComponentOverrides.renderCodeIcon | null;
        renderCogIcon: ComponentOverrides.renderCogIcon | null;
        renderArrowDownIcon: ComponentOverrides.renderArrowDownIcon | null;
        renderErrorIcon: ComponentOverrides.renderErrorIcon | null;
        renderArrowUpIcon: ComponentOverrides.renderArrowUpIcon | null;
    };
    type CallbackError = null;
    export type loadQueryEngineConfigCallback = loadQueryEngineConfigCallbackImported;
    export type loadDataSetsCallback = loadDataSetsCallbackImported;
    export type runQueriesCallback = runQueriesCallbackImported;
    export type runQueriesCallbackInternal = (queries: Component.Attributes | AdditionalFilter | Array<QueryAttributes> | [PreparedQuery], abortSignal?: AbortSignal, filterConfig?: FilterConfig) => Promise<Result[] | CallbackError>;
    export type identityCallback = identityCallbackImported;
    export type loadDataCallback = loadDataCallbackImported;
    export type EditorSectionProps<Attributes> = {
        attributes: Attributes;
        dataSet: DataSet;
        dataSets: DataSet[];
        effectiveAxisBounds?: EffectiveAxisBounds;
        featureToggles: FeatureToggles;
        setDataSet: (dataSetId: string) => void;
        setAttributes: (attributes: Partial<Attributes>) => void;
        setDataSets: (dataSets: Array<DataSet>) => void;
        queryEngineConfig: QueryEngineConfig;
    };
    export type DataMap = {
        [key: string]: string | boolean | number | Date | null;
    };
    export type ViewProps<Additional, Attrs = Component.Attributes> = {
        result: Result | null | undefined;
        library?: boolean;
        id: string;
        queriesAreChanging: boolean;
        supportedAggregates: QueryEngineConfig['supportedAggregates'];
        supportedTimeTruncFunctions: QueryEngineConfig['supportedTimeTruncFunctions'];
        supportedTransformationFunctions: QueryEngineConfig['supportedTransformationFunctions'];
        defaultFormats: () => {
            [functionId: string]: string;
        };
        localFilters: Component['localFilters'];
        setLocalFilters: (localFilters: Component['localFilters']) => void;
        setPartialAttributes: (updates: Partial<Attrs>) => void;
        sm?: boolean;
        dataSet: DataSet;
    } & Additional;
    export type ImplementationMeta = {
        queryEngineEndpoint?: QueryEngineEndpoint;
        type: 'custom' | 'query-engine' | 'in-browser';
    };
    export type OnError = (error: any, errorInfo: any) => void;
    export {};
}
declare type VizzlyEvent = 'manageTheme.save' | 'manageTheme.open' | 'manageTheme.close' | 'manageGlobalFilters.open' | 'manageGlobalFilters.close' | 'manageDisplay.newRow' | 'manageDisplay.removeRow' | 'manageDisplay.appendCell' | 'manageDisplay.removeCell' | 'editor.changesCancelled' | 'editor.changesConfirmed' | 'component.removeFromDisplay' | 'component.downloadRawData' | 'component.mergeRight' | 'component.splitRight' | 'component.startEditing' | 'library.open' | 'library.startCreatingNew' | 'library.startEditing' | 'library.close' | 'library.switchSelectedComponent' | 'manageFeatureToggles.open' | 'manageFeatureToggles.close';
export declare type trackEventCallback = (event: VizzlyEvent) => void;
