UNPKG

@aotearoan/neon

Version:

Neon is a lightweight design library of Vue 3 components with minimal dependencies.

31 lines (30 loc) 1.4 kB
import type { NeonAvailableSpace } from '../models/NeonAvailableSpace'; /** * Utilities for helping calculate placement dimensions & available space. */ export declare class NeonPlacementUtils { /** * Calculate the available space in all directions between a trigger element & the edges of the screen or a defined * container element. * * @param triggerElement The trigger element to calculate available space. * @param maxWidth Maximum available width (screen width or placement container width). * @param maxHeight Maximum available height (screen height or placement container height). * @param placementContainer Bounding container to use for calculation. * * @returns An object defining the available space from the trigger element to the screen or * container edge in each direction. */ static calculateAvailableSpace(triggerElement: HTMLElement, maxWidth: number, maxHeight: number, placementContainer?: HTMLElement): NeonAvailableSpace; /** * Calculate the maximum available on screen width & height of an element. * * @param placementContainer The element for which to calculate the maximum width & height. * * @returns The maximum width & height of the element. */ static calculateBounds(placementContainer?: HTMLElement): { maxWidth: number; maxHeight: number; }; }