import { Visibility, VisibilityOff } from "@mui/icons-material"; import { FormControl, FormHelperText, IconButton, InputAdornment, InputLabel, OutlinedInput, } from "@mui/material"; import React from "react"; import { ServerApi } from "../api/ServerApi"; export function PasswordInput(p: { value: string; onChange: (newPassword: string) => void; label: string; }) { const [showPassword, setShowPassword] = React.useState(false); const error = p.value.length > 0 ? ServerApi.CheckPassword(p.value) : null; const handleClickShowPassword = () => setShowPassword((show) => !show); const handleMouseDownPassword = ( event: React.MouseEvent ) => { event.preventDefault(); }; return ( {p.label} ) => { p.onChange(event.target.value); }} endAdornment={ {showPassword ? : } } /> {error !== null ? error : ""} ); }