|
|
@ -8,29 +8,33 @@ const FormFields = ({ |
|
|
|
defaultValue, |
|
|
|
defaultValue, |
|
|
|
set, |
|
|
|
set, |
|
|
|
label, |
|
|
|
label, |
|
|
|
className, |
|
|
|
borderClassname, |
|
|
|
type, |
|
|
|
type, |
|
|
|
maxLength, |
|
|
|
maxLength, |
|
|
|
max, |
|
|
|
max, |
|
|
|
min, |
|
|
|
min, |
|
|
|
register, |
|
|
|
register, |
|
|
|
|
|
|
|
onClick, |
|
|
|
}) => { |
|
|
|
}) => { |
|
|
|
const [value, setValue] = useState(defaultValue); |
|
|
|
const [value, setValue] = useState(defaultValue); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div |
|
|
|
<div |
|
|
|
|
|
|
|
onClick={onClick} |
|
|
|
className={ |
|
|
|
className={ |
|
|
|
"h-full rounded border border-color7 mx-1 relative flex items-center flex-row-reverse bg-color2_5" + |
|
|
|
"h-full flex flex-row items-center rounded border mx-1 relative " + |
|
|
|
className + |
|
|
|
borderClassname + |
|
|
|
(value ? " border-blue-500 bg-white border rounded" : " bg-transparent") |
|
|
|
(value |
|
|
|
|
|
|
|
? " border-[#2483E1] bg-white border rounded" |
|
|
|
|
|
|
|
: " bg-transparent") |
|
|
|
} |
|
|
|
} |
|
|
|
> |
|
|
|
> |
|
|
|
<div |
|
|
|
<div |
|
|
|
className={ |
|
|
|
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 |
|
|
|
(value |
|
|
|
? `text-blue-500 bg-white top-[-10px]` |
|
|
|
? `text-[#2483E1] bg-white top-[-10px]` |
|
|
|
: "text-color19 top-[20px]") |
|
|
|
: "text-[#0F0543] top-[10px]") |
|
|
|
} |
|
|
|
} |
|
|
|
> |
|
|
|
> |
|
|
|
{label} |
|
|
|
{label} |
|
|
@ -41,7 +45,9 @@ const FormFields = ({ |
|
|
|
maxLength={maxLength} |
|
|
|
maxLength={maxLength} |
|
|
|
value={value} |
|
|
|
value={value} |
|
|
|
type={"text"} |
|
|
|
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)} |
|
|
|
onChange={(e) => setValue(e.target.value)} |
|
|
|
inputMode={type === "number" ? "numeric" : ""} |
|
|
|
inputMode={type === "number" ? "numeric" : ""} |
|
|
|
onInput={(e) => { |
|
|
|
onInput={(e) => { |
|
|
@ -69,3 +75,7 @@ const FormFields = ({ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export default FormFields; |
|
|
|
export default FormFields; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FormFields.defaultProps = { |
|
|
|
|
|
|
|
borderClassname: "border-[#2483E1] bg-indigo-600", |
|
|
|
|
|
|
|
}; |
|
|
|