@wix/headless-stores 0.0.56 → 0.0.58

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.
Files changed (51) hide show
  1. package/cjs/dist/react/Category.d.ts +1 -0
  2. package/cjs/dist/react/Category.js +11 -22
  3. package/cjs/dist/react/CategoryList.js +2 -3
  4. package/cjs/dist/react/Product.d.ts +73 -30
  5. package/cjs/dist/react/Product.js +27 -145
  6. package/cjs/dist/react/ProductList.d.ts +9 -4
  7. package/cjs/dist/react/ProductList.js +4 -32
  8. package/cjs/dist/react/ProductListSort.d.ts +14 -0
  9. package/cjs/dist/react/ProductListSort.js +14 -0
  10. package/cjs/dist/react/core/ProductList.d.ts +3 -0
  11. package/cjs/dist/react/core/ProductList.js +2 -0
  12. package/cjs/dist/react/core/ProductListFilters.d.ts +8 -180
  13. package/cjs/dist/react/core/ProductListFilters.js +137 -171
  14. package/cjs/dist/react/core/ProductListPagination.d.ts +0 -192
  15. package/cjs/dist/react/core/ProductListPagination.js +2 -160
  16. package/cjs/dist/react/core/ProductListSort.d.ts +9 -57
  17. package/cjs/dist/react/core/ProductListSort.js +32 -52
  18. package/cjs/dist/react/core/SelectedVariant.js +2 -2
  19. package/cjs/dist/services/index.d.ts +2 -2
  20. package/cjs/dist/services/products-list-search-service.d.ts +3 -162
  21. package/cjs/dist/services/products-list-search-service.js +31 -424
  22. package/cjs/dist/services/products-list-service.d.ts +86 -4
  23. package/cjs/dist/services/products-list-service.js +125 -4
  24. package/cjs/dist/utils/renderChildren.d.ts +2 -1
  25. package/cjs/dist/utils/renderChildren.js +5 -2
  26. package/dist/react/Category.d.ts +1 -0
  27. package/dist/react/Category.js +11 -22
  28. package/dist/react/CategoryList.js +2 -3
  29. package/dist/react/Product.d.ts +73 -30
  30. package/dist/react/Product.js +27 -145
  31. package/dist/react/ProductList.d.ts +9 -4
  32. package/dist/react/ProductList.js +4 -32
  33. package/dist/react/ProductListSort.d.ts +14 -0
  34. package/dist/react/ProductListSort.js +14 -0
  35. package/dist/react/core/ProductList.d.ts +3 -0
  36. package/dist/react/core/ProductList.js +2 -0
  37. package/dist/react/core/ProductListFilters.d.ts +8 -180
  38. package/dist/react/core/ProductListFilters.js +137 -171
  39. package/dist/react/core/ProductListPagination.d.ts +0 -192
  40. package/dist/react/core/ProductListPagination.js +2 -160
  41. package/dist/react/core/ProductListSort.d.ts +9 -57
  42. package/dist/react/core/ProductListSort.js +32 -52
  43. package/dist/react/core/SelectedVariant.js +2 -2
  44. package/dist/services/index.d.ts +2 -2
  45. package/dist/services/products-list-search-service.d.ts +3 -162
  46. package/dist/services/products-list-search-service.js +31 -424
  47. package/dist/services/products-list-service.d.ts +86 -4
  48. package/dist/services/products-list-service.js +125 -4
  49. package/dist/utils/renderChildren.d.ts +2 -1
  50. package/dist/utils/renderChildren.js +5 -2
  51. package/package.json +4 -3
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import React from 'react';
3
- import { renderAsChild } from '../utils/index.js';
3
+ import { AsChildSlot } from '@wix/headless-utils/react';
4
4
  import { MediaGallery } from '@wix/headless-media/react';
5
5
  import * as CoreProduct from './core/Product.js';
6
6
  import * as ProductVariantSelector from './core/ProductVariantSelector.js';
@@ -99,21 +99,7 @@ export function Root(props) {
99
99
  export const Name = React.forwardRef((props, ref) => {
100
100
  const { asChild, children, className } = props;
101
101
  return (_jsx(CoreProduct.Name, { children: ({ name }) => {
102
- const attributes = {
103
- 'data-testid': TestIds.productName,
104
- };
105
- if (asChild) {
106
- const rendered = renderAsChild({
107
- children,
108
- props: { name },
109
- ref,
110
- content: name,
111
- attributes,
112
- });
113
- if (rendered)
114
- return rendered;
115
- }
116
- return (_jsx("div", { className: className, ...attributes, children: name }));
102
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productName, customElement: children, customElementProps: { name }, content: name, children: _jsx("div", { children: name }) }));
117
103
  } }));
