UNPKG

dgz-ui-shared

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library

28 lines 1.63 kB
import { FormItemProps, MaskInputProps } from 'dgz-ui/form'; import { FieldValues } from 'react-hook-form'; /** * Props for the MyMaskInput component. * @template TFieldValues - The type of the form values. */ export type MyMaskInputProps<TFieldValues extends FieldValues> = FormItemProps<TFieldValues> & MaskInputProps & { /** Whether the field is required. */ required?: boolean; }; /** * MyMaskInput is an input component with masking support and optional react-hook-form integration. * Works in both controlled (with control/name) and uncontrolled modes. By default it uses a space as * thousands separator, underscores as placeholder characters, lazy formatting disabled, and returns * unmasked value on change. * * @template TFieldValues - Form values type used by react-hook-form. * @param control - The `react-hook-form` control object. * @param name - The name of the field in `react-hook-form`. * @param label - The label to display for the mask input. * @param rules - The `react-hook-form` validation rules. * @param required - Whether the field is required. * @param floatingError - Whether to show the error message in a floating container. * @param props - MaskInput and form item props. * @returns {JSX.Element | null} A masked input with label, helper text, and validation message, or null if name/control are missing */ export declare const MyMaskInput: <TFieldValues extends FieldValues>({ control, name, label, rules, required, floatingError, ...props }: MyMaskInputProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element | null; //# sourceMappingURL=MyMaskInput.d.ts.map