import { FormHTMLAttributes, ComponentType } from 'react'; import { ServerFn } from './server-fn.mjs'; import { R as RetryOptions } from './api-client-DHgwXCQX.mjs'; import './cache.mjs'; import './server-fn-error-DDh14a0V.mjs'; import './integration-api-BbaiokCC.mjs'; import './client-cache-2Iu9DTnN.mjs'; import './route-C8RuFaMN.mjs'; type ServerFnActionStatus = "idle" | "pending" | "success" | "error"; type ServerFnSubmit = [unknown] extends [TInput] ? (input?: TInput | FormData) => Promise : (input: TInput | FormData) => Promise; type ServerFnOptimisticContext = { input: TInput | FormData | undefined; formData?: FormData; current: TResult | null; }; type UseServerFnOptions = { initialResult?: TResult | null; resetOnSubmit?: boolean; throwOnFormError?: boolean; optimistic?: (context: ServerFnOptimisticContext) => TResult | null | undefined; rollbackOnError?: boolean; /** Retry failed submissions with the API client's retry shape. Defaults to no retries. */ retry?: RetryOptions; onSuccess?: (result: TResult) => void; onError?: (error: TError) => void; onSettled?: (result: TResult | null, error: TError | null) => void; }; type UseServerFnReturn = { pending: boolean; status: ServerFnActionStatus; result: TResult | null; error: TError | null; submit: ServerFnSubmit; formAction: (formData: FormData) => Promise; reset: () => void; }; type UseActionFormProps = Omit, "action">; type RouteActionTarget> = { readonly action: TServerFn; }; type UseActionReturn = ServerFnSubmit & { pending: boolean; status: ServerFnActionStatus; data: TResult | null; result: TResult | null; error: TError | null; formAction: (formData: FormData) => Promise; Form: ComponentType; reset: () => void; }; declare function useServerFn(serverFn: ServerFn, options?: UseServerFnOptions): UseServerFnReturn; /** * Wrap a server function, or a route's default server function, as a callable * RPC with React mutation state. */ declare function useAction(route: RouteActionTarget>, options?: UseServerFnOptions): UseActionReturn; declare function useAction(serverFn: ServerFn, options?: UseServerFnOptions): UseActionReturn; export { type RouteActionTarget, type ServerFnActionStatus, type ServerFnOptimisticContext, type ServerFnSubmit, type UseActionFormProps, type UseActionReturn, type UseServerFnOptions, type UseServerFnReturn, useAction, useServerFn };