From 75f8a526de483995ccf5fe3df695594c69c0bdf8 Mon Sep 17 00:00:00 2001 From: "Orace.A" Date: Fri, 28 Mar 2025 19:07:21 +0100 Subject: [PATCH] feat: enhance FloatingLabelInput to manage selected value for select type --- src/components/floatingLabelInput.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/floatingLabelInput.tsx b/src/components/floatingLabelInput.tsx index ccda850..9aec32b 100644 --- a/src/components/floatingLabelInput.tsx +++ b/src/components/floatingLabelInput.tsx @@ -17,9 +17,15 @@ export default function FloatingLabelInput({ onChange, }: FloatingLabelInputProps) { const [showPassword, setShowPassword] = useState(false); + const [selectedValue, setSelectedValue] = useState(defaultValue || ''); const handleChange = (e: React.ChangeEvent) => { const value = e.target.value; + + if (type === 'select') { + setSelectedValue(value); + } + if (onChange) { onChange(value); } @@ -34,7 +40,8 @@ export default function FloatingLabelInput({