@wix/headless-stores 0.0.90 → 0.0.92
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/data-component-tags.d.ts +8 -0
- package/cjs/dist/data-component-tags.js +9 -0
- package/cjs/dist/react/Category.d.ts +5 -5
- package/cjs/dist/react/Category.js +10 -7
- package/cjs/dist/react/CategoryList.d.ts +4 -1
- package/cjs/dist/react/CategoryList.js +5 -3
- package/cjs/dist/react/Choice.js +3 -0
- package/cjs/dist/react/Option.js +3 -1
- package/cjs/dist/react/Product.d.ts +4 -1
- package/cjs/dist/react/Product.js +7 -5
- package/cjs/dist/react/ProductList.js +3 -1
- package/cjs/dist/react/core/CategoryList.d.ts +3 -0
- package/cjs/dist/react/core/CategoryList.js +1 -0
- package/dist/data-component-tags.d.ts +8 -0
- package/dist/data-component-tags.js +9 -0
- package/dist/react/Category.d.ts +5 -5
- package/dist/react/Category.js +10 -7
- package/dist/react/CategoryList.d.ts +4 -1
- package/dist/react/CategoryList.js +5 -3
- package/dist/react/Choice.js +3 -0
- package/dist/react/Option.js +3 -1
- package/dist/react/Product.d.ts +4 -1
- package/dist/react/Product.js +7 -5
- package/dist/react/ProductList.js +3 -1
- package/dist/react/core/CategoryList.d.ts +3 -0
- package/dist/react/core/CategoryList.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare enum DataComponentTags {
|
|
2
|
+
categoryListRoot = "stores.category-list-root",
|
|
3
|
+
categoryRoot = "stores.category-root",
|
|
4
|
+
choiceRoot = "stores.choice-root",
|
|
5
|
+
optionRoot = "stores.option-root",
|
|
6
|
+
productListRoot = "stores.product-list-root",
|
|
7
|
+
productRoot = "stores.product-root"
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var DataComponentTags;
|
|
2
|
+
(function (DataComponentTags) {
|
|
3
|
+
DataComponentTags["categoryListRoot"] = "stores.category-list-root";
|
|
4
|
+
DataComponentTags["categoryRoot"] = "stores.category-root";
|
|
5
|
+
DataComponentTags["choiceRoot"] = "stores.choice-root";
|
|
6
|
+
DataComponentTags["optionRoot"] = "stores.option-root";
|
|
7
|
+
DataComponentTags["productListRoot"] = "stores.product-list-root";
|
|
8
|
+
DataComponentTags["productRoot"] = "stores.product-root";
|
|
9
|
+
})(DataComponentTags || (DataComponentTags = {}));
|
|
@@ -98,14 +98,14 @@ export interface CategoryFilterProps {
|
|
|
98
98
|
* ```tsx
|
|
99
99
|
* import { Category } from '@wix/headless-stores/react';
|
|
100
100
|
*
|
|
101
|
-
* <Category.Root
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
101
|
+
* <Category.Root category={category}>
|
|
102
|
+
* <Category.Trigger />
|
|
103
|
+
* <Category.Label />
|
|
104
|
+
* <Category.ID />
|
|
105
105
|
* </Category.Root>
|
|
106
106
|
* ```
|
|
107
107
|
*/
|
|
108
|
-
export declare
|
|
108
|
+
export declare const Root: React.ForwardRefExoticComponent<CategoryRootProps & React.RefAttributes<HTMLElement>>;
|
|
109
109
|
/**
|
|
110
110
|
* Interactive element for selecting or triggering category actions.
|
|
111
111
|
* Provides category data and selection state to custom render functions.
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
4
4
|
import * as CoreProductListFilters from './core/ProductListFilters.js';
|
|
5
|
+
import { DataComponentTags } from '../data-component-tags.js';
|
|
5
6
|
const CategoryContext = React.createContext(null);
|
|
6
7
|
function useCategoryContext() {
|
|
7
8
|
const context = React.useContext(CategoryContext);
|
|
@@ -12,6 +13,7 @@ function useCategoryContext() {
|
|
|
12
13
|
}
|
|
13
14
|
var TestIds;
|
|
14
15
|
(function (TestIds) {
|
|
16
|
+
TestIds["categoryRoot"] = "category-root";
|
|
15
17
|
TestIds["categoryItem"] = "category-item";
|
|
16
18
|
TestIds["categoryTrigger"] = "category-trigger";
|
|
17
19
|
TestIds["categoryLabel"] = "category-label";
|
|
@@ -30,14 +32,14 @@ var TestIds;
|
|
|
30
32
|
* ```tsx
|
|
31
33
|
* import { Category } from '@wix/headless-stores/react';
|
|
32
34
|
*
|
|
33
|
-
* <Category.Root
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* <Category.Root category={category}>
|
|
36
|
+
* <Category.Trigger />
|
|
37
|
+
* <Category.Label />
|
|
38
|
+
* <Category.ID />
|
|
37
39
|
* </Category.Root>
|
|
38
40
|
* ```
|
|
39
41
|
*/
|
|
40
|
-
export
|
|
42
|
+
export const Root = React.forwardRef((props, ref) => {
|
|
41
43
|
const { category, children } = props;
|
|
42
44
|
return (_jsx(CoreProductListFilters.CategoryFilter, { children: ({ selectedCategory, setSelectedCategory }) => {
|
|
43
45
|
// Determine if this category is selected by comparing with selectedCategory
|
|
@@ -48,9 +50,10 @@ export function Root(props) {
|
|
|
48
50
|
selectedCategory,
|
|
49
51
|
setSelectedCategory,
|
|
50
52
|
};
|
|
51
|
-
return (_jsx(CategoryContext.Provider, { value: contextValue, children: children }));
|
|
53
|
+
return (_jsx(CategoryContext.Provider, { value: contextValue, children: _jsx(AsChildSlot, { ref: ref, "data-component-tag": DataComponentTags.categoryRoot, "data-testid": TestIds.categoryRoot, children: children }) }));
|
|
52
54
|
} }));
|
|
53
|
-
}
|
|
55
|
+
});
|
|
56
|
+
Root.displayName = 'Category.Root';
|
|
54
57
|
/**
|
|
55
58
|
* Interactive element for selecting or triggering category actions.
|
|
56
59
|
* Provides category data and selection state to custom render functions.
|
|
@@ -61,7 +61,10 @@ export interface CategoryListCategoryRepeaterProps {
|
|
|
61
61
|
* }
|
|
62
62
|
* ```
|
|
63
63
|
*/
|
|
64
|
-
export declare
|
|
64
|
+
export declare const Root: {
|
|
65
|
+
(props: CategoryListRootProps): React.ReactNode;
|
|
66
|
+
displayName: string;
|
|
67
|
+
};
|
|
65
68
|
/**
|
|
66
69
|
* Displays loading state while category data is being fetched.
|
|
67
70
|
* Only displays its children when the categories list is currently loading.
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import * as CoreCategoryList from './core/CategoryList.js';
|
|
4
4
|
import * as Category from './Category.js';
|
|
5
5
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
6
|
+
import { DataComponentTags } from '../data-component-tags.js';
|
|
6
7
|
var TestIds;
|
|
7
8
|
(function (TestIds) {
|
|
8
9
|
TestIds["categoryListRoot"] = "category-list";
|
|
@@ -31,12 +32,13 @@ var TestIds;
|
|
|
31
32
|
* }
|
|
32
33
|
* ```
|
|
33
34
|
*/
|
|
34
|
-
export
|
|
35
|
+
export const Root = (props) => {
|
|
35
36
|
const { categories, categoriesListConfig, children, emptyState } = props;
|
|
36
37
|
// Create service config, prioritizing categoriesListConfig, then categories prop
|
|
37
38
|
const serviceConfig = categoriesListConfig || (categories ? { categories } : { categories: [] });
|
|
38
|
-
return (
|
|
39
|
-
}
|
|
39
|
+
return (_jsx(CoreCategoryList.Root, { categoriesListConfig: serviceConfig, children: _jsxs(AsChildSlot, { "data-testid": TestIds.categoryListRoot, "data-component-tag": DataComponentTags.categoryListRoot, children: [children, emptyState && (_jsx(CoreCategoryList.EmptyState, { children: emptyState }))] }) }));
|
|
40
|
+
};
|
|
41
|
+
Root.displayName = 'CategoryList.Root';
|
|
40
42
|
/**
|
|
41
43
|
* Displays loading state while category data is being fetched.
|
|
42
44
|
* Only displays its children when the categories list is currently loading.
|
package/cjs/dist/react/Choice.js
CHANGED
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FreeText as FreeTextPrimitive } from './core/ProductModifiers.js';
|
|
4
4
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
5
|
+
import { DataComponentTags } from '../data-component-tags.js';
|
|
5
6
|
var TestIds;
|
|
6
7
|
(function (TestIds) {
|
|
7
8
|
TestIds["choiceRoot"] = "choice-root";
|
|
@@ -43,11 +44,13 @@ export const Root = React.forwardRef((props, ref) => {
|
|
|
43
44
|
}
|
|
44
45
|
const { choice } = choiceContext;
|
|
45
46
|
const attributes = {
|
|
47
|
+
'data-component-tag': DataComponentTags.choiceRoot,
|
|
46
48
|
'data-testid': TestIds.choiceRoot,
|
|
47
49
|
'data-type': choice?.type,
|
|
48
50
|
};
|
|
49
51
|
return (_jsx("div", { ...attributes, ref: ref, children: children }));
|
|
50
52
|
});
|
|
53
|
+
Root.displayName = 'Choice.Root';
|
|
51
54
|
/**
|
|
52
55
|
* Text-based choice button.
|
|
53
56
|
*
|
package/cjs/dist/react/Option.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as Choice from './Choice.js';
|
|
|
4
4
|
import * as ProductModifiersPrimitive from './core/ProductModifiers.js';
|
|
5
5
|
import * as ProductVariantSelectorPrimitive from './core/ProductVariantSelector.js';
|
|
6
6
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
7
|
+
import { DataComponentTags } from '../data-component-tags.js';
|
|
7
8
|
var TestIds;
|
|
8
9
|
(function (TestIds) {
|
|
9
10
|
TestIds["optionRoot"] = "option-root";
|
|
@@ -113,8 +114,9 @@ export const Root = React.forwardRef((props, ref) => {
|
|
|
113
114
|
allowedTypes,
|
|
114
115
|
mandatory: option?.mandatory || false,
|
|
115
116
|
};
|
|
116
|
-
return (_jsx(OptionContext.Provider, { value: contextValue, children: _jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.optionRoot, "data-type": optionType, customElement: children, customElementProps: { option, onValueChange, allowedTypes }, ...otherProps, children: _jsx("div", { children: React.isValidElement(children) ? children : null }) }) }));
|
|
117
|
+
return (_jsx(OptionContext.Provider, { value: contextValue, children: _jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-component-tag": DataComponentTags.optionRoot, "data-testid": TestIds.optionRoot, "data-type": optionType, customElement: children, customElementProps: { option, onValueChange, allowedTypes }, ...otherProps, children: _jsx("div", { children: React.isValidElement(children) ? children : null }) }) }));
|
|
117
118
|
});
|
|
119
|
+
Root.displayName = 'Option.Root';
|
|
118
120
|
// Create a context to pass option data down
|
|
119
121
|
export const OptionContext = React.createContext(null);
|
|
120
122
|
/**
|
|
@@ -60,7 +60,10 @@ export interface ProductRootProps {
|
|
|
60
60
|
* }
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
-
export declare
|
|
63
|
+
export declare const Root: {
|
|
64
|
+
(props: ProductRootProps): React.ReactNode;
|
|
65
|
+
displayName: string;
|
|
66
|
+
};
|
|
64
67
|
/**
|
|
65
68
|
* Props for Product Name component
|
|
66
69
|
*/
|
|
@@ -11,6 +11,7 @@ import * as ProductModifiers from './core/ProductModifiers.js';
|
|
|
11
11
|
import * as SelectedVariant from './core/SelectedVariant.js';
|
|
12
12
|
import * as Option from './Option.js';
|
|
13
13
|
import { AsContent } from './types.js';
|
|
14
|
+
import { DataComponentTags } from '../data-component-tags.js';
|
|
14
15
|
const VariantsContext = React.createContext(null);
|
|
15
16
|
/**
|
|
16
17
|
* Hook to access variants context
|
|
@@ -86,12 +87,13 @@ var TestIds;
|
|
|
86
87
|
* }
|
|
87
88
|
* ```
|
|
88
89
|
*/
|
|
89
|
-
export
|
|
90
|
+
export const Root = (props) => {
|
|
90
91
|
const { children, product, ...attrs } = props;
|
|
91
|
-
return (_jsx(CoreProduct.Root, { productServiceConfig: { product: props.product }, children: _jsx(MediaGallery.Root, { mediaGalleryServiceConfig: {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
92
|
+
return (_jsx(AsChildSlot, { "data-testid": TestIds.productRoot, "data-component-tag": DataComponentTags.productRoot, children: _jsx(CoreProduct.Root, { productServiceConfig: { product: props.product }, children: _jsx(MediaGallery.Root, { mediaGalleryServiceConfig: {
|
|
93
|
+
media: props.product.media?.itemsInfo?.items ?? [],
|
|
94
|
+
}, children: _jsx(ProductVariantSelector.Root, { children: _jsx(ProductModifiers.Root, { children: _jsx(SelectedVariant.Root, { children: _jsx(AsChildSlot, { ...attrs, children: children }) }) }) }) }) }) }));
|
|
95
|
+
};
|
|
96
|
+
Root.displayName = 'Product.Root';
|
|
95
97
|
/**
|
|
96
98
|
* Displays the product name with customizable rendering following the documented API.
|
|
97
99
|
*
|
|
@@ -8,6 +8,7 @@ import { ProductListSort as ProductListSortPrimitive } from './core/ProductListS
|
|
|
8
8
|
import * as CoreProductListFilters from './core/ProductListFilters.js';
|
|
9
9
|
import * as Product from './Product.js';
|
|
10
10
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
11
|
+
import { DataComponentTags } from '../data-component-tags.js';
|
|
11
12
|
var TestIds;
|
|
12
13
|
(function (TestIds) {
|
|
13
14
|
TestIds["productListRoot"] = "product-list-root";
|
|
@@ -60,6 +61,7 @@ export const Root = React.forwardRef((props, ref) => {
|
|
|
60
61
|
};
|
|
61
62
|
return (_jsx(CoreProductList.Root, { productsListConfig: serviceConfig, children: _jsx(RootContent, { children: children, className: className, ref: ref }) }));
|
|
62
63
|
});
|
|
64
|
+
Root.displayName = 'ProductList.Root';
|
|
63
65
|
/**
|
|
64
66
|
* Internal component to handle the Root content with service access
|
|
65
67
|
*/
|
|
@@ -70,7 +72,7 @@ const RootContent = React.forwardRef((props, ref) => {
|
|
|
70
72
|
...product,
|
|
71
73
|
id: product._id,
|
|
72
74
|
}));
|
|
73
|
-
return (_jsx(GenericList.Root, { items: items, onLoadMore: () => productsListService.loadMore(10), hasMore: productsListService.hasMoreProducts.get(), isLoading: productsListService.isLoading.get(), className: className, ref: ref, "data-testid": TestIds.productListRoot, children: children }));
|
|
75
|
+
return (_jsx(GenericList.Root, { items: items, onLoadMore: () => productsListService.loadMore(10), hasMore: productsListService.hasMoreProducts.get(), isLoading: productsListService.isLoading.get(), className: className, ref: ref, "data-component-tag": DataComponentTags.productListRoot, "data-testid": TestIds.productListRoot, children: children }));
|
|
74
76
|
});
|
|
75
77
|
/**
|
|
76
78
|
* Raw component that provides direct access to product list data.
|
|
@@ -36,6 +36,7 @@ export function Root(props) {
|
|
|
36
36
|
const { categoriesListConfig, children } = props;
|
|
37
37
|
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(CategoriesListServiceDefinition, CategoriesListService, categoriesListConfig), children: children }));
|
|
38
38
|
}
|
|
39
|
+
Root.displayName = 'CategoryList.Root';
|
|
39
40
|
/**
|
|
40
41
|
* Component that renders content when the categories list is empty.
|
|
41
42
|
* Only displays its children when there are no categories, no loading state, and no errors.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare enum DataComponentTags {
|
|
2
|
+
categoryListRoot = "stores.category-list-root",
|
|
3
|
+
categoryRoot = "stores.category-root",
|
|
4
|
+
choiceRoot = "stores.choice-root",
|
|
5
|
+
optionRoot = "stores.option-root",
|
|
6
|
+
productListRoot = "stores.product-list-root",
|
|
7
|
+
productRoot = "stores.product-root"
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export var DataComponentTags;
|
|
2
|
+
(function (DataComponentTags) {
|
|
3
|
+
DataComponentTags["categoryListRoot"] = "stores.category-list-root";
|
|
4
|
+
DataComponentTags["categoryRoot"] = "stores.category-root";
|
|
5
|
+
DataComponentTags["choiceRoot"] = "stores.choice-root";
|
|
6
|
+
DataComponentTags["optionRoot"] = "stores.option-root";
|
|
7
|
+
DataComponentTags["productListRoot"] = "stores.product-list-root";
|
|
8
|
+
DataComponentTags["productRoot"] = "stores.product-root";
|
|
9
|
+
})(DataComponentTags || (DataComponentTags = {}));
|
package/dist/react/Category.d.ts
CHANGED
|
@@ -98,14 +98,14 @@ export interface CategoryFilterProps {
|
|
|
98
98
|
* ```tsx
|
|
99
99
|
* import { Category } from '@wix/headless-stores/react';
|
|
100
100
|
*
|
|
101
|
-
* <Category.Root
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
101
|
+
* <Category.Root category={category}>
|
|
102
|
+
* <Category.Trigger />
|
|
103
|
+
* <Category.Label />
|
|
104
|
+
* <Category.ID />
|
|
105
105
|
* </Category.Root>
|
|
106
106
|
* ```
|
|
107
107
|
*/
|
|
108
|
-
export declare
|
|
108
|
+
export declare const Root: React.ForwardRefExoticComponent<CategoryRootProps & React.RefAttributes<HTMLElement>>;
|
|
109
109
|
/**
|
|
110
110
|
* Interactive element for selecting or triggering category actions.
|
|
111
111
|
* Provides category data and selection state to custom render functions.
|
package/dist/react/Category.js
CHANGED
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
4
4
|
import * as CoreProductListFilters from './core/ProductListFilters.js';
|
|
5
|
+
import { DataComponentTags } from '../data-component-tags.js';
|
|
5
6
|
const CategoryContext = React.createContext(null);
|
|
6
7
|
function useCategoryContext() {
|
|
7
8
|
const context = React.useContext(CategoryContext);
|
|
@@ -12,6 +13,7 @@ function useCategoryContext() {
|
|
|
12
13
|
}
|
|
13
14
|
var TestIds;
|
|
14
15
|
(function (TestIds) {
|
|
16
|
+
TestIds["categoryRoot"] = "category-root";
|
|
15
17
|
TestIds["categoryItem"] = "category-item";
|
|
16
18
|
TestIds["categoryTrigger"] = "category-trigger";
|
|
17
19
|
TestIds["categoryLabel"] = "category-label";
|
|
@@ -30,14 +32,14 @@ var TestIds;
|
|
|
30
32
|
* ```tsx
|
|
31
33
|
* import { Category } from '@wix/headless-stores/react';
|
|
32
34
|
*
|
|
33
|
-
* <Category.Root
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
35
|
+
* <Category.Root category={category}>
|
|
36
|
+
* <Category.Trigger />
|
|
37
|
+
* <Category.Label />
|
|
38
|
+
* <Category.ID />
|
|
37
39
|
* </Category.Root>
|
|
38
40
|
* ```
|
|
39
41
|
*/
|
|
40
|
-
export
|
|
42
|
+
export const Root = React.forwardRef((props, ref) => {
|
|
41
43
|
const { category, children } = props;
|
|
42
44
|
return (_jsx(CoreProductListFilters.CategoryFilter, { children: ({ selectedCategory, setSelectedCategory }) => {
|
|
43
45
|
// Determine if this category is selected by comparing with selectedCategory
|
|
@@ -48,9 +50,10 @@ export function Root(props) {
|
|
|
48
50
|
selectedCategory,
|
|
49
51
|
setSelectedCategory,
|
|
50
52
|
};
|
|
51
|
-
return (_jsx(CategoryContext.Provider, { value: contextValue, children: children }));
|
|
53
|
+
return (_jsx(CategoryContext.Provider, { value: contextValue, children: _jsx(AsChildSlot, { ref: ref, "data-component-tag": DataComponentTags.categoryRoot, "data-testid": TestIds.categoryRoot, children: children }) }));
|
|
52
54
|
} }));
|
|
53
|
-
}
|
|
55
|
+
});
|
|
56
|
+
Root.displayName = 'Category.Root';
|
|
54
57
|
/**
|
|
55
58
|
* Interactive element for selecting or triggering category actions.
|
|
56
59
|
* Provides category data and selection state to custom render functions.
|
|
@@ -61,7 +61,10 @@ export interface CategoryListCategoryRepeaterProps {
|
|
|
61
61
|
* }
|
|
62
62
|
* ```
|
|
63
63
|
*/
|
|
64
|
-
export declare
|
|
64
|
+
export declare const Root: {
|
|
65
|
+
(props: CategoryListRootProps): React.ReactNode;
|
|
66
|
+
displayName: string;
|
|
67
|
+
};
|
|
65
68
|
/**
|
|
66
69
|
* Displays loading state while category data is being fetched.
|
|
67
70
|
* Only displays its children when the categories list is currently loading.
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import * as CoreCategoryList from './core/CategoryList.js';
|
|
4
4
|
import * as Category from './Category.js';
|
|
5
5
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
6
|
+
import { DataComponentTags } from '../data-component-tags.js';
|
|
6
7
|
var TestIds;
|
|
7
8
|
(function (TestIds) {
|
|
8
9
|
TestIds["categoryListRoot"] = "category-list";
|
|
@@ -31,12 +32,13 @@ var TestIds;
|
|
|
31
32
|
* }
|
|
32
33
|
* ```
|
|
33
34
|
*/
|
|
34
|
-
export
|
|
35
|
+
export const Root = (props) => {
|
|
35
36
|
const { categories, categoriesListConfig, children, emptyState } = props;
|
|
36
37
|
// Create service config, prioritizing categoriesListConfig, then categories prop
|
|
37
38
|
const serviceConfig = categoriesListConfig || (categories ? { categories } : { categories: [] });
|
|
38
|
-
return (
|
|
39
|
-
}
|
|
39
|
+
return (_jsx(CoreCategoryList.Root, { categoriesListConfig: serviceConfig, children: _jsxs(AsChildSlot, { "data-testid": TestIds.categoryListRoot, "data-component-tag": DataComponentTags.categoryListRoot, children: [children, emptyState && (_jsx(CoreCategoryList.EmptyState, { children: emptyState }))] }) }));
|
|
40
|
+
};
|
|
41
|
+
Root.displayName = 'CategoryList.Root';
|
|
40
42
|
/**
|
|
41
43
|
* Displays loading state while category data is being fetched.
|
|
42
44
|
* Only displays its children when the categories list is currently loading.
|
package/dist/react/Choice.js
CHANGED
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { FreeText as FreeTextPrimitive } from './core/ProductModifiers.js';
|
|
4
4
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
5
|
+
import { DataComponentTags } from '../data-component-tags.js';
|
|
5
6
|
var TestIds;
|
|
6
7
|
(function (TestIds) {
|
|
7
8
|
TestIds["choiceRoot"] = "choice-root";
|
|
@@ -43,11 +44,13 @@ export const Root = React.forwardRef((props, ref) => {
|
|
|
43
44
|
}
|
|
44
45
|
const { choice } = choiceContext;
|
|
45
46
|
const attributes = {
|
|
47
|
+
'data-component-tag': DataComponentTags.choiceRoot,
|
|
46
48
|
'data-testid': TestIds.choiceRoot,
|
|
47
49
|
'data-type': choice?.type,
|
|
48
50
|
};
|
|
49
51
|
return (_jsx("div", { ...attributes, ref: ref, children: children }));
|
|
50
52
|
});
|
|
53
|
+
Root.displayName = 'Choice.Root';
|
|
51
54
|
/**
|
|
52
55
|
* Text-based choice button.
|
|
53
56
|
*
|
package/dist/react/Option.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as Choice from './Choice.js';
|
|
|
4
4
|
import * as ProductModifiersPrimitive from './core/ProductModifiers.js';
|
|
5
5
|
import * as ProductVariantSelectorPrimitive from './core/ProductVariantSelector.js';
|
|
6
6
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
7
|
+
import { DataComponentTags } from '../data-component-tags.js';
|
|
7
8
|
var TestIds;
|
|
8
9
|
(function (TestIds) {
|
|
9
10
|
TestIds["optionRoot"] = "option-root";
|
|
@@ -113,8 +114,9 @@ export const Root = React.forwardRef((props, ref) => {
|
|
|
113
114
|
allowedTypes,
|
|
114
115
|
mandatory: option?.mandatory || false,
|
|
115
116
|
};
|
|
116
|
-
return (_jsx(OptionContext.Provider, { value: contextValue, children: _jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.optionRoot, "data-type": optionType, customElement: children, customElementProps: { option, onValueChange, allowedTypes }, ...otherProps, children: _jsx("div", { children: React.isValidElement(children) ? children : null }) }) }));
|
|
117
|
+
return (_jsx(OptionContext.Provider, { value: contextValue, children: _jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-component-tag": DataComponentTags.optionRoot, "data-testid": TestIds.optionRoot, "data-type": optionType, customElement: children, customElementProps: { option, onValueChange, allowedTypes }, ...otherProps, children: _jsx("div", { children: React.isValidElement(children) ? children : null }) }) }));
|
|
117
118
|
});
|
|
119
|
+
Root.displayName = 'Option.Root';
|
|
118
120
|
// Create a context to pass option data down
|
|
119
121
|
export const OptionContext = React.createContext(null);
|
|
120
122
|
/**
|
package/dist/react/Product.d.ts
CHANGED
|
@@ -60,7 +60,10 @@ export interface ProductRootProps {
|
|
|
60
60
|
* }
|
|
61
61
|
* ```
|
|
62
62
|
*/
|
|
63
|
-
export declare
|
|
63
|
+
export declare const Root: {
|
|
64
|
+
(props: ProductRootProps): React.ReactNode;
|
|
65
|
+
displayName: string;
|
|
66
|
+
};
|
|
64
67
|
/**
|
|
65
68
|
* Props for Product Name component
|
|
66
69
|
*/
|
package/dist/react/Product.js
CHANGED
|
@@ -11,6 +11,7 @@ import * as ProductModifiers from './core/ProductModifiers.js';
|
|
|
11
11
|
import * as SelectedVariant from './core/SelectedVariant.js';
|
|
12
12
|
import * as Option from './Option.js';
|
|
13
13
|
import { AsContent } from './types.js';
|
|
14
|
+
import { DataComponentTags } from '../data-component-tags.js';
|
|
14
15
|
const VariantsContext = React.createContext(null);
|
|
15
16
|
/**
|
|
16
17
|
* Hook to access variants context
|
|
@@ -86,12 +87,13 @@ var TestIds;
|
|
|
86
87
|
* }
|
|
87
88
|
* ```
|
|
88
89
|
*/
|
|
89
|
-
export
|
|
90
|
+
export const Root = (props) => {
|
|
90
91
|
const { children, product, ...attrs } = props;
|
|
91
|
-
return (_jsx(CoreProduct.Root, { productServiceConfig: { product: props.product }, children: _jsx(MediaGallery.Root, { mediaGalleryServiceConfig: {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
92
|
+
return (_jsx(AsChildSlot, { "data-testid": TestIds.productRoot, "data-component-tag": DataComponentTags.productRoot, children: _jsx(CoreProduct.Root, { productServiceConfig: { product: props.product }, children: _jsx(MediaGallery.Root, { mediaGalleryServiceConfig: {
|
|
93
|
+
media: props.product.media?.itemsInfo?.items ?? [],
|
|
94
|
+
}, children: _jsx(ProductVariantSelector.Root, { children: _jsx(ProductModifiers.Root, { children: _jsx(SelectedVariant.Root, { children: _jsx(AsChildSlot, { ...attrs, children: children }) }) }) }) }) }) }));
|
|
95
|
+
};
|
|
96
|
+
Root.displayName = 'Product.Root';
|
|
95
97
|
/**
|
|
96
98
|
* Displays the product name with customizable rendering following the documented API.
|
|
97
99
|
*
|
|
@@ -8,6 +8,7 @@ import { ProductListSort as ProductListSortPrimitive } from './core/ProductListS
|
|
|
8
8
|
import * as CoreProductListFilters from './core/ProductListFilters.js';
|
|
9
9
|
import * as Product from './Product.js';
|
|
10
10
|
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
11
|
+
import { DataComponentTags } from '../data-component-tags.js';
|
|
11
12
|
var TestIds;
|
|
12
13
|
(function (TestIds) {
|
|
13
14
|
TestIds["productListRoot"] = "product-list-root";
|
|
@@ -60,6 +61,7 @@ export const Root = React.forwardRef((props, ref) => {
|
|
|
60
61
|
};
|
|
61
62
|
return (_jsx(CoreProductList.Root, { productsListConfig: serviceConfig, children: _jsx(RootContent, { children: children, className: className, ref: ref }) }));
|
|
62
63
|
});
|
|
64
|
+
Root.displayName = 'ProductList.Root';
|
|
63
65
|
/**
|
|
64
66
|
* Internal component to handle the Root content with service access
|
|
65
67
|
*/
|
|
@@ -70,7 +72,7 @@ const RootContent = React.forwardRef((props, ref) => {
|
|
|
70
72
|
...product,
|
|
71
73
|
id: product._id,
|
|
72
74
|
}));
|
|
73
|
-
return (_jsx(GenericList.Root, { items: items, onLoadMore: () => productsListService.loadMore(10), hasMore: productsListService.hasMoreProducts.get(), isLoading: productsListService.isLoading.get(), className: className, ref: ref, "data-testid": TestIds.productListRoot, children: children }));
|
|
75
|
+
return (_jsx(GenericList.Root, { items: items, onLoadMore: () => productsListService.loadMore(10), hasMore: productsListService.hasMoreProducts.get(), isLoading: productsListService.isLoading.get(), className: className, ref: ref, "data-component-tag": DataComponentTags.productListRoot, "data-testid": TestIds.productListRoot, children: children }));
|
|
74
76
|
});
|
|
75
77
|
/**
|
|
76
78
|
* Raw component that provides direct access to product list data.
|
|
@@ -36,6 +36,7 @@ export function Root(props) {
|
|
|
36
36
|
const { categoriesListConfig, children } = props;
|
|
37
37
|
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(CategoriesListServiceDefinition, CategoriesListService, categoriesListConfig), children: children }));
|
|
38
38
|
}
|
|
39
|
+
Root.displayName = 'CategoryList.Root';
|
|
39
40
|
/**
|
|
40
41
|
* Component that renders content when the categories list is empty.
|
|
41
42
|
* Only displays its children when there are no categories, no loading state, and no errors.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-stores",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.92",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prebuild": "cd ../media && yarn build && cd ../ecom && yarn build",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@wix/ecom": "^1.0.1278",
|
|
64
64
|
"@wix/essentials": "^0.1.24",
|
|
65
65
|
"@wix/headless-ecom": "0.0.30",
|
|
66
|
-
"@wix/headless-media": "0.0.
|
|
66
|
+
"@wix/headless-media": "0.0.14",
|
|
67
67
|
"@wix/headless-utils": "0.0.3",
|
|
68
68
|
"@wix/redirects": "^1.0.83",
|
|
69
69
|
"@wix/services-definitions": "^0.1.4",
|