@aotearoan/neon
Version:
Neon is a lightweight design library of Vue 3 components with minimal dependencies.
23 lines (22 loc) • 1.36 kB
TypeScript
import type { NeonDropdownPlacement } from '../enums/NeonDropdownPlacement';
/**
* Placement utilities for use with popup components like dropdown, dropdown menu & select.
*/
export declare class NeonDropdownPlacementUtils {
/**
* Calculate the placement of an element relative to a trigger element given a desired placement. This method will
* determine if there is enough space to place the element in the desired location & if not it will then determine the
* next best place to position the element.
*
* @param triggerElement The trigger element, e.g. the button to trigger opening a select.
* @param contentElement The content element, i.e. the element for which to calculate the placement.
* @param placement The desired placement relative to the trigger element.
* @param placementContainer An optional containing element to use for calculating the placement instead
* of the screen dimensions. This can be useful if the contentElement must be contained by e.g. A modal div.
*
* @returns The calculated placement of the content element.
*/
static calculatePlacement(triggerElement: HTMLElement, contentElement: HTMLElement, placement: NeonDropdownPlacement, placementContainer?: HTMLElement): NeonDropdownPlacement;
private static findPlacement;
private static validPlacement;
}