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 `
` and `asChild` modes) — the single-form case needs nothing else. 2. */ export declare function FormErrorsProvider({ errors, children }: FormErrorsProviderProp): React.JSX.Element; /** FormField calls this to claim its error-bag key while mounted (no-op outside a Form). */ export declare function useClaimErrorKey(name: string | undefined): void; /** * FormErrors — renders the error-bag entries no mounted `FormField name="…"` displays: server * validation errors attached to hidden/derived fields (an `action_mode`, a `page`, a source-record * id) that would otherwise fail silently. Place it inside a `Form errors={…}` — typically above * the fields; it renders nothing while every entry is claimed or the bag is empty. */ export declare function FormErrors({ errors: errorsProp, title, className }: FormErrorsProp): React.JSX.Element | null;