mskocik / svelty-picker

Simple date & time picker in svelte
https://mskocik.github.io/svelty-picker/
202 stars 46 forks source link

calendar wrapper #148

Closed Vichondrias1 closed 1 year ago

Vichondrias1 commented 1 year ago

How to fix this when I try to add svelte picker on a container in tailwind the calendar doesnt go outside the container.

image image

I was expecting the calendar to be like this. image

mskocik commented 1 year ago

Before 5.2.0 it's not possible to fix.

In 5.2.0 I added new property positionResolver where you can pass your own floating position resolving function. Svelty-picker uses floating-ui itself, so you can use it for your own resolver. It already provides detectOverflow function, which will be required to handle your use case properly.

Vichondrias1 commented 1 year ago

Before 5.2.0 it's not possible to fix.

In 5.2.0 I added new property positionResolver where you can pass your own floating position resolving function. Svelty-picker uses floating-ui itself, so you can use it for your own resolver. It already provides detectOverflow function, which will be required to handle your use case properly.

can u give example how to use that new property you added?

mskocik commented 1 year ago

can u give example how to use that new property you added?

Just like any other prop:

<script>
function myPositionResolver(node) {
  // your code
}
</script>

<SveltyPicker positionResolver={myPositionResolver} />

If you have no idea how the resolver should/could look like, check the built-in position resolver:

https://github.com/mskocik/svelty-picker/blob/8b1061b7fc31e8da9c56e0ab65e441d1b73ab2a1/src/lib/utils/actions.js#L1-L33

And build your own on top of it with detectOverflow helper function etc.

Vichondrias1 commented 1 year ago
<SveltyPicker positionResolver={myPositionResolver} />

is it neccessary to add positionResolver function to fix my problem or the build in function you added should fix problem it and i dont do anything?

mskocik commented 1 year ago

is it neccessary to add positionResolver function to fix my problem or the build in function you added should fix problem it and i dont do anything?

Yes, it is neccessary to add positionResolver for your use case

mskocik commented 1 year ago

@Vichondrias1 were you successful with implementing your own resolver?

Vichondrias1 commented 1 year ago

image i havent figure it out how to use it can you please help me how solve this? dont quite understand sa how to fix this

image

mskocik commented 1 year ago

I gave you all information you need.

My time is precious so I can't help you for free. I believe you understand.

Anyway I am closing this one as root issue - ability to customize position resolver is fixed now.