118
104
  });
119
105
  /**
@@ -142,9 +128,6 @@ export const Name = React.forwardRef((props, ref) => {
142
128
  export const Description = React.forwardRef((props, ref) => {
143
129
  const { asChild, children, className, as = AsContent.Plain } = props;
144
130
  return (_jsx(CoreProduct.Description, { children: ({ description: richDescription, plainDescription }) => {
145
- const attributes = {
146
- 'data-testid': TestIds.productDescription,
147
- };
148
131
  // Determine which description to use based on the 'as' prop
149
132
  let description;
150
133
  switch (as) {
@@ -162,22 +145,13 @@ export const Description = React.forwardRef((props, ref) => {
162
145
  : '';
163
146
  break;
164
147
  }
165
- if (asChild) {
166
- const rendered = renderAsChild({
167
- children,
168
- props: { description },
169
- ref,
170
- content: description,
171
- attributes,
172
- });
173
- if (rendered)
174
- return rendered;
175
- }
176
- // Default rendering based on format
177
- if (as === AsContent.Html) {
178
- return (_jsx("div", { className: className, ...attributes, dangerouslySetInnerHTML: { __html: description } }));
148
+ // Handle default rendering based on format
149
+ if (!asChild || !children) {
150
+ if (as === AsContent.Html) {
151
+ return (_jsx("div", { ref: ref, className: className, "data-testid": TestIds.productDescription, dangerouslySetInnerHTML: { __html: description } }));
152
+ }
179
153
  }
180
- return (_jsx("div", { className: className, ...attributes, children: description }));
154
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productDescription, customElement: children, customElementProps: { description }, content: description, children: _jsx("div", { children: description }) }));
181
155
  } }));
182
156
  });
183
157
  /**
@@ -207,26 +181,10 @@ export const Description = React.forwardRef((props, ref) => {
207
181
  export const Price = React.forwardRef((props, ref) => {
208
182
  const { asChild, children, className } = props;
209
183
  return (_jsx(SelectedVariant.Price, { children: ({ price, compareAtPrice }) => {
210
- const attributes = {
211
- 'data-testid': TestIds.productPrice,
212
- 'data-discounted': compareAtPrice !== null,
213
- };
214
- const priceData = {
215
- price,
216
- formattedPrice: price,
217
- };
218
- if (asChild) {
219
- const rendered = renderAsChild({
220
- children,
221
- props: priceData,
222
- ref,
223
- content: price,
224
- attributes,
225
- });
226
- if (rendered)
227
- return rendered;
228
- }
229
- return (_jsx("span", { className: className, ...attributes, ref: ref, children: price }));
184
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productPrice, "data-discounted": compareAtPrice !== null, customElement: children, customElementProps: {
185
+ price,
186
+ formattedPrice: price,
187
+ }, content: price, children: _jsx("span", { children: price }) }));
230
188
  } }));
231
189
  });
232
190
  /**
@@ -261,30 +219,14 @@ export const CompareAtPrice = React.forwardRef((props, ref) => {
261
219
  const { asChild, children, className } = props;
262
220
  const testId = TestIds.productCompareAtPrice;
263
221
  return (_jsx(SelectedVariant.Price, { children: ({ compareAtPrice }) => {
264
- const attributes = {
265
- 'data-testid': testId,
266
- 'data-discounted': compareAtPrice !== null,
267
- };
268
222
  // Don't render anything if there's no compare-at price
269
223
  if (!compareAtPrice) {
270
224
  return null;
271
225
  }
272
- const priceData = {
273
- price: compareAtPrice,
274
- formattedPrice: compareAtPrice,
275
- };
276
- if (asChild) {
277
- const rendered = renderAsChild({
278
- children,
279
- props: priceData,
280
- ref,
281
- content: compareAtPrice,
282
- attributes,
283
- });
284
- if (rendered)
285
- return rendered;
286
- }
287
- return (_jsx("span", { className: className, ...attributes, ref: ref, children: compareAtPrice }));
226
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": testId, "data-discounted": compareAtPrice !== null, customElement: children, customElementProps: {
227
+ price: compareAtPrice,
228
+ formattedPrice: compareAtPrice,
229
+ }, content: compareAtPrice, children: _jsx("span", { children: compareAtPrice }) }));
288
230
  } }));
289
231
  });
290
232
  /**
@@ -310,25 +252,10 @@ export const CompareAtPrice = React.forwardRef((props, ref) => {
310
252
  * ```
311
253
  */
