@wordpress/components
Version:
UI components for WordPress.
53 lines • 2.02 kB
TypeScript
/**
* External dependencies
*/
import type { MotionProps } from 'framer-motion';
import type { ReferenceType } from '@floating-ui/react-dom';
/**
* Internal dependencies
*/
import type { PopoverProps } from './types';
/**
* Converts the `Popover`'s legacy "position" prop to the new "placement" prop
* (used by `floating-ui`).
*
* @param position The legacy position
* @return The corresponding placement
*/
export declare const positionToPlacement: (position: NonNullable<PopoverProps['position']>) => NonNullable<PopoverProps['placement']>;
/**
* Given the floating-ui `placement`, compute the framer-motion props for the
* popover's entry animation.
*
* @param placement A placement string from floating ui
* @return The object containing the motion props
*/
export declare const placementToMotionAnimationProps: (placement: NonNullable<PopoverProps['placement']>) => MotionProps;
/**
* Returns the offset of a document's frame element.
*
* @param document The iframe's owner document.
*
* @return The offset of the document's frame element, or undefined if the
* document has no frame element.
*/
export declare const getFrameOffset: (document?: Document) => {
x: number;
y: number;
} | undefined;
export declare const getFrameScale: (document?: Document) => {
x: number;
y: number;
};
export declare const getReferenceOwnerDocument: ({ anchor, anchorRef, anchorRect, getAnchorRect, fallbackReferenceElement, fallbackDocument, }: Pick<PopoverProps, "anchor" | "anchorRef" | "anchorRect" | "getAnchorRect"> & {
fallbackReferenceElement: Element | null;
fallbackDocument: Document;
}) => Document;
export declare const getReferenceElement: ({ anchor, anchorRef, anchorRect, getAnchorRect, fallbackReferenceElement, scale, }: Pick<PopoverProps, "anchor" | "anchorRef" | "anchorRect" | "getAnchorRect"> & {
fallbackReferenceElement: Element | null;
scale: {
x: number;
y: number;
};
}) => ReferenceType | null;
//# sourceMappingURL=utils.d.ts.map