import { Optional, record } from '@synnaxlabs/x';
import { FC, ReactElement } from 'react';
import { RenderProp } from '../component/renderProp';
import { ContextValue } from './Context';
import { FieldState, GetOptions } from './state';
import { UseFieldOptions, UseFieldReturn } from './useField';
import { Input } from '../input';
import { Select } from '../select';
interface FieldChild<I, O> extends Input.Control<I, O>, Pick<UseFieldReturn<I, O>, "variant"> {
}
export type FieldProps<I = string | number, O = I> = GetOptions<I> & UseFieldOptions<I, O> & Omit<Input.ItemProps, "children" | "onChange" | "defaultValue"> & {
    path: string;
    children?: RenderProp<FieldChild<I, O>>;
    padHelpText?: boolean;
    visible?: boolean | ((state: FieldState<I>, ctx: ContextValue) => boolean);
    hideIfNull?: boolean;
};
export type FieldT<I, O = I> = (props: FieldProps<I, O>) => ReactElement | null;
export declare const Field: <I = string | number, O = I>({ path, children, label, padHelpText, visible, hideIfNull, optional, onChange, className, defaultValue, ...rest }: FieldProps<I, O>) => ReactElement | null;
export interface FieldBuilderProps<I, O, P extends {}> {
    fieldKey?: string;
    fieldProps?: Partial<FieldProps<I, O>>;
    inputProps: Omit<P, "value" | "onChange">;
}
export type BuiltFieldProps<I, O, P extends {}, OptionalFields extends keyof Omit<P, "value" | "onChange"> = never> = FieldProps<I, O> & {
    inputProps?: Optional<Omit<P, "value" | "onChange">, OptionalFields>;
    fieldKey?: string;
};
export declare const fieldBuilder: <I, O, P extends {}, OptionalFields extends keyof Omit<P, "value" | "onChange"> = never>(Component: FC<P & Input.Control<I, O>>) => ({ fieldKey: baseFieldKey, fieldProps, inputProps: baseInputProps, }: FieldBuilderProps<I, O, P>) => FC<BuiltFieldProps<I, O, P, OptionalFields>>;
export type NumericFieldProps = BuiltFieldProps<number, number, Input.NumericProps>;
export declare const buildNumericField: ({ fieldKey: baseFieldKey, fieldProps, inputProps: baseInputProps, }: FieldBuilderProps<number, number, Input.NumericProps>) => FC<BuiltFieldProps<number, number, Input.NumericProps, never>>;
export declare const NumericField: FC<BuiltFieldProps<number, number, Input.NumericProps, never>>;
export type TextFieldProps = BuiltFieldProps<string, string, Input.TextProps>;
export declare const buildTextField: ({ fieldKey: baseFieldKey, fieldProps, inputProps: baseInputProps, }: FieldBuilderProps<string, string, Input.TextProps>) => FC<BuiltFieldProps<string, string, Input.TextProps, never>>;
export declare const TextField: FC<BuiltFieldProps<string, string, Input.TextProps, never>>;
export type SwitchFieldProps = BuiltFieldProps<boolean, boolean, Input.SwitchProps>;
export declare const buildSwitchField: ({ fieldKey: baseFieldKey, fieldProps, inputProps: baseInputProps, }: FieldBuilderProps<boolean, boolean, Input.SwitchProps>) => FC<BuiltFieldProps<boolean, boolean, Input.SwitchProps, never>>;
export declare const SwitchField: FC<BuiltFieldProps<boolean, boolean, Input.SwitchProps, never>>;
export type SelectFieldProps<K extends record.Key, E extends record.KeyedNamed<K>> = BuiltFieldProps<K, K, Select.StaticProps<K, E>, "data" | "resourceName">;
export declare const buildSelectField: <K extends record.Key, E extends record.KeyedNamed<K>>(props: FieldBuilderProps<K, K, Select.StaticProps<K, E>>) => FC<BuiltFieldProps<K, K, Select.StaticProps<K, E>, "data" | "resourceName">>;
export {};
//# sourceMappingURL=Field.d.ts.map