import { productsV3 } from '@wix/stores'; export interface RootProps { children: React.ReactNode; } /** * Root component that provides the ProductModifiers service context to its children. * This component sets up the necessary services for managing product modifier functionality. * * @order 1 * @component * @example * ```tsx * import { ProductModifiers } from '@wix/stores/components'; * * function ProductCustomization() { * return ( * * * * {({ modifiers, hasModifiers, selectedModifiers, areAllRequiredModifiersFilled }) => ( * * {hasModifiers && ( * * Customize your product * {modifiers.map(modifier => ( * * {({ name, mandatory, hasChoices, choices, isFreeText }) => ( * * * {name} {mandatory && *} * * {hasChoices && ( * * {choices.map(choice => ( * * {({ value, isSelected, select }) => ( * * {value} * * )} * * ))} * * )} * {isFreeText && ( * * {({ value, onChange, placeholder, maxChars }) => ( * onChange(e.target.value)} * placeholder={placeholder} * maxLength={maxChars} * /> * )} * * )} * * )} * * ))} * {!areAllRequiredModifiersFilled && ( * Please fill all required options * )} * * )} * * )} * * * * ); * } * ``` */ export declare function Root(props: RootProps): React.ReactNode; /** * Props for Modifiers headless component */ export interface ModifiersProps { /** Render prop function that receives modifiers data */ children: (props: ModifiersRenderProps) => React.ReactNode; } /** * Render props for Modifiers component */ export interface ModifiersRenderProps { /** Array of product modifiers */ modifiers: productsV3.ConnectedModifier[]; /** Whether product has modifiers */ hasModifiers: boolean; /** Currently selected modifier values */ selectedModifiers: Record; /** Whether all required modifiers are filled */ areAllRequiredModifiersFilled: boolean; } /** * Headless component for all product modifiers * * @component * @example * ```tsx * import { ProductModifiers } from '@wix/stores/components'; * * function ModifiersSelector() { * return ( * * {({ modifiers, hasModifiers, selectedModifiers, areAllRequiredModifiersFilled }) => ( * * {hasModifiers && ( * * Customize your product * {modifiers.map(modifier => ( * * {modifier.name} * {modifier.required && *} * {modifier.choices?.map(choice => ( * * * {choice.description} (+{choice.priceChange?.price}) * * ))} * * ))} * {!areAllRequiredModifiersFilled && ( * Please fill all required options * )} * * )} * * )} * * ); * } * ``` */ export declare function Modifiers(props: ModifiersProps): import("react").ReactNode; /** * Props for Modifier headless component */ export interface ModifierProps { /** Product modifier data */ modifier: productsV3.ConnectedModifier; /** Render prop function that receives modifier data */ children: (props: ModifierRenderProps) => React.ReactNode; } /** * Render props for Modifier component */ export interface ModifierRenderProps { /** Modifier name (may be translated) */ name: string; /** Modifier key (unique identifier) */ key: string; /** Modifier type */ type: any; /** Whether this modifier is mandatory */ mandatory: boolean; /** Array of choices for this modifier (for choice-based modifiers) */ choices: productsV3.ConnectedModifierChoice[]; /** Currently selected value for this modifier */ selectedValue: any; /** Whether this modifier has choices */ hasChoices: boolean; /** Whether this modifier is a free text type */ isFreeText: boolean; /** Maximum characters for free text */ maxChars?: number; /** Placeholder text for free text */ placeholder?: string; } /** * Headless component for a specific product modifier * * @component * @example * ```tsx * import { ProductModifiers } from '@wix/stores/components'; * * function ModifierField({ modifier }) { * return ( * * {({ name, mandatory, hasChoices, choices, selectedValue, isFreeText, placeholder, maxChars }) => ( * * * {name} {mandatory && *} * * {hasChoices && ( * * {choices.map(choice => ( * * * {choice.description} (+{choice.priceChange?.price || '0'}) * * ))} * * )} * {isFreeText && ( * * )} * * )} * * ); * } * ``` */ export declare function Modifier(props: ModifierProps): import("react").ReactNode; /** * Props for ModifierChoice headless component */ export interface ChoiceProps { /** Product modifier data */ modifier: productsV3.ConnectedModifier; /** Choice data */ choice: productsV3.ConnectedModifierChoice; /** Render prop function that receives choice data */ children: (props: ChoiceRenderProps) => React.ReactNode; } /** * Render props for ModifierChoice component */ export interface ChoiceRenderProps { /** Choice value to display */ value: string; /** Choice description (for color options) */ description: string | undefined; /** Whether this choice is currently selected */ isSelected: boolean; /** Function to select this choice */ select: () => void; /** Modifier name */ modifierName: string; /** Choice value */ choiceValue: string; /** Color code for swatch choices */ colorCode?: string; } /** * Headless component for individual modifier choice selection * * @component * @example * ```tsx * import { ProductModifiers } from '@wix/stores/components'; * * function ModifierChoiceButton({ modifier, choice }) { * return ( * * {({ value, description, isSelected, select, colorCode }) => ( * * {colorCode ? ( * * ) : ( * {value} * )} * {description && {description}} * * )} * * ); * } * ``` */ export declare function Choice(props: ChoiceProps): import("react").ReactNode; /** * Props for ModifierFreeText headless component */ export interface FreeTextProps { /** Product modifier data */ modifier: productsV3.ConnectedModifier; /** Render prop function that receives free text data */ children: (props: FreeTextRenderProps) => React.ReactNode; } /** * Render props for ModifierFreeText component */ export interface FreeTextRenderProps { /** Current text value */ value: string; /** Function to update text value */ setText: (value: string) => void; /** Whether this modifier is mandatory */ mandatory: boolean; /** Maximum characters allowed */ maxChars?: number; /** Placeholder text */ placeholder?: string; /** Character count */ charCount: number; /** Whether character limit is exceeded */ isOverLimit: boolean; /** Modifier name */ modifierName: string; } /** * Headless component for free text modifier input * * @component * @example * ```tsx * import { ProductModifiers } from '@wix/stores/components'; * * function FreeTextModifier({ modifier }) { * return ( * * {({ value, setText, mandatory, maxChars, placeholder, charCount, isOverLimit, modifierName }) => ( * * * {modifierName} {mandatory && *} * * setText(e.target.value)} * placeholder={placeholder} * maxLength={maxChars} * className={isOverLimit ? 'over-limit' : ''} * /> * {maxChars && ( * * {charCount}/{maxChars} * * )} * * )} * * ); * } * ``` */ export declare function FreeText(props: FreeTextProps): import("react").ReactNode; /** * Props for ModifierToggleFreeText headless component */ export interface ToggleFreeTextProps { /** Product modifier data */ modifier: productsV3.ConnectedModifier; /** Render prop function that receives toggle data */ children: (props: ToggleFreeTextRenderProps) => React.ReactNode; } /** * Render props for ModifierToggleFreeText component */ export interface ToggleFreeTextRenderProps { /** Whether the text input is shown */ isTextInputShown: boolean; /** Function to toggle text input visibility */ toggle: () => void; /** Whether this modifier is mandatory */ mandatory: boolean; /** Modifier name */ modifierName: string; } /** * Headless component for toggling free text modifier input * Used for optional free text modifiers where a checkbox shows/hides the input * * @component * @example * ```tsx * import { ProductModifiers } from '@wix/stores/components'; * * function ToggleFreeTextModifier({ modifier }) { * return ( * * {({ isTextInputShown, toggle, mandatory, modifierName }) => ( * * {!mandatory && ( * * * Add {modifierName} * * )} * {isTextInputShown && ( * * {(props) => ( * props.onChange(e.target.value)} * placeholder={props.placeholder} * /> * )} * * )} * * )} * * ); * } * ``` */ export declare function ToggleFreeText(props: ToggleFreeTextProps): import("react").ReactNode;