react-advanced-pwcl
Version:
A React Component to display the success or failure of password strength rules, ideal for registration or password reset forms.
43 lines (42 loc) • 1.4 kB
TypeScript
import React from "react";
interface CustomIconComponents {
ValidIcon: React.ReactNode;
InvalidIcon: React.ReactNode;
}
interface PasswordProps {
value: string;
valueAgain?: string;
minLength?: number;
maxLength?: number;
iconSize?: number;
validColor?: string;
invalidColor?: string;
validTextColor?: string;
invalidTextColor?: string;
onChange?: (isValid: boolean, failedRules: RuleNames[]) => any;
messages?: {
[key in RuleNames]?: string;
};
iconComponents?: CustomIconComponents;
messageOnlyColor?: string;
messageOnlyPrefix?: string;
}
export type RuleNames = "minLength" | "maxLength" | "specialChar" | "number" | "capital" | "match" | "lowercase" | "letter" | "notEmpty" | "capitalAndLowercase" | "noSpaces";
export interface PasswordCheckListProps extends PasswordProps {
className?: string;
style?: React.CSSProperties;
rules: Array<RuleNames>;
rtl?: boolean;
hideIcon?: boolean;
specialCharsRegex?: RegExp;
itemClassName?: string;
renderAsMessagesOnly?: boolean;
}
declare const PasswordCheckList: React.FC<PasswordCheckListProps>;
export declare const RenderShortMessage: React.FC<{
className?: string;
style?: React.CSSProperties;
messageOnlyColor: string;
children: React.ReactNode;
}>;
export default PasswordCheckList;