Updated useClickAway Hook:
• The useClickAway hook was enhanced to accept either a single RefObject<HTMLElement | null> or an array of RefObject<HTMLElement | null>[].
• The hook now checks if the clicked element is outside of all the provided refs before triggering the onClickAway callback. This makes the hook more flexible and capable of handling multiple elements.
Consolidated Storybook Example:
• The Storybook demo was updated to demonstrate both the single ref and multiple refs usage within the same example.
• The example includes:
• A red box with a single ref that triggers the onClickAway callback when a click is detected outside of it.
• A green and a blue box, each with its own ref, that together trigger a different onClickAway callback when a click is detected outside of either box.
• This setup effectively showcases the new functionality of the useClickAway hook in a single, concise demonstration.
Description
Example in SandBox
Go to sandbox
Type of change
Checklist
yarn test
)yarn lint
). Fix it withyarn lint:fix
in case of failure.yarn lint:types
).