/**
* @fileoverview MediaGallery Primitive Components
*
* This module provides unstyled, composable components for building media galleries.
* These components follow the Radix UI primitive pattern, offering:
*
* - **Unstyled**: No default styling, only functional behavior
* - **Composable**: Support for the `asChild` pattern for flexible DOM structure
* - **Accessible**: Built-in keyboard navigation and ARIA attributes
* - **Flexible**: Render props pattern for maximum customization
*
* ## Architecture
*
* These components are the **primitive layer** that sits between:
* 1. **Core components** (pure logic, no DOM)
* 2. **Styled components** (project-specific styling)
*
* ## Usage
*
* ```tsx
* import { MediaGallery } from '@wix/headless-media/react';
*
* function ProductGallery({ productMedia }) {
* return (
*
*
*
*
*
*
*
*
*
*
*
* );
* }
* ```
*
* @module MediaGallery
*/
import React from 'react';
import type { MediaGalleryServiceConfig } from '../services/media-gallery-service.js';
import { AsChildChildren } from '@wix/headless-utils/react';
export declare enum TestIds {
mediaGalleryRoot = "media-gallery-root",
mediaGalleryNext = "media-gallery-next",
mediaGalleryPrevious = "media-gallery-previous",
mediaGalleryViewport = "media-gallery-viewport",
mediaGalleryIndicator = "media-gallery-indicator",
mediaGalleryThumbnailItem = "media-gallery-thumbnail-item"
}
/**
* Props for button-like components that support the asChild pattern
*/
export interface ButtonProps extends React.ButtonHTMLAttributes {
/** When true, the component will not render its own element but forward its props to its child */
asChild?: boolean;
}
/**
* Props for the Root component
*/
export interface RootProps {
/** Child components that will have access to the media gallery context */
children: React.ReactNode;
/** Configuration for the media gallery service */
mediaGalleryServiceConfig: MediaGalleryServiceConfig;
}
/**
* Root component that provides media gallery service context to its children.
* This is a primitive wrapper around the core Root component that maintains
* the same API while providing a foundation for composition patterns.
*
* @component
* @example
* ```tsx
* import { MediaGallery } from '@wix/headless-media/react';
*
* function ProductGallery({ productMedia }) {
* return (
*
*
*
*
*
*
*
*
* );
* }
* ```
*/
export declare const Root: ({ children, mediaGalleryServiceConfig }: RootProps) => import("react/jsx-runtime").JSX.Element;
/**
* Next button component that navigates to the next media item.
* Supports the asChild pattern for flexible composition.
*
* @component
* @example
* ```tsx
* // Default button
*
*
* // Custom button with asChild
*
*
*
*
* // With custom content
*
* Next Image →
*
* ```
*/
export declare const Next: React.ForwardRefExoticComponent>;
/**
* Previous button component that navigates to the previous media item.
* Supports the asChild pattern for flexible composition.
*
* @component
* @example
* ```tsx
* // Default button
*
*
* // Custom button with asChild
*
*
*
*
* // With custom content
*
* ← Previous Image
*
* ```
*/
export declare const Previous: React.ForwardRefExoticComponent>;
/**
* Props for the Viewport component
*/
export interface ViewportProps extends Omit, 'children'> {
/** Optional children to render instead of the default image. Renders default media image if not provided */
children?: AsChildChildren<{
src: string;
alt: string;
}>;
/** When true, the component will not render its own element but forward its props to its child */
asChild?: boolean;
/** Custom empty state content to display when no media is available */
emptyState?: React.ReactNode;
}
/**
* Viewport component that displays the currently selected media item.
* Automatically renders the active media using WixMediaImage for optimization.
* Supports the asChild pattern and custom empty states.
*
* @component
* @example
* ```tsx
* // Default viewport
*
*
* // With custom styling
*
*
* // With custom empty state
* No images available}
* />
*
* // Using asChild for custom wrapper
*
*
* Content will be rendered here
*
*
*
* // With completely custom children
*
*
*
* ```
*/
export declare const Viewport: React.ForwardRefExoticComponent>;
/**
* Props for the Indicator component
*/
export interface IndicatorProps extends React.HTMLAttributes {
/** Optional children to render instead of the default "current / total" format */
children?: React.ReactNode;
/** When true, the component will not render its own element but forward its props to its child */
asChild?: boolean;
}
/**
* Indicator component that displays the current media position (e.g., "1 / 5").
* Automatically tracks the current and total media count.
* Supports the asChild pattern for flexible styling.
*
* @component
* @example
* ```tsx
* // Default indicator
*
*
* // With custom styling
*
*
* // Using asChild for custom wrapper
*
*
* "1 / 5" will be rendered here
*
*
*
* // With completely custom children
*
*
*
* ```
*/
export declare const Indicator: React.ForwardRefExoticComponent>;
/**
* Props for the Thumbnails component
*/
export interface ThumbnailsProps {
/** Child components that will have access to the thumbnail context */
children: React.ReactNode;
}
/**
* Thumbnails container component that provides thumbnail context to its children.
* Only renders when there are multiple media items to display.
*
* @component
* @example
* ```tsx
*
*
*
*
*
* ```
*/
export declare const Thumbnails: ({ children }: ThumbnailsProps) => import("react/jsx-runtime").JSX.Element;
/**
* Props for the ThumbnailRepeater component
*/
export interface ThumbnailRepeaterProps {
/** Template to repeat for each thumbnail item */
children: React.ReactNode;
}
/**
* ThumbnailRepeater component that renders a template for each media item.
* Provides index context to each thumbnail item. Only renders when there are
* multiple media items available.
*
* @component
* @example
* ```tsx
*
*
*
* ```
*/
export declare const ThumbnailRepeater: ({ children }: ThumbnailRepeaterProps) => import("react/jsx-runtime").JSX.Element | null;
/**
* Props for the ThumbnailItem component
*/
export interface ThumbnailItemProps extends Omit, 'children'> {
/** Optional children to render instead of the default thumbnail */
children?: AsChildChildren<{
src: string;
alt: string;
isActive: boolean;
select: () => void;
index: number;
}>;
/** When true, the component will not render its own element but forward its props to its child */
asChild?: boolean;
/** Custom empty state content to display when the thumbnail has no media */
emptyState?: React.ReactNode;
}
/**
* ThumbnailItem component that renders an individual thumbnail for media selection.
* Automatically handles selection state, click events, and renders the thumbnail image.
* Must be used within a ThumbnailRepeater context.
*
* @component
* @example
* ```tsx
* // Default thumbnail item
*
*
* // With custom styling
*
*
* // With custom empty state
* No preview}
* />
*
* // Using asChild for custom wrapper
*
*
*
*
* // With completely custom children
*
*
*
* ```
*/
export declare const ThumbnailItem: React.ForwardRefExoticComponent>;