elm-datepicker
elm-datepicker copied to clipboard
Expose more internal data?
I am trying to implement a form with Floating Labels and I need a way to detect when the label need to move from inside the input field to above it.
Usually I use this logic
classList [ ("upperPosition", hasFocus || content /= "" ) ]
So the class "upperPosition" is added to a div if the input fields has focus or has some content (= value) in it.
elm-datepicker doesn't expose any of these values.
I tried with
classList [ ( "upperPosition", not (model.date == Nothing) || DatePicker.isOpen model.datePicker ) ]
but it doesn't cover all cases.
So I was wondering if would be possible to expose more data, for example the focus and the value of the input field.
Find an example here: https://lucamug.github.io/elm-form-examples/Example_19.html And the code here: https://github.com/lucamug/elm-form-examples/blob/master/src/Example_19.elm
Thank you
Sure thing. The datepicker code takes the position (not mine, inherited from the old days) that all model data ought to be encapsulated (presumably to avoid causing too many version bumps if internal details change), but often provides getters/setters for model fields as a public API. I'd be happy to accept a PR that adds getters for new fields.