import type { ReactNode } from "react"; import type { SpecItem } from "../SpecTable/SpecTableProps"; /** One long-form section. */ export interface DetailSection { /** Unique key and DOM anchor (`detail-section-`); reusing a built-in id replaces that built-in section. */ id: string; /** Heading of the accordion row or tab label. */ title: string; /** Body rendered inside the section panel. */ content: ReactNode; } /** Indian legal-metrology disclosures; every field is optional and an empty block is not rendered. */ export interface LegalInfo { /** e.g. "500 g" or "1 N". */ netQuantity?: string; /** Name and address of the manufacturer, packer or importer. */ manufacturer?: string; /** Row value for the "Country of origin" line. */ originCountry?: string; /** Line printed beside "MRP"; defaults to "Maximum retail price, inclusive of all taxes". */ mrpNote?: string; /** Customer care contact. */ customerCare?: string; } /** Every string the sections render; override all of them for another language. */ export interface DetailSectionsLabels { /** Title of the description section. */ description: string; /** Title of the highlights section. */ highlights: string; /** Title of the specifications section. */ specifications: string; /** Title of the care section. */ care: string; /** Title of the shipping and returns section. */ shipping: string; /** Title of the legal and manufacturer section. */ legal: string; /** Row label for `legal.netQuantity`. */ netQuantity: string; /** Row label for `legal.manufacturer`. */ manufacturer: string; /** Row label for `legal.originCountry`. */ originCountry: string; /** Row label for the price note row (`legal.mrpNote` or `mrpIncludesTaxes`). */ mrp: string; /** Row label for `legal.customerCare`. */ customerCare: string; /** Default `mrpNote`. */ mrpIncludesTaxes: string; } /** `accordion` stacks collapsible rows (mobile); `tabs` lays the same sections out as a tab list (desktop). */ export type DetailSectionsLayout = "accordion" | "tabs"; /** Long-form product information: description, highlights, specifications, care, shipping and returns, and legal-metrology info. */ export interface DetailSectionsProps { /** Paragraph shown in the description section; the section is omitted when empty. */ description?: string; /** Bullet list with check icons in the highlights section; omitted when empty. */ highlights?: string[]; /** Rows of the specifications table; the section is omitted when empty. */ specs?: SpecItem[]; /** Care instructions; a list renders as bullets. */ care?: string | string[]; /** Shipping and returns copy. */ shipping?: ReactNode; /** Legal-metrology disclosures; the section is omitted when no field is filled. */ legal?: LegalInfo; /** Extra sections appended after the built-in ones, or replacing a built-in one with the same id (`description`, `highlights`, `specs`, `care`, `shipping`, `legal`). */ sections?: DetailSection[]; /** `accordion` (default) or `tabs`. */ layout?: DetailSectionsLayout; /** Section ids open on mount in `accordion` layout; defaults to the first section. */ defaultOpenIds?: string[]; /** Rows of the specifications table shown before "Show all". */ specCollapsedCount?: number; /** Overrides any subset of the rendered strings; unset keys keep their English default. */ labels?: Partial; /** Test id placed on the root wrapper. */ "data-testid"?: string; }