@@ -2,10 +2,10 @@ import React from "react";
22import { CircleIcon } from "lucide-react" ;
33import { RadioGroup as BaseRadioGroup } from "radix-ui" ;
44import { css as _css , cx } from "@brifui/styled/css" ;
5+ import { radioGroup , RadioGroupVariantProps } from "@brifui/styled/recipes" ;
56import { findChildrenByType , WithCssProps } from "@brifui/utils" ;
67
78import { RadioGroupProvider , useRadioGroup } from "./context" ;
8- import { RadioVariantProps , radioVariants } from "./variants" ;
99
1010export type RadioLabelProps = WithCssProps <
1111 React . ComponentPropsWithRef < "label" >
@@ -17,10 +17,10 @@ const Label: React.FC<RadioLabelProps> = ({
1717 ...props
1818} ) => {
1919 const { size, error } = useRadioGroup ( ) ;
20- const raw = radioVariants . raw ( { size, error } ) ;
20+ const classes = radioGroup ( { size, error } ) ;
2121
2222 return (
23- < label className = { cx ( _css ( raw . label , css ) , className ) } { ...props } >
23+ < label className = { cx ( classes . label , _css ( css ) , className ) } { ...props } >
2424 { children }
2525 </ label >
2626 ) ;
@@ -35,12 +35,12 @@ const Indicator: React.FC<RadioIndicatorProps> = ({
3535 ...props
3636} ) => {
3737 const { size, error } = useRadioGroup ( ) ;
38- const raw = radioVariants . raw ( { size, error } ) ;
38+ const classes = radioGroup ( { size, error } ) ;
3939
4040 return (
4141 < BaseRadioGroup . Indicator
42- aria-invalid = { error }
43- className = { cx ( _css ( raw . indicator , css ) , className ) }
42+ aria-invalid = { ! ! error }
43+ className = { cx ( classes . indicator , _css ( css ) , className ) }
4444 { ...props }
4545 >
4646 < CircleIcon />
@@ -57,14 +57,14 @@ const Item: React.FC<RadioItemProps> = ({
5757 ...props
5858} ) => {
5959 const { size, error } = useRadioGroup ( ) ;
60- const raw = radioVariants . raw ( { size, error } ) ;
60+ const classes = radioGroup ( { size, error } ) ;
6161 const [ indicators , labels ] = findChildrenByType ( children , Indicator , Label ) ;
6262
6363 return (
64- < div className = { cx ( _css ( raw . itemContainer , css ) , className ) } >
64+ < div className = { cx ( classes . itemContainer , _css ( css ) , className ) } >
6565 < BaseRadioGroup . Item
66- aria-invalid = { error }
67- className = { cx ( _css ( raw . item , css ) ) }
66+ aria-invalid = { ! ! error }
67+ className = { classes . item }
6868 { ...props }
6969 >
7070 { indicators }
@@ -75,7 +75,7 @@ const Item: React.FC<RadioItemProps> = ({
7575} ;
7676
7777export type RadioProps = WithCssProps <
78- RadioVariantProps & BaseRadioGroup . RadioGroupProps
78+ RadioGroupVariantProps & BaseRadioGroup . RadioGroupProps
7979> ;
8080const Root : React . FC < RadioProps > = ( {
8181 css,
@@ -85,13 +85,13 @@ const Root: React.FC<RadioProps> = ({
8585 error,
8686 ...props
8787} ) => {
88- const raw = radioVariants . raw ( { error, size } ) ;
88+ const classes = radioGroup ( { error, size } ) ;
8989 const [ items ] = findChildrenByType ( children , Item ) ;
9090
9191 return (
9292 < RadioGroupProvider size = { size } error = { error } >
9393 < BaseRadioGroup . Root
94- className = { cx ( _css ( raw . root , css ) , className ) }
94+ className = { cx ( classes . root , _css ( css ) , className ) }
9595 { ...props }
9696 >
9797 { items }
0 commit comments