312
254
  export const Slug = React.forwardRef((props, ref) => {
313
- const { asChild, children } = props;
255
+ const { asChild, children, className } = props;
314
256
  const testId = TestIds.productSlug;
315
257
  return (_jsx(CoreProduct.Slug, { children: ({ slug }) => {
316
- const attributes = {
317
- 'data-testid': testId,
318
- };
319
- const slugData = { slug };
320
- if (asChild) {
321
- const rendered = renderAsChild({
322
- children,
323
- props: slugData,
324
- ref,
325
- content: slug,
326
- attributes,
327
- });
328
- if (rendered)
329
- return rendered;
330
- }
331
- return (_jsx("span", { ...attributes, ref: ref, children: slug }));
258
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": testId, customElement: children, customElementProps: { slug }, content: slug, children: _jsx("span", { children: slug }) }));
332
259
  } }));
333
260
  });
334
261
  /**
@@ -351,24 +278,13 @@ export const Slug = React.forwardRef((props, ref) => {
351
278
  * ```
352
279
  */
353
280
  export const Raw = React.forwardRef((props, ref) => {
354
- const { asChild, children } = props;
281
+ const { asChild, children, className } = props;
355
282
  return (_jsx(CoreProduct.Content, { children: ({ product }) => {
356
- const attributes = {
357
- 'data-testid': TestIds.productRaw,
358
- };
359
- if (asChild) {
360
- const rendered = renderAsChild({
361
- children,
362
- props: { product },
363
- ref,
364
- content: null,
365
- attributes,
366
- });
367
- if (rendered)
368
- return rendered;
369
- }
370
283
  // Raw component should not render anything by default when not using asChild
371
- return null;
284
+ if (!asChild || !children) {
285
+ return null;
286
+ }
287
+ return (_jsx(AsChildSlot, { ref: ref, className: className, "data-testid": TestIds.productRaw, customElement: children, customElementProps: { product } }));
372
288
  } }));
373
289
  });
374
290
  /**
@@ -414,7 +330,7 @@ export const Raw = React.forwardRef((props, ref) => {
414
330
  * ```
415
331
  */
416
332
  export const Variants = React.forwardRef((props, ref) => {
417
- const { asChild, children } = props;
333
+ const { asChild, children, className } = props;
418
334
  return (_jsx(ProductVariantSelector.Options, { children: ({ hasOptions, options }) => {
419
335
  if (!hasOptions)
420
336
  return null;
@@ -422,24 +338,7 @@ export const Variants = React.forwardRef((props, ref) => {
422
338
  hasOptions,
423
339
  options,
424
340
  };
425
- const attributes = {
426
- 'data-testid': TestIds.productVariants,
427
- };
428
- const content = (_jsx(VariantsContext.Provider, { value: contextValue, children: typeof children === 'function'
429
- ? null
430
- : children }));
431
- if (asChild) {
432
- const rendered = renderAsChild({
433
- children,
434
- props: { hasOptions },
435
- ref,
436
- content,
437
- attributes,
438
- });
439
- if (rendered)
440
- return rendered;
441
- }
442
- return (_jsx("div", { ...attributes, ref: ref, children: content }));
341
+ return (_jsx(VariantsContext.Provider, { value: contextValue, children: _jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productVariants, customElement: children, children: _jsx("div", { children: React.isValidElement(children) ? children : null }) }) }));
443
342
  } }));
444
343
  });
445
344
  /**
@@ -542,7 +441,7 @@ export const VariantOptionRepeater = React.forwardRef((props, _ref) => {
542
441
  * ```
543
442
  */
