import type { IframeHTMLAttributes } from 'react';
import React from 'react';
import type { ComponentModel } from '@teambit/component';
export type OnPreviewLoadProps = {
height?: string;
width?: string;
};
export interface ComponentPreviewProps extends Omit, 'src' | 'referrerPolicy'> {
/**
* component to preview.
*/
component: ComponentModel;
/**
* preview name.
*/
previewName?: string;
/**
* add inner padding to the iframe.
*/
innerBottomPadding?: number;
/**
* query params to append at the end of the *hash*. Changing this property will not reload the preview
*
* e.g. 'foo=bar&bar=there', or ['foo=bar', 'bar=there']
*/
queryParams?: string | string[];
/**
* event to be fired when iframe loads
*/
onLoad?: (event?: any, props?: OnPreviewLoadProps) => void;
/**
* establish a pubsub connection to the iframe,
* allowing sending and receiving messages
*/
pubsub?: boolean;
/**
* class name to override preview style.
*/
className?: string;
disableScroll?: boolean;
/**
* set specific height for the iframe.
*/
forceHeight?: number | string;
/**
* fit the preview to a specific width.
*/
fitView?: boolean;
/**
* viewport
*/
viewport?: number | null;
includeEnv?: boolean;
/**
* is preview being rendered in full height and should fit view height to content.
*/
fullContentHeight?: boolean;
/**
* propagate error to the parent window from the iframe
*/
propagateError?: boolean;
/**
* custom error handler for preview errors
*/
onPreviewError?: (errorData: any) => void;
}
/**
* renders a preview of a component.
*/
export declare function ComponentPreview({ component, previewName, className, forceHeight, includeEnv, queryParams, disableScroll, pubsub, innerBottomPadding, viewport, fullContentHeight, onLoad, style, sandbox, propagateError, onPreviewError, ...rest }: ComponentPreviewProps): React.JSX.Element;