import React from "react"; import { Checkbox, ColourSwatches, ComboBox, InputBox, Radio, TextArea } from "../../design"; /** * Available input types */ export declare type Type = "text" | "checkbox" | "colour" | "combo" | "radio" | "textarea" | "custom"; /** * Get default value */ export declare function emptyValue(type: Type): false | "" | undefined; /** * Component props */ declare type Props = { type: T; value: Value | (() => Value); onChange: (v: Value) => void; disabled?: boolean; } & TypeProps; /** * Multi or single-select choice entry */ declare type Choice = { value: string; name: React.ReactChild; }; /** * Metadata for different input types */ declare type Metadata = { text: { value: string; props: React.ComponentProps; }; checkbox: { value: boolean; props: React.ComponentProps; }; colour: { value: string; props: React.ComponentProps; }; combo: { value: string; props: Omit, "children"> & { options: Choice[]; }; }; radio: { value: string; props: { choices: (Choice & Omit, "title" | "value">)[]; }; }; textarea: { value: string; props: React.ComponentProps; }; custom: { value: never; props: { element: JSX.Element; }; }; }; /** * Actual input value type */ export declare type Value = Metadata[T]["value"]; /** * Additional component props for given input type */ export declare type TypeProps = Omit & { field?: React.ReactChild; }; /** * Generic input element */ export declare function InputElement({ type, value, onChange, ...props }: Props): JSX.Element | null; /** * Generic input element wrapped in MobX observer */ export declare const ObservedInputElement: typeof InputElement & { displayName: string; }; export {};