UNPKG

@focuson/form_components

Version:

Components that can be used by @focuson/forms

30 lines (29 loc) 2.23 kB
import { CommonStateProps, InputOnChangeProps, LabelAlignment } from "./common"; import { TransformerProps } from "./transformers"; import { BooleanValidations, HasDateFn, NameAnd, NumberValidations, StringValidations } from "@focuson/utils"; import { LensState } from "@focuson/state"; import { Transform } from "@focuson/lens"; import { FocusOnContext } from "@focuson/focuson"; import { HasCloseOnePage, InputChangeCommands } from "@focuson/rest"; import { HasPageSelectionLens, HasPathToLens, HasSimpleMessageL } from "@focuson/pages"; export interface LabelAndInputProps<S, T, Context> extends CommonStateProps<S, T, Context>, LabelAlignment, InputOnChangeProps<S, Context> { label?: string; defaultValue?: string | number; value?: string | number; readonly?: boolean; allButtons: NameAnd<JSX.Element>; buttons?: string[]; noLabel?: boolean; enabledBy?: string[][]; placeholder?: string; className?: string; errorMessage?: string; onBlur?: (e: any) => void; tabWhenLengthExceeds?: number; } export declare function makeInputChangeTxs<S, C extends HasSimpleMessageL<S> & HasPathToLens<S> & HasDateFn & HasPageSelectionLens<S> & HasCloseOnePage<S, C>>(id: string, parentState: LensState<S, any, C> | undefined, change?: InputChangeCommands | InputChangeCommands[]): Transform<S, any>[]; export declare const LabelAndTInput: <T extends unknown, P>(tProps: TransformerProps<T>) => <S, Context extends FocusOnContext<S>>(props: LabelAndInputProps<S, T, Context> & P) => import("react/jsx-runtime").JSX.Element; export declare const LabelAndStringInput: <S, Context extends FocusOnContext<S>>(props: LabelAndInputProps<S, string, Context> & StringValidations) => JSX.Element; export declare const LabelAndNumberInput: <S, Context extends FocusOnContext<S>>(props: LabelAndInputProps<S, number, Context> & NumberValidations) => JSX.Element; export declare const LabelAndBooleanInput: <S, Context extends FocusOnContext<S>>(props: LabelAndInputProps<S, boolean, Context> & BooleanValidations) => JSX.Element; export declare const LabelAndYNBooleanInput: <S, Context extends FocusOnContext<S>>(props: LabelAndInputProps<S, string, Context> & BooleanValidations) => JSX.Element;