@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.
@@ -7,4 +7,5 @@ export interface Alignment {
7
7
  export interface Position {
8
8
  top: number;
9
9
  left: number;
10
+ flipped: boolean;
10
11
  }
@@ -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
- * Calculates the position of the menu based on the alignment and offset
3
+ * Calculates the position of the menu based on alignment and viewport constraints.
4
4
  *
5
- * @param menuAlign - the alignment of the menu
6
- * @param offset - the offset from the trigger
7
- * @param elementRect - the bounding client rect of the menu
8
- * @param triggerRect - the bounding client rect of the trigger
9
- * @returns - the position of the menu
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;