@wix/headless-stores 0.0.79 → 0.0.81
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/Product.d.ts +14 -0
- package/cjs/dist/react/Product.js +11 -0
- package/cjs/dist/react/ProductList.d.ts +22 -2
- package/cjs/dist/react/ProductList.js +6 -2
- package/dist/react/Product.d.ts +14 -0
- package/dist/react/Product.js +11 -0
- package/dist/react/ProductList.d.ts +22 -2
- package/dist/react/ProductList.js +6 -2
- package/package.json +1 -1
|
@@ -833,6 +833,20 @@ export interface ProductQuantityRawSubComponentProps {
|
|
|
833
833
|
* ```
|
|
834
834
|
*/
|
|
835
835
|
export declare const ProductQuantityRaw: React.ForwardRefExoticComponent<ProductQuantityRawSubComponentProps & React.RefAttributes<HTMLElement>>;
|
|
836
|
+
export interface ProductVariantSelectorResetProps {
|
|
837
|
+
/** Whether to render as a child component */
|
|
838
|
+
asChild?: boolean;
|
|
839
|
+
/** Custom render function when using asChild */
|
|
840
|
+
children?: AsChildChildren<{
|
|
841
|
+
reset: () => void;
|
|
842
|
+
hasSelections: boolean;
|
|
843
|
+
}>;
|
|
844
|
+
/** CSS classes to apply to the default element */
|
|
845
|
+
className?: string;
|
|
846
|
+
/** Label for the reset button */
|
|
847
|
+
label?: string;
|
|
848
|
+
}
|
|
849
|
+
export declare const ProductVariantSelectorReset: React.ForwardRefExoticComponent<ProductVariantSelectorResetProps & React.RefAttributes<HTMLButtonElement>>;
|
|
836
850
|
/**
|
|
837
851
|
* Add to cart action button component following the documented API.
|
|
838
852
|
* Automatically integrates with the selected variant and handles loading states.
|
|
@@ -46,6 +46,7 @@ var TestIds;
|
|
|
46
46
|
TestIds["productStock"] = "product-stock";
|
|
47
47
|
TestIds["productVariants"] = "product-variants";
|
|
48
48
|
TestIds["productVariantOptions"] = "product-variant-options";
|
|
49
|
+
TestIds["productVariantSelectorReset"] = "product-variant-selector-reset";
|
|
49
50
|
TestIds["productVariantOption"] = "product-variant-option";
|
|
50
51
|
TestIds["productVariant"] = "product-variant";
|
|
51
52
|
TestIds["productVariantSku"] = "product-variant-sku";
|
|
@@ -859,6 +860,16 @@ export const ProductQuantityRaw = React.forwardRef((props, ref) => {
|
|
|
859
860
|
return (_jsx(AsChildSlot, { ref: ref, customElement: children, asChild: asChild, className: className, "data-testid": TestIds.productQuantityRaw, customElementProps: renderProps }));
|
|
860
861
|
} }));
|
|
861
862
|
});
|
|
863
|
+
export const ProductVariantSelectorReset = React.forwardRef((props, ref) => {
|
|
864
|
+
const { asChild, children, className } = props;
|
|
865
|
+
return (_jsx(ProductVariantSelector.Reset, { children: (renderProps) => {
|
|
866
|
+
if (!renderProps.hasSelections) {
|
|
867
|
+
return null;
|
|
868
|
+
}
|
|
869
|
+
const label = props.label || 'Reset Selections';
|
|
870
|
+
return (_jsx(AsChildSlot, { ref: ref, customElement: children, asChild: asChild, className: className, "data-testid": TestIds.productVariantSelectorReset, customElementProps: renderProps, children: _jsx("button", { onClick: renderProps.reset, children: label }) }));
|
|
871
|
+
} }));
|
|
872
|
+
});
|
|
862
873
|
/**
|
|
863
874
|
* Add to cart action button component following the documented API.
|
|
864
875
|
* Automatically integrates with the selected variant and handles loading states.
|
|
@@ -120,9 +120,29 @@ export declare const ProductRepeater: React.ForwardRefExoticComponent<ProductRep
|
|
|
120
120
|
* Props for ProductList LoadMoreTrigger component
|
|
121
121
|
*/
|
|
122
122
|
export interface LoadMoreTriggerProps {
|
|
123
|
-
|
|
123
|
+
/** Custom render function when using asChild */
|
|
124
|
+
children?: React.ReactNode | React.ForwardRefRenderFunction<HTMLButtonElement, {
|
|
125
|
+
isLoading: boolean;
|
|
126
|
+
hasMoreProducts: boolean;
|
|
127
|
+
loadMore: () => void;
|
|
128
|
+
}>;
|
|
129
|
+
/**
|
|
130
|
+
* Whether to render as a child component.
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
124
133
|
asChild?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* The CSS classes to apply to the button.
|
|
136
|
+
*/
|
|
125
137
|
className?: string;
|
|
138
|
+
/**
|
|
139
|
+
* The label to display inside the button.
|
|
140
|
+
*/
|
|
141
|
+
label?: string;
|
|
142
|
+
/**
|
|
143
|
+
* The loading state to display inside the button.
|
|
144
|
+
*/
|
|
145
|
+
loadingState?: React.ReactNode;
|
|
126
146
|
}
|
|
127
147
|
/**
|
|
128
148
|
* Displays a button to load more products. Not rendered if infiniteScroll is false or no products are left to load.
|
|
@@ -136,7 +156,7 @@ export interface LoadMoreTriggerProps {
|
|
|
136
156
|
* </ProductList.LoadMoreTrigger>
|
|
137
157
|
* ```
|
|
138
158
|
*/
|
|
139
|
-
export declare const LoadMoreTrigger: React.ForwardRefExoticComponent<LoadMoreTriggerProps & React.RefAttributes<
|
|
159
|
+
export declare const LoadMoreTrigger: React.ForwardRefExoticComponent<LoadMoreTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
140
160
|
/**
|
|
141
161
|
* Props for ProductList Totals Displayed component
|
|
142
162
|
*/
|
|
@@ -176,13 +176,17 @@ export const ProductRepeater = React.forwardRef((props, _ref) => {
|
|
|
176
176
|
* ```
|
|
177
177
|
*/
|
|
178
178
|
export const LoadMoreTrigger = React.forwardRef((props, ref) => {
|
|
179
|
-
const { asChild, children, className } = props;
|
|
179
|
+
const { asChild, children, className, label = 'Load More', loadingState = 'Loading...', } = props;
|
|
180
180
|
return (_jsx(CoreProductListPagination.LoadMoreTrigger, { children: ({ loadMore, hasMoreProducts, isLoading }) => {
|
|
181
181
|
// Don't render if no more products to load
|
|
182
182
|
if (!hasMoreProducts)
|
|
183
183
|
return null;
|
|
184
184
|
const handleClick = () => loadMore(10);
|
|
185
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, onClick: handleClick, disabled: isLoading, "data-testid": TestIds.productListLoadMore, customElement: children,
|
|
185
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, onClick: handleClick, disabled: isLoading, "data-testid": TestIds.productListLoadMore, customElement: children, customElementProps: {
|
|
186
|
+
loadMore,
|
|
187
|
+
hasMoreProducts,
|
|
188
|
+
isLoading,
|
|
189
|
+
}, children: _jsx("button", { children: isLoading ? loadingState : label }) }));
|
|
186
190
|
} }));
|
|
187
191
|
});
|
|
188
192
|
/**
|
package/dist/react/Product.d.ts
CHANGED
|
@@ -833,6 +833,20 @@ export interface ProductQuantityRawSubComponentProps {
|
|
|
833
833
|
* ```
|
|
834
834
|
*/
|
|
835
835
|
export declare const ProductQuantityRaw: React.ForwardRefExoticComponent<ProductQuantityRawSubComponentProps & React.RefAttributes<HTMLElement>>;
|
|
836
|
+
export interface ProductVariantSelectorResetProps {
|
|
837
|
+
/** Whether to render as a child component */
|
|
838
|
+
asChild?: boolean;
|
|
839
|
+
/** Custom render function when using asChild */
|
|
840
|
+
children?: AsChildChildren<{
|
|
841
|
+
reset: () => void;
|
|
842
|
+
hasSelections: boolean;
|
|
843
|
+
}>;
|
|
844
|
+
/** CSS classes to apply to the default element */
|
|
845
|
+
className?: string;
|
|
846
|
+
/** Label for the reset button */
|
|
847
|
+
label?: string;
|
|
848
|
+
}
|
|
849
|
+
export declare const ProductVariantSelectorReset: React.ForwardRefExoticComponent<ProductVariantSelectorResetProps & React.RefAttributes<HTMLButtonElement>>;
|
|
836
850
|
/**
|
|
837
851
|
* Add to cart action button component following the documented API.
|
|
838
852
|
* Automatically integrates with the selected variant and handles loading states.
|
package/dist/react/Product.js
CHANGED
|
@@ -46,6 +46,7 @@ var TestIds;
|
|
|
46
46
|
TestIds["productStock"] = "product-stock";
|
|
47
47
|
TestIds["productVariants"] = "product-variants";
|
|
48
48
|
TestIds["productVariantOptions"] = "product-variant-options";
|
|
49
|
+
TestIds["productVariantSelectorReset"] = "product-variant-selector-reset";
|
|
49
50
|
TestIds["productVariantOption"] = "product-variant-option";
|
|
50
51
|
TestIds["productVariant"] = "product-variant";
|
|
51
52
|
TestIds["productVariantSku"] = "product-variant-sku";
|
|
@@ -859,6 +860,16 @@ export const ProductQuantityRaw = React.forwardRef((props, ref) => {
|
|
|
859
860
|
return (_jsx(AsChildSlot, { ref: ref, customElement: children, asChild: asChild, className: className, "data-testid": TestIds.productQuantityRaw, customElementProps: renderProps }));
|
|
860
861
|
} }));
|
|
861
862
|
});
|
|
863
|
+
export const ProductVariantSelectorReset = React.forwardRef((props, ref) => {
|
|
864
|
+
const { asChild, children, className } = props;
|
|
865
|
+
return (_jsx(ProductVariantSelector.Reset, { children: (renderProps) => {
|
|
866
|
+
if (!renderProps.hasSelections) {
|
|
867
|
+
return null;
|
|
868
|
+
}
|
|
869
|
+
const label = props.label || 'Reset Selections';
|
|
870
|
+
return (_jsx(AsChildSlot, { ref: ref, customElement: children, asChild: asChild, className: className, "data-testid": TestIds.productVariantSelectorReset, customElementProps: renderProps, children: _jsx("button", { onClick: renderProps.reset, children: label }) }));
|
|
871
|
+
} }));
|
|
872
|
+
});
|
|
862
873
|
/**
|
|
863
874
|
* Add to cart action button component following the documented API.
|
|
864
875
|
* Automatically integrates with the selected variant and handles loading states.
|
|
@@ -120,9 +120,29 @@ export declare const ProductRepeater: React.ForwardRefExoticComponent<ProductRep
|
|
|
120
120
|
* Props for ProductList LoadMoreTrigger component
|
|
121
121
|
*/
|
|
122
122
|
export interface LoadMoreTriggerProps {
|
|
123
|
-
|
|
123
|
+
/** Custom render function when using asChild */
|
|
124
|
+
children?: React.ReactNode | React.ForwardRefRenderFunction<HTMLButtonElement, {
|
|
125
|
+
isLoading: boolean;
|
|
126
|
+
hasMoreProducts: boolean;
|
|
127
|
+
loadMore: () => void;
|
|
128
|
+
}>;
|
|
129
|
+
/**
|
|
130
|
+
* Whether to render as a child component.
|
|
131
|
+
* @default false
|
|
132
|
+
*/
|
|
124
133
|
asChild?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* The CSS classes to apply to the button.
|
|
136
|
+
*/
|
|
125
137
|
className?: string;
|
|
138
|
+
/**
|
|
139
|
+
* The label to display inside the button.
|
|
140
|
+
*/
|
|
141
|
+
label?: string;
|
|
142
|
+
/**
|
|
143
|
+
* The loading state to display inside the button.
|
|
144
|
+
*/
|
|
145
|
+
loadingState?: React.ReactNode;
|
|
126
146
|
}
|
|
127
147
|
/**
|
|
128
148
|
* Displays a button to load more products. Not rendered if infiniteScroll is false or no products are left to load.
|
|
@@ -136,7 +156,7 @@ export interface LoadMoreTriggerProps {
|
|
|
136
156
|
* </ProductList.LoadMoreTrigger>
|
|
137
157
|
* ```
|
|
138
158
|
*/
|
|
139
|
-
export declare const LoadMoreTrigger: React.ForwardRefExoticComponent<LoadMoreTriggerProps & React.RefAttributes<
|
|
159
|
+
export declare const LoadMoreTrigger: React.ForwardRefExoticComponent<LoadMoreTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
140
160
|
/**
|
|
141
161
|
* Props for ProductList Totals Displayed component
|
|
142
162
|
*/
|
|
@@ -176,13 +176,17 @@ export const ProductRepeater = React.forwardRef((props, _ref) => {
|
|
|
176
176
|
* ```
|
|
177
177
|
*/
|
|
178
178
|
export const LoadMoreTrigger = React.forwardRef((props, ref) => {
|
|
179
|
-
const { asChild, children, className } = props;
|
|
179
|
+
const { asChild, children, className, label = 'Load More', loadingState = 'Loading...', } = props;
|
|
180
180
|
return (_jsx(CoreProductListPagination.LoadMoreTrigger, { children: ({ loadMore, hasMoreProducts, isLoading }) => {
|
|
181
181
|
// Don't render if no more products to load
|
|
182
182
|
if (!hasMoreProducts)
|
|
183
183
|
return null;
|
|
184
184
|
const handleClick = () => loadMore(10);
|
|
185
|
-
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, onClick: handleClick, disabled: isLoading, "data-testid": TestIds.productListLoadMore, customElement: children,
|
|
185
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, onClick: handleClick, disabled: isLoading, "data-testid": TestIds.productListLoadMore, customElement: children, customElementProps: {
|
|
186
|
+
loadMore,
|
|
187
|
+
hasMoreProducts,
|
|
188
|
+
isLoading,
|
|
189
|
+
}, children: _jsx("button", { children: isLoading ? loadingState : label }) }));
|
|
186
190
|
} }));
|
|
187
191
|
});
|
|
188
192
|
/**
|