Overlay on a component

I’m looking to create a specialized date/time component. When the user clicks on the component, it should open an overlay on top of the component. The user can then make selections and the overlay closes.

I wasn’t able to get the vaadin-overlay to work, or rather, I couldn’t get it positioned where I wanted.

I tried making a simple overlay using an absolute positioned Div. That actually seems to work very well, but not entirely sure how to correctly determine if the user clicks outside the overlay.

Has anybody else tried to do this?