export const enzymeQuerySelectorWrapper = (wrapper, querySelectorStr, element = undefined) => {
    const el = element !== null && element !== void 0 ? element : document.createElement("div");
    el.innerHTML = wrapper.html();
    return el.querySelector(querySelectorStr);
};
/**
 * Makes onClick functions accessible by duplicating them in an onKeyDown prop. If you also
 * have an onKeyDown function you'd like to provide, you can add it as an optional second argument.
 *
 * Why does it make it more accessible? The `onClick` prop usually only fires if someone
 * clicks an element with a mouse. If a user can't use a mouse due to a disability, they
 * are unable to activate the element. Normally, you'd have to wire up the element to receive
 * tab focus (using `tabIndex={0}`), as well as duplicating the onClick function for Enter
 * and Spacebar key presses. This function does that for you.
 *
 * Note that this is not necessary for buttons or anchor tags.
 *
 * Note that this returns `tabIndex={0}`. If you want to set a custom tabIndex value, apply it
 * after invoking this function. See example.
 *
 * Examples:
 * ```jsx
 * <div role="button" {...onClickA11y(callback)}>Click me!</div>
 *
 * <span className="icon" role="button", {...onClickA11y(() => {
 * 		// do something
 * })}></span>
 *
 * <div role="tab" {...onClickA11y(
 * 		() => setState(true),
 * 		(e) => {
 *	 		if(e.key === "ArrowRight"){
                moveRight();
 * 			}
 *  	}
 *  )}
 *
 *  // If you want to set a custom tabIndex value, set it *after* spreading the onClickA11y values.
 *  // This will let you overwrite the tabIndex value.
 *  tabIndex={focused ? 0 : 1}
 * >Label</div>
 * ```
 *
 * @param onClickFn The function that normally goes in the `onClick={}` prop
 * @param onKeyDown The function that normally goes in the `onKeyDown={}` prop
 * @returns
 */
export const onClickA11y = (onClickFn, onKeyDown) => {
    return {
        tabIndex: 0,
        onClick: onClickFn,
        onKeyDown: (e) => {
            if (e.key === "Enter" || e.key === " ") {
                onClickFn(e);
            }
            onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
        },
    };
};
//# sourceMappingURL=utils.js.map