import { Eye, EyeSlash } from "@phosphor-icons/react"; import { useState } from "react"; import { TextField, type TextFieldProps } from "../text-field"; export type PasswordInputProps = Omit & { hidePasswordLabel?: string; showPasswordLabel?: string; showToggle?: boolean; }; export function PasswordInput({ hidePasswordLabel = "Hide password", showPasswordLabel = "Show password", showToggle = true, ...props }: PasswordInputProps) { const [visible, setVisible] = useState(false); const visibilityButton = showToggle ? (
setVisible((current) => !current)} title={visible ? hidePasswordLabel : showPasswordLabel} > {visible ? (
) : null; return ( ); }