import { ChangeEventHandler, InputHTMLAttributes, ReactElement } from 'react';
import { TextFieldProps } from '../TextField';
/**
* Props for InputMask when using with children
*/
interface InputMaskPropsWithChildren {
/**
* Custom input element to be wrapped with mask functionality.
*/
children: ReactElement>;
/**
* Additional props to pass to the input element.
*/
inputProps?: InputHTMLAttributes;
}
/**
* Props for InputMask when using without children
*/
interface InputMaskPropsWithoutChildren {
/**
* No children allowed when using default TextField.
*/
children?: never;
/**
* Props to pass to the default TextField component.
*/
inputProps?: TextFieldProps;
}
/**
* Configuration for custom mask handler matching
*/
interface ICustomMaskHandlerMatch {
/**
* Regular expression pattern to match against input.
*/
matchPattern: RegExp;
/**
* Starting position in the input string.
*/
startPosition: number;
/**
* Ending position in the input string.
*/
endPosition: number;
}
/**
* Configuration for custom mask handler application
*/
interface ICustomMaskHandlerApply {
/**
* Pattern to apply when match is found.
*/
applyPattern: string;
/**
* Offset to apply to cursor position after transformation.
*/
caretOffset: number;
}
/**
* Custom mask handler for advanced input transformations
*/
interface ICustomMaskHandler {
/**
* Matching configuration for the handler.
*/
match: ICustomMaskHandlerMatch;
/**
* Application configuration for the handler.
*/
apply: ICustomMaskHandlerApply;
}
/**
* Shared props for InputMask component
*/
interface SharedInputMaskProps {
/**
* The mask pattern to apply to the input.
* - "9" for digits only
* - "a" for letters only
* - "*" for alphanumeric
* - Any other character is treated as a fixed character
*/
mask: string;
/**
* Character to display for unfilled mask positions.
* @default "_"
*/
defaultMaskCharacter?: string;
/**
* Controlled value for the input.
*/
value?: string;
/**
* Default value for uncontrolled input.
*/
defaultValue?: string;
/**
* Callback function called when input value changes.
*/
onChange?: ChangeEventHandler;
/**
* Array of custom mask handlers for advanced transformations.
*/
customMaskHandler?: ICustomMaskHandler[];
}
/**
* Props for the InputMask component
*/
export type InputMaskProps = SharedInputMaskProps & (InputMaskPropsWithChildren | InputMaskPropsWithoutChildren);
/**
* InputMask component for applying input masks and formatting to text inputs.
*
* Features:
* - Input masking with configurable patterns (9, a, *, fixed characters)
* - Support for both controlled and uncontrolled inputs
* - Custom input elements or default TextField integration
* - Advanced cursor positioning and selection management
* - Custom mask handlers for complex transformations
* - Paste and keyboard event handling
* - Automatic mask character replacement
* - Focus and blur event management
* - Accessible with proper ARIA attributes
* - Support for all standard input element props
* - Flexible mask pattern configuration
* - Real-time input validation and formatting
*
* @example
*
*
* @example
*
*
*
*
* @example
*
*/
export declare const InputMask: import('react').ForwardRefExoticComponent>;
export {};