artsy / palette

Artsy's design system
https://palette-storybook.artsy.net/
MIT License
215 stars 45 forks source link

feat(radio): supports generic type #1390

Closed dzucconi closed 5 months ago

dzucconi commented 5 months ago

Closes DIA-729

Re: https://artsy.slack.com/archives/C2TQ4PT8R/p1718623491874389

dzucconi commented 5 months ago

Just a note though: this can't infer the type from the child radios when you're using RadioGroup — it'll infer based on the defaultValue. If you want to specify a mixed type then you'll have to provide it like: <RadioGroup<string | boolean> ...

artsyit commented 5 months ago

:rocket: PR was released in @artsy/palette-charts@37.13.0, @artsy/palette@38.13.0 :rocket:

dariakoko commented 5 months ago

@dzucconi thanks for the fix. I have an issue setting the default value to false. Do you have any idea why it can be? The selected prop value always stays false when the initial value is false

image

Here on the screenshot the initial value if false, but the "No" option is not selected. If it's true, then "Yes" is selected, so the issue is only with the false

dzucconi commented 5 months ago

Ah, here you go https://github.com/artsy/palette/pull/1391