@thecb/components 10.7.6-beta.0 → 10.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +15 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +15 -0
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/form-layouts/FormInput.js +11 -0
- package/src/components/molecules/payment-form-card/PaymentFormCard.js +1 -0
- package/src/components/atoms/.DS_Store +0 -0
- package/src/components/atoms/icons/.DS_Store +0 -0
package/package.json
CHANGED
|
@@ -120,6 +120,7 @@ const FormInput = ({
|
|
|
120
120
|
...props
|
|
121
121
|
}) => {
|
|
122
122
|
const [showPassword, setShowPassword] = useState(false);
|
|
123
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
123
124
|
const { isMobile } = useContext(ThemeContext);
|
|
124
125
|
|
|
125
126
|
const setValue = value => {
|
|
@@ -134,6 +135,7 @@ const FormInput = ({
|
|
|
134
135
|
if (isRequired && value === "") {
|
|
135
136
|
setValue("");
|
|
136
137
|
}
|
|
138
|
+
setIsFocused(false);
|
|
137
139
|
};
|
|
138
140
|
|
|
139
141
|
return (
|
|
@@ -226,6 +228,15 @@ const FormInput = ({
|
|
|
226
228
|
data-qa={dataQa || labelTextWhenNoError}
|
|
227
229
|
autoComplete={autocompleteValue}
|
|
228
230
|
required={isRequired}
|
|
231
|
+
// Additional handler to detect autofilled values
|
|
232
|
+
{...(autocompleteValue && {
|
|
233
|
+
onFocus: e => {
|
|
234
|
+
if (!isFocused) {
|
|
235
|
+
setValue(e.target?.value);
|
|
236
|
+
setIsFocused(true);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
})}
|
|
229
240
|
{...props}
|
|
230
241
|
/>
|
|
231
242
|
) : (
|
|
Binary file
|
|
Binary file
|