@@ -34,7 +34,7 @@ let resizeTimeout: ReturnType<typeof setTimeout>;
3434 * isOpen: $isMenuOpen,
3535 * closeDropdown: () => isMenuOpen.set(false),
3636 * onStatusChange: (status) => console.log(`Menu is ${status ? 'open' : 'closed'}`)
37- * updatePosition: (x, y, isLower ) => {updateDropdownPosition(x, y, isLower )},
37+ * updatePosition: (x, y, isInBottomHalf ) => {updateDropdownPosition(x, y, isInBottomHalf )},
3838 * }}>
3939 * <!-- Dropdown content -->
4040 * </div>
@@ -46,7 +46,7 @@ export function handleDropdownBehavior(
4646 isOpen : boolean ;
4747 closeDropdown : ( ) => void ;
4848 onStatusChange ?: ( status : boolean ) => void ;
49- updatePosition ?: ( x : number , y : number , isLower : boolean ) => void ;
49+ updatePosition ?: ( x : number , y : number , isInBottomHalf : boolean ) => void ;
5050 } ,
5151) {
5252 if ( ! browser ) {
@@ -107,7 +107,7 @@ export function handleDropdownBehavior(
107107 isOpen : boolean ;
108108 closeDropdown : ( ) => void ;
109109 onStatusChange ?: ( status : boolean ) => void ;
110- updatePosition ?: ( x : number , y : number , isLower : boolean ) => void ;
110+ updatePosition ?: ( x : number , y : number , isInBottomHalf : boolean ) => void ;
111111 } ) {
112112 Object . assign ( options , newOptions ) ;
113113 } ,
@@ -133,12 +133,12 @@ export function handleDropdownBehavior(
133133 * @returns An object containing:
134134 * - x: The horizontal position (right edge of the element)
135135 * - y: The vertical position (bottom edge of the element)
136- * - isLower : Boolean indicating whether the element is in the lower half of the viewport
136+ * - isInBottomHalf : Boolean indicating whether the element is in the lower half of the viewport
137137 */
138138export function calculateDropdownPosition ( event : MouseEvent ) : {
139139 x : number ;
140140 y : number ;
141- isLower : boolean ;
141+ isInBottomHalf : boolean ;
142142} {
143143 lastTriggerElement = event . currentTarget as HTMLElement ;
144144 const rect = ( lastTriggerElement as HTMLElement ) . getBoundingClientRect ( ) ;
@@ -147,7 +147,7 @@ export function calculateDropdownPosition(event: MouseEvent): {
147147 return {
148148 x : x ,
149149 y : y ,
150- isLower : rect . top > window . innerHeight / 2 ,
150+ isInBottomHalf : rect . top > window . innerHeight / 2 ,
151151 } ;
152152}
153153
@@ -167,11 +167,11 @@ export function calculateDropdownPosition(event: MouseEvent): {
167167 * and will do nothing if either is undefined or if the dropdown is not open.
168168 *
169169 * The dropdown will be positioned at the bottom-right corner of the trigger element.
170- * The `isLower ` parameter passed to `updatePosition` will be true if the trigger is
170+ * The `isInBottomHalf ` parameter passed to `updatePosition` will be true if the trigger is
171171 * in the top half of the screen, suggesting the dropdown should expand downward.
172172 */
173173export function recalculateDropdownPosition ( options : {
174- updatePosition : ( x : number , y : number , isLower : boolean ) => void ;
174+ updatePosition : ( x : number , y : number , isInBottomHalf : boolean ) => void ;
175175 dropdownIsOpen : boolean ;
176176} ) : void {
177177 if ( ! browser || ! lastTriggerElement || ! options . dropdownIsOpen ) {
0 commit comments