UNPKG

@eccenca/gui-elements

Version:

GUI elements based on other libraries, usable in React application, written in Typescript.

30 lines (29 loc) 1.27 kB
import React, { ChangeEventHandler } from "react"; export interface InvisibleCharacterWarningProps { /** * If set, the function is called after every value change what invisible characters have been detected. * The input component must be controlled for this callback to be triggered. */ callback: (detectedCodePoints: Set<number>) => any; /** * The delay in milliseconds after which an input string should be checked. Only the most recent value will be checked. * A higher value will reduce the probability that the typing stalls. * * Default: 500 */ callbackDelay?: number; } interface Props<T = Element> { /** Forwarded TextField props */ value?: string | ReadonlyArray<string> | number | undefined; readOnly?: boolean | undefined; disabled?: boolean | undefined; onChange?: ChangeEventHandler<T>; /** * If set, allows to be informed of invisible, hard to spot characters in the string value. */ invisibleCharacterWarning?: InvisibleCharacterWarningProps; } /** Validates the string value for invisible characters. */ export declare const useTextValidation: <T>({ value, onChange, invisibleCharacterWarning }: Props<T>) => React.ChangeEventHandler<T> | undefined; export {};