/** * Element retargeting utilities. * * Handles cases where the logical interaction target differs from the DOM element * under the cursor. For example: * - Clicking a label should target the associated input * - Clicking text inside a button should target the button * - Clicking an icon inside a link should target the link * * Based on Playwright's retarget() implementation. */ /** * Retargeting behavior options. */ export type RetargetBehavior = 'none' | 'follow-label' | 'button-link' | 'no-follow-label'; /** * Check if an element is a label. */ export declare function isLabelElement(element: Element): element is HTMLLabelElement; /** * Check if an element is interactive (button, link, or has interactive role). */ export declare function isInteractiveElement(element: Element): boolean; /** * Check if an element is an input-like element (can receive input). */ export declare function isInputLike(element: Element): boolean; /** * Check if an element is an action target (button, link, checkbox, radio, etc.). */ export declare function isActionTarget(element: Element): boolean; /** * Find the form control associated with a label element. * Handles both `for` attribute and nested controls. */ export declare function getLabelTarget(label: HTMLLabelElement): Element | null; /** * Find the nearest interactive ancestor (button or link). * Used for 'button-link' behavior. */ export declare function getInteractiveAncestor(element: Element): Element | null; /** * Find the nearest interactive ancestor including checkbox/radio roles. * Used for 'follow-label' and 'no-follow-label' behaviors. */ export declare function getInteractiveAncestorWithCheckbox(element: Element): Element | null; /** * Retarget an element based on the specified behavior. * * This handles cases where the logical interaction target differs * from the DOM element under the cursor. For example: * - Clicking a label should target the associated input * - Clicking text inside a button should target the button * - Clicking an icon inside a link should target the link * * @param node - The node to retarget (can be Element or Text node) * @param behavior - The retargeting behavior to apply * @returns The retargeted element, or null if the node has no element */ export declare function retarget(node: Node | null, behavior: RetargetBehavior): Element | null; export { isFormControl } from './utils.js'; //# sourceMappingURL=retarget.d.ts.map