WickyNilliams / cally

Small, feature-rich calendar components
https://wicky.nillia.ms/cally/
MIT License
1.06k stars 12 forks source link

Consider Form Participation? #36

Closed cfjedimaster closed 2 months ago

cfjedimaster commented 2 months ago

I know you want to keep this component as lightweight as possible, but it would be nice if it could use the form participation feature of web components. I could then simply place it in a form block, ensure I give it a name, and it would submit it's value when the form is submitted.

WickyNilliams commented 2 months ago

I considered this during development, but decided against it.

It can be trivially wrapped in a component that adds form association if you want that. For many people these components will form part of a date picker or some larger component. And usually it's not the calendar you want to submit with the form, but the associated input.

So I'd rather leave the specifics to consumers, who can choose what best suits their needs

cfjedimaster commented 2 months ago

Ehhh... I'd argue that form participation isn't trivial - but maybe that was just my experience with it. (I found most of the web component space easy to grok... except for that.) I'm not sure I'd want to add another component to wrap this component though. Anyway, maybe reconsider in the future? :>

WickyNilliams commented 2 months ago

Maybe in the future, sure.

I agree form association is complex. Its not complexity I want to take on. You might want to look at the Open WC form participation mixins for an off the shelf integration https://github.com/open-wc/form-participation

Personally I like the formdata event which is simple to understand, has better browser support, and fits 90% or more of use cases in my experience (I built a whole design system around formdata usage and it worked great).

cfjedimaster commented 2 months ago

Cool beans - thanks for the great component - I'm featuring it on my next blog post (that plus 2.99 will get you a cup of coffee.)

WickyNilliams commented 2 months ago

Awesome! Please post a link when it's up. Look forward to reading :)

cfjedimaster commented 2 months ago

https://www.raymondcamden.com/2024/04/28/links-for-you

WickyNilliams commented 2 months ago

I think you can call a web component cute haha. Thanks for the shout out!