Closed megagames-me closed 1 week ago
Hi, can I submit a PR for this?
Hey @megagames-me,
The datepicker is now a core component of Flowbite so it can be initialized just like any other component:
https://flowbite.com/docs/components/datepicker/index.html#javascript-behaviour
Please check it out and see if this will make your example work.
Cheers, Zoltan
Looks great, thanks!
Is your feature request related to a problem? Please describe. When integrating the datepicker with flowbite-svelte (and I assume must happen with other wrapper libraries too), because the loader uses the
DOMContentLoaded
event which doesn't get fired when clicking on normal links in SvelteKit, so rel="external" must be added to the link soDOMContentLoaded
can be fired and the datepicker script can execute.Describe the solution you'd like This would be rather easy to fix. We can keep an event listener for
DOMContentLoaded
, but fire our own synthetic event that is documented whenDOMContentLoaded
is detected. If we do this, the user can fire the synthetic event when the page is loaded. This would not be a breaking change because it would still listen forDOMContentLoaded
.Describe alternatives you've considered The script could also set a function in the window that can be called to initialize the library/search for
input[datepicker]
s when the user calls it.Additional context If this gets approved, I can fix it for you guys.