@wix/headless-stores 0.0.38 → 0.0.40

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 (43) hide show
  1. package/cjs/dist/react/Category.d.ts +9 -8
  2. package/cjs/dist/react/CategoryList.d.ts +12 -11
  3. package/cjs/dist/react/Product.d.ts +5 -4
  4. package/cjs/dist/react/ProductListFilters.d.ts +14 -10
  5. package/cjs/dist/react/ProductListFilters.js +19 -10
  6. package/cjs/dist/react/ProductListPagination.d.ts +17 -15
  7. package/cjs/dist/react/ProductListPagination.js +4 -4
  8. package/cjs/dist/react/ProductListSort.d.ts +11 -9
  9. package/cjs/dist/react/ProductListSort.js +6 -6
  10. package/cjs/dist/react/ProductModifiers.d.ts +15 -13
  11. package/cjs/dist/react/ProductModifiers.js +14 -14
  12. package/cjs/dist/react/ProductVariantSelector.d.ts +11 -14
  13. package/cjs/dist/react/ProductVariantSelector.js +8 -10
  14. package/cjs/dist/react/SelectedVariant.d.ts +10 -9
  15. package/cjs/dist/react/SelectedVariant.js +10 -12
  16. package/cjs/dist/services/products-list-filters-service.d.ts +41 -24
  17. package/cjs/dist/services/products-list-filters-service.js +150 -92
  18. package/cjs/dist/services/products-list-pagination-service.d.ts +5 -5
  19. package/cjs/dist/services/products-list-pagination-service.js +2 -2
  20. package/cjs/dist/services/products-list-service.d.ts +4 -2
  21. package/cjs/dist/services/products-list-service.js +4 -2
  22. package/dist/react/Category.d.ts +9 -8
  23. package/dist/react/CategoryList.d.ts +12 -11
  24. package/dist/react/Product.d.ts +5 -4
  25. package/dist/react/ProductListFilters.d.ts +14 -10
  26. package/dist/react/ProductListFilters.js +19 -10
  27. package/dist/react/ProductListPagination.d.ts +17 -15
  28. package/dist/react/ProductListPagination.js +4 -4
  29. package/dist/react/ProductListSort.d.ts +11 -9
  30. package/dist/react/ProductListSort.js +6 -6
  31. package/dist/react/ProductModifiers.d.ts +15 -13
  32. package/dist/react/ProductModifiers.js +14 -14
  33. package/dist/react/ProductVariantSelector.d.ts +11 -14
  34. package/dist/react/ProductVariantSelector.js +8 -10
  35. package/dist/react/SelectedVariant.d.ts +10 -9
  36. package/dist/react/SelectedVariant.js +10 -12
  37. package/dist/services/products-list-filters-service.d.ts +41 -24
  38. package/dist/services/products-list-filters-service.js +150 -92
  39. package/dist/services/products-list-pagination-service.d.ts +5 -5
  40. package/dist/services/products-list-pagination-service.js +2 -2
  41. package/dist/services/products-list-service.d.ts +4 -2
  42. package/dist/services/products-list-service.js +4 -2
  43. package/package.json +3 -3
@@ -1,5 +1,8 @@
1
- import type { PropsWithChildren, ReactNode } from "react";
2
1
  import { type CategoryServiceConfig } from "../services/category-service.js";
2
+ export interface RootProps {
3
+ children: React.ReactNode;
4
+ categoryServiceConfig: CategoryServiceConfig;
5
+ }
3
6
  /**
4
7
  * Root component that provides the Category service context to its children.
5
8
  * This component sets up the necessary services for managing category state.
@@ -24,15 +27,13 @@ import { type CategoryServiceConfig } from "../services/category-service.js";
24
27
  * }
25
28
  * ```
26
29
  */
27
- export declare function Root(props: PropsWithChildren<{
28
- categoryServiceConfig: CategoryServiceConfig;
29
- }>): import("react/jsx-runtime").JSX.Element;
30
+ export declare function Root(props: RootProps): React.ReactNode;
30
31
  /**
31
32
  * Props for Name headless component
32
33
  */
33
34
  export interface NameProps {
34
35
  /** Content to display (can be a render function receiving name data or ReactNode) */
35
- children: ((props: NameRenderProps) => ReactNode) | ReactNode;
36
+ children: ((props: NameRenderProps) => React.ReactNode) | React.ReactNode;
36
37
  }
