File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import React from "react" ;
1+ import React , { forwardRef } from "react" ;
22
33import classnames from "classnames" ;
44import PropTypes from "prop-types" ;
@@ -7,37 +7,42 @@ import Label from "components/Label";
77import { useId } from "hooks" ;
88import { hyphenize } from "utils" ;
99
10- const Item = ( {
11- name = "" ,
12- label = "" ,
13- className = "" ,
14- labelProps,
15- dataCy = "" ,
16- ...otherProps
17- } ) => {
18- const id = useId ( otherProps . id ) ;
10+ const Item = forwardRef (
11+ (
12+ {
13+ name = "" ,
14+ label = "" ,
15+ className = "" ,
16+ labelProps,
17+ dataCy = "" ,
18+ ...otherProps
19+ } ,
20+ ref
21+ ) => {
22+ const id = useId ( otherProps . id ) ;
1923
20- return (
21- < div className = { classnames ( [ "neeto-ui-radio__item" , className ] ) } >
22- < input
23- { ...{ id, name } }
24- className = "neeto-ui-radio"
25- data-cy = { dataCy || `${ hyphenize ( label ) } -radio-input` }
26- type = "radio"
27- { ...otherProps }
28- />
29- { label && (
30- < Label
31- data-cy = { dataCy || `${ hyphenize ( label ) } -radio-label` }
32- htmlFor = { id }
33- { ...labelProps }
34- >
35- { label }
36- </ Label >
37- ) }
38- </ div >
39- ) ;
40- } ;
24+ return (
25+ < div className = { classnames ( [ "neeto-ui-radio__item" , className ] ) } >
26+ < input
27+ { ...{ id, name, ref } }
28+ className = "neeto-ui-radio"
29+ data-cy = { dataCy || `${ hyphenize ( label ) } -radio-input` }
30+ type = "radio"
31+ { ...otherProps }
32+ />
33+ { label && (
34+ < Label
35+ data-cy = { dataCy || `${ hyphenize ( label ) } -radio-label` }
36+ htmlFor = { id }
37+ { ...labelProps }
38+ >
39+ { label }
40+ </ Label >
41+ ) }
42+ </ div >
43+ ) ;
44+ }
45+ ) ;
4146
4247Item . displayName = "Radio.Item" ;
4348
You can’t perform that action at this time.
0 commit comments