import type { ReactNode } from "react"; /** Visible copy; override every string for another language. */ export interface AddressCardLabels { /** Text of the tag shown when `isDefault` is set. */ default: string; /** Edit button text; also the verb in its accessible name. */ edit: string; /** Remove button text; also the verb in its accessible name. */ remove: string; } /** A saved delivery address. Inside an `AddressCardGroup` it is a radio keyed by `value`; alone, `onSelect` makes it a toggle button. */ export interface AddressCardProps { /** Identifies the card inside an `AddressCardGroup`; required there. */ value?: string; /** Recipient name, shown bold; also the card's accessible name when selectable. */ name: string; /** Recipient phone, shown in tabular figures under the address lines. */ phone?: string; /** Address lines in order, e.g. ["12 Palm Grove, Indiranagar", "Bengaluru, Karnataka 560038"]. */ lines: string[]; /** Short place tag such as "Home" or "Work". */ tag?: string; /** Adds a "Default" tag. */ isDefault?: boolean; /** Muted line under the address, e.g. "Delivers by Thu, 9 Oct". */ note?: ReactNode; /** Standalone selection state; ignored inside a group, where the group's value decides. */ selected?: boolean; /** Called when the card is chosen; also fires inside a group, after the group updates. */ onSelect?: () => void; /** Shows an Edit button when set; called on click. */ onEdit?: () => void; /** Shows a Remove button when set; called on click. */ onRemove?: () => void; /** Dims the card, drops it from the tab order and ignores selection; Edit and Remove still work. */ disabled?: boolean; /** Overrides the default English strings; unset keys keep their default. */ labels?: Partial; /** Test id on the card's outer element. */ "data-testid"?: string; } /** Radiogroup of `AddressCard`s with a roving tab stop; arrow keys move focus and selection together. */ export interface AddressCardGroupProps { /** Selected card's `value`; controls the group when set. */ value?: string; /** Initially selected `value` when the group is uncontrolled. */ defaultValue?: string; /** Called with the new `value` when selection changes by click or arrow key. */ onValueChange?: (value: string) => void; /** Direct `AddressCard` children; wrapping them in another component hides their `value` from the roving tab stop. */ children: ReactNode; /** Accessible name of the radiogroup; give this or `aria-labelledby`. */ "aria-label"?: string; /** Id of the element that names the radiogroup. */ "aria-labelledby"?: string; /** Test id on the radiogroup element. */ "data-testid"?: string; }