@wix/headless-stores 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/astro/actions/package.json +4 -0
- package/cjs/dist/astro/actions/custom-checkout.d.ts +50 -0
- package/cjs/dist/astro/actions/custom-checkout.js +53 -0
- package/cjs/dist/astro/actions/index.d.ts +1 -0
- package/cjs/dist/astro/actions/index.js +1 -0
- package/cjs/dist/data-component-tags.d.ts +8 -0
- package/cjs/dist/data-component-tags.js +9 -0
- package/cjs/dist/enums/index.d.ts +2 -0
- package/cjs/dist/enums/index.js +2 -0
- package/cjs/dist/enums/social-platform-enums.d.ts +25 -0
- package/cjs/dist/enums/social-platform-enums.js +27 -0
- package/cjs/dist/enums/sort-enums.d.ts +17 -0
- package/cjs/dist/enums/sort-enums.js +18 -0
- package/cjs/dist/react/Category.d.ts +242 -0
- package/cjs/dist/react/Category.js +235 -0
- package/cjs/dist/react/CategoryList.d.ts +107 -0
- package/cjs/dist/react/CategoryList.js +91 -0
- package/cjs/dist/react/Choice.d.ts +211 -0
- package/cjs/dist/react/Choice.js +213 -0
- package/cjs/dist/react/Option.d.ts +242 -0
- package/cjs/dist/react/Option.js +346 -0
- package/cjs/dist/react/Product.d.ts +1065 -0
- package/cjs/dist/react/Product.js +1157 -0
- package/cjs/dist/react/ProductList.d.ts +400 -0
- package/cjs/dist/react/ProductList.js +368 -0
- package/cjs/dist/react/core/CategoryList.d.ts +194 -0
- package/cjs/dist/react/core/CategoryList.js +180 -0
- package/cjs/dist/react/core/Product.d.ts +225 -0
- package/cjs/dist/react/core/Product.js +190 -0
- package/cjs/dist/react/core/ProductList.d.ts +235 -0
- package/cjs/dist/react/core/ProductList.js +217 -0
- package/cjs/dist/react/core/ProductListFilters.d.ts +138 -0
- package/cjs/dist/react/core/ProductListFilters.js +242 -0
- package/cjs/dist/react/core/ProductListPagination.d.ts +49 -0
- package/cjs/dist/react/core/ProductListPagination.js +41 -0
- package/cjs/dist/react/core/ProductListSort.d.ts +19 -0
- package/cjs/dist/react/core/ProductListSort.js +52 -0
- package/cjs/dist/react/core/ProductModifiers.d.ts +416 -0
- package/cjs/dist/react/core/ProductModifiers.js +413 -0
- package/cjs/dist/react/core/ProductVariantSelector.d.ts +313 -0
- package/cjs/dist/react/core/ProductVariantSelector.js +291 -0
- package/cjs/dist/react/core/SelectedVariant.d.ts +230 -0
- package/cjs/dist/react/core/SelectedVariant.js +269 -0
- package/cjs/dist/react/index.d.ts +6 -0
- package/cjs/dist/react/index.js +6 -0
- package/cjs/dist/react/types.d.ts +8 -0
- package/cjs/dist/react/types.js +9 -0
- package/cjs/dist/server-actions/custom-checkout-action.d.ts +49 -0
- package/cjs/dist/server-actions/custom-checkout-action.js +64 -0
- package/cjs/dist/server-actions/index.d.ts +1 -0
- package/cjs/dist/server-actions/index.js +1 -0
- package/cjs/dist/services/buy-now-service.d.ts +346 -0
- package/cjs/dist/services/buy-now-service.js +197 -0
- package/cjs/dist/services/categories-list-service.d.ts +164 -0
- package/cjs/dist/services/categories-list-service.js +148 -0
- package/cjs/dist/services/index.d.ts +5 -0
- package/cjs/dist/services/index.js +5 -0
- package/cjs/dist/services/pay-now-service.d.ts +214 -0
- package/cjs/dist/services/pay-now-service.js +156 -0
- package/cjs/dist/services/product-modifiers-service.d.ts +34 -0
- package/cjs/dist/services/product-modifiers-service.js +107 -0
- package/cjs/dist/services/product-service.d.ts +177 -0
- package/cjs/dist/services/product-service.js +190 -0
- package/cjs/dist/services/products-list-search-service.d.ts +1 -0
- package/cjs/dist/services/products-list-search-service.js +1 -0
- package/cjs/dist/services/products-list-service.d.ts +429 -0
- package/cjs/dist/services/products-list-service.js +893 -0
- package/cjs/dist/services/selected-variant-service.d.ts +66 -0
- package/cjs/dist/services/selected-variant-service.js +527 -0
- package/cjs/dist/utils/index.d.ts +1 -0
- package/cjs/dist/utils/index.js +30 -0
- package/cjs/dist/utils/url-params.d.ts +73 -0
- package/cjs/dist/utils/url-params.js +114 -0
- package/cjs/package.json +3 -0
- package/dist/astro/actions/custom-checkout.d.ts +50 -0
- package/dist/astro/actions/custom-checkout.js +53 -0
- package/dist/astro/actions/index.d.ts +1 -0
- package/dist/astro/actions/index.js +1 -0
- package/dist/data-component-tags.d.ts +8 -0
- package/dist/data-component-tags.js +9 -0
- package/dist/enums/index.d.ts +2 -0
- package/dist/enums/index.js +2 -0
- package/dist/enums/social-platform-enums.d.ts +25 -0
- package/dist/enums/social-platform-enums.js +27 -0
- package/dist/enums/sort-enums.d.ts +17 -0
- package/dist/enums/sort-enums.js +18 -0
- package/dist/react/Category.d.ts +242 -0
- package/dist/react/Category.js +235 -0
- package/dist/react/CategoryList.d.ts +107 -0
- package/dist/react/CategoryList.js +91 -0
- package/dist/react/Choice.d.ts +211 -0
- package/dist/react/Choice.js +213 -0
- package/dist/react/Option.d.ts +242 -0
- package/dist/react/Option.js +346 -0
- package/dist/react/Product.d.ts +1065 -0
- package/dist/react/Product.js +1157 -0
- package/dist/react/ProductList.d.ts +400 -0
- package/dist/react/ProductList.js +368 -0
- package/dist/react/core/CategoryList.d.ts +194 -0
- package/dist/react/core/CategoryList.js +180 -0
- package/dist/react/core/Product.d.ts +225 -0
- package/dist/react/core/Product.js +190 -0
- package/dist/react/core/ProductList.d.ts +235 -0
- package/dist/react/core/ProductList.js +217 -0
- package/dist/react/core/ProductListFilters.d.ts +138 -0
- package/dist/react/core/ProductListFilters.js +242 -0
- package/dist/react/core/ProductListPagination.d.ts +49 -0
- package/dist/react/core/ProductListPagination.js +41 -0
- package/dist/react/core/ProductListSort.d.ts +19 -0
- package/dist/react/core/ProductListSort.js +52 -0
- package/dist/react/core/ProductModifiers.d.ts +416 -0
- package/dist/react/core/ProductModifiers.js +413 -0
- package/dist/react/core/ProductVariantSelector.d.ts +313 -0
- package/dist/react/core/ProductVariantSelector.js +291 -0
- package/dist/react/core/SelectedVariant.d.ts +230 -0
- package/dist/react/core/SelectedVariant.js +269 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.js +6 -0
- package/dist/react/types.d.ts +8 -0
- package/dist/react/types.js +9 -0
- package/dist/server-actions/custom-checkout-action.d.ts +49 -0
- package/dist/server-actions/custom-checkout-action.js +64 -0
- package/dist/server-actions/index.d.ts +1 -0
- package/dist/server-actions/index.js +1 -0
- package/dist/services/buy-now-service.d.ts +346 -0
- package/dist/services/buy-now-service.js +197 -0
- package/dist/services/categories-list-service.d.ts +164 -0
- package/dist/services/categories-list-service.js +148 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/services/index.js +5 -0
- package/dist/services/pay-now-service.d.ts +214 -0
- package/dist/services/pay-now-service.js +156 -0
- package/dist/services/product-modifiers-service.d.ts +34 -0
- package/dist/services/product-modifiers-service.js +107 -0
- package/dist/services/product-service.d.ts +177 -0
- package/dist/services/product-service.js +190 -0
- package/dist/services/products-list-search-service.d.ts +0 -0
- package/dist/services/products-list-search-service.js +1 -0
- package/dist/services/products-list-service.d.ts +429 -0
- package/dist/services/products-list-service.js +893 -0
- package/dist/services/selected-variant-service.d.ts +66 -0
- package/dist/services/selected-variant-service.js +527 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +30 -0
- package/dist/utils/url-params.d.ts +73 -0
- package/dist/utils/url-params.js +114 -0
- package/package.json +89 -0
- package/react/package.json +4 -0
- package/server-actions/package.json +4 -0
- package/services/package.json +4 -0
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import type { V3Product } from '@wix/auto_sdk_stores_products-v-3';
|
|
2
|
+
import { Sort as SortPrimitive, GenericListTotalsRenderProps, GenericListLoadMoreRenderProps, ListVariant, GenericListRepeaterRenderProps } from '@wix/headless-components/react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import type { ProductsListServiceConfig } from '../services/products-list-service.js';
|
|
5
|
+
import { productsV3 } from '@wix/stores';
|
|
6
|
+
import { AsChildChildren } from '@wix/headless-utils/react';
|
|
7
|
+
/**
|
|
8
|
+
* Props for the ProductList root component following the documented API
|
|
9
|
+
*/
|
|
10
|
+
export interface ProductListRootProps {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
products?: V3Product[];
|
|
13
|
+
productsListConfig?: ProductsListServiceConfig;
|
|
14
|
+
className?: string;
|
|
15
|
+
variant?: ListVariant;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Root component that provides the ProductList service context for rendering product lists.
|
|
19
|
+
*
|
|
20
|
+
* @order 1
|
|
21
|
+
* @component
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* import { ProductList } from '@wix/stores/components';
|
|
25
|
+
*
|
|
26
|
+
* function ProductListPage({ products }) {
|
|
27
|
+
* return (
|
|
28
|
+
* <ProductList.Root products={products}>
|
|
29
|
+
* <ProductList.Products>
|
|
30
|
+
* <ProductList.ProductRepeater>
|
|
31
|
+
* <Product.Name />
|
|
32
|
+
* <Product.Price />
|
|
33
|
+
* </ProductList.ProductRepeater>
|
|
34
|
+
* </ProductList.Products>
|
|
35
|
+
* </ProductList.Root>
|
|
36
|
+
* );
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const Root: React.ForwardRefExoticComponent<ProductListRootProps & React.RefAttributes<HTMLElement>>;
|
|
41
|
+
/**
|
|
42
|
+
* Props for ProductList Raw component
|
|
43
|
+
*/
|
|
44
|
+
export interface RawProps {
|
|
45
|
+
children: ((props: {
|
|
46
|
+
totalProducts: number;
|
|
47
|
+
displayedProducts: number;
|
|
48
|
+
isFiltered: boolean;
|
|
49
|
+
}) => React.ReactNode) | React.ReactNode;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Raw component that provides direct access to product list data.
|
|
53
|
+
* Similar to Product.Raw, this should only be used when you need custom access to list data.
|
|
54
|
+
*
|
|
55
|
+
* @component
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* <ProductList.Raw>
|
|
59
|
+
* {({ totalProducts, displayedProducts, isFiltered }) => (
|
|
60
|
+
* <div className="text-content-muted">
|
|
61
|
+
* Showing {displayedProducts} of {totalProducts} products
|
|
62
|
+
* {isFiltered && <span className="ml-2 text-brand-primary">(Filtered)</span>}
|
|
63
|
+
* </div>
|
|
64
|
+
* )}
|
|
65
|
+
* </ProductList.Raw>
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare const Raw: React.ForwardRefExoticComponent<RawProps & React.RefAttributes<HTMLElement>>;
|
|
69
|
+
/**
|
|
70
|
+
* Props for ProductList Products component
|
|
71
|
+
*/
|
|
72
|
+
export interface ProductsProps {
|
|
73
|
+
children: React.ReactNode;
|
|
74
|
+
emptyState?: React.ReactNode;
|
|
75
|
+
infiniteScroll?: boolean;
|
|
76
|
+
pageSize?: number;
|
|
77
|
+
className?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Container for the product list with empty state support.
|
|
81
|
+
* Follows List Container Level pattern.
|
|
82
|
+
*
|
|
83
|
+
* @component
|
|
84
|
+
* @example
|
|
85
|
+
* ```tsx
|
|
86
|
+
* <ProductList.Products emptyState={<div>No products found</div>}>
|
|
87
|
+
* <ProductList.ProductRepeater>
|
|
88
|
+
* <Product.Name />
|
|
89
|
+
* <Product.Price />
|
|
90
|
+
* </ProductList.ProductRepeater>
|
|
91
|
+
* </ProductList.Products>
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare const Products: React.ForwardRefExoticComponent<ProductsProps & React.RefAttributes<HTMLElement>>;
|
|
95
|
+
/**
|
|
96
|
+
* Render props for ProductRepeater asChild pattern
|
|
97
|
+
*/
|
|
98
|
+
export type ProductRepeaterRenderProps = GenericListRepeaterRenderProps<V3Product>;
|
|
99
|
+
/**
|
|
100
|
+
* Props for ProductList ProductRepeater component
|
|
101
|
+
*/
|
|
102
|
+
export interface ProductRepeaterProps {
|
|
103
|
+
children: React.ReactNode | ((props: ProductRepeaterRenderProps, ref: React.Ref<HTMLElement>) => React.ReactNode);
|
|
104
|
+
/** Whether to render as child component (asChild pattern) */
|
|
105
|
+
asChild?: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Repeater component that renders Product.Root for each product.
|
|
109
|
+
* Follows Repeater Level pattern and uses GenericList.Repeater for consistency.
|
|
110
|
+
* Supports asChild pattern for advanced layout components like GalleryWrapper.
|
|
111
|
+
*
|
|
112
|
+
* @component
|
|
113
|
+
* @example
|
|
114
|
+
* ```tsx
|
|
115
|
+
* // Standard usage
|
|
116
|
+
* <ProductList.ProductRepeater>
|
|
117
|
+
* <Product.Name />
|
|
118
|
+
* <Product.Price />
|
|
119
|
+
* </ProductList.ProductRepeater>
|
|
120
|
+
*
|
|
121
|
+
* // AsChild usage with GalleryWrapper
|
|
122
|
+
* <ProductList.ProductRepeater asChild>
|
|
123
|
+
* {({ items, variant, itemWrapper }) => (
|
|
124
|
+
* <GalleryWrapper
|
|
125
|
+
* items={items}
|
|
126
|
+
* variant={variant}
|
|
127
|
+
* itemRenderer={(item, index) =>
|
|
128
|
+
* itemWrapper({ item, index, children: <>
|
|
129
|
+
* <Product.Name />
|
|
130
|
+
* <Product.Price />
|
|
131
|
+
* </> })
|
|
132
|
+
* }
|
|
133
|
+
* />
|
|
134
|
+
* )}
|
|
135
|
+
* </ProductList.ProductRepeater>
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export declare const ProductRepeater: React.ForwardRefExoticComponent<ProductRepeaterProps & React.RefAttributes<HTMLElement>>;
|
|
139
|
+
/**
|
|
140
|
+
* Props for ProductList LoadMoreTrigger component
|
|
141
|
+
*/
|
|
142
|
+
export interface LoadMoreTriggerProps {
|
|
143
|
+
/** Custom render function when using asChild */
|
|
144
|
+
children?: React.ReactNode | React.ForwardRefRenderFunction<HTMLButtonElement, GenericListLoadMoreRenderProps>;
|
|
145
|
+
/**
|
|
146
|
+
* Whether to render as a child component.
|
|
147
|
+
* @default false
|
|
148
|
+
*/
|
|
149
|
+
asChild?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* The CSS classes to apply to the button.
|
|
152
|
+
*/
|
|
153
|
+
className?: string;
|
|
154
|
+
/**
|
|
155
|
+
* The label to display inside the button.
|
|
156
|
+
*/
|
|
157
|
+
label?: string;
|
|
158
|
+
/**
|
|
159
|
+
* The loading state to display inside the button.
|
|
160
|
+
*/
|
|
161
|
+
loadingState?: React.ReactNode;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Displays a button to load more products. Not rendered if infiniteScroll is false or no products are left to load.
|
|
165
|
+
* Follows the architecture rules - does not support asChild as it's a simple trigger component.
|
|
166
|
+
*
|
|
167
|
+
* @component
|
|
168
|
+
* @example
|
|
169
|
+
* ```tsx
|
|
170
|
+
* <ProductList.LoadMoreTrigger asChild>
|
|
171
|
+
* <button>Load More</button>
|
|
172
|
+
* </ProductList.LoadMoreTrigger>
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
export declare const LoadMoreTrigger: React.ForwardRefExoticComponent<LoadMoreTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
176
|
+
/**
|
|
177
|
+
* Props for ProductList Totals Displayed component
|
|
178
|
+
*/
|
|
179
|
+
export interface TotalsDisplayedProps {
|
|
180
|
+
/** Whether to render as a child component */
|
|
181
|
+
asChild?: boolean;
|
|
182
|
+
/** Custom render function when using asChild */
|
|
183
|
+
children?: AsChildChildren<GenericListTotalsRenderProps>;
|
|
184
|
+
/** CSS classes to apply to the default element */
|
|
185
|
+
className?: string;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Displays the number of products currently displayed.
|
|
189
|
+
*
|
|
190
|
+
* @component
|
|
191
|
+
* @example
|
|
192
|
+
* ```tsx
|
|
193
|
+
* <ProductList.TotalsDisplayed />
|
|
194
|
+
* // or with asChild
|
|
195
|
+
* <ProductList.TotalsDisplayed asChild>
|
|
196
|
+
* <strong />
|
|
197
|
+
* </ProductList.TotalsDisplayed>
|
|
198
|
+
* // or with render function
|
|
199
|
+
* <ProductList.TotalsDisplayed asChild>
|
|
200
|
+
* {({ displayedItems }, ref) => <strong ref={ref}>{displayedItems}</strong>}
|
|
201
|
+
* </ProductList.TotalsDisplayed>
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
export declare const TotalsDisplayed: React.ForwardRefExoticComponent<TotalsDisplayedProps & React.RefAttributes<HTMLElement>>;
|
|
205
|
+
/**
|
|
206
|
+
* Props for the ProductList Sort component
|
|
207
|
+
*/
|
|
208
|
+
export interface SortProps {
|
|
209
|
+
/**
|
|
210
|
+
* Render function that provides sort state and controls when using asChild pattern.
|
|
211
|
+
* Only called when asChild is true and children is provided.
|
|
212
|
+
*
|
|
213
|
+
* @param props.currentSort - Current sort configuration from Wix Stores API
|
|
214
|
+
* @param props.sortOptions - Available sort options with field names, order, and labels
|
|
215
|
+
* @param props.setSort - Function to update the sort configuration
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```tsx
|
|
219
|
+
* <ProductList.Sort asChild>
|
|
220
|
+
* {({ currentSort, sortOptions, setSort }) => (
|
|
221
|
+
* <CustomSortSelect
|
|
222
|
+
* value={currentSort}
|
|
223
|
+
* options={sortOptions}
|
|
224
|
+
* onChange={setSort}
|
|
225
|
+
* />
|
|
226
|
+
* )}
|
|
227
|
+
* </ProductList.Sort>
|
|
228
|
+
* ```
|
|
229
|
+
*/
|
|
230
|
+
children?: (props: {
|
|
231
|
+
currentSort: productsV3.V3ProductSearch['sort'];
|
|
232
|
+
sortOptions: SortPrimitive.SortOption[];
|
|
233
|
+
setSort: (sort: productsV3.V3ProductSearch['sort']) => void;
|
|
234
|
+
}) => React.ReactNode;
|
|
235
|
+
/**
|
|
236
|
+
* CSS classes to apply to the sort component.
|
|
237
|
+
* Only used when asChild is false (default rendering).
|
|
238
|
+
*/
|
|
239
|
+
className?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Render mode for the default sort component.
|
|
242
|
+
* - 'select': Renders as HTML select dropdown
|
|
243
|
+
* - 'list': Renders as clickable list of options
|
|
244
|
+
*
|
|
245
|
+
* @default 'select'
|
|
246
|
+
*/
|
|
247
|
+
as?: 'select' | 'list';
|
|
248
|
+
/**
|
|
249
|
+
* When true, the component uses the asChild pattern and delegates
|
|
250
|
+
* rendering to the children render function. When false (default),
|
|
251
|
+
* renders the built-in Sort.Root component.
|
|
252
|
+
*
|
|
253
|
+
* @default false
|
|
254
|
+
*/
|
|
255
|
+
asChild?: boolean;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Sort component for product lists that provides sorting functionality.
|
|
259
|
+
*
|
|
260
|
+
* This component integrates with the ProductList service to provide predefined sort options
|
|
261
|
+
* including name (A-Z, Z-A) and price (low to high, high to low). It supports both
|
|
262
|
+
* controlled rendering via the asChild pattern and default UI rendering.
|
|
263
|
+
*
|
|
264
|
+
* @component
|
|
265
|
+
* @example
|
|
266
|
+
* ```tsx
|
|
267
|
+
* // Default select dropdown
|
|
268
|
+
* <ProductList.Sort />
|
|
269
|
+
*
|
|
270
|
+
* // As list of clickable options
|
|
271
|
+
* <ProductList.Sort as="list" />
|
|
272
|
+
*
|
|
273
|
+
* // With custom styling
|
|
274
|
+
* <ProductList.Sort
|
|
275
|
+
* as="select"
|
|
276
|
+
* className="custom-sort-select"
|
|
277
|
+
* />
|
|
278
|
+
*
|
|
279
|
+
* // Custom implementation using asChild pattern
|
|
280
|
+
* <ProductList.Sort asChild>
|
|
281
|
+
* {({ currentSort, sortOptions, setSort }) => (
|
|
282
|
+
* <div className="custom-sort-container">
|
|
283
|
+
* {sortOptions.map((option) => (
|
|
284
|
+
* <button
|
|
285
|
+
* key={`${option.fieldName}-${option.order}`}
|
|
286
|
+
* onClick={() => setSort([{ fieldName: option.fieldName, order: option.order }])}
|
|
287
|
+
* className={isCurrentSort(option) ? 'active' : ''}
|
|
288
|
+
* >
|
|
289
|
+
* {option.label}
|
|
290
|
+
* </button>
|
|
291
|
+
* ))}
|
|
292
|
+
* </div>
|
|
293
|
+
* )}
|
|
294
|
+
* </ProductList.Sort>
|
|
295
|
+
* ```
|
|
296
|
+
*
|
|
297
|
+
* @see {@link ProductListSortPrimitive} for the underlying sort logic
|
|
298
|
+
* @see {@link SortPrimitive.Root} for the primitive sort component
|
|
299
|
+
*/
|
|
300
|
+
export declare const Sort: React.ForwardRefExoticComponent<SortProps & React.RefAttributes<HTMLElement>>;
|
|
301
|
+
/**
|
|
302
|
+
* Props for ProductList Filter component
|
|
303
|
+
*/
|
|
304
|
+
export interface FilterProps {
|
|
305
|
+
/** Whether to render as a child component */
|
|
306
|
+
asChild?: boolean;
|
|
307
|
+
/** Child components that will have access to filter functionality */
|
|
308
|
+
children: React.ReactNode;
|
|
309
|
+
/** CSS classes to apply to the default element */
|
|
310
|
+
className?: string;
|
|
311
|
+
}
|
|
312
|
+
export declare const Filter: {
|
|
313
|
+
Root: React.ForwardRefExoticComponent<FilterProps & React.RefAttributes<HTMLElement>>;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Props for ProductList FilterResetTrigger component
|
|
317
|
+
*/
|
|
318
|
+
export interface FilterResetTriggerProps {
|
|
319
|
+
/** Whether to render as a child component */
|
|
320
|
+
asChild?: boolean;
|
|
321
|
+
/** Custom render function when using asChild */
|
|
322
|
+
children?: AsChildChildren<{
|
|
323
|
+
resetFilters: () => void;
|
|
324
|
+
isFiltered: boolean;
|
|
325
|
+
}>;
|
|
326
|
+
/** CSS classes to apply to the default element */
|
|
327
|
+
className?: string;
|
|
328
|
+
/** Label for the button */
|
|
329
|
+
label?: string;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Reset trigger component for clearing all applied filters.
|
|
333
|
+
* Provides reset functionality and filter state to custom render functions.
|
|
334
|
+
* Only renders when filters are applied.
|
|
335
|
+
*
|
|
336
|
+
* @component
|
|
337
|
+
* @example
|
|
338
|
+
* ```tsx
|
|
339
|
+
* // Default usage
|
|
340
|
+
* <ProductList.FilterResetTrigger className="reset-filters-btn" />
|
|
341
|
+
*
|
|
342
|
+
* // With custom label
|
|
343
|
+
* <ProductList.FilterResetTrigger label="Clear Filters" />
|
|
344
|
+
*
|
|
345
|
+
* // Custom rendering with forwardRef
|
|
346
|
+
* <ProductList.FilterResetTrigger asChild>
|
|
347
|
+
* {React.forwardRef(({resetFilters, isFiltered, ...props}, ref) => (
|
|
348
|
+
* <button
|
|
349
|
+
* ref={ref}
|
|
350
|
+
* {...props}
|
|
351
|
+
* onClick={resetFilters}
|
|
352
|
+
* disabled={!isFiltered}
|
|
353
|
+
* className="custom-reset-button disabled:opacity-50"
|
|
354
|
+
* >
|
|
355
|
+
* Reset All Filters
|
|
356
|
+
* </button>
|
|
357
|
+
* ))}
|
|
358
|
+
* </ProductList.FilterResetTrigger>
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
export declare const FilterResetTrigger: React.ForwardRefExoticComponent<FilterResetTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
362
|
+
/**
|
|
363
|
+
* Props for ProductList Error component
|
|
364
|
+
*/
|
|
365
|
+
export interface ErrorProps {
|
|
366
|
+
/** Whether to render as a child component */
|
|
367
|
+
asChild?: boolean;
|
|
368
|
+
/** Custom render function when using asChild */
|
|
369
|
+
children?: AsChildChildren<{
|
|
370
|
+
error: string | null;
|
|
371
|
+
}>;
|
|
372
|
+
/** CSS classes to apply to the default element */
|
|
373
|
+
className?: string;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Error component that displays product list errors.
|
|
377
|
+
* Provides error data to custom render functions.
|
|
378
|
+
* Only renders when there's an error.
|
|
379
|
+
*
|
|
380
|
+
* @component
|
|
381
|
+
* @example
|
|
382
|
+
* ```tsx
|
|
383
|
+
* // Default usage
|
|
384
|
+
* <ProductList.Error className="error-message" />
|
|
385
|
+
*
|
|
386
|
+
* // Custom rendering with forwardRef
|
|
387
|
+
* <ProductList.Error asChild>
|
|
388
|
+
* {React.forwardRef(({error, ...props}, ref) => (
|
|
389
|
+
* <div
|
|
390
|
+
* ref={ref}
|
|
391
|
+
* {...props}
|
|
392
|
+
* className="custom-error-container"
|
|
393
|
+
* >
|
|
394
|
+
* Error: {error}
|
|
395
|
+
* </div>
|
|
396
|
+
* ))}
|
|
397
|
+
* </ProductList.Error>
|
|
398
|
+
* ```
|
|
399
|
+
*/
|
|
400
|
+
export declare const Error: React.ForwardRefExoticComponent<ErrorProps & React.RefAttributes<HTMLElement>>;
|