@wix/headless-stores 0.0.52 → 0.0.53
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/astro/actions/custom-checkout.d.ts +1 -1
- package/cjs/dist/astro/actions/custom-checkout.js +2 -2
- package/cjs/dist/astro/actions/index.d.ts +1 -1
- package/cjs/dist/astro/actions/index.js +1 -1
- package/cjs/dist/enums/index.d.ts +2 -2
- package/cjs/dist/enums/index.js +2 -2
- package/cjs/dist/react/Category.d.ts +168 -67
- package/cjs/dist/react/Category.js +166 -50
- package/cjs/dist/react/CategoryList.d.ts +56 -138
- package/cjs/dist/react/CategoryList.js +44 -129
- package/cjs/dist/react/Choice.d.ts +193 -0
- package/cjs/dist/react/Choice.js +259 -0
- package/cjs/dist/react/Option.d.ts +224 -0
- package/cjs/dist/react/Option.js +388 -0
- package/cjs/dist/react/Product.d.ts +339 -96
- package/cjs/dist/react/Product.js +507 -94
- package/cjs/dist/react/{BuyNow.js → core/BuyNow.js} +2 -2
- package/cjs/dist/react/core/Category.d.ts +98 -0
- package/cjs/dist/react/core/Category.js +81 -0
- package/cjs/dist/react/core/CategoryList.d.ts +185 -0
- package/cjs/dist/react/core/CategoryList.js +174 -0
- package/{dist/react → cjs/dist/react/core}/PayNow.js +2 -2
- package/cjs/dist/react/core/Product.d.ts +148 -0
- package/cjs/dist/react/core/Product.js +126 -0
- package/cjs/dist/react/{ProductList.d.ts → core/ProductList.d.ts} +3 -3
- package/cjs/dist/react/{ProductList.js → core/ProductList.js} +10 -10
- package/{dist/react → cjs/dist/react/core}/ProductListFilters.d.ts +3 -3
- package/{dist/react → cjs/dist/react/core}/ProductListFilters.js +7 -7
- package/cjs/dist/react/{ProductListPagination.js → core/ProductListPagination.js} +8 -8
- package/{dist/react → cjs/dist/react/core}/ProductListSort.d.ts +1 -1
- package/cjs/dist/react/{ProductListSort.js → core/ProductListSort.js} +3 -3
- package/{dist/react → cjs/dist/react/core}/ProductModifiers.d.ts +1 -1
- package/{dist/react → cjs/dist/react/core}/ProductModifiers.js +13 -13
- package/{dist/react → cjs/dist/react/core}/ProductVariantSelector.d.ts +2 -2
- package/{dist/react → cjs/dist/react/core}/ProductVariantSelector.js +7 -10
- package/{dist/react → cjs/dist/react/core}/SelectedVariant.d.ts +2 -2
- package/{dist/react → cjs/dist/react/core}/SelectedVariant.js +43 -15
- package/cjs/dist/react/index.d.ts +15 -10
- package/cjs/dist/react/index.js +15 -10
- package/cjs/dist/react/types.d.ts +8 -0
- package/cjs/dist/react/types.js +9 -0
- package/cjs/dist/server-actions/custom-checkout-action.js +14 -10
- package/cjs/dist/server-actions/index.d.ts +1 -1
- package/cjs/dist/server-actions/index.js +1 -1
- package/cjs/dist/services/buy-now-service.d.ts +1 -1
- package/cjs/dist/services/buy-now-service.js +6 -6
- package/cjs/dist/services/categories-list-service.d.ts +4 -4
- package/cjs/dist/services/categories-list-service.js +10 -10
- package/cjs/dist/services/category-service.d.ts +18 -22
- package/cjs/dist/services/category-service.js +12 -10
- package/cjs/dist/services/index.d.ts +7 -7
- package/cjs/dist/services/index.js +7 -7
- package/cjs/dist/services/pay-now-service.d.ts +1 -1
- package/cjs/dist/services/pay-now-service.js +4 -4
- package/cjs/dist/services/product-modifiers-service.d.ts +3 -3
- package/cjs/dist/services/product-modifiers-service.js +7 -7
- package/cjs/dist/services/product-service.d.ts +4 -4
- package/cjs/dist/services/product-service.js +18 -18
- package/cjs/dist/services/products-list-search-service.d.ts +5 -5
- package/cjs/dist/services/products-list-search-service.js +117 -117
- package/cjs/dist/services/products-list-service.d.ts +4 -4
- package/cjs/dist/services/products-list-service.js +12 -12
- package/cjs/dist/services/selected-variant-service.d.ts +6 -2
- package/cjs/dist/services/selected-variant-service.js +86 -83
- package/cjs/dist/utils/index.d.ts +1 -0
- package/cjs/dist/utils/index.js +5 -4
- package/cjs/dist/utils/renderAsChild.d.ts +96 -0
- package/cjs/dist/utils/renderAsChild.js +66 -0
- package/cjs/dist/utils/renderChildren.d.ts +41 -0
- package/cjs/dist/utils/renderChildren.js +44 -0
- package/cjs/dist/utils/url-params.js +3 -3
- package/dist/astro/actions/custom-checkout.d.ts +1 -1
- package/dist/astro/actions/custom-checkout.js +2 -2
- package/dist/astro/actions/index.d.ts +1 -1
- package/dist/astro/actions/index.js +1 -1
- package/dist/enums/index.d.ts +2 -2
- package/dist/enums/index.js +2 -2
- package/dist/react/Category.d.ts +168 -67
- package/dist/react/Category.js +166 -50
- package/dist/react/CategoryList.d.ts +56 -138
- package/dist/react/CategoryList.js +44 -129
- package/dist/react/Choice.d.ts +193 -0
- package/dist/react/Choice.js +259 -0
- package/dist/react/Option.d.ts +224 -0
- package/dist/react/Option.js +388 -0
- package/dist/react/Product.d.ts +339 -96
- package/dist/react/Product.js +507 -94
- package/dist/react/{BuyNow.js → core/BuyNow.js} +2 -2
- package/dist/react/core/Category.d.ts +98 -0
- package/dist/react/core/Category.js +81 -0
- package/dist/react/core/CategoryList.d.ts +185 -0
- package/dist/react/core/CategoryList.js +174 -0
- package/{cjs/dist/react → dist/react/core}/PayNow.js +2 -2
- package/dist/react/core/Product.d.ts +148 -0
- package/dist/react/core/Product.js +126 -0
- package/dist/react/{ProductList.d.ts → core/ProductList.d.ts} +3 -3
- package/dist/react/{ProductList.js → core/ProductList.js} +10 -10
- package/{cjs/dist/react → dist/react/core}/ProductListFilters.d.ts +3 -3
- package/{cjs/dist/react → dist/react/core}/ProductListFilters.js +7 -7
- package/dist/react/{ProductListPagination.js → core/ProductListPagination.js} +8 -8
- package/{cjs/dist/react → dist/react/core}/ProductListSort.d.ts +1 -1
- package/dist/react/{ProductListSort.js → core/ProductListSort.js} +3 -3
- package/{cjs/dist/react → dist/react/core}/ProductModifiers.d.ts +1 -1
- package/{cjs/dist/react → dist/react/core}/ProductModifiers.js +13 -13
- package/{cjs/dist/react → dist/react/core}/ProductVariantSelector.d.ts +2 -2
- package/{cjs/dist/react → dist/react/core}/ProductVariantSelector.js +7 -10
- package/{cjs/dist/react → dist/react/core}/SelectedVariant.d.ts +2 -2
- package/{cjs/dist/react → dist/react/core}/SelectedVariant.js +43 -15
- package/dist/react/index.d.ts +15 -10
- package/dist/react/index.js +15 -10
- package/dist/react/types.d.ts +8 -0
- package/dist/react/types.js +9 -0
- package/dist/server-actions/custom-checkout-action.js +14 -10
- package/dist/server-actions/index.d.ts +1 -1
- package/dist/server-actions/index.js +1 -1
- package/dist/services/buy-now-service.d.ts +1 -1
- package/dist/services/buy-now-service.js +6 -6
- package/dist/services/categories-list-service.d.ts +4 -4
- package/dist/services/categories-list-service.js +10 -10
- package/dist/services/category-service.d.ts +18 -22
- package/dist/services/category-service.js +12 -10
- package/dist/services/index.d.ts +7 -7
- package/dist/services/index.js +7 -7
- package/dist/services/pay-now-service.d.ts +1 -1
- package/dist/services/pay-now-service.js +4 -4
- package/dist/services/product-modifiers-service.d.ts +3 -3
- package/dist/services/product-modifiers-service.js +7 -7
- package/dist/services/product-service.d.ts +4 -4
- package/dist/services/product-service.js +18 -18
- package/dist/services/products-list-search-service.d.ts +5 -5
- package/dist/services/products-list-search-service.js +117 -117
- package/dist/services/products-list-service.d.ts +4 -4
- package/dist/services/products-list-service.js +12 -12
- package/dist/services/selected-variant-service.d.ts +6 -2
- package/dist/services/selected-variant-service.js +86 -83
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +5 -4
- package/dist/utils/renderAsChild.d.ts +96 -0
- package/dist/utils/renderAsChild.js +66 -0
- package/dist/utils/renderChildren.d.ts +41 -0
- package/dist/utils/renderChildren.js +44 -0
- package/dist/utils/url-params.js +3 -3
- package/package.json +7 -3
- /package/cjs/dist/react/{BuyNow.d.ts → core/BuyNow.d.ts} +0 -0
- /package/cjs/dist/react/{PayNow.d.ts → core/PayNow.d.ts} +0 -0
- /package/cjs/dist/react/{ProductListPagination.d.ts → core/ProductListPagination.d.ts} +0 -0
- /package/dist/react/{BuyNow.d.ts → core/BuyNow.d.ts} +0 -0
- /package/dist/react/{PayNow.d.ts → core/PayNow.d.ts} +0 -0
- /package/dist/react/{ProductListPagination.d.ts → core/ProductListPagination.d.ts} +0 -0
package/dist/react/Product.d.ts
CHANGED
|
@@ -1,12 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import type { V3Product } from '@wix/auto_sdk_stores_products-v-3';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { type AsChildProps } from '../utils/index.js';
|
|
4
|
+
import { AsContent } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Context for sharing variant options state between components
|
|
7
|
+
*/
|
|
8
|
+
interface VariantsContextValue {
|
|
9
|
+
hasOptions: boolean;
|
|
10
|
+
options: any[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Hook to access variants context
|
|
14
|
+
*/
|
|
15
|
+
export declare function useVariantsContext(): VariantsContextValue;
|
|
16
|
+
/**
|
|
17
|
+
* Context for sharing modifier options state between components
|
|
18
|
+
*/
|
|
19
|
+
interface ModifiersContextValue {
|
|
20
|
+
hasModifiers: boolean;
|
|
21
|
+
modifiers: any[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Hook to access modifiers context
|
|
25
|
+
*/
|
|
26
|
+
export declare function useModifiersContext(): ModifiersContextValue;
|
|
27
|
+
/**
|
|
28
|
+
* Props for the Product root component following the documented API
|
|
29
|
+
*/
|
|
30
|
+
export interface ProductRootProps {
|
|
4
31
|
children: React.ReactNode;
|
|
5
|
-
|
|
32
|
+
product: V3Product;
|
|
33
|
+
selectedVariant?: any;
|
|
6
34
|
}
|
|
7
35
|
/**
|
|
8
|
-
* Root component that provides
|
|
9
|
-
* This component
|
|
36
|
+
* Root component that provides all necessary service contexts for a complete product experience.
|
|
37
|
+
* This composite component combines Product, ProductVariantSelector, ProductModifiers, and SelectedVariant
|
|
38
|
+
* functionality following the documented API patterns with proper data attributes.
|
|
10
39
|
*
|
|
11
40
|
* @order 1
|
|
12
41
|
* @component
|
|
@@ -14,135 +43,349 @@ export interface RootProps {
|
|
|
14
43
|
* ```tsx
|
|
15
44
|
* import { Product } from '@wix/stores/components';
|
|
16
45
|
*
|
|
17
|
-
* function ProductPage() {
|
|
46
|
+
* function ProductPage({ product }) {
|
|
18
47
|
* return (
|
|
19
|
-
* <Product.Root
|
|
20
|
-
* <
|
|
21
|
-
* <Product.Name>
|
|
22
|
-
* {({ name }) => (
|
|
23
|
-
* <h1
|
|
24
|
-
* className="text-4xl font-bold text-content-primary mb-4"
|
|
25
|
-
* data-testid="product-name"
|
|
26
|
-
* >
|
|
27
|
-
* {name}
|
|
28
|
-
* </h1>
|
|
29
|
-
* )}
|
|
30
|
-
* </Product.Name>
|
|
31
|
-
* </div>
|
|
48
|
+
* <Product.Root product={product}>
|
|
49
|
+
* <Product.Name className="text-4xl font-bold" />
|
|
32
50
|
* </Product.Root>
|
|
33
51
|
* );
|
|
34
52
|
* }
|
|
35
53
|
* ```
|
|
36
54
|
*/
|
|
37
|
-
export declare function Root(props:
|
|
55
|
+
export declare function Root(props: ProductRootProps): React.ReactNode;
|
|
38
56
|
/**
|
|
39
|
-
* Props for
|
|
57
|
+
* Props for Product Name component
|
|
40
58
|
*/
|
|
41
|
-
export interface
|
|
42
|
-
|
|
43
|
-
|
|
59
|
+
export interface NameProps extends AsChildProps<{
|
|
60
|
+
name: string;
|
|
61
|
+
}> {
|
|
44
62
|
}
|
|
45
63
|
/**
|
|
46
|
-
*
|
|
64
|
+
* Displays the product name with customizable rendering following the documented API.
|
|
65
|
+
*
|
|
66
|
+
* @component
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* // Default usage
|
|
70
|
+
* <Product.Name className="text-4xl font-bold" />
|
|
71
|
+
*
|
|
72
|
+
* // asChild with primitive
|
|
73
|
+
* <Product.Name asChild>
|
|
74
|
+
* <h1 className="text-4xl font-bold" />
|
|
75
|
+
* </Product.Name>
|
|
76
|
+
*
|
|
77
|
+
* // asChild with react component
|
|
78
|
+
* <Product.Name asChild>
|
|
79
|
+
* {React.forwardRef(({name, ...props}, ref) => (
|
|
80
|
+
* <h1 ref={ref} {...props} className="text-4xl font-bold">
|
|
81
|
+
* {name}
|
|
82
|
+
* </h1>
|
|
83
|
+
* ))}
|
|
84
|
+
* </Product.Name>
|
|
85
|
+
* ```
|
|
47
86
|
*/
|
|
48
|
-
export
|
|
49
|
-
|
|
50
|
-
|
|
87
|
+
export declare const Name: React.ForwardRefExoticComponent<NameProps & React.RefAttributes<HTMLElement>>;
|
|
88
|
+
/**
|
|
89
|
+
* Props for Product Description component
|
|
90
|
+
*/
|
|
91
|
+
export interface DescriptionProps extends AsChildProps<{
|
|
92
|
+
description: string;
|
|
93
|
+
}> {
|
|
94
|
+
/** Format of the description content */
|
|
95
|
+
as?: `${AsContent}`;
|
|
51
96
|
}
|
|
52
97
|
/**
|
|
53
|
-
*
|
|
98
|
+
* Displays the product description with customizable rendering and format options following the documented API.
|
|
54
99
|
*
|
|
55
100
|
* @component
|
|
56
101
|
* @example
|
|
57
102
|
* ```tsx
|
|
58
|
-
*
|
|
103
|
+
* // Default usage (plain text)
|
|
104
|
+
* <Product.Description className="text-content-secondary" />
|
|
59
105
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* }
|
|
106
|
+
* // HTML content
|
|
107
|
+
* <Product.Description as="html" className="prose" />
|
|
108
|
+
*
|
|
109
|
+
* // asChild with custom rendering
|
|
110
|
+
* <Product.Description as="html" asChild>
|
|
111
|
+
* {({ description }) => (
|
|
112
|
+
* <div
|
|
113
|
+
* className="text-content-secondary"
|
|
114
|
+
* dangerouslySetInnerHTML={{ __html: description }}
|
|
115
|
+
* />
|
|
116
|
+
* )}
|
|
117
|
+
* </Product.Description>
|
|
69
118
|
* ```
|
|
70
119
|
*/
|
|
71
|
-
export declare
|
|
120
|
+
export declare const Description: React.ForwardRefExoticComponent<DescriptionProps & React.RefAttributes<HTMLElement>>;
|
|
72
121
|
/**
|
|
73
|
-
* Props for
|
|
122
|
+
* Props for Product Price component
|
|
74
123
|
*/
|
|
75
|
-
export interface
|
|
76
|
-
|
|
77
|
-
|
|
124
|
+
export interface PriceProps extends AsChildProps<{
|
|
125
|
+
price: string;
|
|
126
|
+
formattedPrice: string;
|
|
127
|
+
}> {
|
|
78
128
|
}
|
|
79
129
|
/**
|
|
80
|
-
*
|
|
130
|
+
* Displays the current product price with customizable rendering following the documented API.
|
|
131
|
+
*
|
|
132
|
+
* @component
|
|
133
|
+
* @example
|
|
134
|
+
* ```tsx
|
|
135
|
+
* // Default usage
|
|
136
|
+
* <Product.Price className="text-3xl font-bold text-content-primary data-[discounted]:text-brand-primary" />
|
|
137
|
+
*
|
|
138
|
+
* // asChild with primitive
|
|
139
|
+
* <Product.Price asChild>
|
|
140
|
+
* <span className="text-3xl font-bold text-content-primary" />
|
|
141
|
+
* </Product.Price>
|
|
142
|
+
*
|
|
143
|
+
* // asChild with react component
|
|
144
|
+
* <Product.Price asChild>
|
|
145
|
+
* {React.forwardRef(({price, formattedPrice, ...props}, ref) => (
|
|
146
|
+
* <span ref={ref} {...props} className="text-3xl font-bold text-content-primary">
|
|
147
|
+
* {formattedPrice}
|
|
148
|
+
* </span>
|
|
149
|
+
* ))}
|
|
150
|
+
* </Product.Price>
|
|
151
|
+
* ```
|
|
81
152
|
*/
|
|
82
|
-
export
|
|
83
|
-
/** Product description using the RICOS (Rich Content Object) format. See https://dev.wix.com/docs/ricos/api-reference/ricos-document */
|
|
84
|
-
description: NonNullable<V3Product["description"]>;
|
|
85
|
-
/** Product description with plain html */
|
|
86
|
-
plainDescription: NonNullable<V3Product["plainDescription"]>;
|
|
87
|
-
}
|
|
153
|
+
export declare const Price: React.ForwardRefExoticComponent<PriceProps & React.RefAttributes<HTMLElement>>;
|
|
88
154
|
/**
|
|
89
|
-
*
|
|
155
|
+
* Props for Product CompareAtPrice component
|
|
90
156
|
*/
|
|
91
|
-
export interface
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
plainDescription: NonNullable<V3Product["plainDescription"]>;
|
|
157
|
+
export interface CompareAtPriceProps extends AsChildProps<{
|
|
158
|
+
price: string;
|
|
159
|
+
formattedPrice: string;
|
|
160
|
+
}> {
|
|
96
161
|
}
|
|
97
162
|
/**
|
|
98
|
-
*
|
|
163
|
+
* Displays the compare-at (original) price when on sale with customizable rendering following the documented API.
|
|
99
164
|
*
|
|
100
165
|
* @component
|
|
101
166
|
* @example
|
|
102
167
|
* ```tsx
|
|
103
|
-
*
|
|
168
|
+
* // Default usage (only shows when on sale)
|
|
169
|
+
* <Product.CompareAtPrice className="text-lg text-content-faded line-through hidden data-[discounted]:inline" />
|
|
104
170
|
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* </Product.Description>
|
|
123
|
-
* );
|
|
124
|
-
* }
|
|
171
|
+
* // asChild with primitive
|
|
172
|
+
* <Product.CompareAtPrice asChild>
|
|
173
|
+
* <span className="text-lg text-content-faded line-through" />
|
|
174
|
+
* </Product.CompareAtPrice>
|
|
175
|
+
*
|
|
176
|
+
* // asChild with react component
|
|
177
|
+
* <Product.CompareAtPrice asChild>
|
|
178
|
+
* {React.forwardRef(({formattedPrice, ...props}, ref) => (
|
|
179
|
+
* <span
|
|
180
|
+
* ref={ref}
|
|
181
|
+
* {...props}
|
|
182
|
+
* className="hidden data-[discounted]:inline text-lg text-content-faded line-through"
|
|
183
|
+
* >
|
|
184
|
+
* Was: {formattedPrice}
|
|
185
|
+
* </span>
|
|
186
|
+
* ))}
|
|
187
|
+
* </Product.CompareAtPrice>
|
|
125
188
|
* ```
|
|
126
189
|
*/
|
|
127
|
-
export declare
|
|
128
|
-
|
|
129
|
-
|
|
190
|
+
export declare const CompareAtPrice: React.ForwardRefExoticComponent<CompareAtPriceProps & React.RefAttributes<HTMLElement>>;
|
|
191
|
+
/**
|
|
192
|
+
* Props for Product Variants container
|
|
193
|
+
*/
|
|
194
|
+
export interface VariantsProps extends AsChildProps<{
|
|
195
|
+
hasOptions: boolean;
|
|
196
|
+
}> {
|
|
130
197
|
}
|
|
131
|
-
|
|
132
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Container for product variant selection system.
|
|
200
|
+
* Does not render when there are no variants.
|
|
201
|
+
*
|
|
202
|
+
* @component
|
|
203
|
+
* @example
|
|
204
|
+
* ```tsx
|
|
205
|
+
* // Default usage
|
|
206
|
+
* <Product.Variants>
|
|
207
|
+
* <Product.VariantOptions>
|
|
208
|
+
* <Product.VariantOptionRepeater>
|
|
209
|
+
* <Option.Name className="text-lg font-medium mb-3" />
|
|
210
|
+
* <Option.Choices>
|
|
211
|
+
* <Option.ChoiceRepeater>
|
|
212
|
+
* <Choice.Text className="px-4 py-2 border rounded-lg" />
|
|
213
|
+
* <Choice.Color className="w-10 h-10 rounded-full border-4" />
|
|
214
|
+
* </Option.ChoiceRepeater>
|
|
215
|
+
* </Option.Choices>
|
|
216
|
+
* </Product.VariantOptionRepeater>
|
|
217
|
+
* </Product.VariantOptions>
|
|
218
|
+
* </Product.Variants>
|
|
219
|
+
*
|
|
220
|
+
* // asChild with primitive
|
|
221
|
+
* <Product.Variants asChild>
|
|
222
|
+
* <section className="variant-section">
|
|
223
|
+
* <Product.VariantOptions>
|
|
224
|
+
* // variant options
|
|
225
|
+
* </Product.VariantOptions>
|
|
226
|
+
* </section>
|
|
227
|
+
* </Product.Variants>
|
|
228
|
+
*
|
|
229
|
+
* // asChild with react component
|
|
230
|
+
* <Product.Variants asChild>
|
|
231
|
+
* {React.forwardRef(({hasOptions, ...props}, ref) => (
|
|
232
|
+
* <section ref={ref} {...props} className="variant-section">
|
|
233
|
+
* {hasOptions && <h3>Choose Options</h3>}
|
|
234
|
+
* {props.children}
|
|
235
|
+
* </section>
|
|
236
|
+
* ))}
|
|
237
|
+
* </Product.Variants>
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
export declare const Variants: React.ForwardRefExoticComponent<VariantsProps & React.RefAttributes<HTMLElement>>;
|
|
241
|
+
/**
|
|
242
|
+
* Props for Product VariantOptions component
|
|
243
|
+
*/
|
|
244
|
+
export interface VariantOptionsProps {
|
|
245
|
+
children: React.ReactNode;
|
|
246
|
+
emptyState?: React.ReactNode;
|
|
133
247
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
248
|
+
/**
|
|
249
|
+
* Component that provides access to variant options.
|
|
250
|
+
*
|
|
251
|
+
* @component
|
|
252
|
+
* @example
|
|
253
|
+
* ```tsx
|
|
254
|
+
* // Default usage
|
|
255
|
+
* <Product.VariantOptions emptyState={<div>No options available</div>}>
|
|
256
|
+
* <Product.VariantOptionRepeater>
|
|
257
|
+
* <Option.Name />
|
|
258
|
+
* <Option.Choices>
|
|
259
|
+
* <Option.ChoiceRepeater>
|
|
260
|
+
* <Choice.Text />
|
|
261
|
+
* </Option.ChoiceRepeater>
|
|
262
|
+
* </Option.Choices>
|
|
263
|
+
* </Product.VariantOptionRepeater>
|
|
264
|
+
* </Product.VariantOptions>
|
|
265
|
+
*
|
|
266
|
+
* // Simple container usage
|
|
267
|
+
* <Product.VariantOptions emptyState={<div>No options</div>}>
|
|
268
|
+
* <div className="options-container">
|
|
269
|
+
* <Product.VariantOptionRepeater>
|
|
270
|
+
* // option content
|
|
271
|
+
* </Product.VariantOptionRepeater>
|
|
272
|
+
* </div>
|
|
273
|
+
* </Product.VariantOptions>
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
export declare const VariantOptions: React.ForwardRefExoticComponent<VariantOptionsProps & React.RefAttributes<HTMLElement>>;
|
|
277
|
+
/**
|
|
278
|
+
* Props for Product VariantOptionRepeater component
|
|
279
|
+
*/
|
|
280
|
+
export interface VariantOptionRepeaterProps {
|
|
281
|
+
children: React.ReactNode;
|
|
137
282
|
}
|
|
138
|
-
|
|
139
|
-
|
|
283
|
+
/**
|
|
284
|
+
* Repeater component that renders children for each variant option.
|
|
285
|
+
*
|
|
286
|
+
* @component
|
|
287
|
+
*/
|
|
288
|
+
export declare const VariantOptionRepeater: React.ForwardRefExoticComponent<VariantOptionRepeaterProps & React.RefAttributes<HTMLElement>>;
|
|
289
|
+
/**
|
|
290
|
+
* Props for Product Modifiers container
|
|
291
|
+
*/
|
|
292
|
+
export interface ModifiersProps extends AsChildProps<{
|
|
293
|
+
hasModifiers: boolean;
|
|
294
|
+
}> {
|
|
140
295
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
296
|
+
/**
|
|
297
|
+
* Container for product modifier system.
|
|
298
|
+
* Does not render when there are no modifiers.
|
|
299
|
+
*
|
|
300
|
+
* @component
|
|
301
|
+
* @example
|
|
302
|
+
* ```tsx
|
|
303
|
+
* // Default usage
|
|
304
|
+
* <Product.Modifiers>
|
|
305
|
+
* <Product.ModifierOptions>
|
|
306
|
+
* <Product.ModifierOptionRepeater>
|
|
307
|
+
* <Option.Name className="text-lg font-medium mb-3" />
|
|
308
|
+
* <Option.Choices>
|
|
309
|
+
* <Option.ChoiceRepeater>
|
|
310
|
+
* <Choice.Text className="px-4 py-2 border rounded-lg" />
|
|
311
|
+
* <Choice.Color className="w-10 h-10 rounded-full border-4" />
|
|
312
|
+
* <Choice.FreeText className="w-full p-3 border rounded-lg resize-none" />
|
|
313
|
+
* </Option.ChoiceRepeater>
|
|
314
|
+
* </Option.Choices>
|
|
315
|
+
* </Product.ModifierOptionRepeater>
|
|
316
|
+
* </Product.ModifierOptions>
|
|
317
|
+
* </Product.Modifiers>
|
|
318
|
+
*
|
|
319
|
+
* // asChild with primitive
|
|
320
|
+
* <Product.Modifiers asChild>
|
|
321
|
+
* <section className="modifier-section">
|
|
322
|
+
* <Product.ModifierOptions>
|
|
323
|
+
* // modifier options
|
|
324
|
+
* </Product.ModifierOptions>
|
|
325
|
+
* </section>
|
|
326
|
+
* </Product.Modifiers>
|
|
327
|
+
*
|
|
328
|
+
* // asChild with react component
|
|
329
|
+
* <Product.Modifiers asChild>
|
|
330
|
+
* {React.forwardRef(({hasModifiers, ...props}, ref) => (
|
|
331
|
+
* <section ref={ref} {...props} className="modifier-section">
|
|
332
|
+
* {hasModifiers && <h3>Customize Your Product</h3>}
|
|
333
|
+
* {props.children}
|
|
334
|
+
* </section>
|
|
335
|
+
* ))}
|
|
336
|
+
* </Product.Modifiers>
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
export declare const Modifiers: React.ForwardRefExoticComponent<ModifiersProps & React.RefAttributes<HTMLElement>>;
|
|
340
|
+
/**
|
|
341
|
+
* Props for Product ModifierOptions component
|
|
342
|
+
*/
|
|
343
|
+
export interface ModifierOptionsProps {
|
|
344
|
+
children: React.ReactNode;
|
|
345
|
+
emptyState?: React.ReactNode;
|
|
144
346
|
}
|
|
145
|
-
|
|
146
|
-
|
|
347
|
+
/**
|
|
348
|
+
* Component that provides access to modifier options.
|
|
349
|
+
*
|
|
350
|
+
* @component
|
|
351
|
+
* @example
|
|
352
|
+
* ```tsx
|
|
353
|
+
* // Default usage
|
|
354
|
+
* <Product.ModifierOptions emptyState={<div>No options available</div>}>
|
|
355
|
+
* <Product.ModifierOptionRepeater>
|
|
356
|
+
* <Option.Name />
|
|
357
|
+
* <Option.Choices>
|
|
358
|
+
* <Option.ChoiceRepeater>
|
|
359
|
+
* <Choice.Text />
|
|
360
|
+
* <Choice.Color />
|
|
361
|
+
* <Choice.FreeText />
|
|
362
|
+
* </Option.ChoiceRepeater>
|
|
363
|
+
* </Option.Choices>
|
|
364
|
+
* </Product.ModifierOptionRepeater>
|
|
365
|
+
* </Product.ModifierOptions>
|
|
366
|
+
*
|
|
367
|
+
* // Simple container usage
|
|
368
|
+
* <Product.ModifierOptions emptyState={<div>No options</div>}>
|
|
369
|
+
* <div className="options-container">
|
|
370
|
+
* <Product.ModifierOptionRepeater>
|
|
371
|
+
* // option content
|
|
372
|
+
* </Product.ModifierOptionRepeater>
|
|
373
|
+
* </div>
|
|
374
|
+
* </Product.ModifierOptions>
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
export declare const ModifierOptions: React.ForwardRefExoticComponent<ModifierOptionsProps & React.RefAttributes<HTMLElement>>;
|
|
378
|
+
/**
|
|
379
|
+
* Props for Product ModifierOptionRepeater component
|
|
380
|
+
*/
|
|
381
|
+
export interface ModifierOptionRepeaterProps {
|
|
382
|
+
children: React.ReactNode;
|
|
383
|
+
allowedTypes?: ('color' | 'text' | 'free-text')[];
|
|
147
384
|
}
|
|
148
|
-
|
|
385
|
+
/**
|
|
386
|
+
* Repeater component that renders children for each modifier option.
|
|
387
|
+
*
|
|
388
|
+
* @component
|
|
389
|
+
*/
|
|
390
|
+
export declare const ModifierOptionRepeater: React.ForwardRefExoticComponent<ModifierOptionRepeaterProps & React.RefAttributes<HTMLElement>>;
|
|
391
|
+
export {};
|