@codecademy/gamut

68.2.268.2.3-alpha.809fdd.0
dist/PopoverContainer/hooks.d.ts
~dist/PopoverContainer/hooks.d.tsModified
+15−4
Index: package/dist/PopoverContainer/hooks.d.ts
===================================================================
--- package/dist/PopoverContainer/hooks.d.ts
+++ package/dist/PopoverContainer/hooks.d.ts
@@ -1,8 +1,19 @@
-export declare const useScrollingParentsEffect: (targetRef: React.RefObject<Pick<HTMLDivElement, "getBoundingClientRect" | "contains">>, setTargetRect: (rect: DOMRect | undefined) => void) => void;
-export declare const useResizingParentEffect: (targetRef: React.RefObject<Pick<HTMLDivElement, "getBoundingClientRect" | "contains">>, setTargetRect: (rect: DOMRect | undefined) => void) => void;
 /**
+ * Minimal element shape required for popover positioning.
+ * Accepts both HTMLElement and TargetRef so Popover and PopoverContainer can share hooks.
+ */
+export interface PopoverTargetElement {
+    getBoundingClientRect(): DOMRect;
+    contains(other: Node | null): boolean;
+}
+/** Resolves Ref to current element; returns null for RefCallback or null ref. */
+export declare function getRefElement(ref: React.Ref<PopoverTargetElement | null>): PopoverTargetElement | null;
+/** Casts minimal target to HTMLElement for utils that need full DOM (e.g. parentElement). */
+export declare function getTargetAsElement(target: PopoverTargetElement | null): HTMLElement | null;
+export declare const useScrollingParentsEffect: (targetRef: React.Ref<PopoverTargetElement | null>, setTargetRect: (rect: DOMRect | undefined) => void) => void;
+export declare const useResizingParentEffect: (targetRef: React.Ref<PopoverTargetElement | null>, setTargetRect: (rect: DOMRect | undefined) => void) => void;
+/**
  * Memoizes the list of scrolling parent elements for a target element.
- * This avoids expensive DOM traversals and getComputedStyle calls on every render.
  * Returns an empty array if the target element is not available.
  */
-export declare const useScrollingParents: (targetRef: React.RefObject<HTMLElement | null>) => HTMLElement[];
+export declare const useScrollingParents: (targetRef: React.Ref<PopoverTargetElement | null>) => HTMLElement[];