@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
42 lines (41 loc) • 1.31 kB
TypeScript
import { Rect } from '../../esl-utils/dom/rect';
import type { Point } from '../../esl-utils/dom/point';
export type DimensionNameType = 'width' | 'height';
export type PositionType = 'top' | 'bottom' | 'left' | 'right';
export type PositionOriginType = 'inner' | 'outer';
export type PlacedAtType = 'top' | 'bottom' | 'left' | 'right' | 'top-inner' | 'bottom-inner' | 'left-inner' | 'right-inner';
export interface PopupPositionValue {
placedAt: PlacedAtType;
popup: Rect;
arrow: Point;
}
export interface IntersectionRatioRect {
top?: number;
left?: number;
right?: number;
bottom?: number;
}
export interface PopupPositionConfig {
position: PositionType;
hasInnerOrigin: boolean;
behavior: string;
marginArrow: number;
offsetArrowRatio: number;
intersectionRatio: IntersectionRatioRect;
arrow: Rect;
element: Rect;
inner: Rect;
outer: Rect;
trigger: Rect;
isRTL: boolean;
}
/**
* Checks that the position along the horizontal axis
* @param position - name of position
*/
export declare function isOnHorizontalAxis(position: PositionType): boolean;
/**
* Calculates popup and arrow popup positions.
* @param cfg - popup position config
* */
export declare function calcPopupPosition(cfg: PopupPositionConfig): PopupPositionValue;