json-joy
Version:
Collection of libraries for building collaborative editing apps.
18 lines (17 loc) • 703 B
TypeScript
import * as React from 'react';
import type { Rect } from '../web';
export interface EntangledPortalStateOpts {
position?: (base: Rect, dest: Rect) => [x: number, y: number];
onBase?: (el: HTMLSpanElement | null) => void;
onDest?: (el: HTMLElement | null) => void;
}
export interface EntangledPortalProps extends EntangledPortalStateOpts {
span?: React.HTMLAttributes<HTMLSpanElement>;
children?: React.ReactNode;
}
/**
* Renders a <span> with a <div> child rendered in a portal, such that the
* <div> position is entangled with the <span> position, the <div> moves
* with the <span> on resize and scroll.
*/
export declare const EntangledPortal: React.FC<EntangledPortalProps>;