import type { AddressSurface, ResolvedAddressField, ResolvedAddressSchema } from '@evershop/evershop/lib/address/types'; import React from 'react'; import { type RegisterOptions } from 'react-hook-form'; /** * The default address renderer (spec § 3.9): rows from `row`, the country * first, react-hook-form rules from `required` and `pattern`, enumerated * levels as lazy region selects with the `dependsOn` cascade, explicit * clearing on a country swap, the retired-key marker, and a live preview * through the same `formatAddress` the server uses. Each field sits in its * own Area (`addressField.`); the whole block sits in * `addressForm.`. `AddressRendererProps` is public API: a theme that * wants another layout ships its own renderer over the same props. */ export interface AddressRendererProps { schema: ResolvedAddressSchema; /** Form field-name prefix: '', 'shippingAddress', 'billingAddress'. */ namePrefix: string; /** 'account' | 'shipping' | 'billing' — also the Area id suffix. */ surface: AddressSurface; /** Country options for the select, from `countries(scope:)`. */ countries: { value: string; label: string; }[]; /** Initial values by field id (a stored address); absent on a new address. */ initialValues?: Record; /** Called with the ISO code when the customer changes the country. */ onCountryChange?: (country: string) => void; } /** * react-hook-form rules from the schema: `required` and the anchored * `pattern`. Every key is ALWAYS present (`false` / `undefined` when unused): * a field kept across a country swap re-registers with the new rules, and * react-hook-form merges them over the old ones — a key that is merely absent * leaves the previous country's rule in place (the default schema's required * City followed the form into Vietnam, where City is optional). */ export declare function rulesFor(field: ResolvedAddressField, label: string): RegisterOptions; export declare function AddressFields(props: AddressRendererProps): React.JSX.Element; export default AddressFields;