react-elegant-ui
Version:
Elegant UI components, made by BEM best practices for react
70 lines (69 loc) • 1.89 kB
TypeScript
import { Ref, RefObject } from 'react';
import { VirtualElement } from '@popperjs/core';
import { PopperAnyModifiers, Direction, Boundary } from '../../../hooks/behavior/usePopper';
import { IPopupProps } from '../Popup';
export interface IModPopupTargetAnchor {
/**
* Position popup relative of element specified as `anchor`
*/
target?: 'anchor';
/**
* Element relative to which the popup will be positioned
*/
anchor?: RefObject<HTMLElement | VirtualElement>;
/**
* Ref to elements where popup should fit
*/
boundary?: Boundary;
/**
* Direction of popup relative a target.
*
* One direction or directions list ordered by priority
*
* @default ['bottom-start', 'bottom', 'bottom-end',
* 'top-start', 'top', 'top-end', 'right-start',
* 'right', 'right-end', 'left-start', 'left', 'left-end']
*/
direction?: Direction | Direction[];
/**
* Modifiers for popperjs
*/
modifiers?: PopperAnyModifiers;
/**
* Pin a popup position after open
*/
motionless?: boolean;
/**
* Popup indent for main direction
*
* @default 0
*/
mainOffset?: number;
/**
* Popup indent for secondary direction
*
* @default 0
*/
secondaryOffset?: number;
/**
* Offset of tail from popup edge
*
* @default 0
*/
tailOffset?: number;
/**
* Offset from the viewport edge
*
* @default 16
*/
viewportOffset?: number;
/**
* Ref with hook for force update position
*/
UNSTABLE_updatePosition?: Ref<() => void>;
}
/**
* Mod to set position relative of element specified as `anchor`
* @param {IModPopupTargetAnchor} props
*/
export declare const withModPopupTargetAnchor: import("../../../lib/compose").ConfigurableHOC<IModPopupTargetAnchor, IPopupProps>;