import { Sort as SortPrimitive, type GenericListRepeaterRenderProps, type ListVariant } from '@wix/headless-components/react';
import { AsChildChildren } from '@wix/headless-utils/react';
import React from 'react';
import { type BlogFeedServiceConfig, type PostWithResolvedFields, type QueryPostsSort } from '../services/blog-feed-service.js';
interface PostsContextValue {
hasPosts: boolean;
posts: PostWithResolvedFields[];
totalPosts: number;
isLoading: boolean;
fallbackImageUrl?: string;
}
export declare function usePostsContext(): PostsContextValue;
export interface BlogFeedRootProps {
asChild?: boolean;
className?: string;
children: AsChildChildren<{
hasPosts: boolean;
}> | React.ReactNode;
blogFeedServiceConfig: BlogFeedServiceConfig;
fallbackImageUrl?: string;
variant?: ListVariant;
}
/**
* Root container for blog feed that provides posts context to all child components.
* Follows Container Level pattern from architecture rules.
*
* @order 1
* @component
* @example
* ```tsx
* import { Blog } from '@wix/blog/components';
*
* function BlogPage() {
* return (
*
* No posts found}>
*
*
*
*
*
*
* );
* }
* ```
*/
export declare const Root: React.ForwardRefExoticComponent>;
export interface PostItemsProps {
children: React.ReactNode;
className?: string;
emptyState?: React.ReactNode;
}
/**
* Container for the posts list with empty state support.
* Follows List Container Level pattern from architecture rules.
*
* @component
* @example
* ```tsx
* No posts found}>
*
*
*
*
*
* ```
*/
export declare const PostItems: React.ForwardRefExoticComponent>;
export type PostRepeaterRenderProps = GenericListRepeaterRenderProps;
export interface SortProps {
/**
* Render function that provides sort state and controls when using asChild pattern.
* Only called when asChild is true and children is provided.
*
* @param props.currentSort - Current sort configuration from Wix Blog API
* @param props.sortOptions - Available sort options with field names, order, and labels
* @param props.setSort - Function to update the sort configuration
*
* @example
* ```tsx
*
* {({ currentSort, sortOptions, setSort }) => (
*
* )}
*
* ```
*/
children?: (props: {
currentSort: QueryPostsSort[];
sortOptions: SortPrimitive.SortOption[];
setSort: (sort: QueryPostsSort[]) => void;
}) => React.ReactNode;
/**
* CSS classes to apply to the sort component.
* Only used when asChild is false (default rendering).
*/
className?: string;
/**
* Render mode for the default sort component.
* - 'select': Renders as HTML select dropdown
* - 'list': Renders as clickable list of options
*
* @default 'select'
*/
as?: 'select' | 'list';
/**
* When true, the component uses the asChild pattern and delegates
* rendering to the children render function. When false (default),
* renders the built-in Sort.Root component.
*
* @default false
*/
asChild?: boolean;
}
/**
* Sort component for blog feed that provides sorting functionality.
*
* This component integrates with the BlogFeed service to provide predefined sort options
* supports both controlled rendering via the asChild pattern and default UI rendering.
*
* @component
* @example
* ```tsx
* // Default select dropdown
*
*
* // As list of clickable options
*
*
* // With custom styling
*
* ```
*/
export declare const Sort: React.ForwardRefExoticComponent>;
export interface PostItemRepeaterProps {
children: React.ReactNode | ((props: PostRepeaterRenderProps, ref: React.Ref) => React.ReactNode);
offset?: number;
limit?: number;
asChild?: boolean;
}
/**
* Repeater component that creates individual post contexts for each post.
* Follows Repeater Level pattern from architecture rules and uses GenericList.Repeater for consistency.
* Supports asChild pattern for advanced layout components.
*
* @component
* @example
* ```tsx
* // Standard usage
*
*
*
*
*
*
* // AsChild usage with custom wrapper and conditional rendering
*
* {({ itemWrapper, items }) => (
* <>
* {items.map((item, index) =>
* itemWrapper({
* item,
* index,
* children:
* index === 0 ? (
*
*
*
*
*
* ) : (
*
*
*
*
* ),
* })
* )}
* >
* )}
*
* ```
*/
export declare const PostItemRepeater: React.ForwardRefExoticComponent>;
export interface LoadMoreProps {
className?: string;
loadingState?: React.ReactNode;
children?: React.ReactNode;
}
/**
* Load more trigger component for pagination.
*
* @component
* @example
* ```tsx
*
*
*
* ```
*/
export declare const LoadMore: React.ForwardRefExoticComponent>;
export {};