@exadel/esl
Version:
Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components
46 lines (45 loc) • 1.49 kB
TypeScript
import { Rect } from '../../esl-utils/dom/rect';
import type { Point } from '../../esl-utils/dom/point';
export type DimensionNameType = 'width' | 'height';
export type PlacementType = 'top' | 'left' | 'bottom' | 'right';
export type AlignmentType = '' | 'start' | 'end';
export type PositionType = '' | PlacementType | AlignmentType | `${PlacementType} ${AlignmentType}`;
export type PositionOriginType = 'inner' | 'outer';
export type PlacedAtType = PlacementType | `${PlacementType}-inner`;
export interface PopupPositionValue {
placedAt: PlacedAtType;
popup: Rect;
arrow: Point;
}
export interface IntersectionRatioRect {
top?: number;
left?: number;
right?: number;
bottom?: number;
}
export interface PopupPositionConfig {
placement: PlacementType;
alignment?: AlignmentType;
hasInnerOrigin: boolean;
behavior: string;
marginTether: number;
offsetTetherRatio: number;
offsetPlacement: 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 | PlacementType): boolean;
/**
* Calculates popup and arrow popup positions.
* @param cfg - popup position config
* */
export declare function calcPopupPosition(cfg: PopupPositionConfig): PopupPositionValue;