As an experiment, I have built a standard wrapper of the Flatpickr library.
One of my first goals was to publish a package on NPM (first time… so far from perfect) and also to package in a Stimulus way a standard library.
Overall this wrapper doesn’t bring a lot of magic but makes all Flatpickr options available as HTML tags and hooks available in the Controller. Therefore you can directly enable and configure a DateTime picker in your
erb/html view with the
data-attributes and extend a standard
stimulus-flatpickr controller to add some business logic.
This was inspired by several initiatives:
- this question about standard Stimulus Controllers: Interest in a StimulusJS controller aggregation site?
- this package for standard Tabs using stimulus : https://github.com/jwald1/stimulus-tabs
Comments, issues, PR Welcome of course