1- import { forwardRef , Fragment , InputHTMLAttributes , ReactNode } from 'react'
1+ import { forwardRef , InputHTMLAttributes , ReactNode } from 'react'
22
33import { Caption , ControlGroup , Icon , IconProps , Label , Message , MessageTheme } from '@/components'
44import { cn } from '@utils/cn'
@@ -9,12 +9,12 @@ export interface BaseInputProps
99 VariantProps < typeof inputVariants > { }
1010
1111const inputVariants = cva (
12- 'bg-input-background px-3 py-1 text-foreground-1 disabled:cursor-not-allowed disabled: bg-background-3 disabled:text-foreground-7' ,
12+ 'bg-input-background text-foreground-1 disabled:bg-background-3 disabled:text-foreground-7 px-3 py-1 disabled:cursor-not-allowed ' ,
1313 {
1414 variants : {
1515 variant : {
1616 default :
17- 'flex w-full rounded border text-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-foreground-4 focus-visible:rounded focus-visible:outline-none' ,
17+ 'placeholder:text-foreground-4 flex w-full rounded border text-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:rounded focus-visible:outline-none' ,
1818 extended : 'grow border-none focus-visible:outline-none'
1919 } ,
2020 size : {
@@ -114,10 +114,6 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
114114 } ,
115115 ref
116116 ) => {
117- const isControlGroup = ! ! error || ! ! caption || ! ! label || ! ! wrapperClassName
118- const InputWrapper = isControlGroup ? ControlGroup : Fragment
119- const inputWrapperProps = isControlGroup ? { className : wrapperClassName } : { }
120-
121117 const InputComponent = customContent ? BaseInputWithWrapper : BaseInput
122118
123119 const baseInputComp = (
@@ -154,7 +150,7 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
154150
155151 return inputIconName ? (
156152 < span className = "relative" >
157- < Icon className = "absolute left-3 top-1/2 -translate-y-1/2 text-icons-9 " name = { inputIconName } size = { 14 } />
153+ < Icon className = "text-icons-9 absolute left-3 top-1/2 -translate-y-1/2" name = { inputIconName } size = { 14 } />
158154 { baseInputComp }
159155 </ span >
160156 ) : (
@@ -163,7 +159,7 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
163159 }
164160
165161 return (
166- < InputWrapper { ... inputWrapperProps } >
162+ < ControlGroup className = { wrapperClassName } >
167163 { ! ! label && (
168164 < Label className = "mb-2.5" color = { disabled ? 'disabled-dark' : 'secondary' } optional = { optional } htmlFor = { id } >
169165 { label }
@@ -179,7 +175,7 @@ const Input = forwardRef<HTMLInputElement, InputProps>(
179175 ) }
180176
181177 { caption && < Caption className = { cn ( { 'text-foreground-9' : disabled } ) } > { caption } </ Caption > }
182- </ InputWrapper >
178+ </ ControlGroup >
183179 )
184180 }
185181)
0 commit comments