react-form-toolkit
Version:
A form validation toolkit for React, specializing in simple to medium-sized, secure forms. It provides an easy-to-use API to validate form inputs and ensure data integrity.
29 lines (28 loc) • 1.13 kB
TypeScript
export declare enum InputType {
TEXT = "text",
NUMBER = "number",
CHECKBOX = "checkbox",
FILE = "file",
STRING = "string"
}
export declare enum defaultErrorMessage {
Required = "This field is required",
InvalidEmail = "Invalid email address",
WeakPassword = "Password must be at least 8 characters long and include one uppercase letter, one lowercase letter, one number, and one special character",
InvalidPhoneNumber = "Invalid phone number",
InvalidZipCode = "Invalid US zip code",
InvalidUrl = "Invalid URL",
InvalidDate = "Invalid date format",
MinValue = "Value is too low",
MaxValue = "Value is too high",
MinLength = "Value is too short",
MaxLength = "Value is too long",
NotANumber = "Value is not a number",
NotABoolean = "Value is not a boolean",
NotAString = "Value is not a string",
NotAnImage = "Value is not an image",
NotTrue = "Value is not true",
NotFalse = "Value is not false"
}
export type ValidationValue = boolean | number | string | RegExp;
export type ValidationRules<TValidation extends ValidationValue> = TValidation;