544
443
  export const Modifiers = React.forwardRef((props, ref) => {
545
- const { asChild, children } = props;
444
+ const { asChild, children, className } = props;
546
445
  return (_jsx(ProductModifiers.Modifiers, { children: ({ hasModifiers, modifiers }) => {
547
446
  if (!hasModifiers)
548
447
  return null;
@@ -550,24 +449,7 @@ export const Modifiers = React.forwardRef((props, ref) => {
550
449
  hasModifiers,
551
450
  modifiers,
552
451
  };
553
- const attributes = {
554
- 'data-testid': TestIds.productModifiers,
555
- };
556
- const content = (_jsx(ModifiersContext.Provider, { value: contextValue, children: typeof children === 'function'
557
- ? null
558
- : children }));
559
- if (asChild) {
560
- const rendered = renderAsChild({
561
- children,
562
- props: { hasModifiers },
563
- ref,
564
- content,
565
- attributes,
566
- });
567
- if (rendered)
568
- return rendered;
569
- }
570
- return (_jsx("div", { ...attributes, ref: ref, children: content }));
452
+ return (_jsx(ModifiersContext.Provider, { value: contextValue, children: _jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productModifiers, customElement: children, children: _jsx("div", { children: React.isValidElement(children) ? children : null }) }) }));
571
453
  } }));
572
454
  });
573
455
  /**
@@ -2,7 +2,6 @@ import type { V3Product } from '@wix/auto_sdk_stores_products-v-3';
2
2
  import React from 'react';
3
3
  import type { ProductsListSearchServiceConfig } from '../services/products-list-search-service.js';
4
4
  import type { ProductsListServiceConfig } from '../services/products-list-service.js';
5
- import { type AsChildProps } from '../utils/renderAsChild.js';
6
5
  /**
7
6
  * Props for the ProductList root component following the documented API
8
7
  */
@@ -139,9 +138,15 @@ export declare const LoadMoreTrigger: React.ForwardRefExoticComponent<LoadMoreTr
139
138
  /**
140
139
  * Props for ProductList Totals Displayed component
141
140
  */
