|
|
|
@ -8,29 +8,33 @@ const FormFields = ({ |
|
|
|
|
defaultValue, |
|
|
|
|
set, |
|
|
|
|
label, |
|
|
|
|
className, |
|
|
|
|
borderClassname, |
|
|
|
|
type, |
|
|
|
|
maxLength, |
|
|
|
|
max, |
|
|
|
|
min, |
|
|
|
|
register, |
|
|
|
|
onClick, |
|
|
|
|
}) => { |
|
|
|
|
const [value, setValue] = useState(defaultValue); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div |
|
|
|
|
onClick={onClick} |
|
|
|
|
className={ |
|
|
|
|
"h-full rounded border border-color7 mx-1 relative flex items-center flex-row-reverse bg-color2_5" + |
|
|
|
|
className + |
|
|
|
|
(value ? " border-blue-500 bg-white border rounded" : " bg-transparent") |
|
|
|
|
"h-full flex flex-row items-center rounded border mx-1 relative " + |
|
|
|
|
borderClassname + |
|
|
|
|
(value |
|
|
|
|
? " border-[#2483E1] bg-white border rounded" |
|
|
|
|
: " bg-transparent") |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<div |
|
|
|
|
className={ |
|
|
|
|
" text-sm absolute transition-all duration-300 pointer-events-none px-3 PY-2 text-left transform translate-x-[-10px] " + |
|
|
|
|
" text-xs absolute transition-all duration-300 pointer-events-none px-3 transform -translate-x-[7px] " + |
|
|
|
|
(value |
|
|
|
|
? `text-blue-500 bg-white top-[-10px]` |
|
|
|
|
: "text-color19 top-[20px]") |
|
|
|
|
? `text-[#2483E1] bg-white top-[-10px]` |
|
|
|
|
: "text-[#0F0543] top-[10px]") |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
{label} |
|
|
|
@ -41,7 +45,9 @@ const FormFields = ({ |
|
|
|
|
maxLength={maxLength} |
|
|
|
|
value={value} |
|
|
|
|
type={"text"} |
|
|
|
|
className={"rtl w-full h-full px-4 outline-0 "} |
|
|
|
|
className={`rtl w-full h-full px-4 py-2 bg-[#F9F9F9] text-[#F9F9F9] outline-0 text-xs rounded focus:border-[#2483E1 focus:ring-[#2483E1
|
|
|
|
|
${value === "" ? "bg-[#F9F9F9]" : "bg-red-600"} |
|
|
|
|
`}
|
|
|
|
|
onChange={(e) => setValue(e.target.value)} |
|
|
|
|
inputMode={type === "number" ? "numeric" : ""} |
|
|
|
|
onInput={(e) => { |
|
|
|
@ -69,3 +75,7 @@ const FormFields = ({ |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export default FormFields; |
|
|
|
|
|
|
|
|
|
FormFields.defaultProps = { |
|
|
|
|
borderClassname: "border-[#2483E1] bg-indigo-600", |
|
|
|
|
}; |
|
|
|
|