import { Button } from '@wordpress/components'; import { seen, unseen } from '@wordpress/icons'; import clsx from 'clsx'; import { localize } from 'i18n-calypso'; import { createRef, Component } from 'react'; import FormTextInput from 'calypso/components/forms/form-text-input'; import './style.scss'; class FormPasswordInput extends Component { static displayName = 'FormPasswordInput'; textFieldRef = createRef(); constructor( props ) { super( props ); this.state = { hidePassword: true }; } togglePasswordVisibility = () => { this.setState( { hidePassword: ! this.state.hidePassword } ); }; getIsValueHidden() { if ( this.props.hideToggle ) { return true; } return this.props.submitting || this.state.hidePassword; } focus = () => { this.textFieldRef.current.focus(); }; render() { const { hideToggle, submitting, isHidden, locale, translate, ...rest } = this.props; const isValueHidden = this.getIsValueHidden(); return (
); } } export default localize( FormPasswordInput );