import type { DrawerContentProps } from "@chakra-ui/react"; import type { OptionAxis, PriceFormat, ProductMedia, ProductVariant, VariantSelection } from "../Commerce/commerceTypes"; /** Visible copy of the sheet; override every string for another language. */ export interface QuickAddSheetLabels { /** Sheet heading, which also names the dialog. */ heading: string; /** Label of the quantity stepper row. */ quantity: string; /** Confirm button text while no variant is chosen. */ confirm: string; /** Confirm button text for a chosen variant, given the formatted total. */ confirmWithTotal: (total: string) => string; /** Prompt shown when confirming with an axis unpicked, given the lower-cased axis label ("size"). */ prompt: (axisLabel: string) => string; } /** drawer slides up from the bottom edge, modal is a centred panel, auto picks modal from 48em up. */ export type QuickAddPresentation = "auto" | "drawer" | "modal"; /** Option picker shown before an add: the product, a `VariantSelector`, a quantity stepper and a confirm button naming the total. */ export interface QuickAddSheetProps extends PriceFormat { /** Whether the sheet is shown; each time it opens, selection resets to `defaultSelection` and quantity to 1. */ isOpen: boolean; /** Fires on dismissal (close button, overlay or Escape); also required to close after `onConfirm`. */ onClose: () => void; /** Product name shown beside the thumbnail and used to label the quantity stepper. */ title: string; /** Muted line above the title; omitted when absent. */ brand?: string; /** Thumbnail beside the title. */ media?: ProductMedia; /** Option axes the shopper picks from; each must be chosen before confirming. */ axes: OptionAxis[]; /** Availability and the confirm total are derived from these. */ variants: ProductVariant[]; /** Picks to start from each time the sheet opens, e.g. the colour already chosen on the card. */ defaultSelection?: VariantSelection; /** Fires with the chosen variant and quantity; the sheet does not close itself. */ onConfirm: (variant: ProductVariant, quantity: number) => void; /** How the sheet opens; defaults to `auto`. */ presentation?: QuickAddPresentation; /** Merged over the drawer panel defaults, e.g. `{ maxW: "390px !important", mx: "auto" }` inside a phone-width frame; the slide sets an inline max-width. */ drawerContentProps?: DrawerContentProps; /** Overrides for the sheet copy; unspecified strings keep the English defaults. */ labels?: Partial; /** Set on the sheet body wrapper, not on the dialog root. */ "data-testid"?: string; }