37
38
  /**
38
39
  * Render props for Name component
@@ -60,13 +61,13 @@ export interface NameRenderProps {
60
61
  * }
61
62
  * ```
62
63
  */
63
- export declare function Name(props: NameProps): ReactNode;
64
+ export declare function Name(props: NameProps): import("react").ReactNode;
64
65
  /**
65
66
  * Props for Slug headless component
66
67
  */
67
68
  export interface SlugProps {
68
69
  /** Content to display (can be a render function receiving slug data or ReactNode) */
69
- children: ((props: SlugRenderProps) => ReactNode) | ReactNode;
70
+ children: ((props: SlugRenderProps) => React.ReactNode) | React.ReactNode;
70
71
  }
71
72
  /**
72
73
  * Render props for Slug component
@@ -94,4 +95,4 @@ export interface SlugRenderProps {
94
95
  * }
95
96
  * ```
96
97
  */
97
- export declare function Slug(props: SlugProps): ReactNode;
98
+ export declare function Slug(props: SlugProps): import("react").ReactNode;
@@ -1,6 +1,9 @@
1
1
  import { type CategoriesListServiceConfig } from "../services/categories-list-service.js";
2
- import type { PropsWithChildren, ReactNode } from "react";
3
2
  import { categories } from "@wix/categories";
3
+ export interface RootProps {
4
+ children: React.ReactNode;
5
+ categoriesListConfig: CategoriesListServiceConfig;
6
+ }
4
7
  /**
5
8
  * Root component that provides the CategoryList service context to its children.
6
9
  * This component sets up the necessary services for managing categories list state.
@@ -26,15 +29,13 @@ import { categories } from "@wix/categories";
26
29
  * }
27
30
  * ```
28
31
  */
29
- export declare function Root(props: PropsWithChildren<{
30
- categoriesListConfig: CategoriesListServiceConfig;
31
- }>): import("react/jsx-runtime").JSX.Element;
32
+ export declare function Root(props: RootProps): React.ReactNode;
32
33
  /**
33
34
  * Props for EmptyState headless component
34
35
  */
35
36
  export interface EmptyStateProps {
36
37
  /** Content to display when categories list is empty (can be a render function or ReactNode) */
37
- children: ((props: EmptyStateRenderProps) => ReactNode) | ReactNode;
38
+ children: ((props: EmptyStateRenderProps) => React.ReactNode) | React.ReactNode;
38
39
  }
39
40
  /**
40
41
  * Render props for EmptyState component
@@ -64,13 +65,13 @@ export interface EmptyStateRenderProps {
64
65
  * }
65
66
  * ```
66
67
  */
67
- export declare function EmptyState(props: EmptyStateProps): ReactNode;
68
+ export declare function EmptyState(props: EmptyStateProps): import("react").ReactNode;
68
69
  /**
69
70
  * Props for Loading headless component
70
71
  */
71
72
  export interface LoadingProps {
72
73
  /** Content to display during loading (can be a render function or ReactNode) */
73
- children: ((props: LoadingRenderProps) => ReactNode) | ReactNode;
74
+ children: ((props: LoadingRenderProps) => React.ReactNode) | React.ReactNode;
74
75
  }
75
76
  /**
76
77
  * Render props for Loading component
@@ -100,13 +101,13 @@ export interface LoadingRenderProps {
100
101
  * }
101
102
  * ```
102
103
  */
103
- export declare function Loading(props: LoadingProps): ReactNode;
104
+ export declare function Loading(props: LoadingProps): import("react").ReactNode;
104
105
  /**
105
106
  * Props for Error headless component
106
107
  */
107
108
  export interface ErrorProps {
108
109
  /** Content to display during error state (can be a render function or ReactNode) */
109
- children: ((props: ErrorRenderProps) => ReactNode) | ReactNode;
110
+ children: ((props: ErrorRenderProps) => React.ReactNode) | React.ReactNode;
110
111
  }
111
112
  /**
112
113
  * Render props for Error component
@@ -141,13 +142,13 @@ export interface ErrorRenderProps {
141
142
  * }
142
143
  * ```
143
144
  */