142
- export interface TotalsDisplayedProps extends AsChildProps<{
143
- displayedProducts: number;
144
- }> {
141
+ export interface TotalsDisplayedProps {
142
+ /** Whether to render as a child component */
143
+ asChild?: boolean;
144
+ /** Custom render function when using asChild */
145
+ children?: React.ReactNode | React.ForwardRefRenderFunction<HTMLElement, {
146
+ displayedProducts: number;
147
+ }> | React.ForwardRefExoticComponent<any>;
148
+ /** CSS classes to apply to the default element */
149
+ className?: string;
145
150
  }
146
151
  /**
147
152
  * Displays the number of products currently displayed.
@@ -5,7 +5,7 @@ import { ProductsListServiceDefinition } from '../services/products-list-service
5
5
  import * as CoreProductList from './core/ProductList.js';
6
6
  import * as CoreProductListPagination from './core/ProductListPagination.js';
7
7
  import * as Product from './Product.js';
8
- import { renderAsChild } from '../utils/renderAsChild.js';
8
+ import { AsChildSlot } from '@wix/headless-utils/react';
9
9
  var TestIds;
10
10
  (function (TestIds) {
11
11
  TestIds["productListRoot"] = "product-list-root";
@@ -48,6 +48,7 @@ export const Root = React.forwardRef((props, ref) => {
48
48
  count: products?.length || 0,
49
49
  },
50
50
  aggregations: {}, // Empty aggregation data
51
+ customizations: [],
51
52
  };
52
53
  return (_jsx(CoreProductList.Root, { productsListConfig: serviceConfig, productsListSearchConfig: productsListSearchConfig, children: _jsx(RootContent, { children: children, className: className, ref: ref }) }));
53
54
  });
@@ -177,20 +178,7 @@ export const LoadMoreTrigger = React.forwardRef((props, ref) => {
177
178
  if (!hasMoreProducts)
178
179
  return null;
179
180
  const handleClick = () => loadMore(10);
180
- const attributes = {
181
- 'data-testid': TestIds.productListLoadMore,
182
- className,
183
- onClick: handleClick,
184
- disabled: isLoading,
185
- };
186
- if (asChild && React.isValidElement(children)) {
187
- return React.cloneElement(children, {
188
- ...attributes,
189
- onClick: handleClick,
190
- ref,
191
- });
192
- }
193
- return (_jsx("button", { ...attributes, ref: ref, children: children }));
181
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, onClick: handleClick, disabled: isLoading, "data-testid": TestIds.productListLoadMore, customElement: children, children: _jsx("button", { children: children }) }));
194
182
  } }));
195
183
  });
196
184
  /**
@@ -215,21 +203,5 @@ export const TotalsDisplayed = React.forwardRef((props, ref) => {
215
203
  const productsListService = useService(ProductsListServiceDefinition);
216
204
  const products = productsListService.products.get();
217
205
  const displayedProducts = products.length;
218
- const attributes = {
219
- 'data-testid': TestIds.productListTotalsDisplayed,
220
- 'data-displayed': displayedProducts,
221
- className,
222
- };
223
- if (asChild) {
224
- const rendered = renderAsChild({
225
- children,
226
- props: { displayedProducts },
227
- ref,
228
- content: displayedProducts.toString(),
229
- attributes,
230
- });
231
- if (rendered)
232
- return rendered;
233
- }
234
- return (_jsx("span", { ...attributes, ref: ref, children: displayedProducts }));
206
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.productListTotalsDisplayed, "data-displayed": displayedProducts, customElement: children, customElementProps: { displayedProducts }, content: displayedProducts, children: _jsx("span", { children: displayedProducts }) }));
235
207
  });
@@ -0,0 +1,14 @@
1
+ import { Sort as SortPrimitive } from '@wix/headless-components/react';
2
+ import { productsV3 } from '@wix/stores';
3
+ import React from 'react';
4
+ export interface ProductListSortProps {
5
+ children?: (props: {
6
+ currentSort: productsV3.V3ProductSearch['sort'];
7
+ sortOptions: SortPrimitive.SortOption[];
8
+ setSort: (sort: productsV3.V3ProductSearch['sort']) => void;
9
+ }) => React.ReactNode;
10
+ className?: string;
11
+ as?: 'select' | 'list';
12
+ asChild?: boolean;
13
+ }
14
+ export declare const ProductListSort: React.ForwardRefExoticComponent<ProductListSortProps & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Sort as SortPrimitive } from '@wix/headless-components/react';
3
+ import { ProductListSort as ProductListSortPrimitive } from './core/ProductListSort.js';
4
+ import React from 'react';
5
+ export const ProductListSort = React.forwardRef(({ children, className, as, asChild }, ref) => {
6
+ return (_jsx(ProductListSortPrimitive, { children: ({ currentSort, sortOptions, setSort }) => {
7
+ if (asChild && children) {
8
+ return children({ currentSort, sortOptions, setSort });
9
+ }
10
+ return (_jsx(SortPrimitive.Root, { ref: ref, value: currentSort, onChange: (value) => {
11
+ setSort(value);
12
+ }, sortOptions: sortOptions, as: as, className: className }));
13
+ } }));
14
+ });
@@ -1,6 +1,7 @@
1
1
  import { type ProductsListServiceConfig } from '../../services/products-list-service.js';
2
2
  import { productsV3 } from '@wix/stores';
3
3
  import { ProductsListSearchServiceConfig } from '../../services/products-list-search-service.js';
4
+ import { CategoriesListServiceConfig } from '../../services/categories-list-service.js';
4
5
  /**
5
6
  * Props for Root headless component
6
7
  */
@@ -11,6 +12,8 @@ export interface RootProps {
11
12
  productsListConfig: ProductsListServiceConfig;
12
13
  /** Configuration for the ProductListSearch service */
13
14
  productsListSearchConfig?: ProductsListSearchServiceConfig;
15
+ /** Configuration for the CategoriesList service */
16
+ categoriesListConfig?: CategoriesListServiceConfig;
14
17
  }
15
18
  /**
16
19
  * Root component that provides both ProductList and ProductListSearch service contexts to its children.
@@ -4,6 +4,7 @@ import { createServicesMap } from '@wix/services-manager';
4
4
  import { ProductListService, ProductsListServiceDefinition, } from '../../services/products-list-service.js';
5
5
  import { ProductService, ProductServiceDefinition, } from '../../services/product-service.js';
6
6
  import { ProductsListSearchService, ProductsListSearchServiceDefinition, } from '../../services/products-list-search-service.js';
7
+ import { CategoriesListService, CategoriesListServiceDefinition, } from '../../services/categories-list-service.js';
7
8
  /**
8
9
  * Root component that provides both ProductList and ProductListSearch service contexts to its children.
9
10
  * This component sets up the necessary services for managing products list state, including search,
@@ -64,6 +65,7 @@ import { ProductsListSearchService, ProductsListSearchServiceDefinition, } from
64
65
  */
65
66
  export function Root(props) {
66
67
  return (_jsx(WixServices, { servicesMap: createServicesMap()
68
+ .addService(CategoriesListServiceDefinition, CategoriesListService, props.categoriesListConfig)
67
69
  .addService(ProductsListServiceDefinition, ProductListService, props.productsListConfig)
68
70
  .addService(ProductsListSearchServiceDefinition, ProductsListSearchService, props.productsListSearchConfig), children: props.children }));
69
71
  }
@@ -1,61 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
- import { type ProductOption, InventoryStatusType } from '../../services/products-list-search-service.js';
3
2
  import { Category } from '@wix/auto_sdk_categories_categories';
4
- /**
5
- * Props for InventoryStatus headless component
6
- */
7
- export interface InventoryStatusProps {
8
- /** Content to display (can be a render function receiving inventory status controls or ReactNode) */
9
- children: ((props: InventoryStatusRenderProps) => ReactNode) | ReactNode;
10
- }
11
- /**
12
- * Render props for InventoryStatus component
13
- */
14
- export interface InventoryStatusRenderProps {
15
- /** Available inventory status options */
16
- availableInventoryStatuses: InventoryStatusType[];
17
- /** Currently selected inventory statuses */
18
- selectedInventoryStatuses: InventoryStatusType[];
19
- /** Function to toggle an inventory status filter */
20
- toggleInventoryStatus: (status: InventoryStatusType) => void;
21
- }
22
- /**
23
- * Headless component for managing inventory status filters
24
- *
25
- * @component
26
- * @example
27
- * ```tsx
28
- * import { ProductList, ProductListFilters } from '@wix/stores/components';
29
- *
30
- * function InventoryStatusFilter() {
31
- * return (
32
- * <ProductList.Root
33
- * productsListConfig={{ products: [], searchOptions: {}, pagingMetadata: {}, aggregations: {} }}
34
- * productsListSearchConfig={{ customizations: [] }}
35
- * >
36
- * <ProductListFilters.InventoryStatus>
37
- * {({ availableInventoryStatuses, selectedInventoryStatuses, toggleInventoryStatus }) => (
38
- * <div>
39
- * <h4>Inventory Status:</h4>
40
- * {availableInventoryStatuses.map(status => (
41
- * <label key={status}>
42
- * <input
43
- * type="checkbox"
44
- * checked={selectedInventoryStatuses.includes(status)}
45
- * onChange={() => toggleInventoryStatus(status)}
46
- * />
47
- * {status}
48
- * </label>
49
- * ))}
50
- * </div>
51
- * )}
52
- * </ProductListFilters.InventoryStatus>
53
- * </ProductList.Root>
54
- * );
55
- * }
56
- * ```
57
- */
58
- export declare function InventoryStatus(props: InventoryStatusProps): ReactNode;
3
+ import React from 'react';
59
4
  /**
60
5
  * Props for ResetTrigger headless component
61
6
  */
@@ -103,136 +48,19 @@ export interface ResetTriggerRenderProps {
103
48
  * ```
104
49
  */
105
50
  export declare function ResetTrigger(props: ResetTriggerProps): ReactNode;
106
- /**
107
- * Props for PriceRange headless component
108
- */
109
- export interface PriceRangeProps {
110
- /** Content to display (can be a render function receiving price range controls or ReactNode) */
111
- children: ((props: PriceRangeRenderProps) => ReactNode) | ReactNode;
112
- }
113
- /**
114
- * Render props for PriceRange component
115
- */
116
- export interface PriceRangeRenderProps {
117
- /** Current minimum price filter value */
118
- selectedMinPrice: number;
119
- /** Current maximum price filter value */
120
- selectedMaxPrice: number;
121
- /** Catalog minimum price */
122
- availableMinPrice: number;
123
- /** Catalog maximum price */
124
- availableMaxPrice: number;
125
- /** Function to update the minimum price filter */
126
- setSelectedMinPrice: (minPrice: number) => void;
127
- /** Function to update the maximum price filter */
128
- setSelectedMaxPrice: (maxPrice: number) => void;
129
- }
130
- /**
131
- * Headless component for managing price range filters (combined min/max)
132
- *
133
- * @component
134
- * @example
135
- * ```tsx
136
- * import { ProductList, ProductListFilters } from '@wix/stores/components';
137
- *
138
- * function PriceRangeFilter() {
139
- * return (
140
- * <ProductList.Root
141
- * productsListConfig={{ products: [], searchOptions: {}, pagingMetadata: {}, aggregations: {} }}
142
- * productsListSearchConfig={{ customizations: [] }}
143
- * >
144
- * <ProductListFilters.PriceRange>
145
- * {({ minPrice, maxPrice, setSelectedMinPrice, setSelectedMaxPrice }) => (
146
- * <div className="price-range">
147
- * <h4>Price Range:</h4>
148
- * <div className="price-inputs">
149
- * <input
150
- * type="number"
151
- * value={minPrice}
152
- * onChange={(e) => setSelectedMinPrice(Number(e.target.value))}
153
- * placeholder="Min"
154
- * />
155
- * <span>to</span>
156
- * <input
157
- * type="number"
158
- * value={maxPrice}
159
- * onChange={(e) => setSelectedMaxPrice(Number(e.target.value))}
160
- * placeholder="Max"
161
- * />
162
- * </div>
163
- * </div>
164
- * )}
165
- * </ProductListFilters.PriceRange>
166
- * </ProductList.Root>
167
- * );
168
- * }
169
- * ```
170
- */
171
- export declare function PriceRange(props: PriceRangeProps): ReactNode;
172
51
  export interface CategoryFilterRenderProps {
173
52
  selectedCategory: Category | null;
174
- setSelectedCategory: (category: Category | null) => void;
53
+ setSelectedCategory: (category: Category) => void;
175
54
  }
176
55
  export interface CategoryFilterProps {
177
56
  /** Content to display (can be a render function receiving category data or ReactNode) */
178
57
  children: ((props: CategoryFilterRenderProps) => ReactNode) | ReactNode;
179
58
  }
180
59
  export declare function CategoryFilter(props: CategoryFilterProps): ReactNode;
181
- /**
182
- * Props for ProductOptions headless component
183
- */
184
- export interface ProductOptionsProps {
185
- /** Content to display (can be a render function receiving product option data or ReactNode) */
186
- children: ((props: ProductOptionRenderProps) => ReactNode) | ReactNode;
60
+ interface FilterProps {
61
+ children: ReactNode;
62
+ asChild?: boolean;
63
+ className?: string;
187
64
  }
188
- /**
189
- * Render props for ProductOption component
190
- */
191
- export interface ProductOptionRenderProps {
192
- /** Product option data */
193
- option: ProductOption;
194
- /** Currently selected choice IDs for this option */
195
- selectedChoices: string[];
196
- /** Function to toggle a choice selection */
197
- toggleChoice: (choiceId: string) => void;
198
- }
199
- /**
200
- * Headless component that renders content for each product option in the list.
201
- * Maps over all available product options and provides each option through a render prop.
202
- * Only renders when options are available (not loading, no error, and has options).
203
- * This follows the same collection pattern as ProductList.ItemContent and CategoryList.ItemContent.
204
- *
205
- * @component
206
- * @example
207
- * ```tsx
208
- * import { ProductList, ProductListFilters } from '@wix/stores/components';
209
- *
210
- * function ProductOptionsFilter() {
211
- * return (
212
- * <ProductList.Root
213
- * productsListConfig={{ products: [], searchOptions: {}, pagingMetadata: {}, aggregations: {} }}
214
- * productsListSearchConfig={{ customizations: [] }}
215
- * >
216
- * <ProductListFilters.ProductOptions>
217
- * {({ option, selectedChoices, toggleChoice }) => (
218
- * <div key={option.id}>
219
- * <h4>{option.name}</h4>
220
- * {option.choices.map(choice => (
221
- * <label key={choice.id}>
222
- * <input
223
- * type="checkbox"
224
- * checked={selectedChoices.includes(choice.id)}
225
- * onChange={() => toggleChoice(choice.id)}
226
- * />
227
- * {choice.name}
228
- * </label>
229
- * ))}
230
- * </div>
231
- * )}
232
- * </ProductListFilters.ProductOptions>
233
- * </ProductList.Root>
234
- * );
235
- * }
236
- * ```
237
- */
238
- export declare function ProductOptions(props: ProductOptionsProps): import("react/jsx-runtime").JSX.Element | null;
65
+ export declare const Filter: React.ForwardRefExoticComponent<FilterProps & React.RefAttributes<HTMLDivElement>>;
66
+ export {};