@airplane/views
Version:
A React library for building Airplane views. Views components are optimized in style and functionality to produce internal apps that are easy to build and maintain.
27 lines (26 loc) • 658 B
TypeScript
import { ValidateFnProp } from "./types";
export type InputState<TValue> = {
value?: TValue;
disabled: boolean;
errors: string[];
showErrors: boolean;
};
export type InputAction<TValue> = {
type: "setValue";
value: TValue;
} | {
type: "setDisabled";
disabled?: boolean;
} | {
type: "validate";
required?: boolean;
validate?: ValidateFnProp<TValue>;
} | {
type: "setShowErrors";
showErrors: boolean;
} | {
type: "reset";
initialValue: TValue;
initialDisabled: boolean;
};
export declare const inputReducer: <TValue>(state: InputState<TValue>, action: InputAction<TValue>) => InputState<TValue>;