/* eslint-disable */ // @ts-nocheck import { FormHelperText, HelperText, HelperTextItem, ValidatedOptions, } from "../../@patternfly/react-core"; import { FieldPath, FieldValues, PathValue, UseControllerProps, useController, } from "react-hook-form"; import { getRuleValue } from "../utils/getRuleValue"; import { FormLabel } from "./FormLabel"; import { PasswordInput, PasswordInputProps } from "./PasswordInput"; export type PasswordControlProps< T extends FieldValues, P extends FieldPath = FieldPath, > = UseControllerProps & Omit & { label: string; labelIcon?: string; isDisabled?: boolean; helperText?: string; }; export const PasswordControl = < T extends FieldValues, P extends FieldPath = FieldPath, >( props: PasswordControlProps, ) => { const { labelIcon, ...rest } = props; const required = !!getRuleValue(props.rules?.required); const defaultValue = props.defaultValue ?? ("" as PathValue); const { field, fieldState } = useController({ ...props, defaultValue, }); return ( {props.helperText && ( {props.helperText} )} ); };