@navinc/base-react-components
Version:
Nav's Pattern Library
19 lines (18 loc) • 834 B
TypeScript
import { FocusEventHandler, ChangeEventHandler } from 'react';
import Input from '../input.js';
import { InferComponentProps } from '../types.js';
declare type PatternInputProps = InferComponentProps<typeof Input> & {
name: string;
/** pattern - A Vanilla Masker pattern that will be passed into `toPattern` */
pattern: string;
onBlur?: FocusEventHandler<HTMLInputElement>;
onChange?: ChangeEventHandler<HTMLInputElement>;
invalidOnTouched?: boolean;
};
/**
* PatternInput - A generic text input that works with Vanilla Masker's `toPattern`
*
* `<PatternInput pattern="99-99-99" value="123456" />` the value will be reformatted and displayed as "12-34-56"
*/
export declare const PatternInput: ({ name, pattern, onBlur, onChange, invalidOnTouched, ...props }: PatternInputProps) => JSX.Element;
export {};