@wix/headless-stores 0.0.90 → 0.0.91

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.
@@ -0,0 +1,6 @@
1
+ export declare enum DataComponentTags {
2
+ categoryRoot = "stores.category-root",
3
+ productListRoot = "stores.product-list-root",
4
+ optionRoot = "stores.option-root",
5
+ choiceRoot = "stores.choice-root"
6
+ }
@@ -0,0 +1,7 @@
1
+ export var DataComponentTags;
2
+ (function (DataComponentTags) {
3
+ DataComponentTags["categoryRoot"] = "stores.category-root";
4
+ DataComponentTags["productListRoot"] = "stores.product-list-root";
5
+ DataComponentTags["optionRoot"] = "stores.option-root";
6
+ DataComponentTags["choiceRoot"] = "stores.choice-root";
7
+ })(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 categoryServiceConfig={{ category }}>
102
- * <Category.Trigger />
103
- * <Category.Label />
104
- * <Category.ID />
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 function Root(props: CategoryRootProps): React.ReactNode;
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 categoryServiceConfig={{ category }}>
34
- * <Category.Trigger />
35
- * <Category.Label />
36
- * <Category.ID />
35
+ * <Category.Root category={category}>
36
+ * <Category.Trigger />
37
+ * <Category.Label />
38
+ * <Category.ID />
37
39
  * </Category.Root>
38
40
  * ```
39
41
  */
40
- export function Root(props) {
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,9 @@ 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
+ });
54
56
  /**
55
57
  * Interactive element for selecting or triggering category actions.
56
58
  * Provides category data and selection state to custom render functions.
@@ -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,6 +44,7 @@ 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
  };
@@ -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,7 +114,7 @@ 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
  });
118
119
  // Create a context to pass option data down
119
120
  export const OptionContext = React.createContext(null);
@@ -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";
@@ -70,7 +71,7 @@ const RootContent = React.forwardRef((props, ref) => {
70
71
  ...product,
71
72
  id: product._id,
72
73
  }));
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 }));
74
+ 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
75
  });
75
76
  /**
76
77
  * Raw component that provides direct access to product list data.
@@ -0,0 +1,6 @@
1
+ export declare enum DataComponentTags {
2
+ categoryRoot = "stores.category-root",
3
+ productListRoot = "stores.product-list-root",
4
+ optionRoot = "stores.option-root",
5
+ choiceRoot = "stores.choice-root"
6
+ }
@@ -0,0 +1,7 @@
1
+ export var DataComponentTags;
2
+ (function (DataComponentTags) {
3
+ DataComponentTags["categoryRoot"] = "stores.category-root";
4
+ DataComponentTags["productListRoot"] = "stores.product-list-root";
5
+ DataComponentTags["optionRoot"] = "stores.option-root";
6
+ DataComponentTags["choiceRoot"] = "stores.choice-root";
7
+ })(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 categoryServiceConfig={{ category }}>
102
- * <Category.Trigger />
103
- * <Category.Label />
104
- * <Category.ID />
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 function Root(props: CategoryRootProps): React.ReactNode;
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 categoryServiceConfig={{ category }}>
34
- * <Category.Trigger />
35
- * <Category.Label />
36
- * <Category.ID />
35
+ * <Category.Root category={category}>
36
+ * <Category.Trigger />
37
+ * <Category.Label />
38
+ * <Category.ID />
37
39
  * </Category.Root>
38
40
  * ```
39
41
  */
40
- export function Root(props) {
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,9 @@ 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
+ });
54
56
  /**
55
57
  * Interactive element for selecting or triggering category actions.
56
58
  * Provides category data and selection state to custom render functions.
@@ -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,6 +44,7 @@ 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
  };
@@ -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,7 +114,7 @@ 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
  });
118
119
  // Create a context to pass option data down
119
120
  export const OptionContext = React.createContext(null);
@@ -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";
@@ -70,7 +71,7 @@ const RootContent = React.forwardRef((props, ref) => {
70
71
  ...product,
71
72
  id: product._id,
72
73
  }));
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 }));
74
+ 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
75
  });
75
76
  /**
76
77
  * Raw component that provides direct access to product list data.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/headless-stores",
3
- "version": "0.0.90",
3
+ "version": "0.0.91",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "prebuild": "cd ../media && yarn build && cd ../ecom && yarn build",