import React__default, { useState } from 'react';
import { F as FormField } from './FormField-es.js';
import 'classnames';
import './tslib.es6-es.js';
import 'react-hook-form';
import '@jobber/hooks';
import 'framer-motion';
import '@jobber/design';
import './Button-es.js';

function InputPassword(props) {
    const { hasVisibility = false } = props;
    const [visible, setVisibility] = useState(false);
    return (React__default.createElement(FormField, Object.assign({}, props, (hasVisibility && {
        suffix: {
            ariaLabel: visible ? "Hide password" : "Show password",
            icon: visible ? "eye" : "eyeCrossed",
            onClick: () => setVisibility(!visible),
        },
    }), { type: visible ? "text" : "password", onChange: handleChange })));
    function handleChange(newValue) {
        props.onChange && props.onChange(newValue);
    }
}

export { InputPassword as I };
