@@ -21,20 +21,16 @@ import PropTypes from "prop-types";
21
21
import React , { useEffect , useState } from "react" ;
22
22
import { useTranslations } from "../../hooks/use-translations" ;
23
23
import { getTranslationByKey } from "../../utils/i18n-utils" ;
24
- import ValidationCriteria from "../field-validation" ;
25
24
26
- const OTPFieldAdapter = ( { component, formState , formStateHandler, otpLength = 6 } ) => {
25
+ const OTPFieldAdapter = ( { component, formStateHandler, otpLength = 6 } ) => {
27
26
28
- const { label, required, styles, validation } = component . properties ;
29
- const { errors } = formState ;
30
- const fieldErrors = errors && errors . filter ( error => error . field === component . properties . name ) ;
27
+ const { label, required, styles } = component . properties ;
31
28
32
29
const { translations } = useTranslations ( ) ;
33
30
34
31
const [ otpValues , setOtpValues ] = useState ( Array ( otpLength ) . fill ( "" ) ) ;
35
32
36
33
useEffect ( ( ) => {
37
- // Join all OTP fields to form the complete OTP value
38
34
formStateHandler ( component . properties . name , otpValues . join ( "" ) ) ;
39
35
} , [ otpValues ] ) ;
40
36
@@ -125,9 +121,6 @@ const OTPFieldAdapter = ({ component, formState, formStateHandler, otpLength = 6
125
121
/>
126
122
</ div >
127
123
) }
128
- { validation && (
129
- < ValidationCriteria validationConfig = { validation } errors = { fieldErrors } value = { otpValues } />
130
- ) }
131
124
</ div >
132
125
) ;
133
126
} ;
0 commit comments