import { FieldPath, FieldValues, UseControllerProps } from 'react-hook-form'; /** * Type definition for customizable rule messages. */ export type ComposeRulesMessages = { /** * Message or function to generate a message for the `max` rule. * @param max - The maximum value allowed. * @returns The message for the `max` rule. */ max?: ((max: number | string) => string) | string; /** * Message or function to generate a message for the `maxLength` rule. * @param maxLength - The maximum length allowed. * @returns The message for the `maxLength` rule. */ maxLength?: ((maxLength: number) => string) | string; /** * Message or function to generate a message for the `min` rule. * @param min - The minimum value allowed. * @returns The message for the `min` rule. */ min?: ((min: number | string) => string) | string; /** * Message or function to generate a message for the `minLength` rule. * @param minLength - The minimum length allowed. * @returns The message for the `minLength` rule. */ minLength?: ((minLength: number) => string) | string; /** * Message or function to generate a message for the `pattern` rule. * @param pattern - The regular expression pattern for validation. * @param title - Optional title for the error message. * @returns The message for the `pattern` rule. */ pattern?: ((pattern: RegExp, title?: string) => string) | string; /** * Message for the `required` rule. */ required?: string; }; /** * Retrieves a message based on the provided string or function. * * @param messageOrFunction - A string or function that returns a message. * @param values - Values to pass to the function if `messageOrFunction` is a function. * @returns The generated message or an empty string if not defined. */ export declare function getMessage(messageOrFunction: ((...values: any) => string | undefined) | string | undefined, ...values: any): string; /** * Props for the `useComposeRules` hook. */ export type UseComposeRulesProps = FieldPath> = { /** * Maximum value allowed. */ max?: number | string; /** * Maximum length allowed. */ maxLength?: number; /** * Custom messages for validation rules. */ messages?: ComposeRulesMessages; /** * Minimum value allowed. */ min?: number | string; /** * Minimum length allowed. */ minLength?: number; /** * Regular expression pattern for validation. */ pattern?: RegExp | string; /** * Indicates if the field is required. */ required?: boolean; /** * Validation rules to be used by React Hook Form. */ rules?: UseControllerProps['rules']; /** * Optional title for pattern messages. Some components may use it to render a tooltip */ title?: string | undefined; }; /** * Composes validation rules for a React Hook Form. * * @param props - The properties to compose rules from. * @returns The composed validation rules. */ export declare function useUnstableComposeRules = FieldPath>(props: UseComposeRulesProps): Omit, "disabled" | "setValueAs" | "valueAsNumber" | "valueAsDate">;