@etsoo/materialui
Version:
TypeScript Material-UI Implementation
158 lines (157 loc) • 3.65 kB
TypeScript
import React from "react";
import { TextFieldProps } from "@mui/material/TextField";
/**
* Extended text field props
*/
export type TextFieldExProps = TextFieldProps & {
/**
* Change delay (ms) to avoid repeatly dispatch onChange
*/
changeDelay?: number;
/**
* Clear button label
*/
clearLabel?: string;
/**
* Click clear button callback
*/
onClear?: (doClear: () => void) => void;
/**
* On enter click
*/
onEnter?: React.KeyboardEventHandler<HTMLDivElement>;
/**
* On visibility
* @param input HTML input
* @returns Result
*/
onVisibility?: (input: HTMLInputElement) => void | boolean | Promise<boolean>;
/**
* Is the field read only?
*/
readOnly?: boolean;
/**
* Show clear button
*/
showClear?: boolean;
/**
* Show password button
*/
showPassword?: boolean;
};
/**
* Extended text field methods
*/
export interface TextFieldExMethods {
/**
* Set error
* @param error Error
*/
setError(error: React.ReactNode): void;
}
export declare const TextFieldEx: React.ForwardRefExoticComponent<(Omit<import("@mui/material").StandardTextFieldProps & {
/**
* Change delay (ms) to avoid repeatly dispatch onChange
*/
changeDelay?: number;
/**
* Clear button label
*/
clearLabel?: string;
/**
* Click clear button callback
*/
onClear?: (doClear: () => void) => void;
/**
* On enter click
*/
onEnter?: React.KeyboardEventHandler<HTMLDivElement>;
/**
* On visibility
* @param input HTML input
* @returns Result
*/
onVisibility?: (input: HTMLInputElement) => void | boolean | Promise<boolean>;
/**
* Is the field read only?
*/
readOnly?: boolean;
/**
* Show clear button
*/
showClear?: boolean;
/**
* Show password button
*/
showPassword?: boolean;
}, "ref"> | Omit<import("@mui/material").OutlinedTextFieldProps & {
/**
* Change delay (ms) to avoid repeatly dispatch onChange
*/
changeDelay?: number;
/**
* Clear button label
*/
clearLabel?: string;
/**
* Click clear button callback
*/
onClear?: (doClear: () => void) => void;
/**
* On enter click
*/
onEnter?: React.KeyboardEventHandler<HTMLDivElement>;
/**
* On visibility
* @param input HTML input
* @returns Result
*/
onVisibility?: (input: HTMLInputElement) => void | boolean | Promise<boolean>;
/**
* Is the field read only?
*/
readOnly?: boolean;
/**
* Show clear button
*/
showClear?: boolean;
/**
* Show password button
*/
showPassword?: boolean;
}, "ref"> | Omit<import("@mui/material").FilledTextFieldProps & {
/**
* Change delay (ms) to avoid repeatly dispatch onChange
*/
changeDelay?: number;
/**
* Clear button label
*/
clearLabel?: string;
/**
* Click clear button callback
*/
onClear?: (doClear: () => void) => void;
/**
* On enter click
*/
onEnter?: React.KeyboardEventHandler<HTMLDivElement>;
/**
* On visibility
* @param input HTML input
* @returns Result
*/
onVisibility?: (input: HTMLInputElement) => void | boolean | Promise<boolean>;
/**
* Is the field read only?
*/
readOnly?: boolean;
/**
* Show clear button
*/
showClear?: boolean;
/**
* Show password button
*/
showPassword?: boolean;
}, "ref">) & React.RefAttributes<TextFieldExMethods>>;