UNPKG

@joint/react

Version:

React bindings and hooks for JointJS to build interactive diagrams and graphs.

53 lines (52 loc) 2.52 kB
import { type ReactNode } from 'react'; import type { CellWithId } from '../../types/cell.types'; import type { GraphElement } from '../../types/element-types'; export interface PaperPortalProps<Data extends CellWithId = GraphElement> { /** * A function that renders the element. It is called every time the element is rendered. */ readonly renderElement: (element: Data) => ReactNode; /** * The cell to render. */ readonly portalElement: SVGElement | HTMLElement | null; } declare function SVGElementItemComponent<Data extends CellWithId = GraphElement>(props: PaperPortalProps<Data>): import("react").ReactPortal | null; /** * Helper paper render component wrapped in a portal to render SVGElement. * This component is used to render a paper element inside a portal. * It takes a renderElement function, a cell, and a containerElement as props. * The renderElement function is called with the cell as an argument and its return value is rendered inside the containerElement. * @param props - The props for the component. * @group Components * @description * This component is used to render a paper element inside a portal. * @returns The rendered element inside the portal. * @internal */ export declare const SVGElementItem: typeof SVGElementItemComponent; /** * Helper paper render component wrapped in a portal to render HTMLElement. * This component is used to render a paper element inside a portal. * It takes a renderElement function, a cell, and a containerElement as props. * The renderElement function is called with the cell as an argument and its return value is rendered inside the containerElement. * @param props - The props for the component. * @group Components * @description * This component is used to render a paper element inside a portal. * @returns The rendered element inside the portal. * @internal */ declare function HTMLElementItemComponent<Data extends CellWithId = GraphElement>(props: PaperPortalProps<Data>): import("react").ReactPortal | null; /** * Helper paper render component wrapped in a portal to render HTMLElement. * This component is used to render a paper element inside a portal. * It takes a renderElement function, a cell, and a containerElement as props. * @private * @param props - The props for the component. * @group Components * @description * This component is used to render a paper element inside a portal. */ export declare const HTMLElementItem: typeof HTMLElementItemComponent; export {};