-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(radio-group): migrate to signals #500
Conversation
This refactoring to signals looks really clean! I will close #344 for now. Perhaps with the new structure it will be easier to implement the changes to support card layouts (#246) and hlm components e.g. <hlm-radio-group>
<hlm-radio value="16.1.4">
<hlm-radio-indicator indicator />
v16.1.4
</hlm-radio>
</hlm-radio-group> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple minor comments. I think this looks great!
bd7b3d3
to
39847eb
Compare
Thanks, feedback addressed. If this is something we want to make consistent, we could add an eslint rule to enforce explicit method return types. |
I am a fan of being as explicit as possible so I am down, but as always happy to hear everyone's thoughts! |
I tend to agree, particularly in a library, it can help prevent unexpected breaking changes due to method signatures changing, but yes, we can get consensus one way or the other and then make it consistent. |
PR Checklist
Please check if your PR fulfills the following requirements:
guidelines: https://github.com/goetzrobin/spartan/blob/main/CONTRIBUTING.md#-commit-message-guidelines
PR Type
What kind of change does this PR introduce?
Which package are you modifying?
What is the current behavior?
Closes #442
What is the new behavior?
Does this PR introduce a breaking change?
Other information
I have migrated these directives to use signals, and have been able to significantly reduce the amount of code required. One change I did make - I can revert if we feel its important to retain - but essentially there was the assumption that a radio button may be used without a group. Personally I don't ever think I have seen an instance where a single radio button is used, as typically that would be what a checkbox is for. Accommodating the potential case for a standalone radio button results in potentially multiple sources of truth, for example, a radio button has a checked state and the group has a value representing which item should be checked. We can always make the group take preference, however this does add a lot of additional code and complexity for a case I don't believe is likely to occur. I'd be interested to hear if anyone has any strong feelings in retaining that functionality, and if so I can restore it.