@wix/headless-stores 0.0.41 → 0.0.43
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/cjs/dist/react/ProductList.d.ts +31 -3
- package/cjs/dist/react/ProductList.js +33 -5
- package/cjs/dist/react/ProductListFilters.d.ts +100 -111
- package/cjs/dist/react/ProductListFilters.js +105 -115
- package/cjs/dist/react/ProductListPagination.d.ts +89 -96
- package/cjs/dist/react/ProductListPagination.js +96 -104
- package/cjs/dist/react/ProductListSort.d.ts +26 -57
- package/cjs/dist/react/ProductListSort.js +26 -58
- package/cjs/dist/services/index.d.ts +1 -3
- package/cjs/dist/services/index.js +1 -3
- package/cjs/dist/services/products-list-search-service.d.ts +220 -0
- package/cjs/dist/services/products-list-search-service.js +813 -0
- package/cjs/dist/services/products-list-service.d.ts +28 -11
- package/cjs/dist/services/products-list-service.js +26 -6
- package/dist/react/ProductList.d.ts +31 -3
- package/dist/react/ProductList.js +33 -5
- package/dist/react/ProductListFilters.d.ts +100 -111
- package/dist/react/ProductListFilters.js +105 -115
- package/dist/react/ProductListPagination.d.ts +89 -96
- package/dist/react/ProductListPagination.js +96 -104
- package/dist/react/ProductListSort.d.ts +26 -57
- package/dist/react/ProductListSort.js +26 -58
- package/dist/services/index.d.ts +1 -3
- package/dist/services/index.js +1 -3
- package/dist/services/products-list-search-service.d.ts +220 -0
- package/dist/services/products-list-search-service.js +813 -0
- package/dist/services/products-list-service.d.ts +28 -11
- package/dist/services/products-list-service.js +26 -6
- package/package.json +2 -2
- package/cjs/dist/services/products-list-filters-service.d.ts +0 -309
- package/cjs/dist/services/products-list-filters-service.js +0 -504
- package/cjs/dist/services/products-list-pagination-service.d.ts +0 -186
- package/cjs/dist/services/products-list-pagination-service.js +0 -179
- package/cjs/dist/services/products-list-sort-service.d.ts +0 -117
- package/cjs/dist/services/products-list-sort-service.js +0 -144
- package/dist/services/products-list-filters-service.d.ts +0 -309
- package/dist/services/products-list-filters-service.js +0 -504
- package/dist/services/products-list-pagination-service.d.ts +0 -186
- package/dist/services/products-list-pagination-service.js +0 -179
- package/dist/services/products-list-sort-service.d.ts +0 -117
- package/dist/services/products-list-sort-service.js +0 -144
|
@@ -1,76 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ProductsListFiltersService, ProductsListFiltersServiceDefinition, } from "../services/products-list-filters-service.js";
|
|
5
|
-
/**
|
|
6
|
-
* Root component that provides the ProductListFilters service context to its children.
|
|
7
|
-
* This component sets up the necessary services for managing products list filters.
|
|
8
|
-
*
|
|
9
|
-
* @order 1
|
|
10
|
-
* @component
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* import { ProductListFilters } from '@wix/stores/components';
|
|
14
|
-
*
|
|
15
|
-
* function FiltersSection() {
|
|
16
|
-
* return (
|
|
17
|
-
* <ProductListFilters.Root
|
|
18
|
-
* productsListFiltersConfig={{
|
|
19
|
-
* minPrice: 0,
|
|
20
|
-
* maxPrice: 1000
|
|
21
|
-
* }}
|
|
22
|
-
* >
|
|
23
|
-
* <ProductListFilters.MinPrice>
|
|
24
|
-
* {({ minPrice, setSelectedMinPrice }) => (
|
|
25
|
-
* <input
|
|
26
|
-
* type="number"
|
|
27
|
-
* value={minPrice}
|
|
28
|
-
* onChange={(e) => setSelectedMinPrice(Number(e.target.value))}
|
|
29
|
-
* placeholder="Min price"
|
|
30
|
-
* />
|
|
31
|
-
* )}
|
|
32
|
-
* </ProductListFilters.MinPrice>
|
|
33
|
-
* </ProductListFilters.Root>
|
|
34
|
-
* );
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export function Root(props) {
|
|
39
|
-
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(ProductsListFiltersServiceDefinition, ProductsListFiltersService, props.productsListFiltersConfig), children: props.children }));
|
|
40
|
-
}
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useService } from "@wix/services-manager-react";
|
|
3
|
+
import { ProductsListSearchServiceDefinition, } from "../services/products-list-search-service.js";
|
|
41
4
|
/**
|
|
42
5
|
* Headless component for managing inventory status filters
|
|
43
6
|
*
|
|
44
7
|
* @component
|
|
45
8
|
* @example
|
|
46
9
|
* ```tsx
|
|
47
|
-
* import { ProductListFilters } from '@wix/stores/components';
|
|
10
|
+
* import { ProductList, ProductListFilters } from '@wix/stores/components';
|
|
48
11
|
*
|
|
49
12
|
* function InventoryStatusFilter() {
|
|
50
13
|
* return (
|
|
51
|
-
* <
|
|
52
|
-
* {
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
14
|
+
* <ProductList.Root
|
|
15
|
+
* productsListConfig={{ products: [], searchOptions: {}, pagingMetadata: {}, aggregations: {} }}
|
|
16
|
+
* productsListSearchConfig={{ customizations: [] }}
|
|
17
|
+
* >
|
|
18
|
+
* <ProductListFilters.InventoryStatus>
|
|
19
|
+
* {({ availableInventoryStatuses, selectedInventoryStatuses, toggleInventoryStatus }) => (
|
|
20
|
+
* <div>
|
|
21
|
+
* <h4>Inventory Status:</h4>
|
|
22
|
+
* {availableInventoryStatuses.map(status => (
|
|
23
|
+
* <label key={status}>
|
|
24
|
+
* <input
|
|
25
|
+
* type="checkbox"
|
|
26
|
+
* checked={selectedInventoryStatuses.includes(status)}
|
|
27
|
+
* onChange={() => toggleInventoryStatus(status)}
|
|
28
|
+
* />
|
|
29
|
+
* {status}
|
|
30
|
+
* </label>
|
|
31
|
+
* ))}
|
|
32
|
+
* </div>
|
|
33
|
+
* )}
|
|
34
|
+
* </ProductListFilters.InventoryStatus>
|
|
35
|
+
* </ProductList.Root>
|
|
68
36
|
* );
|
|
69
37
|
* }
|
|
70
38
|
* ```
|
|
71
39
|
*/
|
|
72
40
|
export function InventoryStatus(props) {
|
|
73
|
-
const service = useService(
|
|
41
|
+
const service = useService(ProductsListSearchServiceDefinition);
|
|
74
42
|
const availableInventoryStatuses = service.availableInventoryStatuses.get();
|
|
75
43
|
const selectedInventoryStatuses = service.selectedInventoryStatuses.get();
|
|
76
44
|
const toggleInventoryStatus = service.toggleInventoryStatus;
|
|
@@ -88,27 +56,32 @@ export function InventoryStatus(props) {
|
|
|
88
56
|
* @component
|
|
89
57
|
* @example
|
|
90
58
|
* ```tsx
|
|
91
|
-
* import { ProductListFilters } from '@wix/stores/components';
|
|
59
|
+
* import { ProductList, ProductListFilters } from '@wix/stores/components';
|
|
92
60
|
*
|
|
93
61
|
* function ResetFiltersButton() {
|
|
94
62
|
* return (
|
|
95
|
-
* <
|
|
96
|
-
* {
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
63
|
+
* <ProductList.Root
|
|
64
|
+
* productsListConfig={{ products: [], searchOptions: {}, pagingMetadata: {}, aggregations: {} }}
|
|
65
|
+
* productsListSearchConfig={{ customizations: [] }}
|
|
66
|
+
* >
|
|
67
|
+
* <ProductListFilters.ResetTrigger>
|
|
68
|
+
* {({ resetFilters, isFiltered }) => (
|
|
69
|
+
* <button
|
|
70
|
+
* onClick={resetFilters}
|
|
71
|
+
* disabled={!isFiltered}
|
|
72
|
+
* className={isFiltered ? 'active' : 'disabled'}
|
|
73
|
+
* >
|
|
74
|
+
* {isFiltered ? 'Clear Filters' : 'No Filters Applied'}
|
|
75
|
+
* </button>
|
|
76
|
+
* )}
|
|
77
|
+
* </ProductListFilters.ResetTrigger>
|
|
78
|
+
* </ProductList.Root>
|
|
106
79
|
* );
|
|
107
80
|
* }
|
|
108
81
|
* ```
|
|
109
82
|
*/
|
|
110
83
|
export function ResetTrigger(props) {
|
|
111
|
-
const service = useService(
|
|
84
|
+
const service = useService(ProductsListSearchServiceDefinition);
|
|
112
85
|
const resetFilters = service.reset;
|
|
113
86
|
const isFiltered = service.isFiltered.get();
|
|
114
87
|
return typeof props.children === "function"
|
|
@@ -121,41 +94,46 @@ export function ResetTrigger(props) {
|
|
|
121
94
|
* @component
|
|
122
95
|
* @example
|
|
123
96
|
* ```tsx
|
|
124
|
-
* import { ProductListFilters } from '@wix/stores/components';
|
|
97
|
+
* import { ProductList, ProductListFilters } from '@wix/stores/components';
|
|
125
98
|
*
|
|
126
99
|
* function PriceRangeFilter() {
|
|
127
100
|
* return (
|
|
128
|
-
* <
|
|
129
|
-
* {
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
101
|
+
* <ProductList.Root
|
|
102
|
+
* productsListConfig={{ products: [], searchOptions: {}, pagingMetadata: {}, aggregations: {} }}
|
|
103
|
+
* productsListSearchConfig={{ customizations: [] }}
|
|
104
|
+
* >
|
|
105
|
+
* <ProductListFilters.PriceRange>
|
|
106
|
+
* {({ minPrice, maxPrice, setSelectedMinPrice, setSelectedMaxPrice }) => (
|
|
107
|
+
* <div className="price-range">
|
|
108
|
+
* <h4>Price Range:</h4>
|
|
109
|
+
* <div className="price-inputs">
|
|
110
|
+
* <input
|
|
111
|
+
* type="number"
|
|
112
|
+
* value={minPrice}
|
|
113
|
+
* onChange={(e) => setSelectedMinPrice(Number(e.target.value))}
|
|
114
|
+
* placeholder="Min"
|
|
115
|
+
* />
|
|
116
|
+
* <span>to</span>
|
|
117
|
+
* <input
|
|
118
|
+
* type="number"
|
|
119
|
+
* value={maxPrice}
|
|
120
|
+
* onChange={(e) => setSelectedMaxPrice(Number(e.target.value))}
|
|
121
|
+
* placeholder="Max"
|
|
122
|
+
* />
|
|
123
|
+
* </div>
|
|
146
124
|
* </div>
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* </
|
|
125
|
+
* )}
|
|
126
|
+
* </ProductListFilters.PriceRange>
|
|
127
|
+
* </ProductList.Root>
|
|
150
128
|
* );
|
|
151
129
|
* }
|
|
152
130
|
* ```
|
|
153
131
|
*/
|
|
154
132
|
export function PriceRange(props) {
|
|
155
|
-
const service = useService(
|
|
133
|
+
const service = useService(ProductsListSearchServiceDefinition);
|
|
156
134
|
const selectedMinPrice = service.selectedMinPrice.get();
|
|
157
|
-
const availableMinPrice = service.availableMinPrice.get();
|
|
158
135
|
const selectedMaxPrice = service.selectedMaxPrice.get();
|
|
136
|
+
const availableMinPrice = service.availableMinPrice.get();
|
|
159
137
|
const availableMaxPrice = service.availableMaxPrice.get();
|
|
160
138
|
const setSelectedMinPrice = service.setSelectedMinPrice;
|
|
161
139
|
const setSelectedMaxPrice = service.setSelectedMaxPrice;
|
|
@@ -170,6 +148,13 @@ export function PriceRange(props) {
|
|
|
170
148
|
})
|
|
171
149
|
: props.children;
|
|
172
150
|
}
|
|
151
|
+
export function CategoryFilter(props) {
|
|
152
|
+
const service = useService(ProductsListSearchServiceDefinition);
|
|
153
|
+
const selectedCategory = service.selectedCategory.get();
|
|
154
|
+
return typeof props.children === "function"
|
|
155
|
+
? props.children({ selectedCategory })
|
|
156
|
+
: props.children;
|
|
157
|
+
}
|
|
173
158
|
/**
|
|
174
159
|
* Headless component that renders content for each product option in the list.
|
|
175
160
|
* Maps over all available product options and provides each option through a render prop.
|
|
@@ -179,33 +164,38 @@ export function PriceRange(props) {
|
|
|
179
164
|
* @component
|
|
180
165
|
* @example
|
|
181
166
|
* ```tsx
|
|
182
|
-
* import { ProductListFilters } from '@wix/stores/components';
|
|
167
|
+
* import { ProductList, ProductListFilters } from '@wix/stores/components';
|
|
183
168
|
*
|
|
184
169
|
* function ProductOptionsFilter() {
|
|
185
170
|
* return (
|
|
186
|
-
* <
|
|
187
|
-
* {
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
171
|
+
* <ProductList.Root
|
|
172
|
+
* productsListConfig={{ products: [], searchOptions: {}, pagingMetadata: {}, aggregations: {} }}
|
|
173
|
+
* productsListSearchConfig={{ customizations: [] }}
|
|
174
|
+
* >
|
|
175
|
+
* <ProductListFilters.ProductOptions>
|
|
176
|
+
* {({ option, selectedChoices, toggleChoice }) => (
|
|
177
|
+
* <div key={option.id}>
|
|
178
|
+
* <h4>{option.name}</h4>
|
|
179
|
+
* {option.choices.map(choice => (
|
|
180
|
+
* <label key={choice.id}>
|
|
181
|
+
* <input
|
|
182
|
+
* type="checkbox"
|
|
183
|
+
* checked={selectedChoices.includes(choice.id)}
|
|
184
|
+
* onChange={() => toggleChoice(choice.id)}
|
|
185
|
+
* />
|
|
186
|
+
* {choice.name}
|
|
187
|
+
* </label>
|
|
188
|
+
* ))}
|
|
189
|
+
* </div>
|
|
190
|
+
* )}
|
|
191
|
+
* </ProductListFilters.ProductOptions>
|
|
192
|
+
* </ProductList.Root>
|
|
203
193
|
* );
|
|
204
194
|
* }
|
|
205
195
|
* ```
|
|
206
196
|
*/
|
|
207
197
|
export function ProductOptions(props) {
|
|
208
|
-
const service = useService(
|
|
198
|
+
const service = useService(ProductsListSearchServiceDefinition);
|
|
209
199
|
const availableOptions = service.availableProductOptions.get();
|
|
210
200
|
const selectedProductOptions = service.selectedProductOptions.get();
|
|
211
201
|
// Don't render if no options are available
|
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
export interface RootProps {
|
|
2
|
-
children: React.ReactNode;
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* Root component that provides the ProductListPagination service context to its children.
|
|
6
|
-
* This component sets up the necessary services for managing products list pagination.
|
|
7
|
-
*
|
|
8
|
-
* @order 1
|
|
9
|
-
* @component
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* import { ProductListPagination } from '@wix/stores/components';
|
|
13
|
-
*
|
|
14
|
-
* function PaginationSection() {
|
|
15
|
-
* return (
|
|
16
|
-
* <ProductListPagination.Root>
|
|
17
|
-
* <ProductListPagination.NextPageTrigger>
|
|
18
|
-
* {({ nextPage, hasNextPage }) => (
|
|
19
|
-
* <button
|
|
20
|
-
* onClick={nextPage}
|
|
21
|
-
* disabled={!hasNextPage}
|
|
22
|
-
* >
|
|
23
|
-
* Next Page
|
|
24
|
-
* </button>
|
|
25
|
-
* )}
|
|
26
|
-
* </ProductListPagination.NextPageTrigger>
|
|
27
|
-
* </ProductListPagination.Root>
|
|
28
|
-
* );
|
|
29
|
-
* }
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function Root(props: RootProps): React.ReactNode;
|
|
33
1
|
/**
|
|
34
2
|
* Props for PageSize headless component
|
|
35
3
|
*/
|
|
@@ -52,25 +20,30 @@ export interface PageSizeRenderProps {
|
|
|
52
20
|
* @component
|
|
53
21
|
* @example
|
|
54
22
|
* ```tsx
|
|
55
|
-
* import { ProductListPagination } from '@wix/stores/components';
|
|
23
|
+
* import { ProductList, ProductListPagination } from '@wix/stores/components';
|
|
56
24
|
*
|
|
57
25
|
* function PageSizeSelector() {
|
|
58
26
|
* return (
|
|
59
|
-
* <
|
|
60
|
-
* {
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* <
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
27
|
+
* <ProductList.Root
|
|
28
|
+
* productsListConfig={{ products: [], searchOptions: {}, pagingMetadata: {}, aggregations: {} }}
|
|
29
|
+
* productsListSearchConfig={{ customizations: [] }}
|
|
30
|
+
* >
|
|
31
|
+
* <ProductListPagination.PageSize>
|
|
32
|
+
* {({ currentLimit, setLimit }) => (
|
|
33
|
+
* <div>
|
|
34
|
+
* <label>Items per page:</label>
|
|
35
|
+
* <select
|
|
36
|
+
* value={currentLimit}
|
|
37
|
+
* onChange={(e) => setLimit(Number(e.target.value))}
|
|
38
|
+
* >
|
|
39
|
+
* <option value={10}>10</option>
|
|
40
|
+
* <option value={20}>20</option>
|
|
41
|
+
* <option value={50}>50</option>
|
|
42
|
+
* </select>
|
|
43
|
+
* </div>
|
|
44
|
+
* )}
|
|
45
|
+
* </ProductListPagination.PageSize>
|
|
46
|
+
* </ProductList.Root>
|
|
74
47
|
* );
|
|
75
48
|
* }
|
|
76
49
|
* ```
|
|
@@ -98,21 +71,26 @@ export interface NextPageTriggerRenderProps {
|
|
|
98
71
|
* @component
|
|
99
72
|
* @example
|
|
100
73
|
* ```tsx
|
|
101
|
-
* import { ProductListPagination } from '@wix/stores/components';
|
|
74
|
+
* import { ProductList, ProductListPagination } from '@wix/stores/components';
|
|
102
75
|
*
|
|
103
76
|
* function NextPageButton() {
|
|
104
77
|
* return (
|
|
105
|
-
* <
|
|
106
|
-
* {
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
78
|
+
* <ProductList.Root
|
|
79
|
+
* productsListConfig={{ products: [], searchOptions: {}, pagingMetadata: {}, aggregations: {} }}
|
|
80
|
+
* productsListSearchConfig={{ customizations: [] }}
|
|
81
|
+
* >
|
|
82
|
+
* <ProductListPagination.NextPageTrigger>
|
|
83
|
+
* {({ nextPage, hasNextPage }) => (
|
|
84
|
+
* <button
|
|
85
|
+
* onClick={nextPage}
|
|
86
|
+
* disabled={!hasNextPage}
|
|
87
|
+
* className={hasNextPage ? 'enabled' : 'disabled'}
|
|
88
|
+
* >
|
|
89
|
+
* Next →
|
|
90
|
+
* </button>
|
|
91
|
+
* )}
|
|
92
|
+
* </ProductListPagination.NextPageTrigger>
|
|
93
|
+
* </ProductList.Root>
|
|
116
94
|
* );
|
|
117
95
|
* }
|
|
118
96
|
* ```
|
|
@@ -140,21 +118,26 @@ export interface PreviousPageTriggerRenderProps {
|
|
|
140
118
|
* @component
|
|
141
119
|
* @example
|
|
142
120
|
* ```tsx
|
|
143
|
-
* import { ProductListPagination } from '@wix/stores/components';
|
|
121
|
+
* import { ProductList, ProductListPagination } from '@wix/stores/components';
|
|
144
122
|
*
|
|
145
123
|
* function PrevPageButton() {
|
|
146
124
|
* return (
|
|
147
|
-
* <
|
|
148
|
-
* {
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
125
|
+
* <ProductList.Root
|
|
126
|
+
* productsListConfig={{ products: [], searchOptions: {}, pagingMetadata: {}, aggregations: {} }}
|
|
127
|
+
* productsListSearchConfig={{ customizations: [] }}
|
|
128
|
+
* >
|
|
129
|
+
* <ProductListPagination.PreviousPageTrigger>
|
|
130
|
+
* {({ prevPage, hasPrevPage }) => (
|
|
131
|
+
* <button
|
|
132
|
+
* onClick={prevPage}
|
|
133
|
+
* disabled={!hasPrevPage}
|
|
134
|
+
* className={hasPrevPage ? 'enabled' : 'disabled'}
|
|
135
|
+
* >
|
|
136
|
+
* ← Previous
|
|
137
|
+
* </button>
|
|
138
|
+
* )}
|
|
139
|
+
* </ProductListPagination.PreviousPageTrigger>
|
|
140
|
+
* </ProductList.Root>
|
|
158
141
|
* );
|
|
159
142
|
* }
|
|
160
143
|
* ```
|
|
@@ -182,21 +165,26 @@ export interface FirstPageTriggerRenderProps {
|
|
|
182
165
|
* @component
|
|
183
166
|
* @example
|
|
184
167
|
* ```tsx
|
|
185
|
-
* import { ProductListPagination } from '@wix/stores/components';
|
|
168
|
+
* import { ProductList, ProductListPagination } from '@wix/stores/components';
|
|
186
169
|
*
|
|
187
170
|
* function FirstPageButton() {
|
|
188
171
|
* return (
|
|
189
|
-
* <
|
|
190
|
-
* {
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
172
|
+
* <ProductList.Root
|
|
173
|
+
* productsListConfig={{ products: [], searchOptions: {}, pagingMetadata: {}, aggregations: {} }}
|
|
174
|
+
* productsListSearchConfig={{ customizations: [] }}
|
|
175
|
+
* >
|
|
176
|
+
* <ProductListPagination.FirstPageTrigger>
|
|
177
|
+
* {({ navigateToFirstPage, hasPrevPage }) => (
|
|
178
|
+
* <button
|
|
179
|
+
* onClick={navigateToFirstPage}
|
|
180
|
+
* disabled={!hasPrevPage}
|
|
181
|
+
* title="Go to first page"
|
|
182
|
+
* >
|
|
183
|
+
* ⏮ First
|
|
184
|
+
* </button>
|
|
185
|
+
* )}
|
|
186
|
+
* </ProductListPagination.FirstPageTrigger>
|
|
187
|
+
* </ProductList.Root>
|
|
200
188
|
* );
|
|
201
189
|
* }
|
|
202
190
|
* ```
|
|
@@ -226,21 +214,26 @@ export interface LoadMoreTriggerRenderProps {
|
|
|
226
214
|
* @component
|
|
227
215
|
* @example
|
|
228
216
|
* ```tsx
|
|
229
|
-
* import { ProductListPagination } from '@wix/stores/components';
|
|
217
|
+
* import { ProductList, ProductListPagination } from '@wix/stores/components';
|
|
230
218
|
*
|
|
231
219
|
* function LoadMoreButton() {
|
|
232
220
|
* return (
|
|
233
|
-
* <
|
|
234
|
-
* {
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
221
|
+
* <ProductList.Root
|
|
222
|
+
* productsListConfig={{ products: [], searchOptions: {}, pagingMetadata: {}, aggregations: {} }}
|
|
223
|
+
* productsListSearchConfig={{ customizations: [] }}
|
|
224
|
+
* >
|
|
225
|
+
* <ProductListPagination.LoadMoreTrigger>
|
|
226
|
+
* {({ loadMore, hasMoreProducts, isLoading }) => (
|
|
227
|
+
* <button
|
|
228
|
+
* onClick={() => loadMore(10)}
|
|
229
|
+
* disabled={!hasMoreProducts || isLoading}
|
|
230
|
+
* className="load-more-btn"
|
|
231
|
+
* >
|
|
232
|
+
* {isLoading ? 'Loading...' : hasMoreProducts ? 'Load More' : 'No More Products'}
|
|
233
|
+
* </button>
|
|
234
|
+
* )}
|
|
235
|
+
* </ProductListPagination.LoadMoreTrigger>
|
|
236
|
+
* </ProductList.Root>
|
|
244
237
|
* );
|
|
245
238
|
* }
|
|
246
239
|
* ```
|