144
- export declare function Error(props: ErrorProps): ReactNode;
145
+ export declare function Error(props: ErrorProps): import("react").ReactNode;
145
146
  /**
146
147
  * Props for ItemContent headless component
147
148
  */
148
149
  export interface ItemContentProps {
149
150
  /** Content to display for each category (can be a render function receiving category data or ReactNode) */
150
- children: ((props: ItemContentRenderProps) => ReactNode) | ReactNode;
151
+ children: ((props: ItemContentRenderProps) => React.ReactNode) | React.ReactNode;
151
152
  }
152
153
  /**
153
154
  * Render props for ItemContent component
@@ -1,6 +1,9 @@
1
1
  import { ProductServiceConfig } from "../services/product-service.js";
2
2
  import type { V3Product, ProductMedia } from "@wix/auto_sdk_stores_products-v-3";
3
- import type { PropsWithChildren } from "react";
3
+ export interface RootProps {
4
+ children: React.ReactNode;
5
+ productServiceConfig: ProductServiceConfig;
6
+ }
4
7
  /**
5
8
  * Root component that provides the Product service context to its children.
6
9
  * This component sets up the necessary services for rendering and managing a single product's data.
@@ -31,9 +34,7 @@ import type { PropsWithChildren } from "react";
31
34
  * }
32
35
  * ```
33
36
  */
34
- export declare function Root(props: PropsWithChildren<{
35
- productServiceConfig: ProductServiceConfig;
36
- }>): import("react/jsx-runtime").JSX.Element;
37
+ export declare function Root(props: RootProps): React.ReactNode;
37
38
  /**
38
39
  * Props for ProductName headless component
39
40
  */
@@ -25,11 +25,11 @@ export interface RootProps {
25
25
  * }}
26
26
  * >
27
27
  * <ProductListFilters.MinPrice>
