UNPKG

@focuson/form_components

Version:

Components that can be used by @focuson/forms

22 lines (21 loc) 2.02 kB
import { CommonStateProps, InputEnabledProps, InputOnChangeProps } from "./common"; import { CheckboxProps, StringProps, TransformerProps } from "./transformers"; import { BooleanValidations, NameAnd, NumberValidations, StringValidations } from "@focuson/utils"; import { FocusOnContext } from "@focuson/focuson"; export interface InputProps<S, T, Context> extends CommonStateProps<S, T, Context>, InputOnChangeProps<S, Context>, InputEnabledProps { defaultValue?: string | number; placeholder?: string; readonly?: boolean; enums?: NameAnd<string>; onBlur?: (e: any) => void; errorMessage?: string; tabWhenLengthExceeds?: number; } export declare const cleanInputProps: <T extends NameAnd<any>>(p: T) => T; export declare const Input: <S, T extends unknown, P>(tProps: TransformerProps<T>) => <Props extends InputProps<S, T, Context> & P, Context extends FocusOnContext<S>>(props: Props) => import("react/jsx-runtime").JSX.Element; export declare const CheckboxInput: <S, T extends unknown, P>(tProps: CheckboxProps<T>) => <Props extends InputProps<S, T, Context> & P, Context extends FocusOnContext<S>>(props: Props) => import("react/jsx-runtime").JSX.Element; export declare const NonCheckboxInput: <S, T extends unknown, P>(tProps: StringProps<T>) => <Props extends InputProps<S, T, Context> & P, Context extends FocusOnContext<S>>(props: Props) => import("react/jsx-runtime").JSX.Element; export declare const StringInput: <S, Context extends FocusOnContext<S>>(props: InputProps<S, string, Context> & StringValidations) => JSX.Element; export declare const NumberInput: <S, Context extends FocusOnContext<S>>(props: InputProps<S, number, Context> & NumberValidations) => JSX.Element; export declare const BooleanInput: <S, Context extends FocusOnContext<S>>(props: InputProps<S, boolean, Context> & BooleanValidations) => JSX.Element; export declare const BooleanYNInput: <S, Context extends FocusOnContext<S>>(props: InputProps<S, string, Context> & BooleanValidations) => JSX.Element;