[web] Modify findTooltipPosition to support new tooltip positioning logic
Summary:
Refactor findTooltipPosition by removing size calculation from this function and adding new TOP and BOTTOM positions. Also made the return value optional, as we want to handle the case where it is impossible to display the tooltip anywhere.
Now, the naming convention for position is the following:
- the first word indicates on which border of the source object we want to display the tooltip.
- the second word indicates the direction we want to align the tooltip
So LEFT_BOTTOM means we display the tooltip on the left of the source, and it is aligned to the bottom of the source - for examples see: https://linear.app/comm/issue/ENG-1575#comment-ef9727c3
Test Plan: Flow; Jest tests; Tested with the rest of diffs stack.
Reviewers: tomek, atul, abosh
Reviewed By: tomek
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D4913