@@ -11,6 +11,7 @@ const PasswordInput = React.forwardRef(function PasswordInput(
1111 {
1212 labelText,
1313 className,
14+ disabled,
1415 id,
1516 placeholder,
1617 onChange,
@@ -46,12 +47,12 @@ const PasswordInput = React.forwardRef(function PasswordInput(
4647 const sharedTextInputProps = {
4748 id,
4849 onChange : ( evt ) => {
49- if ( ! other . disabled ) {
50+ if ( ! disabled ) {
5051 onChange ( evt ) ;
5152 }
5253 } ,
5354 onClick : ( evt ) => {
54- if ( ! other . disabled ) {
55+ if ( ! disabled ) {
5556 onClick ( evt ) ;
5657 }
5758 } ,
@@ -63,10 +64,10 @@ const PasswordInput = React.forwardRef(function PasswordInput(
6364 } ;
6465 const labelClasses = classNames ( `${ prefix } --label` , {
6566 [ `${ prefix } --visually-hidden` ] : hideLabel ,
66- [ `${ prefix } --label--disabled` ] : other . disabled ,
67+ [ `${ prefix } --label--disabled` ] : disabled ,
6768 } ) ;
6869 const helperTextClasses = classNames ( `${ prefix } --form__helper-text` , {
69- [ `${ prefix } --form__helper-text--disabled` ] : other . disabled ,
70+ [ `${ prefix } --form__helper-text--disabled` ] : disabled ,
7071 } ) ;
7172 const label = labelText ? (
7273 < label htmlFor = { id } className = { labelClasses } >
@@ -86,10 +87,12 @@ const PasswordInput = React.forwardRef(function PasswordInput(
8687 ) ;
8788 const passwordVisibilityToggleClasses = classNames (
8889 `${ prefix } --text-input--password__visibility__toggle` ,
90+ `${ prefix } --btn` ,
8991 `${ prefix } --btn--icon-only` ,
9092 `${ prefix } --tooltip__trigger` ,
9193 `${ prefix } --tooltip--a11y` ,
9294 {
95+ [ `${ prefix } --btn--disabled` ] : disabled ,
9396 [ `${ prefix } --tooltip--${ tooltipPosition } ` ] : tooltipPosition ,
9497 [ `${ prefix } --tooltip--align-${ tooltipAlignment } ` ] : tooltipAlignment ,
9598 }
@@ -98,15 +101,19 @@ const PasswordInput = React.forwardRef(function PasswordInput(
98101 < >
99102 < input
100103 { ...textInputProps ( { invalid, sharedTextInputProps, errorId } ) }
104+ disabled = { disabled }
101105 data-toggle-password-visibility = { inputType === 'password' }
102106 />
103107 < button
104108 type = "button"
105109 className = { passwordVisibilityToggleClasses }
110+ disabled = { disabled }
106111 onClick = { togglePasswordVisibility } >
107- < span className = { `${ prefix } --assistive-text` } >
108- { passwordIsVisible ? hidePasswordLabel : showPasswordLabel }
109- </ span >
112+ { ! disabled && (
113+ < span className = { `${ prefix } --assistive-text` } >
114+ { passwordIsVisible ? hidePasswordLabel : showPasswordLabel }
115+ </ span >
116+ ) }
110117 { passwordVisibilityIcon }
111118 </ button >
112119 </ >
0 commit comments