import { Field, FieldGetter, FieldOptions, Type } from 'alinea/core';
import { Atom, Getter } from 'jotai';
import { PropsWithChildren } from 'react';
import * as Y from 'yjs';
export interface FieldInfo<Value = any, Mutator = any, Options extends FieldOptions<Value> = FieldOptions<Value>> {
    key: string;
    field: Field<Value, Mutator, Options>;
    value: Atom<Value>;
    options: Atom<Options | Promise<Options>>;
    mutator: Mutator;
}
export declare class FormAtoms<T = any> {
    type: Type<T>;
    container: Y.Map<any>;
    private options;
    fieldInfo: Map<symbol, FieldInfo<any, any, FieldOptions<any>>>;
    constructor(type: Type<T>, container: Y.Map<any>, options?: {
        readOnly: boolean;
    });
    data(): Type.Infer<T>;
    getter: (get: Getter) => FieldGetter;
    private valueAtom;
    fieldByKey(key: string): Field;
    keyOf(field: Field): string;
    atomsOf<Value, Mutator, Options extends FieldOptions<Value>>(field: Field<Value, Mutator, Options>): FieldInfo<Value, Mutator, Options>;
}
export interface UseFormOptions<T> {
    doc?: Y.Doc;
    initialValue?: Partial<Type.Infer<T>>;
}
export declare function useForm<T>(type: Type<T>, options?: UseFormOptions<T>): FormAtoms<T>;
export declare function useFormContext(): FormAtoms<any>;
export interface FieldAtomsProviderProps {
    form: FormAtoms;
}
export declare function FormProvider({ children, form }: PropsWithChildren<FieldAtomsProviderProps>): import("react/jsx-runtime").JSX.Element;
export interface FormRowProps {
    field: Field;
    rowId?: string;
    type: Type;
}
export declare function FormRow({ children, field, type, rowId }: PropsWithChildren<FormRowProps>): import("react/jsx-runtime").JSX.Element;
