petalframework / petal_components

Phoenix + Live View HEEX Components
https://petal.build/components
MIT License
768 stars 84 forks source link

Switch component attr :rest does not include ~w(checked_value unchecked_value checked hidden_input) #235

Closed periclesd closed 11 months ago

periclesd commented 11 months ago

We're seeing the following error when compiling our app with --warnings-as-errors:

Compiling 103 files (.ex)
warning: undefined attribute "checked_value" for component PetalComponents.Form.switch/1
  lib/colife_web/live/profile_live/show.ex:153: (file)

warning: undefined attribute "unchecked_value" for component PetalComponents.Form.switch/1
  lib/colife_web/live/profile_live/show.ex:153: (file)

Compilation failed due to warnings while using the --warnings-as-errors option

I've tracked it down to attr :rest in the switch component https://github.com/petalframework/petal_components/blob/main/lib/petal_components/form.ex#L598 not accepting the same values as the checkbox component https://github.com/petalframework/petal_components/blob/main/lib/petal_components/form.ex#L527-L529, when both call https://hexdocs.pm/phoenix_html/Phoenix.HTML.Form.html#checkbox/3-options.

Cheers.

nhobes commented 11 months ago

@periclesd apologies for not getting back to you sooner, this was fixed in 1.4.1.

periclesd commented 11 months ago

Awesome, thanks for fixing it! 🙌