How to drag panel down so it hides

Below is the concept I’m trying to implement:

I’ve almost done with it, but one thing is missing, I want to drag panel (which appears from the bottom) via handle and collapse it down.
Also I want it to collapse if I dragged it down enough like more than 50% it’s height and release my finger.
I’ve created repo where I can toggle bottom panel, but what should I use to be able to hide it using Drag?

What a coincidence that we’ve had a similar challenge very recently. See the code in this post for a potential solution.

Thank you Uldis, will explore these examples !