UNPKG

redux-form-normalize-on-blur

Version:

a Field component that supports a normalizeOnBlur property

65 lines (64 loc) 3.93 kB
import * as React from 'react'; import type { BaseFieldProps, WrappedFieldProps } from 'redux-form'; type AdditionalProps = { input: { onKeyDown?: React.KeyboardEventHandler<any>; }; }; type BaseNormalizeOnBlurFieldProps<P = {}> = BaseFieldProps<P & AdditionalProps> & { normalizeOnBlur?: any; }; export default function createNormalizeOnBlurField(Field: React.ComponentType<BaseFieldProps<AdditionalProps>>): { new <P extends BaseNormalizeOnBlurFieldProps<{}> = BaseNormalizeOnBlurFieldProps<{}>>(props: P | Readonly<P>): { _input: Element | null | undefined; BlurHandler: (arg1: React.ComponentType<WrappedFieldProps & AdditionalProps>) => ({ input: { onBlur, ...input }, ...props }: WrappedFieldProps) => React.ReactElement; render(): React.ReactElement; context: unknown; setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly<P>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; componentDidMount?(): void; shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<P>, prevState: Readonly<{}>): any; componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<{}>, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): void; }; new <P extends BaseNormalizeOnBlurFieldProps<{}> = BaseNormalizeOnBlurFieldProps<{}>>(props: P, context: any): { _input: Element | null | undefined; BlurHandler: (arg1: React.ComponentType<WrappedFieldProps & AdditionalProps>) => ({ input: { onBlur, ...input }, ...props }: WrappedFieldProps) => React.ReactElement; render(): React.ReactElement; context: unknown; setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<P>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void; forceUpdate(callback?: (() => void) | undefined): void; readonly props: Readonly<P>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; componentDidMount?(): void; shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly<P>, prevState: Readonly<{}>): any; componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<{}>, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void; componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<{}>, nextContext: any): void; }; contextType?: React.Context<any> | undefined; }; export {};