@@ -26,6 +26,23 @@ import type { AriaRadioProps } from 'react-aria';
2626export { AriaRadioProps } ;
2727export { useRadio } ;
2828
29+ const RadioButtonElement = tasty ( ItemBase , {
30+ qa : 'Radio' ,
31+ as : 'label' ,
32+ styles : {
33+ preset : 't3m' ,
34+ lineHeight : '1fs' ,
35+ } ,
36+ } ) ;
37+
38+ const RadioButtonSelectedElement = tasty ( RadioButtonElement , {
39+ qa : 'RadioSelected' ,
40+ styles : {
41+ fill : '#white' ,
42+ shadow : '0 0 .5x #shadow' ,
43+ } ,
44+ } ) ;
45+
2946const RadioWrapperElement = tasty ( {
3047 as : 'label' ,
3148 qa : 'RadioWrapper' ,
@@ -258,10 +275,14 @@ function Radio(props: CubeRadioProps, ref) {
258275
259276 // Render button type using ItemBase
260277 if ( isButton ) {
278+ const ButtonElement =
279+ isRadioSelected && contextType === 'tabs'
280+ ? RadioButtonSelectedElement
281+ : RadioButtonElement ;
282+
261283 return (
262- < ItemBase
284+ < ButtonElement
263285 ref = { domRef }
264- as = "label"
265286 qa = { qa || 'Radio' }
266287 type = { effectiveButtonType }
267288 theme = { isInvalid ? 'danger' : 'default' }
@@ -274,15 +295,7 @@ function Radio(props: CubeRadioProps, ref) {
274295 isSelected = { isRadioSelected }
275296 isDisabled = { isRadioDisabled }
276297 mods = { mods }
277- preset = "t3m"
278- styles = { {
279- preset : 't3m' ,
280- lineHeight : '1fs' ,
281- ...( isRadioSelected && effectiveType === 'tabs'
282- ? { fill : '#white' , shadow : '0 0 .5x #shadow' }
283- : { } ) ,
284- ...styles ,
285- } }
298+ styles = { styles }
286299 { ...mergeProps ( hoverProps , focusProps ) }
287300 >
288301 < HiddenInput
@@ -293,7 +306,7 @@ function Radio(props: CubeRadioProps, ref) {
293306 mods = { { button : isButton , disabled : isRadioDisabled } }
294307 />
295308 { label }
296- </ ItemBase >
309+ </ ButtonElement >
297310 ) ;
298311 }
299312
0 commit comments