import * as React from "react";
import type { FormErrorsProp, FormErrorsProviderProp } from "../../props/components/data-entry.prop.js";
import type { ErrorBagProp } from "../../props/vocabulary/index.js";
export type { FormErrorsProp, FormErrorsProp as FormErrorsProps, FormErrorsProviderProp, FormErrorsProviderProp as FormErrorsProviderProps, } from "../../props/components/data-entry.prop.js";
/**
* Registry shared by a `Form` with its FormFields and ``. Each mounted `FormField
* name="…"` CLAIMS its error-bag key (it is the visible owner of that message); ``
* renders only the unclaimed remainder.
*/
interface FormErrorsRegistryValue {
errors: ErrorBagProp;
claimed: ReadonlyMap;
/** Claim `key`; returns the release function (stable identity — safe as an effect dep). */
claim: (key: string) => () => void;
}
/** Read the nearest Form's error registry (null when used outside a Form). */
export declare function useFormErrorsRegistry(): FormErrorsRegistryValue | null;
/** First message of a bag entry — Laravel arrays surface their first message on the field. */
export declare function firstBagMessage(entry: string | string[] | undefined): string | undefined;
/**
* `true` when an error bag holds at least one non-empty message. A bag with no keys, or keys whose
* entries are empty (`{ code: [] }`), shows nothing anywhere — so it never counts as "displayed".
*/
export declare function errorBagHasMessage(errors: ErrorBagProp | undefined): boolean;
/**
* FormErrorsProvider — one shared error registry (error bag + claim set) over a region. 兄弟 Form 群で
* 1 つのエラーバッグを共有するための公開プロバイダ。Two ways to get one: 1. `Form errors={…}` renders this provider itself
* (both `