28
- * {({ minPrice, setMinPrice }) => (
28
+ * {({ minPrice, setSelectedMinPrice }) => (
29
29
  * <input
30
30
  * type="number"
31
31
  * value={minPrice}
32
- * onChange={(e) => setMinPrice(Number(e.target.value))}
32
+ * onChange={(e) => setSelectedMinPrice(Number(e.target.value))}
33
33
  * placeholder="Min price"
34
34
  * />
35
35
  * )}
@@ -39,7 +39,7 @@ export interface RootProps {
39
39
  * }
40
40
  * ```
41
41
  */
42
- export declare function Root(props: RootProps): import("react/jsx-runtime").JSX.Element;
42
+ export declare function Root(props: RootProps): React.ReactNode;
43
43
  /**
44
44
  * Props for InventoryStatus headless component
45
45
  */
@@ -144,13 +144,17 @@ export interface PriceRangeProps {
144
144
  */
145
145
  export interface PriceRangeRenderProps {
146
146
  /** Current minimum price filter value */
147
- minPrice: number;
147
+ selectedMinPrice: number;
148
148
  /** Current maximum price filter value */
149
- maxPrice: number;
149
+ selectedMaxPrice: number;
150
+ /** Catalog minimum price */
151
+ availableMinPrice: number;
152
+ /** Catalog maximum price */
153
+ availableMaxPrice: number;
150
154
  /** Function to update the minimum price filter */
151
- setMinPrice: (minPrice: number) => void;
155
+ setSelectedMinPrice: (minPrice: number) => void;
152
156
  /** Function to update the maximum price filter */
153
- setMaxPrice: (maxPrice: number) => void;
157
+ setSelectedMaxPrice: (maxPrice: number) => void;
154
158
  }
155
159
  /**
156
160
  * Headless component for managing price range filters (combined min/max)
@@ -163,21 +167,21 @@ export interface PriceRangeRenderProps {
163
167
  * function PriceRangeFilter() {
164
168
  * return (
165
169
  * <ProductListFilters.PriceRange>
166
- * {({ minPrice, maxPrice, setMinPrice, setMaxPrice }) => (
170
+ * {({ minPrice, maxPrice, setSelectedMinPrice, setSelectedMaxPrice }) => (
167
171
  * <div className="price-range">
168
172
  * <h4>Price Range:</h4>
169
173
  * <div className="price-inputs">
170
174
  * <input
171
175
  * type="number"
172
176
  * value={minPrice}
173
- * onChange={(e) => setMinPrice(Number(e.target.value))}
177
+ * onChange={(e) => setSelectedMinPrice(Number(e.target.value))}
174
178
  * placeholder="Min"
175
179
  * />
176
180
  * <span>to</span>
177
181
  * <input
178
182
  * type="number"
179
183
  * value={maxPrice}
180
- * onChange={(e) => setMaxPrice(Number(e.target.value))}
184
+ * onChange={(e) => setSelectedMaxPrice(Number(e.target.value))}
181
185
  * placeholder="Max"
182
186
  * />
183
187
  * </div>
@@ -21,11 +21,11 @@ import { ProductsListFiltersService, ProductsListFiltersServiceDefinition, } fro
21
21
  * }}
22
22
  * >
23
23
  * <ProductListFilters.MinPrice>
24
- * {({ minPrice, setMinPrice }) => (
24
+ * {({ minPrice, setSelectedMinPrice }) => (
25
25
  * <input
26
26
  * type="number"
27
27
  * value={minPrice}
28
- * onChange={(e) => setMinPrice(Number(e.target.value))}
28
+ * onChange={(e) => setSelectedMinPrice(Number(e.target.value))}
29
29
  * placeholder="Min price"
30
30
  * />
31
31
  * )}
@@ -126,21 +126,21 @@ export function ResetTrigger(props) {
126
126
  * function PriceRangeFilter() {
127
127
  * return (
128
128
  * <ProductListFilters.PriceRange>
129
- * {({ minPrice, maxPrice, setMinPrice, setMaxPrice }) => (
129
+ * {({ minPrice, maxPrice, setSelectedMinPrice, setSelectedMaxPrice }) => (
130
130
  * <div className="price-range">
131
131
  * <h4>Price Range:</h4>
132
132
  * <div className="price-inputs">
133
133
  * <input
134
134
  * type="number"
135
135
  * value={minPrice}
136
- * onChange={(e) => setMinPrice(Number(e.target.value))}
136
+ * onChange={(e) => setSelectedMinPrice(Number(e.target.value))}
137
137
  * placeholder="Min"
138
138
  * />
139
139
  * <span>to</span>
140
140
  * <input
141
141
  * type="number"
142
142
  * value={maxPrice}
143
- * onChange={(e) => setMaxPrice(Number(e.target.value))}
143
+ * onChange={(e) => setSelectedMaxPrice(Number(e.target.value))}
144
144
  * placeholder="Max"
145
145
  * />
146
146
  * </div>
@@ -153,12 +153,21 @@ export function ResetTrigger(props) {
153
153
  */
154
154
  export function PriceRange(props) {
155
155
  const service = useService(ProductsListFiltersServiceDefinition);
156
- const minPrice = service.minPrice.get();
157
- const maxPrice = service.maxPrice.get();
158
- const setMinPrice = service.setMinPrice;
159
- const setMaxPrice = service.setMaxPrice;
156
+ const selectedMinPrice = service.selectedMinPrice.get();
157
+ const availableMinPrice = service.availableMinPrice.get();
158
+ const selectedMaxPrice = service.selectedMaxPrice.get();
159
+ const availableMaxPrice = service.availableMaxPrice.get();
160
+ const setSelectedMinPrice = service.setSelectedMinPrice;
161
+ const setSelectedMaxPrice = service.setSelectedMaxPrice;
160
162
  return typeof props.children === "function"
161
- ? props.children({ minPrice, maxPrice, setMinPrice, setMaxPrice })
163
+ ? props.children({
164
+ availableMinPrice,
165
+ selectedMinPrice,
166
+ selectedMaxPrice,
167
+ availableMaxPrice,
168
+ setSelectedMinPrice,
169
+ setSelectedMaxPrice,
170
+ })
162
171
  : props.children;
163
172
  }
164
173
  /**
@@ -1,4 +1,6 @@
1
- import type { PropsWithChildren, ReactNode } from "react";
1
+ export interface RootProps {
2
+ children: React.ReactNode;
3
+ }
2
4
  /**
3
5
  * Root component that provides the ProductListPagination service context to its children.
4
6
  * This component sets up the necessary services for managing products list pagination.
@@ -27,13 +29,13 @@ import type { PropsWithChildren, ReactNode } from "react";
27
29
  * }
28
30
  * ```
29
31
  */
30
- export declare function Root(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
32
+ export declare function Root(props: RootProps): React.ReactNode;
31
33
  /**
32
34
  * Props for PageSize headless component
33
35
  */
34
36
  export interface PageSizeProps {
35
37
  /** Content to display (can be a render function receiving page size controls or ReactNode) */
36
- children: ((props: PageSizeRenderProps) => ReactNode) | ReactNode;
38
+ children: ((props: PageSizeRenderProps) => React.ReactNode) | React.ReactNode;
37
39
  }
38
40
  /**
39
41
  * Render props for PageSize component
@@ -73,13 +75,13 @@ export interface PageSizeRenderProps {
73
75
  * }
74
76
  * ```
75
77
  */
76
- export declare function PageSize(props: PageSizeProps): ReactNode;
78
+ export declare function PageSize(props: PageSizeProps): import("react").ReactNode;
77
79
  /**
78
80
  * Props for NextPageTrigger headless component
79
81
  */
80
82
  export interface NextPageTriggerProps {
81
83
  /** Content to display (can be a render function receiving next page controls or ReactNode) */
82
- children: ((props: NextPageTriggerRenderProps) => ReactNode) | ReactNode;
84
+ children: ((props: NextPageTriggerRenderProps) => React.ReactNode) | React.ReactNode;
83
85
  }
84
86
  /**
85
87
  * Render props for NextPageTrigger component
@@ -115,13 +117,13 @@ export interface NextPageTriggerRenderProps {
115
117
  * }
116
118
  * ```
117
119
  */
118
- export declare function NextPageTrigger(props: NextPageTriggerProps): ReactNode;
120
+ export declare function NextPageTrigger(props: NextPageTriggerProps): import("react").ReactNode;
119
121
  /**
120
122
  * Props for PreviousPageTrigger headless component
121
123
  */
122
124
  export interface PreviousPageTriggerProps {
123
125
  /** Content to display (can be a render function receiving previous page controls or ReactNode) */
124
- children: ((props: PreviousPageTriggerRenderProps) => ReactNode) | ReactNode;
126
+ children: ((props: PreviousPageTriggerRenderProps) => React.ReactNode) | React.ReactNode;
125
127
  }
126
128
  /**
127
129
  * Render props for PreviousPageTrigger component
@@ -157,20 +159,20 @@ export interface PreviousPageTriggerRenderProps {
157
159
  * }
158
160
  * ```
159
161
  */
160
- export declare function PreviousPageTrigger(props: PreviousPageTriggerProps): ReactNode;
162
+ export declare function PreviousPageTrigger(props: PreviousPageTriggerProps): import("react").ReactNode;
161
163
  /**
162
164
  * Props for FirstPageTrigger headless component
163
165
  */
164
166
  export interface FirstPageTriggerProps {
165
167
  /** Content to display (can be a render function receiving first page controls or ReactNode) */
166
- children: ((props: FirstPageTriggerRenderProps) => ReactNode) | ReactNode;
168
+ children: ((props: FirstPageTriggerRenderProps) => React.ReactNode) | React.ReactNode;
167
169
  }
168
170
  /**
169
171
  * Render props for FirstPageTrigger component
170
172
  */
171
173
  export interface FirstPageTriggerRenderProps {
172
174
  /** Function to navigate to the first page */
173
- goToFirstPage: () => void;
175
+ navigateToFirstPage: () => void;
174
176
  /** Whether there is a previous page (indicating not on first page) */
175
177
  hasPrevPage: boolean;
176
178
  }
@@ -185,9 +187,9 @@ export interface FirstPageTriggerRenderProps {
185
187
  * function FirstPageButton() {
186
188
  * return (
187
189
  * <ProductListPagination.FirstPageTrigger>
188
- * {({ goToFirstPage, hasPrevPage }) => (
190
+ * {({ navigateToFirstPage, hasPrevPage }) => (
189
191
  * <button
190
- * onClick={goToFirstPage}
192
+ * onClick={navigateToFirstPage}
191
193
  * disabled={!hasPrevPage}
192
194
  * title="Go to first page"
193
195
  * >
@@ -199,13 +201,13 @@ export interface FirstPageTriggerRenderProps {
199
201
  * }
200
202
  * ```
201
203
  */
202
- export declare function FirstPageTrigger(props: FirstPageTriggerProps): ReactNode;
204
+ export declare function FirstPageTrigger(props: FirstPageTriggerProps): import("react").ReactNode;
203
205
  /**
204
206
  * Props for LoadMoreTrigger headless component
205
207
  */
206
208
  export interface LoadMoreTriggerProps {
207
209
  /** Content to display (can be a render function receiving load more controls or ReactNode) */
208
- children: ((props: LoadMoreTriggerRenderProps) => ReactNode) | ReactNode;
210
+ children: ((props: LoadMoreTriggerRenderProps) => React.ReactNode) | React.ReactNode;
209
211
  }
210
212
  /**
211
213
  * Render props for LoadMoreTrigger component
@@ -243,4 +245,4 @@ export interface LoadMoreTriggerRenderProps {
243
245
  * }
244
246
  * ```
245
247
  */
246
- export declare function LoadMoreTrigger(props: LoadMoreTriggerProps): ReactNode;
248
+ export declare function LoadMoreTrigger(props: LoadMoreTriggerProps): import("react").ReactNode;
@@ -148,9 +148,9 @@ export function PreviousPageTrigger(props) {
148
148
  * function FirstPageButton() {
149
149
  * return (
150
150
  * <ProductListPagination.FirstPageTrigger>
151
- * {({ goToFirstPage, hasPrevPage }) => (
151
+ * {({ navigateToFirstPage, hasPrevPage }) => (
152
152
  * <button
153
- * onClick={goToFirstPage}
153
+ * onClick={navigateToFirstPage}
154
154
  * disabled={!hasPrevPage}
155
155
  * title="Go to first page"
156
156
  * >
@@ -164,10 +164,10 @@ export function PreviousPageTrigger(props) {
164
164
  */
165
165
  export function FirstPageTrigger(props) {
166
166
  const service = useService(ProductsListPaginationServiceDefinition);
167
- const goToFirstPage = service.goToFirstPage;
167
+ const navigateToFirstPage = service.navigateToFirstPage;
168
168
  const hasPrevPage = service.hasPrevPage.get();
169
169
  return typeof props.children === "function"
170
- ? props.children({ goToFirstPage, hasPrevPage })
170
+ ? props.children({ navigateToFirstPage, hasPrevPage })
171
171
  : props.children;
172
172
  }
173
173
  /**
@@ -1,5 +1,7 @@
1
- import type { PropsWithChildren, ReactNode } from "react";
2
1
  import { SortType } from "../services/products-list-sort-service.js";
2
+ export interface RootProps {
3
+ children: React.ReactNode;
4
+ }
3
5
  /**
4
6
  * Root component that provides the ProductListSort service context to its children.
5
7
  * This component sets up the necessary services for managing products list sorting.
@@ -14,10 +16,10 @@ import { SortType } from "../services/products-list-sort-service.js";
14
16
  * return (
15
17
  * <ProductListSort.Root>
16
18
  * <ProductListSort.Options>
17
- * {({ selectedSortOption, setSelectedSortOption, sortOptions }) => (
19
+ * {({ selectedSortOption, updateSortOption, sortOptions }) => (
18
20
  * <select
19
21
  * value={selectedSortOption}
20
- * onChange={(e) => setSelectedSortOption(e.target.value)}
22
+ * onChange={(e) => updateSortOption(e.target.value)}
21
23
  * >
22
24
  * {sortOptions.map(option => (
23
25
  * <option key={option.value} value={option.value}>
@@ -32,13 +34,13 @@ import { SortType } from "../services/products-list-sort-service.js";
32
34
  * }
33
35
  * ```
34
36
  */
35
- export declare function Root(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
37
+ export declare function Root(props: RootProps): React.ReactNode;
36
38
  /**
37
39
  * Props for Options headless component
38
40
  */
39
41
  export interface OptionsProps {
40
42
  /** Content to display (can be a render function receiving sort controls or ReactNode) */
41
- children: ((props: OptionsRenderProps) => ReactNode) | ReactNode;
43
+ children: ((props: OptionsRenderProps) => React.ReactNode) | React.ReactNode;
42
44
  }
43
45
  /**
44
46
  * Render props for Options component
@@ -47,7 +49,7 @@ export interface OptionsRenderProps {
47
49
  /** Currently selected sort option value */
48
50
  selectedSortOption: string;
49
51
  /** Function to update the selected sort option */
50
- setSelectedSortOption: (sort: string) => void;
52
+ updateSortOption: (sort: string) => void;
51
53
  /** Available sort options */
52
54
  sortOptions: SortType[];
53
55
  }
@@ -62,13 +64,13 @@ export interface OptionsRenderProps {
62
64
  * function ProductSortDropdown() {
63
65
  * return (
64
66
  * <ProductListSort.Options>
65
- * {({ selectedSortOption, setSelectedSortOption, sortOptions }) => (
67
+ * {({ selectedSortOption, updateSortOption, sortOptions }) => (
66
68
  * <div className="sort-container">
67
69
  * <label htmlFor="sort-select">Sort by:</label>
68
70
  * <select
69
71
  * id="sort-select"
70
72
  * value={selectedSortOption}
71
- * onChange={(e) => setSelectedSortOption(e.target.value)}
73
+ * onChange={(e) => updateSortOption(e.target.value)}
72
74
  * className="sort-dropdown"
73
75
  * >
74
76
  * {sortOptions.map(option => (
@@ -84,4 +86,4 @@ export interface OptionsRenderProps {
84
86
  * }
85
87
  * ```
86
88
  */
87
- export declare function Options(props: OptionsProps): ReactNode;
89
+ export declare function Options(props: OptionsProps): import("react").ReactNode;
@@ -16,10 +16,10 @@ import { ProductsListSortService, ProductsListSortServiceDefinition, } from "../
16
16
  * return (
17
17
  * <ProductListSort.Root>
18
18
  * <ProductListSort.Options>
19
- * {({ selectedSortOption, setSelectedSortOption, sortOptions }) => (
19
+ * {({ selectedSortOption, updateSortOption, sortOptions }) => (
20
20
  * <select
21
21
  * value={selectedSortOption}
22
- * onChange={(e) => setSelectedSortOption(e.target.value)}
22
+ * onChange={(e) => updateSortOption(e.target.value)}
23
23
  * >
24
24
  * {sortOptions.map(option => (
25
25
  * <option key={option.value} value={option.value}>
@@ -48,13 +48,13 @@ export function Root(props) {
48
48
  * function ProductSortDropdown() {
49
49
  * return (
50
50
  * <ProductListSort.Options>
51
- * {({ selectedSortOption, setSelectedSortOption, sortOptions }) => (
51
+ * {({ selectedSortOption, updateSortOption, sortOptions }) => (
52
52
  * <div className="sort-container">
53
53
  * <label htmlFor="sort-select">Sort by:</label>
54
54
  * <select
55
55
  * id="sort-select"
56
56
  * value={selectedSortOption}
57
- * onChange={(e) => setSelectedSortOption(e.target.value)}
57
+ * onChange={(e) => updateSortOption(e.target.value)}
58
58
  * className="sort-dropdown"
59
59
  * >
60
60
  * {sortOptions.map(option => (
@@ -74,11 +74,11 @@ export function Options(props) {
74
74
  const service = useService(ProductsListSortServiceDefinition);
75
75
  const selectedSortOption = service.selectedSortOption.get();
76
76
  const sortOptions = service.sortOptions;
77
- const setSelectedSortOption = service.setSelectedSortOption;
77
+ const updateSortOption = service.setSelectedSortOption;
78
78
  return typeof props.children === "function"
79
79
  ? props.children({
80
80
  selectedSortOption,
81
- setSelectedSortOption,
81
+ updateSortOption,
82
82
  sortOptions,
83
83
  })
84
84
  : props.children;
@@ -1,5 +1,7 @@
1
1
  import { type ConnectedModifier, type ConnectedModifierChoice } from "@wix/auto_sdk_stores_products-v-3";
2
- import type { PropsWithChildren } from "react";
2
+ export interface RootProps {
3
+ children: React.ReactNode;
4
+ }
3
5
  /**
4
6
  * Root component that provides the ProductModifiers service context to its children.
5
7
  * This component sets up the necessary services for managing product modifier functionality.
@@ -31,9 +33,9 @@ import type { PropsWithChildren } from "react";
31
33
  * <div className="choices">
32
34
  * {choices.map(choice => (
33
35
  * <ProductModifiers.Choice key={choice.id} modifier={modifier} choice={choice}>
34
- * {({ value, isSelected, onSelect }) => (
36
+ * {({ value, isSelected, select }) => (
35
37
  * <button
36
- * onClick={onSelect}
38
+ * onClick={select}
37
39
  * className={isSelected ? 'selected' : ''}
38
40
  * >
39
41
  * {value}
@@ -74,7 +76,7 @@ import type { PropsWithChildren } from "react";
74
76
  * }
75
77
  * ```
76
78
  */
77
- export declare function Root(props: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
79
+ export declare function Root(props: RootProps): React.ReactNode;
78
80
  /**
79
81
  * Props for Modifiers headless component
80
82
  */
@@ -242,7 +244,7 @@ export interface ChoiceRenderProps {
242
244
  /** Whether this choice is currently selected */
243
245
  isSelected: boolean;
244
246
  /** Function to select this choice */
245
- onSelect: () => void;
247
+ select: () => void;
246
248
  /** Modifier name */
247
249
  modifierName: string;
248
250
  /** Choice value */
@@ -261,9 +263,9 @@ export interface ChoiceRenderProps {
261
263
  * function ModifierChoiceButton({ modifier, choice }) {
262
264
  * return (
263
265
  * <ProductModifiers.Choice modifier={modifier} choice={choice}>
264
- * {({ value, description, isSelected, onSelect, colorCode }) => (
266
+ * {({ value, description, isSelected, select, colorCode }) => (
265
267
  * <button
266
- * onClick={onSelect}
268
+ * onClick={select}
267
269
  * className={`choice-button ${isSelected ? 'selected' : ''}`}
268
270
  * style={colorCode ? { backgroundColor: colorCode } : {}}
269
271
  * >
@@ -297,7 +299,7 @@ export interface FreeTextRenderProps {
297
299
  /** Current text value */
298
300
  value: string;
299
301
  /** Function to update text value */
300
- onChange: (value: string) => void;
302
+ setText: (value: string) => void;
301
303
  /** Whether this modifier is mandatory */
302
304
  mandatory: boolean;
303
305
  /** Maximum characters allowed */
@@ -322,14 +324,14 @@ export interface FreeTextRenderProps {
322
324
  * function FreeTextModifier({ modifier }) {
323
325
  * return (
324
326
  * <ProductModifiers.FreeText modifier={modifier}>
325
- * {({ value, onChange, mandatory, maxChars, placeholder, charCount, isOverLimit, modifierName }) => (
327
+ * {({ value, setText, mandatory, maxChars, placeholder, charCount, isOverLimit, modifierName }) => (
326
328
  * <div className="free-text-modifier">
327
329
  * <label>
328
330
  * {modifierName} {mandatory && <span className="required">*</span>}
329
331
  * </label>
330
332
  * <textarea
331
333
  * value={value}
332
- * onChange={(e) => onChange(e.target.value)}
334
+ * setText={(e) => setText(e.target.value)}
333
335
  * placeholder={placeholder}
334
336
  * maxLength={maxChars}
335
337
  * className={isOverLimit ? 'over-limit' : ''}
@@ -363,7 +365,7 @@ export interface ToggleFreeTextRenderProps {
363
365
  /** Whether the text input is shown */
364
366
  isTextInputShown: boolean;
365
367
  /** Function to toggle text input visibility */
366
- onToggle: () => void;
368
+ toggle: () => void;
367
369
  /** Whether this modifier is mandatory */
368
370
  mandatory: boolean;
369
371
  /** Modifier name */
@@ -381,14 +383,14 @@ export interface ToggleFreeTextRenderProps {
381
383
  * function ToggleFreeTextModifier({ modifier }) {
382
384
  * return (
383
385
  * <ProductModifiers.ToggleFreeText modifier={modifier}>
384
- * {({ isTextInputShown, onToggle, mandatory, modifierName }) => (
386
+ * {({ isTextInputShown, toggle, mandatory, modifierName }) => (
385
387
  * <div className="toggle-free-text">
386
388
  * {!mandatory && (
387
389
  * <label>
388
390
  * <input
389
391
  * type="checkbox"
390
392
  * checked={isTextInputShown}
391
- * onChange={onToggle}
393
+ * onChange={toggle}
392
394
  * />
393
395
  * Add {modifierName}
394
396
  * </label>