@muraldevkit/ui-toolkit 4.35.1 → 4.35.2-dev-6GR3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MenuPosition } from '../../components/menu/constants';
|
|
2
|
+
/**
|
|
3
|
+
* Flips the given position to its opposite.
|
|
4
|
+
*
|
|
5
|
+
* @param pos - The position to flip. Can be 'left', 'right', 'top', or 'bottom'.
|
|
6
|
+
* @returns The flipped position. Will be 'right' for 'left', 'left' for 'right', 'bottom' for 'top', and 'top' for 'bottom'.
|
|
7
|
+
*/
|
|
8
|
+
export declare const flipPosition: (pos: MenuPosition) => MenuPosition;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Alignment, Position } from './constants';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Calculates the position of the menu based on alignment and viewport constraints.
|
|
4
4
|
*
|
|
5
|
-
* @param menuAlign -
|
|
6
|
-
* @param offset -
|
|
7
|
-
* @param elementRect -
|
|
8
|
-
* @param triggerRect -
|
|
9
|
-
* @returns
|
|
5
|
+
* @param {Alignment} menuAlign - The alignment configuration for the menu.
|
|
6
|
+
* @param {number} offset - The offset distance between the menu and the trigger.
|
|
7
|
+
* @param {DOMRect} elementRect - The bounding rectangle of the menu element.
|
|
8
|
+
* @param {DOMRect} [triggerRect] - The bounding rectangle of the trigger element.
|
|
9
|
+
* @returns {Position} The calculated position of the menu.
|
|
10
10
|
*/
|
|
11
11
|
export declare const calculatePosition: (menuAlign: Alignment, offset: number, elementRect: DOMRect, triggerRect?: DOMRect) => Position;
|