@@ -107,23 +107,21 @@ export const CFormCheck = forwardRef<HTMLInputElement, CFormCheckProps>(
107107 }
108108 } , [ indeterminate ] )
109109
110- const formControl = ( ) => {
111- return (
112- < input
113- type = { type }
114- className = { classNames ( button ? 'btn-check' : 'form-check-input' , {
115- 'is-invalid' : invalid ,
116- 'is-valid' : valid ,
117- 'me-2' : hitArea ,
118- } ) }
119- id = { id }
120- { ...rest }
121- ref = { forkedRef }
122- />
123- )
124- }
110+ const FormControl = ( ) => (
111+ < input
112+ type = { type }
113+ className = { classNames ( button ? 'btn-check' : 'form-check-input' , {
114+ 'is-invalid' : invalid ,
115+ 'is-valid' : valid ,
116+ 'me-2' : hitArea ,
117+ } ) }
118+ id = { id }
119+ { ...rest }
120+ ref = { forkedRef }
121+ />
122+ )
125123
126- const formValidation = ( ) => (
124+ const FormValidation = ( ) => (
127125 < CFormControlValidation
128126 describedby = { rest [ 'aria-describedby' ] }
129127 feedback = { feedback }
@@ -136,42 +134,40 @@ export const CFormCheck = forwardRef<HTMLInputElement, CFormCheckProps>(
136134 />
137135 )
138136
139- const formLabel = ( ) => {
140- return (
141- < CFormLabel
142- customClassName = { classNames (
143- button
144- ? classNames (
145- 'btn' ,
146- button . variant ? `btn-${ button . variant } -${ button . color } ` : `btn-${ button . color } ` ,
147- {
148- [ `btn-${ button . size } ` ] : button . size ,
149- } ,
150- `${ button . shape } ` ,
151- )
152- : 'form-check-label' ,
153- ) }
154- { ...( id && { htmlFor : id } ) }
155- >
156- { label }
157- </ CFormLabel >
158- )
159- }
137+ const FormLabel = ( ) => (
138+ < CFormLabel
139+ customClassName = { classNames (
140+ button
141+ ? classNames (
142+ 'btn' ,
143+ button . variant ? `btn-${ button . variant } -${ button . color } ` : `btn-${ button . color } ` ,
144+ {
145+ [ `btn-${ button . size } ` ] : button . size ,
146+ } ,
147+ `${ button . shape } ` ,
148+ )
149+ : 'form-check-label' ,
150+ ) }
151+ { ...( id && { htmlFor : id } ) }
152+ >
153+ { label }
154+ </ CFormLabel >
155+ )
160156
161157 return button ? (
162158 < >
163- { formControl ( ) }
164- { label && formLabel ( ) }
165- { formValidation ( ) }
159+ < FormControl />
160+ { label && < FormLabel /> }
161+ < FormValidation />
166162 </ >
167163 ) : label ? (
168164 hitArea ? (
169165 < >
170166 < CFormLabel customClassName = { className } { ...( id && { htmlFor : id } ) } >
171- { formControl ( ) }
167+ < FormControl />
172168 { label }
173169 </ CFormLabel >
174- { formValidation ( ) }
170+ < FormValidation />
175171 </ >
176172 ) : (
177173 < div
@@ -185,13 +181,13 @@ export const CFormCheck = forwardRef<HTMLInputElement, CFormCheckProps>(
185181 className ,
186182 ) }
187183 >
188- { formControl ( ) }
189- { formLabel ( ) }
190- { formValidation ( ) }
184+ < FormControl />
185+ < FormLabel />
186+ < FormValidation />
191187 </ div >
192188 )
193189 ) : (
194- formControl ( )
190+ < FormControl />
195191 )
196192 } ,
197193)
0 commit comments