1 import type { ElementType } from 'react';
3 import { type FactoryArg } from 'imask/esm/masked/factory';
4 import { pipe } from 'imask/esm/masked/pipe';
6 import { ValueControl, type ValueControlProps } from './ValueControl';
8 export type MaskedValueControlProps<E extends ElementType> = ValueControlProps<E> & {
12 export const MaskedValueControl = <E extends ElementType>({ mask, ...props }: MaskedValueControlProps<E>) => {
13 const { value } = props;
14 const maskedValue = value ? pipe(value, mask) : '';
16 return <ValueControl {...props} value={maskedValue} />;