@@ -3,6 +3,14 @@ import uuid from "uuid";
33import { InputProperties } from "../../atoms/interfaces/input-properties" ;
44import { PasswordInput } from "../../atoms/forms/password-input" ;
55
6+ // -----------------------------------------------------------------------------------------
7+ // #region Constants
8+ // -----------------------------------------------------------------------------------------
9+
10+ const COMPONENT_CLASS = "c-form-field" ;
11+
12+ // #endregion Constants
13+
614// -----------------------------------------------------------------------------------------
715// #region Interfaces
816// -----------------------------------------------------------------------------------------
@@ -40,9 +48,10 @@ const PasswordFormField: React.FC<PasswordFormFields> = (
4048 value,
4149 } = props ;
4250
43- const fieldId = uuid . v4 ( ) ;
4451 const [ isVisible , setIsVisible ] = useState < boolean > ( false ) ;
52+ const cssIsValid = isValid ? "" : "-invalid" ;
4553 const disableShowHide = value == null || value === "" || disabled ;
54+ const fieldId = uuid . v4 ( ) ;
4655 const passwordShowHideLabel = isVisible ? "Hide" : "Show" ;
4756
4857 const onChangeIsVisible = (
@@ -58,11 +67,13 @@ const PasswordFormField: React.FC<PasswordFormFields> = (
5867 }
5968
6069 return (
61- < div className = { `c-form-field -password ${ isValid ? "" : "-invalid" } ` } >
70+ < div className = { `${ COMPONENT_CLASS } -password ${ cssIsValid } ` } >
6271 < label htmlFor = { fieldId } >
6372 { label }
6473 { required && (
65- < span className = "c-form-field__required" > { " *" } </ span >
74+ < span className = { `${ COMPONENT_CLASS } __required` } >
75+ { " *" }
76+ </ span >
6677 ) }
6778 </ label >
6879 { // if
@@ -84,8 +95,8 @@ const PasswordFormField: React.FC<PasswordFormFields> = (
8495 testId = { inputTestId }
8596 value = { value }
8697 />
87- < div className = "c-form-field__bottom" >
88- < div className = "c-form-field__bottom__errors" >
98+ < div className = { ` ${ COMPONENT_CLASS } __bottom` } >
99+ < div className = { ` ${ COMPONENT_CLASS } __bottom__errors` } >
89100 < label > { errorMessage } </ label >
90101 </ div >
91102 </ div >
0 commit comments