@wix/headless-stores 0.0.0
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/astro/actions/package.json +4 -0
- package/cjs/dist/astro/actions/custom-checkout.d.ts +50 -0
- package/cjs/dist/astro/actions/custom-checkout.js +53 -0
- package/cjs/dist/astro/actions/index.d.ts +1 -0
- package/cjs/dist/astro/actions/index.js +1 -0
- package/cjs/dist/data-component-tags.d.ts +8 -0
- package/cjs/dist/data-component-tags.js +9 -0
- package/cjs/dist/enums/index.d.ts +2 -0
- package/cjs/dist/enums/index.js +2 -0
- package/cjs/dist/enums/social-platform-enums.d.ts +25 -0
- package/cjs/dist/enums/social-platform-enums.js +27 -0
- package/cjs/dist/enums/sort-enums.d.ts +17 -0
- package/cjs/dist/enums/sort-enums.js +18 -0
- package/cjs/dist/react/Category.d.ts +242 -0
- package/cjs/dist/react/Category.js +235 -0
- package/cjs/dist/react/CategoryList.d.ts +107 -0
- package/cjs/dist/react/CategoryList.js +91 -0
- package/cjs/dist/react/Choice.d.ts +211 -0
- package/cjs/dist/react/Choice.js +213 -0
- package/cjs/dist/react/Option.d.ts +242 -0
- package/cjs/dist/react/Option.js +346 -0
- package/cjs/dist/react/Product.d.ts +1065 -0
- package/cjs/dist/react/Product.js +1157 -0
- package/cjs/dist/react/ProductList.d.ts +400 -0
- package/cjs/dist/react/ProductList.js +368 -0
- package/cjs/dist/react/core/CategoryList.d.ts +194 -0
- package/cjs/dist/react/core/CategoryList.js +180 -0
- package/cjs/dist/react/core/Product.d.ts +225 -0
- package/cjs/dist/react/core/Product.js +190 -0
- package/cjs/dist/react/core/ProductList.d.ts +235 -0
- package/cjs/dist/react/core/ProductList.js +217 -0
- package/cjs/dist/react/core/ProductListFilters.d.ts +138 -0
- package/cjs/dist/react/core/ProductListFilters.js +242 -0
- package/cjs/dist/react/core/ProductListPagination.d.ts +49 -0
- package/cjs/dist/react/core/ProductListPagination.js +41 -0
- package/cjs/dist/react/core/ProductListSort.d.ts +19 -0
- package/cjs/dist/react/core/ProductListSort.js +52 -0
- package/cjs/dist/react/core/ProductModifiers.d.ts +416 -0
- package/cjs/dist/react/core/ProductModifiers.js +413 -0
- package/cjs/dist/react/core/ProductVariantSelector.d.ts +313 -0
- package/cjs/dist/react/core/ProductVariantSelector.js +291 -0
- package/cjs/dist/react/core/SelectedVariant.d.ts +230 -0
- package/cjs/dist/react/core/SelectedVariant.js +269 -0
- package/cjs/dist/react/index.d.ts +6 -0
- package/cjs/dist/react/index.js +6 -0
- 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.d.ts +49 -0
- package/cjs/dist/server-actions/custom-checkout-action.js +64 -0
- package/cjs/dist/server-actions/index.d.ts +1 -0
- package/cjs/dist/server-actions/index.js +1 -0
- package/cjs/dist/services/buy-now-service.d.ts +346 -0
- package/cjs/dist/services/buy-now-service.js +197 -0
- package/cjs/dist/services/categories-list-service.d.ts +164 -0
- package/cjs/dist/services/categories-list-service.js +148 -0
- package/cjs/dist/services/index.d.ts +5 -0
- package/cjs/dist/services/index.js +5 -0
- package/cjs/dist/services/pay-now-service.d.ts +214 -0
- package/cjs/dist/services/pay-now-service.js +156 -0
- package/cjs/dist/services/product-modifiers-service.d.ts +34 -0
- package/cjs/dist/services/product-modifiers-service.js +107 -0
- package/cjs/dist/services/product-service.d.ts +177 -0
- package/cjs/dist/services/product-service.js +190 -0
- package/cjs/dist/services/products-list-search-service.d.ts +1 -0
- package/cjs/dist/services/products-list-search-service.js +1 -0
- package/cjs/dist/services/products-list-service.d.ts +429 -0
- package/cjs/dist/services/products-list-service.js +893 -0
- package/cjs/dist/services/selected-variant-service.d.ts +66 -0
- package/cjs/dist/services/selected-variant-service.js +527 -0
- package/cjs/dist/utils/index.d.ts +1 -0
- package/cjs/dist/utils/index.js +30 -0
- package/cjs/dist/utils/url-params.d.ts +73 -0
- package/cjs/dist/utils/url-params.js +114 -0
- package/cjs/package.json +3 -0
- package/dist/astro/actions/custom-checkout.d.ts +50 -0
- package/dist/astro/actions/custom-checkout.js +53 -0
- package/dist/astro/actions/index.d.ts +1 -0
- package/dist/astro/actions/index.js +1 -0
- package/dist/data-component-tags.d.ts +8 -0
- package/dist/data-component-tags.js +9 -0
- package/dist/enums/index.d.ts +2 -0
- package/dist/enums/index.js +2 -0
- package/dist/enums/social-platform-enums.d.ts +25 -0
- package/dist/enums/social-platform-enums.js +27 -0
- package/dist/enums/sort-enums.d.ts +17 -0
- package/dist/enums/sort-enums.js +18 -0
- package/dist/react/Category.d.ts +242 -0
- package/dist/react/Category.js +235 -0
- package/dist/react/CategoryList.d.ts +107 -0
- package/dist/react/CategoryList.js +91 -0
- package/dist/react/Choice.d.ts +211 -0
- package/dist/react/Choice.js +213 -0
- package/dist/react/Option.d.ts +242 -0
- package/dist/react/Option.js +346 -0
- package/dist/react/Product.d.ts +1065 -0
- package/dist/react/Product.js +1157 -0
- package/dist/react/ProductList.d.ts +400 -0
- package/dist/react/ProductList.js +368 -0
- package/dist/react/core/CategoryList.d.ts +194 -0
- package/dist/react/core/CategoryList.js +180 -0
- package/dist/react/core/Product.d.ts +225 -0
- package/dist/react/core/Product.js +190 -0
- package/dist/react/core/ProductList.d.ts +235 -0
- package/dist/react/core/ProductList.js +217 -0
- package/dist/react/core/ProductListFilters.d.ts +138 -0
- package/dist/react/core/ProductListFilters.js +242 -0
- package/dist/react/core/ProductListPagination.d.ts +49 -0
- package/dist/react/core/ProductListPagination.js +41 -0
- package/dist/react/core/ProductListSort.d.ts +19 -0
- package/dist/react/core/ProductListSort.js +52 -0
- package/dist/react/core/ProductModifiers.d.ts +416 -0
- package/dist/react/core/ProductModifiers.js +413 -0
- package/dist/react/core/ProductVariantSelector.d.ts +313 -0
- package/dist/react/core/ProductVariantSelector.js +291 -0
- package/dist/react/core/SelectedVariant.d.ts +230 -0
- package/dist/react/core/SelectedVariant.js +269 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.js +6 -0
- package/dist/react/types.d.ts +8 -0
- package/dist/react/types.js +9 -0
- package/dist/server-actions/custom-checkout-action.d.ts +49 -0
- package/dist/server-actions/custom-checkout-action.js +64 -0
- package/dist/server-actions/index.d.ts +1 -0
- package/dist/server-actions/index.js +1 -0
- package/dist/services/buy-now-service.d.ts +346 -0
- package/dist/services/buy-now-service.js +197 -0
- package/dist/services/categories-list-service.d.ts +164 -0
- package/dist/services/categories-list-service.js +148 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/services/index.js +5 -0
- package/dist/services/pay-now-service.d.ts +214 -0
- package/dist/services/pay-now-service.js +156 -0
- package/dist/services/product-modifiers-service.d.ts +34 -0
- package/dist/services/product-modifiers-service.js +107 -0
- package/dist/services/product-service.d.ts +177 -0
- package/dist/services/product-service.js +190 -0
- package/dist/services/products-list-search-service.d.ts +0 -0
- package/dist/services/products-list-search-service.js +1 -0
- package/dist/services/products-list-service.d.ts +429 -0
- package/dist/services/products-list-service.js +893 -0
- package/dist/services/selected-variant-service.d.ts +66 -0
- package/dist/services/selected-variant-service.js +527 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +30 -0
- package/dist/utils/url-params.d.ts +73 -0
- package/dist/utils/url-params.js +114 -0
- package/package.json +89 -0
- package/react/package.json +4 -0
- package/server-actions/package.json +4 -0
- package/services/package.json +4 -0
|
@@ -0,0 +1,1065 @@
|
|
|
1
|
+
import type { V3Product } from '@wix/auto_sdk_stores_products-v-3';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { AsChildChildren } from '@wix/headless-utils/react';
|
|
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
|
+
* Basic stock status type for product availability states
|
|
29
|
+
*/
|
|
30
|
+
export type BasicStockStatus = 'in-stock' | 'limited-stock' | 'out-of-stock';
|
|
31
|
+
/**
|
|
32
|
+
* Extended stock status type including pre-order capability
|
|
33
|
+
*/
|
|
34
|
+
export type StockStatus = BasicStockStatus | 'can-pre-order';
|
|
35
|
+
/**
|
|
36
|
+
* Props for the Product root component following the documented API
|
|
37
|
+
*/
|
|
38
|
+
export interface ProductRootProps {
|
|
39
|
+
children: React.ReactNode;
|
|
40
|
+
product: V3Product;
|
|
41
|
+
selectedVariant?: any;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Root component that provides all necessary service contexts for a complete product experience.
|
|
45
|
+
* This composite component combines Product, ProductVariantSelector, ProductModifiers, and SelectedVariant
|
|
46
|
+
* functionality following the documented API patterns with proper data attributes.
|
|
47
|
+
*
|
|
48
|
+
* @order 1
|
|
49
|
+
* @component
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* import { Product } from '@wix/stores/components';
|
|
53
|
+
*
|
|
54
|
+
* function ProductPage({ product }) {
|
|
55
|
+
* return (
|
|
56
|
+
* <Product.Root product={product}>
|
|
57
|
+
* <Product.Name className="text-4xl font-bold" />
|
|
58
|
+
* </Product.Root>
|
|
59
|
+
* );
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare const Root: {
|
|
64
|
+
(props: ProductRootProps): React.ReactNode;
|
|
65
|
+
displayName: string;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Props for Product Name component
|
|
69
|
+
*/
|
|
70
|
+
export interface NameProps {
|
|
71
|
+
/** Whether to render as a child component */
|
|
72
|
+
asChild?: boolean;
|
|
73
|
+
/** Custom render function when using asChild */
|
|
74
|
+
children?: AsChildChildren<{
|
|
75
|
+
name: string;
|
|
76
|
+
}>;
|
|
77
|
+
/** CSS classes to apply to the default element */
|
|
78
|
+
className?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Displays the product name with customizable rendering following the documented API.
|
|
82
|
+
*
|
|
83
|
+
* @component
|
|
84
|
+
* @example
|
|
85
|
+
* ```tsx
|
|
86
|
+
* // Default usage
|
|
87
|
+
* <Product.Name className="text-4xl font-bold" />
|
|
88
|
+
*
|
|
89
|
+
* // asChild with primitive
|
|
90
|
+
* <Product.Name asChild>
|
|
91
|
+
* <h1 className="text-4xl font-bold" />
|
|
92
|
+
* </Product.Name>
|
|
93
|
+
*
|
|
94
|
+
* // asChild with react component
|
|
95
|
+
* <Product.Name asChild>
|
|
96
|
+
* {React.forwardRef(({name, ...props}, ref) => (
|
|
97
|
+
* <h1 ref={ref} {...props} className="text-4xl font-bold">
|
|
98
|
+
* {name}
|
|
99
|
+
* </h1>
|
|
100
|
+
* ))}
|
|
101
|
+
* </Product.Name>
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare const Name: React.ForwardRefExoticComponent<NameProps & React.RefAttributes<HTMLElement>>;
|
|
105
|
+
/**
|
|
106
|
+
* Props for Product Description component
|
|
107
|
+
*/
|
|
108
|
+
export interface DescriptionProps {
|
|
109
|
+
/** Whether to render as a child component */
|
|
110
|
+
asChild?: boolean;
|
|
111
|
+
/** Custom render function when using asChild */
|
|
112
|
+
children?: AsChildChildren<{
|
|
113
|
+
description: string;
|
|
114
|
+
}>;
|
|
115
|
+
/** CSS classes to apply to the default element */
|
|
116
|
+
className?: string;
|
|
117
|
+
/** Format of the description content */
|
|
118
|
+
as?: `${AsContent}`;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Displays the product description with customizable rendering and format options following the documented API.
|
|
122
|
+
*
|
|
123
|
+
* @component
|
|
124
|
+
* @example
|
|
125
|
+
* ```tsx
|
|
126
|
+
* // Default usage (plain text)
|
|
127
|
+
* <Product.Description className="text-content-secondary" />
|
|
128
|
+
*
|
|
129
|
+
* // HTML content
|
|
130
|
+
* <Product.Description as="html" className="prose" />
|
|
131
|
+
*
|
|
132
|
+
* // asChild with custom rendering
|
|
133
|
+
* <Product.Description as="html" asChild>
|
|
134
|
+
* {({ description }) => (
|
|
135
|
+
* <div
|
|
136
|
+
* className="text-content-secondary"
|
|
137
|
+
* dangerouslySetInnerHTML={{ __html: description }}
|
|
138
|
+
* />
|
|
139
|
+
* )}
|
|
140
|
+
* </Product.Description>
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
export declare const Description: React.ForwardRefExoticComponent<DescriptionProps & React.RefAttributes<HTMLElement>>;
|
|
144
|
+
/**
|
|
145
|
+
* Props for Product Price component
|
|
146
|
+
*/
|
|
147
|
+
export interface PriceProps {
|
|
148
|
+
/** Whether to render as a child component */
|
|
149
|
+
asChild?: boolean;
|
|
150
|
+
/** Custom render function when using asChild */
|
|
151
|
+
children?: AsChildChildren<{
|
|
152
|
+
price: string;
|
|
153
|
+
formattedPrice: string;
|
|
154
|
+
}>;
|
|
155
|
+
/** CSS classes to apply to the default element */
|
|
156
|
+
className?: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Displays the current product price with customizable rendering following the documented API.
|
|
160
|
+
*
|
|
161
|
+
* @component
|
|
162
|
+
* @example
|
|
163
|
+
* ```tsx
|
|
164
|
+
* // Default usage
|
|
165
|
+
* <Product.Price className="text-3xl font-bold text-content-primary data-[discounted]:text-brand-primary" />
|
|
166
|
+
*
|
|
167
|
+
* // asChild with primitive
|
|
168
|
+
* <Product.Price asChild>
|
|
169
|
+
* <span className="text-3xl font-bold text-content-primary" />
|
|
170
|
+
* </Product.Price>
|
|
171
|
+
*
|
|
172
|
+
* // asChild with react component
|
|
173
|
+
* <Product.Price asChild>
|
|
174
|
+
* {React.forwardRef(({price, formattedPrice, ...props}, ref) => (
|
|
175
|
+
* <span ref={ref} {...props} className="text-3xl font-bold text-content-primary">
|
|
176
|
+
* {formattedPrice}
|
|
177
|
+
* </span>
|
|
178
|
+
* ))}
|
|
179
|
+
* </Product.Price>
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
export declare const Price: React.ForwardRefExoticComponent<PriceProps & React.RefAttributes<HTMLElement>>;
|
|
183
|
+
/**
|
|
184
|
+
* Props for Product CompareAtPrice component
|
|
185
|
+
*/
|
|
186
|
+
export interface CompareAtPriceProps {
|
|
187
|
+
/** Whether to render as a child component */
|
|
188
|
+
asChild?: boolean;
|
|
189
|
+
/** Custom render function when using asChild */
|
|
190
|
+
children?: AsChildChildren<{
|
|
191
|
+
price: string;
|
|
192
|
+
formattedPrice: string;
|
|
193
|
+
}>;
|
|
194
|
+
/** CSS classes to apply to the default element */
|
|
195
|
+
className?: string;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Displays the compare-at (original) price when on sale with customizable rendering following the documented API.
|
|
199
|
+
*
|
|
200
|
+
* @component
|
|
201
|
+
* @example
|
|
202
|
+
* ```tsx
|
|
203
|
+
* // Default usage (only shows when on sale)
|
|
204
|
+
* <Product.CompareAtPrice className="text-lg text-content-faded line-through hidden data-[discounted]:inline" />
|
|
205
|
+
*
|
|
206
|
+
* // asChild with primitive
|
|
207
|
+
* <Product.CompareAtPrice asChild>
|
|
208
|
+
* <span className="text-lg text-content-faded line-through" />
|
|
209
|
+
* </Product.CompareAtPrice>
|
|
210
|
+
*
|
|
211
|
+
* // asChild with react component
|
|
212
|
+
* <Product.CompareAtPrice asChild>
|
|
213
|
+
* {React.forwardRef(({formattedPrice, ...props}, ref) => (
|
|
214
|
+
* <span
|
|
215
|
+
* ref={ref}
|
|
216
|
+
* {...props}
|
|
217
|
+
* className="hidden data-[discounted]:inline text-lg text-content-faded line-through"
|
|
218
|
+
* >
|
|
219
|
+
* Was: {formattedPrice}
|
|
220
|
+
* </span>
|
|
221
|
+
* ))}
|
|
222
|
+
* </Product.CompareAtPrice>
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export declare const CompareAtPrice: React.ForwardRefExoticComponent<CompareAtPriceProps & React.RefAttributes<HTMLElement>>;
|
|
226
|
+
/**
|
|
227
|
+
* Props for Slug component
|
|
228
|
+
* @interface SlugProps
|
|
229
|
+
*/
|
|
230
|
+
export interface SlugProps {
|
|
231
|
+
/** Whether to render as a child component */
|
|
232
|
+
asChild?: boolean;
|
|
233
|
+
/** Custom render function when using asChild */
|
|
234
|
+
children?: AsChildChildren<{
|
|
235
|
+
slug: string;
|
|
236
|
+
}>;
|
|
237
|
+
/** CSS classes to apply to the default element */
|
|
238
|
+
className?: string;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Product Slug component that displays the product's slug
|
|
242
|
+
*
|
|
243
|
+
* @component
|
|
244
|
+
* @order 6
|
|
245
|
+
* @example
|
|
246
|
+
* ```tsx
|
|
247
|
+
* import { Product } from '@wix/stores/components';
|
|
248
|
+
*
|
|
249
|
+
* function ProductSlugLink() {
|
|
250
|
+
* return (
|
|
251
|
+
* <Product.Slug>
|
|
252
|
+
* {({ slug }) => (
|
|
253
|
+
* <a href={`/product/${slug}`}>
|
|
254
|
+
* View Product Details
|
|
255
|
+
* </a>
|
|
256
|
+
* )}
|
|
257
|
+
* </Product.Slug>
|
|
258
|
+
* );
|
|
259
|
+
* }
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
export declare const Slug: React.ForwardRefExoticComponent<SlugProps & React.RefAttributes<HTMLElement>>;
|
|
263
|
+
/**
|
|
264
|
+
* Props for Product Raw component
|
|
265
|
+
*/
|
|
266
|
+
export interface RawProps {
|
|
267
|
+
/** Whether to render as a child component */
|
|
268
|
+
asChild?: boolean;
|
|
269
|
+
/** Custom render function when using asChild */
|
|
270
|
+
children?: AsChildChildren<{
|
|
271
|
+
product: V3Product;
|
|
272
|
+
}>;
|
|
273
|
+
/** CSS classes to apply to the default element */
|
|
274
|
+
className?: string;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Provides access to the raw product data for advanced use cases.
|
|
278
|
+
* Similar to Category.Raw, this should only be used when you need custom access to product data.
|
|
279
|
+
*
|
|
280
|
+
* @component
|
|
281
|
+
* @example
|
|
282
|
+
* ```tsx
|
|
283
|
+
* // Custom rendering with forwardRef
|
|
284
|
+
* <Product.Raw asChild>
|
|
285
|
+
* {React.forwardRef(({product, ...props}, ref) => (
|
|
286
|
+
* <div ref={ref} {...props} className="product-debug">
|
|
287
|
+
* <span>Product ID: {product._id}</span>
|
|
288
|
+
* <span>SKU: {product.sku}</span>
|
|
289
|
+
* <span>Inventory: {product.inventory?.quantity}</span>
|
|
290
|
+
* </div>
|
|
291
|
+
* ))}
|
|
292
|
+
* </Product.Raw>
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
export declare const Raw: React.ForwardRefExoticComponent<RawProps & React.RefAttributes<HTMLElement>>;
|
|
296
|
+
/**
|
|
297
|
+
* Props for Product Ribbon component
|
|
298
|
+
*/
|
|
299
|
+
export interface RibbonProps {
|
|
300
|
+
/** Whether to render as a child component */
|
|
301
|
+
asChild?: boolean;
|
|
302
|
+
/** Custom render function when using asChild */
|
|
303
|
+
children?: AsChildChildren<{
|
|
304
|
+
ribbon: string | null;
|
|
305
|
+
}>;
|
|
306
|
+
/** CSS classes to apply to the default element */
|
|
307
|
+
className?: string;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Displays the product ribbon with customizable rendering following the documented API.
|
|
311
|
+
*
|
|
312
|
+
* @component
|
|
313
|
+
* @example
|
|
314
|
+
* ```tsx
|
|
315
|
+
* // Default usage
|
|
316
|
+
* <Product.Ribbon className="absolute top-2 left-2 bg-red-500 text-white px-2 py-1 text-xs rounded" />
|
|
317
|
+
*
|
|
318
|
+
* // asChild with primitive
|
|
319
|
+
* <Product.Ribbon asChild>
|
|
320
|
+
* <span className="ribbon-badge" />
|
|
321
|
+
* </Product.Ribbon>
|
|
322
|
+
*
|
|
323
|
+
* // asChild with react component
|
|
324
|
+
* <Product.Ribbon asChild>
|
|
325
|
+
* {React.forwardRef(({ribbon, ...props}, ref) => (
|
|
326
|
+
* <div ref={ref} {...props} className="ribbon-badge">
|
|
327
|
+
* {ribbon}
|
|
328
|
+
* </div>
|
|
329
|
+
* ))}
|
|
330
|
+
* </Product.Ribbon>
|
|
331
|
+
* ```
|
|
332
|
+
*/
|
|
333
|
+
export declare const Ribbon: React.ForwardRefExoticComponent<RibbonProps & React.RefAttributes<HTMLElement>>;
|
|
334
|
+
/**
|
|
335
|
+
* Props for Product Stock component
|
|
336
|
+
*/
|
|
337
|
+
export interface StockProps {
|
|
338
|
+
/** Whether to render as a child component */
|
|
339
|
+
asChild?: boolean;
|
|
340
|
+
/** Custom render function when using asChild */
|
|
341
|
+
children?: AsChildChildren<{
|
|
342
|
+
status: BasicStockStatus;
|
|
343
|
+
label: string;
|
|
344
|
+
}>;
|
|
345
|
+
/** CSS classes to apply to the default element */
|
|
346
|
+
className?: string;
|
|
347
|
+
/** Custom labels for different stock states */
|
|
348
|
+
labels?: {
|
|
349
|
+
/** Label for in stock state */
|
|
350
|
+
inStock?: string;
|
|
351
|
+
/** Label for limited stock state (when quantity is low) */
|
|
352
|
+
limitedStock?: string;
|
|
353
|
+
/** Label for out of stock state */
|
|
354
|
+
outOfStock?: string;
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Displays the product stock status with customizable rendering and labels following the documented API.
|
|
359
|
+
*
|
|
360
|
+
* @component
|
|
361
|
+
* @example
|
|
362
|
+
* ```tsx
|
|
363
|
+
* // Default usage
|
|
364
|
+
* <Product.Stock
|
|
365
|
+
* className="stock-indicator"
|
|
366
|
+
* labels={{
|
|
367
|
+
* inStock: 'In Stock',
|
|
368
|
+
* limitedStock: 'Limited Stock',
|
|
369
|
+
* outOfStock: 'Out of Stock'
|
|
370
|
+
* }}
|
|
371
|
+
* />
|
|
372
|
+
*
|
|
373
|
+
* // asChild with primitive
|
|
374
|
+
* <Product.Stock asChild>
|
|
375
|
+
* <div className="stock-status" />
|
|
376
|
+
* </Product.Stock>
|
|
377
|
+
*
|
|
378
|
+
* // asChild with react component
|
|
379
|
+
* <Product.Stock
|
|
380
|
+
* labels={{
|
|
381
|
+
* inStock: 'Available',
|
|
382
|
+
* limitedStock: 'Low Stock',
|
|
383
|
+
* outOfStock: 'Sold Out'
|
|
384
|
+
* }}
|
|
385
|
+
* asChild
|
|
386
|
+
* >
|
|
387
|
+
* {React.forwardRef(({status, label, ...props}, ref) => (
|
|
388
|
+
* <div
|
|
389
|
+
* ref={ref}
|
|
390
|
+
* {...props}
|
|
391
|
+
* className="flex items-center gap-1 data-[state='in-stock']:text-green-600 data-[state='limited-stock']:text-yellow-600 data-[state='out-of-stock']:text-red-600"
|
|
392
|
+
* >
|
|
393
|
+
* <div className="w-2 h-2 rounded-full data-[state='in-stock']:bg-green-500 data-[state='limited-stock']:bg-yellow-500 data-[state='out-of-stock']:bg-red-500" />
|
|
394
|
+
* <span className="text-xs font-medium">
|
|
395
|
+
* {label}
|
|
396
|
+
* </span>
|
|
397
|
+
* </div>
|
|
398
|
+
* ))}
|
|
399
|
+
* </Product.Stock>
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
export declare const Stock: React.ForwardRefExoticComponent<StockProps & React.RefAttributes<HTMLElement>>;
|
|
403
|
+
/**
|
|
404
|
+
* Props for Product Variants container
|
|
405
|
+
*/
|
|
406
|
+
export interface VariantsProps {
|
|
407
|
+
/** Whether to render as a child component */
|
|
408
|
+
asChild?: boolean;
|
|
409
|
+
/** Custom render function when using asChild */
|
|
410
|
+
children: React.ReactNode;
|
|
411
|
+
/** CSS classes to apply to the default element */
|
|
412
|
+
className?: string;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Container for product variant selection system.
|
|
416
|
+
* Does not render when there are no variants.
|
|
417
|
+
*
|
|
418
|
+
* @component
|
|
419
|
+
* @example
|
|
420
|
+
* ```tsx
|
|
421
|
+
* // Default usage
|
|
422
|
+
* <Product.Variants>
|
|
423
|
+
* <Product.VariantOptions>
|
|
424
|
+
* <Product.VariantOptionRepeater>
|
|
425
|
+
* <Option.Name className="text-lg font-medium mb-3" />
|
|
426
|
+
* <Option.Choices>
|
|
427
|
+
* <Option.ChoiceRepeater>
|
|
428
|
+
* <Choice.Text className="px-4 py-2 border rounded-lg" />
|
|
429
|
+
* <Choice.Color className="w-10 h-10 rounded-full border-4" />
|
|
430
|
+
* </Option.ChoiceRepeater>
|
|
431
|
+
* </Option.Choices>
|
|
432
|
+
* </Product.VariantOptionRepeater>
|
|
433
|
+
* </Product.VariantOptions>
|
|
434
|
+
* </Product.Variants>
|
|
435
|
+
*
|
|
436
|
+
* // asChild with primitive
|
|
437
|
+
* <Product.Variants asChild>
|
|
438
|
+
* <section className="variant-section">
|
|
439
|
+
* <Product.VariantOptions>
|
|
440
|
+
* // variant options
|
|
441
|
+
* </Product.VariantOptions>
|
|
442
|
+
* </section>
|
|
443
|
+
* </Product.Variants>
|
|
444
|
+
*
|
|
445
|
+
* // asChild with react component
|
|
446
|
+
* <Product.Variants asChild>
|
|
447
|
+
* {React.forwardRef(({hasOptions, ...props}, ref) => (
|
|
448
|
+
* <section ref={ref} {...props} className="variant-section">
|
|
449
|
+
* {hasOptions && <h3>Choose Options</h3>}
|
|
450
|
+
* {props.children}
|
|
451
|
+
* </section>
|
|
452
|
+
* ))}
|
|
453
|
+
* </Product.Variants>
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
export declare const Variants: React.ForwardRefExoticComponent<VariantsProps & React.RefAttributes<HTMLElement>>;
|
|
457
|
+
/**
|
|
458
|
+
* Props for Product VariantOptions component
|
|
459
|
+
*/
|
|
460
|
+
export interface VariantOptionsProps {
|
|
461
|
+
children: React.ReactNode;
|
|
462
|
+
emptyState?: React.ReactNode;
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Component that provides access to variant options.
|
|
466
|
+
*
|
|
467
|
+
* @component
|
|
468
|
+
* @example
|
|
469
|
+
* ```tsx
|
|
470
|
+
* // Default usage
|
|
471
|
+
* <Product.VariantOptions emptyState={<div>No options available</div>}>
|
|
472
|
+
* <Product.VariantOptionRepeater>
|
|
473
|
+
* <Option.Name />
|
|
474
|
+
* <Option.Choices>
|
|
475
|
+
* <Option.ChoiceRepeater>
|
|
476
|
+
* <Choice.Text />
|
|
477
|
+
* </Option.ChoiceRepeater>
|
|
478
|
+
* </Option.Choices>
|
|
479
|
+
* </Product.VariantOptionRepeater>
|
|
480
|
+
* </Product.VariantOptions>
|
|
481
|
+
*
|
|
482
|
+
* // Simple container usage
|
|
483
|
+
* <Product.VariantOptions emptyState={<div>No options</div>}>
|
|
484
|
+
* <div className="options-container">
|
|
485
|
+
* <Product.VariantOptionRepeater>
|
|
486
|
+
* // option content
|
|
487
|
+
* </Product.VariantOptionRepeater>
|
|
488
|
+
* </div>
|
|
489
|
+
* </Product.VariantOptions>
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
|
+
export declare const VariantOptions: React.ForwardRefExoticComponent<VariantOptionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
493
|
+
/**
|
|
494
|
+
* Props for Product VariantOptionRepeater component
|
|
495
|
+
*/
|
|
496
|
+
export interface VariantOptionRepeaterProps {
|
|
497
|
+
children: React.ReactNode;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Repeater component that renders children for each variant option.
|
|
501
|
+
*
|
|
502
|
+
* @component
|
|
503
|
+
*/
|
|
504
|
+
export declare const VariantOptionRepeater: React.ForwardRefExoticComponent<VariantOptionRepeaterProps & React.RefAttributes<HTMLElement>>;
|
|
505
|
+
/**
|
|
506
|
+
* Props for Product Modifiers container
|
|
507
|
+
*/
|
|
508
|
+
export interface ModifiersProps {
|
|
509
|
+
/** Whether to render as a child component */
|
|
510
|
+
asChild?: boolean;
|
|
511
|
+
/** Custom render function when using asChild */
|
|
512
|
+
children: React.ReactNode;
|
|
513
|
+
/** CSS classes to apply to the default element */
|
|
514
|
+
className?: string;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Container for product modifier system.
|
|
518
|
+
* Does not render when there are no modifiers.
|
|
519
|
+
*
|
|
520
|
+
* @component
|
|
521
|
+
* @example
|
|
522
|
+
* ```tsx
|
|
523
|
+
* // Default usage
|
|
524
|
+
* <Product.Modifiers>
|
|
525
|
+
* <Product.ModifierOptions>
|
|
526
|
+
* <Product.ModifierOptionRepeater>
|
|
527
|
+
* <Option.Name className="text-lg font-medium mb-3" />
|
|
528
|
+
* <Option.Choices>
|
|
529
|
+
* <Option.ChoiceRepeater>
|
|
530
|
+
* <Choice.Text className="px-4 py-2 border rounded-lg" />
|
|
531
|
+
* <Choice.Color className="w-10 h-10 rounded-full border-4" />
|
|
532
|
+
* <Choice.FreeText className="w-full p-3 border rounded-lg resize-none" />
|
|
533
|
+
* </Option.ChoiceRepeater>
|
|
534
|
+
* </Option.Choices>
|
|
535
|
+
* </Product.ModifierOptionRepeater>
|
|
536
|
+
* </Product.ModifierOptions>
|
|
537
|
+
* </Product.Modifiers>
|
|
538
|
+
*
|
|
539
|
+
* // asChild with primitive
|
|
540
|
+
* <Product.Modifiers asChild>
|
|
541
|
+
* <section className="modifier-section">
|
|
542
|
+
* <Product.ModifierOptions>
|
|
543
|
+
* // modifier options
|
|
544
|
+
* </Product.ModifierOptions>
|
|
545
|
+
* </section>
|
|
546
|
+
* </Product.Modifiers>
|
|
547
|
+
*
|
|
548
|
+
* // asChild with react component
|
|
549
|
+
* <Product.Modifiers asChild>
|
|
550
|
+
* {React.forwardRef(({hasModifiers, ...props}, ref) => (
|
|
551
|
+
* <section ref={ref} {...props} className="modifier-section">
|
|
552
|
+
* {hasModifiers && <h3>Customize Your Product</h3>}
|
|
553
|
+
* {props.children}
|
|
554
|
+
* </section>
|
|
555
|
+
* ))}
|
|
556
|
+
* </Product.Modifiers>
|
|
557
|
+
* ```
|
|
558
|
+
*/
|
|
559
|
+
export declare const Modifiers: React.ForwardRefExoticComponent<ModifiersProps & React.RefAttributes<HTMLElement>>;
|
|
560
|
+
/**
|
|
561
|
+
* Props for Product ModifierOptions component
|
|
562
|
+
*/
|
|
563
|
+
export interface ModifierOptionsProps {
|
|
564
|
+
children: React.ReactNode;
|
|
565
|
+
emptyState?: React.ReactNode;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Component that provides access to modifier options.
|
|
569
|
+
*
|
|
570
|
+
* @component
|
|
571
|
+
* @example
|
|
572
|
+
* ```tsx
|
|
573
|
+
* // Default usage
|
|
574
|
+
* <Product.ModifierOptions emptyState={<div>No options available</div>}>
|
|
575
|
+
* <Product.ModifierOptionRepeater>
|
|
576
|
+
* <Option.Name />
|
|
577
|
+
* <Option.Choices>
|
|
578
|
+
* <Option.ChoiceRepeater>
|
|
579
|
+
* <Choice.Text />
|
|
580
|
+
* <Choice.Color />
|
|
581
|
+
* <Choice.FreeText />
|
|
582
|
+
* </Option.ChoiceRepeater>
|
|
583
|
+
* </Option.Choices>
|
|
584
|
+
* </Product.ModifierOptionRepeater>
|
|
585
|
+
* </Product.ModifierOptions>
|
|
586
|
+
*
|
|
587
|
+
* // Simple container usage
|
|
588
|
+
* <Product.ModifierOptions emptyState={<div>No options</div>}>
|
|
589
|
+
* <div className="options-container">
|
|
590
|
+
* <Product.ModifierOptionRepeater>
|
|
591
|
+
* // option content
|
|
592
|
+
* </Product.ModifierOptionRepeater>
|
|
593
|
+
* </div>
|
|
594
|
+
* </Product.ModifierOptions>
|
|
595
|
+
* ```
|
|
596
|
+
*/
|
|
597
|
+
export declare const ModifierOptions: React.ForwardRefExoticComponent<ModifierOptionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
598
|
+
/**
|
|
599
|
+
* Props for Product ModifierOptionRepeater component
|
|
600
|
+
*/
|
|
601
|
+
export interface ModifierOptionRepeaterProps {
|
|
602
|
+
children: React.ReactNode;
|
|
603
|
+
allowedTypes?: ('color' | 'text' | 'free-text')[];
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Repeater component that renders children for each modifier option.
|
|
607
|
+
*
|
|
608
|
+
* @component
|
|
609
|
+
*/
|
|
610
|
+
export declare const ModifierOptionRepeater: React.ForwardRefExoticComponent<ModifierOptionRepeaterProps & React.RefAttributes<HTMLElement>>;
|
|
611
|
+
/**
|
|
612
|
+
* Props for Product MediaGallery component
|
|
613
|
+
*/
|
|
614
|
+
export interface ProductMediaGalleryProps {
|
|
615
|
+
children: React.ReactNode;
|
|
616
|
+
infinite?: boolean;
|
|
617
|
+
autoPlay?: {
|
|
618
|
+
direction?: 'forward' | 'backward';
|
|
619
|
+
intervalMs?: number;
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Container for product media gallery.
|
|
624
|
+
* Renders a MediaGallery.Root with the product media items.
|
|
625
|
+
*
|
|
626
|
+
* @component
|
|
627
|
+
* @example
|
|
628
|
+
* ```tsx
|
|
629
|
+
* // Default usage
|
|
630
|
+
* <Product.MediaGallery
|
|
631
|
+
* infinite={true}
|
|
632
|
+
* autoPlay={{ direction: "forward", intervalMs: 5000 }}
|
|
633
|
+
* >
|
|
634
|
+
* <MediaGallery.Viewport />
|
|
635
|
+
* <MediaGallery.Previous />
|
|
636
|
+
* <MediaGallery.Next />
|
|
637
|
+
* <MediaGallery.Thumbnails>
|
|
638
|
+
* <MediaGallery.ThumbnailRepeater>
|
|
639
|
+
* <MediaGallery.ThumbnailItem />
|
|
640
|
+
* </MediaGallery.ThumbnailRepeater>
|
|
641
|
+
* </MediaGallery.Thumbnails>
|
|
642
|
+
* </Product.MediaGallery>
|
|
643
|
+
*
|
|
644
|
+
* // Simple usage
|
|
645
|
+
* <Product.MediaGallery>
|
|
646
|
+
* <MediaGallery.Viewport className="rounded-lg" />
|
|
647
|
+
* </Product.MediaGallery>
|
|
648
|
+
* ```
|
|
649
|
+
*/
|
|
650
|
+
export declare const ProductMediaGallery: React.ForwardRefExoticComponent<ProductMediaGalleryProps & React.RefAttributes<HTMLDivElement>>;
|
|
651
|
+
/**
|
|
652
|
+
* Alias for ProductMediaGallery to match the documented API
|
|
653
|
+
*/
|
|
654
|
+
export { ProductMediaGallery as MediaGallery };
|
|
655
|
+
/**
|
|
656
|
+
* Props for Product Quantity component
|
|
657
|
+
*/
|
|
658
|
+
export interface ProductQuantityProps {
|
|
659
|
+
/** Whether to render as a child component */
|
|
660
|
+
asChild?: boolean;
|
|
661
|
+
/** Custom render function when using asChild */
|
|
662
|
+
children?: AsChildChildren<{
|
|
663
|
+
selectedQuantity: number;
|
|
664
|
+
availableQuantity: number | null;
|
|
665
|
+
inStock: boolean;
|
|
666
|
+
isPreOrderEnabled: boolean;
|
|
667
|
+
setSelectedQuantity: (quantity: number) => void;
|
|
668
|
+
}>;
|
|
669
|
+
/** CSS classes to apply to the default element */
|
|
670
|
+
className?: string;
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Props for Product Quantity sub-components
|
|
674
|
+
*/
|
|
675
|
+
export interface ProductQuantitySubComponentProps {
|
|
676
|
+
/** CSS classes to apply to the element */
|
|
677
|
+
className?: string;
|
|
678
|
+
/** Whether to render as a child component */
|
|
679
|
+
asChild?: boolean;
|
|
680
|
+
/** Custom render function when using asChild */
|
|
681
|
+
children?: AsChildChildren<{
|
|
682
|
+
disabled: boolean;
|
|
683
|
+
}>;
|
|
684
|
+
/** Whether the component is disabled */
|
|
685
|
+
disabled?: boolean;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Product quantity selector component that integrates with the selected variant.
|
|
689
|
+
* Provides quantity controls with stock validation and can-pre-order support.
|
|
690
|
+
* Uses a compound component pattern with Root, Decrement, Input, Increment, and Raw sub-components.
|
|
691
|
+
*
|
|
692
|
+
* @component
|
|
693
|
+
* @example
|
|
694
|
+
* ```tsx
|
|
695
|
+
* // Compound component usage (recommended)
|
|
696
|
+
* <Product.Quantity.Root className="flex items-center gap-3">
|
|
697
|
+
* <div className="flex items-center border border-brand-light rounded-lg">
|
|
698
|
+
* <Product.Quantity.Decrement className="px-3 py-1 hover:bg-surface-primary transition-colors" />
|
|
699
|
+
* <Product.Quantity.Input className="w-16 text-center py-1 border-x border-brand-light focus:outline-none focus:ring-2 focus:ring-brand-primary" />
|
|
700
|
+
* <Product.Quantity.Increment className="px-3 py-1 hover:bg-surface-primary transition-colors" />
|
|
701
|
+
* </div>
|
|
702
|
+
* <Product.Quantity.Raw asChild>
|
|
703
|
+
* {({ availableQuantity, inStock, isPreOrderEnabled }) => (
|
|
704
|
+
* <div>
|
|
705
|
+
* {!inStock && isPreOrderEnabled && availableQuantity && (
|
|
706
|
+
* <span className="text-content-muted text-sm">
|
|
707
|
+
* Max: {availableQuantity} Pre Order
|
|
708
|
+
* </span>
|
|
709
|
+
* )}
|
|
710
|
+
* {inStock && availableQuantity && availableQuantity < 10 && (
|
|
711
|
+
* <span className="text-content-muted text-sm">
|
|
712
|
+
* Only {availableQuantity} left in stock
|
|
713
|
+
* </span>
|
|
714
|
+
* )}
|
|
715
|
+
* </div>
|
|
716
|
+
* )}
|
|
717
|
+
* </Product.Quantity.Raw>
|
|
718
|
+
* </Product.Quantity.Root>
|
|
719
|
+
*
|
|
720
|
+
* // Legacy asChild usage (still supported)
|
|
721
|
+
* <Product.Quantity asChild>
|
|
722
|
+
* {({ selectedQuantity, availableQuantity, inStock, setSelectedQuantity }) => (
|
|
723
|
+
* <div className="flex items-center gap-3">
|
|
724
|
+
* <div className="flex items-center border border-brand-light rounded-lg">
|
|
725
|
+
* <button
|
|
726
|
+
* onClick={() => setSelectedQuantity(selectedQuantity - 1)}
|
|
727
|
+
* disabled={selectedQuantity <= 1 || (!inStock && !isPreOrderEnabled)}
|
|
728
|
+
* className="px-3 py-2 hover:bg-surface-primary disabled:opacity-50"
|
|
729
|
+
* >
|
|
730
|
+
* -
|
|
731
|
+
* </button>
|
|
732
|
+
* <span className="px-4 py-2 border-x border-brand-light min-w-[3rem] text-center">
|
|
733
|
+
* {selectedQuantity}
|
|
734
|
+
* </span>
|
|
735
|
+
* <button
|
|
736
|
+
* onClick={() => setSelectedQuantity(selectedQuantity + 1)}
|
|
737
|
+
* disabled={availableQuantity && selectedQuantity >= availableQuantity}
|
|
738
|
+
* className="px-3 py-2 hover:bg-surface-primary disabled:opacity-50"
|
|
739
|
+
* >
|
|
740
|
+
* +
|
|
741
|
+
* </button>
|
|
742
|
+
* </div>
|
|
743
|
+
* </div>
|
|
744
|
+
* )}
|
|
745
|
+
* </Product.Quantity>
|
|
746
|
+
* ```
|
|
747
|
+
*/
|
|
748
|
+
export declare const ProductQuantity: React.ForwardRefExoticComponent<ProductQuantityProps & React.RefAttributes<HTMLDivElement>>;
|
|
749
|
+
/**
|
|
750
|
+
* Product Quantity Decrement component.
|
|
751
|
+
* Automatically handles disabled state based on stock and can-pre-order settings.
|
|
752
|
+
* Must be used within Product.Quantity.Root.
|
|
753
|
+
*
|
|
754
|
+
* @component
|
|
755
|
+
* @example
|
|
756
|
+
* ```tsx
|
|
757
|
+
* <Product.Quantity.Decrement className="px-3 py-1 hover:bg-surface-primary transition-colors" />
|
|
758
|
+
* ```
|
|
759
|
+
*/
|
|
760
|
+
export declare const ProductQuantityDecrement: React.ForwardRefExoticComponent<ProductQuantitySubComponentProps & React.RefAttributes<HTMLButtonElement>>;
|
|
761
|
+
/**
|
|
762
|
+
* Product Quantity Input component.
|
|
763
|
+
* Displays the current quantity value. Must be used within Product.Quantity.Root.
|
|
764
|
+
*
|
|
765
|
+
* @component
|
|
766
|
+
* @example
|
|
767
|
+
* ```tsx
|
|
768
|
+
* <Product.Quantity.Input className="w-16 text-center py-1 border-x border-brand-light focus:outline-none focus:ring-2 focus:ring-brand-primary" />
|
|
769
|
+
* ```
|
|
770
|
+
*/
|
|
771
|
+
export declare const ProductQuantityInput: React.ForwardRefExoticComponent<ProductQuantitySubComponentProps & React.RefAttributes<HTMLInputElement>>;
|
|
772
|
+
/**
|
|
773
|
+
* Product Quantity Increment component.
|
|
774
|
+
* Automatically handles disabled state based on stock availability.
|
|
775
|
+
* Must be used within Product.Quantity.Root.
|
|
776
|
+
*
|
|
777
|
+
* @component
|
|
778
|
+
* @example
|
|
779
|
+
* ```tsx
|
|
780
|
+
* <Product.Quantity.Increment className="px-3 py-1 hover:bg-surface-primary transition-colors" />
|
|
781
|
+
* ```
|
|
782
|
+
*/
|
|
783
|
+
export declare const ProductQuantityIncrement: React.ForwardRefExoticComponent<ProductQuantitySubComponentProps & React.RefAttributes<HTMLButtonElement>>;
|
|
784
|
+
/**
|
|
785
|
+
* Props for Product Action components following the documented API
|
|
786
|
+
*/
|
|
787
|
+
export interface ProductActionProps {
|
|
788
|
+
/** Whether to render as a child component */
|
|
789
|
+
asChild?: boolean;
|
|
790
|
+
/** Text label for the button */
|
|
791
|
+
label: string;
|
|
792
|
+
/** Custom render function when using asChild */
|
|
793
|
+
children?: AsChildChildren<{
|
|
794
|
+
disabled: boolean;
|
|
795
|
+
isLoading: boolean;
|
|
796
|
+
onClick: () => Promise<void>;
|
|
797
|
+
}>;
|
|
798
|
+
/** CSS classes to apply to the button */
|
|
799
|
+
className?: string;
|
|
800
|
+
/** Content to display when loading */
|
|
801
|
+
loadingState?: string | React.ReactNode;
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Props for Product Quantity Raw component
|
|
805
|
+
*/
|
|
806
|
+
export interface ProductQuantityRawSubComponentProps {
|
|
807
|
+
/** CSS classes to apply to the element */
|
|
808
|
+
className?: string;
|
|
809
|
+
/** Whether to render as a child component */
|
|
810
|
+
asChild?: boolean;
|
|
811
|
+
/** Custom render function when using asChild */
|
|
812
|
+
children?: AsChildChildren<{
|
|
813
|
+
selectedQuantity: number;
|
|
814
|
+
availableQuantity: number;
|
|
815
|
+
inStock: boolean;
|
|
816
|
+
isPreOrderEnabled: boolean;
|
|
817
|
+
setSelectedQuantity: (quantity: number) => void;
|
|
818
|
+
}>;
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Product Quantity Raw component.
|
|
822
|
+
* Provides access to raw quantity data for custom stock messages and advanced use cases.
|
|
823
|
+
* Must be used within Product.Quantity.Root.
|
|
824
|
+
*
|
|
825
|
+
* @component
|
|
826
|
+
* @example
|
|
827
|
+
* ```tsx
|
|
828
|
+
* <Product.Quantity.Raw asChild>
|
|
829
|
+
* {({ availableQuantity, inStock, isPreOrderEnabled }) => (
|
|
830
|
+
* <div>
|
|
831
|
+
* {!inStock && isPreOrderEnabled && availableQuantity && (
|
|
832
|
+
* <span className="text-content-muted text-sm">
|
|
833
|
+
* Max: {availableQuantity} Pre Order
|
|
834
|
+
* </span>
|
|
835
|
+
* )}
|
|
836
|
+
* {inStock && availableQuantity && availableQuantity < 10 && (
|
|
837
|
+
* <span className="text-content-muted text-sm">
|
|
838
|
+
* Only {availableQuantity} left in stock
|
|
839
|
+
* </span>
|
|
840
|
+
* )}
|
|
841
|
+
* </div>
|
|
842
|
+
* )}
|
|
843
|
+
* </Product.Quantity.Raw>
|
|
844
|
+
* ```
|
|
845
|
+
*/
|
|
846
|
+
export declare const ProductQuantityRaw: React.ForwardRefExoticComponent<ProductQuantityRawSubComponentProps & React.RefAttributes<HTMLElement>>;
|
|
847
|
+
export interface ProductVariantSelectorResetProps {
|
|
848
|
+
/** Whether to render as a child component */
|
|
849
|
+
asChild?: boolean;
|
|
850
|
+
/** Custom render function when using asChild */
|
|
851
|
+
children?: AsChildChildren<{
|
|
852
|
+
reset: () => void;
|
|
853
|
+
hasSelections: boolean;
|
|
854
|
+
}>;
|
|
855
|
+
/** CSS classes to apply to the default element */
|
|
856
|
+
className?: string;
|
|
857
|
+
/** Label for the reset button */
|
|
858
|
+
label?: string;
|
|
859
|
+
}
|
|
860
|
+
export declare const ProductVariantSelectorReset: React.ForwardRefExoticComponent<ProductVariantSelectorResetProps & React.RefAttributes<HTMLButtonElement>>;
|
|
861
|
+
/**
|
|
862
|
+
* Add to cart action button component following the documented API.
|
|
863
|
+
* Automatically integrates with the selected variant and handles loading states.
|
|
864
|
+
*/
|
|
865
|
+
export declare const ProductActionAddToCart: React.ForwardRefExoticComponent<ProductActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
866
|
+
/**
|
|
867
|
+
* Buy Now action button component following the documented API.
|
|
868
|
+
* Bypasses the cart and redirects directly to checkout.
|
|
869
|
+
*/
|
|
870
|
+
export declare const ProductActionBuyNow: React.ForwardRefExoticComponent<ProductActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
871
|
+
/**
|
|
872
|
+
* Pre-Order action button component following the documented API.
|
|
873
|
+
* Handles can-pre-order functionality when products are not in stock.
|
|
874
|
+
*/
|
|
875
|
+
export declare const ProductActionPreOrder: React.ForwardRefExoticComponent<ProductActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
876
|
+
/**
|
|
877
|
+
* Actions namespace containing all product action components
|
|
878
|
+
* following the documented API: Product.Action.AddToCart, Product.Action.BuyNow, Product.Action.PreOrder
|
|
879
|
+
*/
|
|
880
|
+
export declare const Action: {
|
|
881
|
+
/** Add to cart action button */
|
|
882
|
+
readonly AddToCart: React.ForwardRefExoticComponent<ProductActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
883
|
+
/** Buy now action button */
|
|
884
|
+
readonly BuyNow: React.ForwardRefExoticComponent<ProductActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
885
|
+
/** Pre-order action button */
|
|
886
|
+
readonly PreOrder: React.ForwardRefExoticComponent<ProductActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
887
|
+
};
|
|
888
|
+
/**
|
|
889
|
+
* Props for ProductVariantStock component
|
|
890
|
+
*/
|
|
891
|
+
export interface ProductVariantStockProps {
|
|
892
|
+
/** Whether to render as a child component */
|
|
893
|
+
asChild?: boolean;
|
|
894
|
+
/** Custom render function when using asChild */
|
|
895
|
+
children?: AsChildChildren<{
|
|
896
|
+
status: StockStatus;
|
|
897
|
+
label: string;
|
|
898
|
+
}>;
|
|
899
|
+
/** CSS classes to apply to the default element */
|
|
900
|
+
className?: string;
|
|
901
|
+
/** Custom labels for different stock states */
|
|
902
|
+
labels?: {
|
|
903
|
+
/** Label for in stock state */
|
|
904
|
+
inStock?: string;
|
|
905
|
+
/** Label for limited stock state (when quantity is low) */
|
|
906
|
+
limitedStock?: string;
|
|
907
|
+
/** Label for out of stock state */
|
|
908
|
+
outOfStock?: string;
|
|
909
|
+
/** Label for can-pre-order state */
|
|
910
|
+
preOrder?: string;
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Displays the selected variant stock status with customizable rendering and labels,
|
|
915
|
+
* including can-pre-order support. Similar to Product.Stock but for the selected variant.
|
|
916
|
+
*
|
|
917
|
+
* @component
|
|
918
|
+
* @example
|
|
919
|
+
* ```tsx
|
|
920
|
+
* // Default usage
|
|
921
|
+
* <Product.ProductVariant.Stock
|
|
922
|
+
* className="stock-indicator"
|
|
923
|
+
* labels={{
|
|
924
|
+
* inStock: 'In Stock',
|
|
925
|
+
* limitedStock: 'Limited Stock',
|
|
926
|
+
* outOfStock: 'Out of Stock',
|
|
927
|
+
* preOrder: 'Available for Pre-order'
|
|
928
|
+
* }}
|
|
929
|
+
* />
|
|
930
|
+
*
|
|
931
|
+
* // asChild with primitive
|
|
932
|
+
* <Product.ProductVariant.Stock asChild>
|
|
933
|
+
* <div className="variant-stock-status" />
|
|
934
|
+
* </Product.ProductVariant.Stock>
|
|
935
|
+
*
|
|
936
|
+
* // asChild with react component
|
|
937
|
+
* <Product.ProductVariant.Stock
|
|
938
|
+
* labels={{
|
|
939
|
+
* inStock: 'Available',
|
|
940
|
+
* limitedStock: 'Low Stock',
|
|
941
|
+
* outOfStock: 'Sold Out',
|
|
942
|
+
* preOrder: 'Pre-order Now'
|
|
943
|
+
* }}
|
|
944
|
+
* asChild
|
|
945
|
+
* >
|
|
946
|
+
* {React.forwardRef(({status, label, ...props}, ref) => (
|
|
947
|
+
* <div
|
|
948
|
+
* ref={ref}
|
|
949
|
+
* {...props}
|
|
950
|
+
* className="flex items-center gap-2 data-[state='in-stock']:text-green-600 data-[state='limited-stock']:text-yellow-600 data-[state='out-of-stock']:text-red-600 data-[state='can-pre-order']:text-blue-600"
|
|
951
|
+
* >
|
|
952
|
+
* <div className="w-3 h-3 rounded-full data-[state='in-stock']:bg-green-500 data-[state='limited-stock']:bg-yellow-500 data-[state='out-of-stock']:bg-red-500 data-[state='can-pre-order']:bg-blue-500" />
|
|
953
|
+
* <span className="text-sm font-medium">
|
|
954
|
+
* {label}
|
|
955
|
+
* </span>
|
|
956
|
+
* </div>
|
|
957
|
+
* ))}
|
|
958
|
+
* </Product.ProductVariant.Stock>
|
|
959
|
+
* ```
|
|
960
|
+
*/
|
|
961
|
+
export declare const ProductVariantStock: React.ForwardRefExoticComponent<ProductVariantStockProps & React.RefAttributes<HTMLElement>>;
|
|
962
|
+
/**
|
|
963
|
+
* Props for ProductVariantSKU component
|
|
964
|
+
*/
|
|
965
|
+
export interface ProductVariantSKUProps {
|
|
966
|
+
/** Whether to render as a child component */
|
|
967
|
+
asChild?: boolean;
|
|
968
|
+
/** Custom render function when using asChild */
|
|
969
|
+
children?: AsChildChildren<{
|
|
970
|
+
sku: string | null;
|
|
971
|
+
}>;
|
|
972
|
+
/** CSS classes to apply to the default element */
|
|
973
|
+
className?: string;
|
|
974
|
+
}
|
|
975
|
+
/**
|
|
976
|
+
* Displays the selected variant SKU with customizable rendering following the documented API.
|
|
977
|
+
*
|
|
978
|
+
* @component
|
|
979
|
+
* @example
|
|
980
|
+
* ```tsx
|
|
981
|
+
* // Default usage
|
|
982
|
+
* <Product.ProductVariant.SKU className="text-content-secondary" />
|
|
983
|
+
*
|
|
984
|
+
* // asChild with primitive
|
|
985
|
+
* <Product.ProductVariant.SKU asChild>
|
|
986
|
+
* <span className="sku-value" />
|
|
987
|
+
* </Product.ProductVariant.SKU>
|
|
988
|
+
*
|
|
989
|
+
* // asChild with react component
|
|
990
|
+
* <Product.ProductVariant.SKU asChild>
|
|
991
|
+
* {React.forwardRef(({sku, ...props}, ref) => (
|
|
992
|
+
* <span ref={ref} {...props}>
|
|
993
|
+
* {sku}
|
|
994
|
+
* </span>
|
|
995
|
+
* ))}
|
|
996
|
+
* </Product.ProductVariant.SKU>
|
|
997
|
+
* ```
|
|
998
|
+
*/
|
|
999
|
+
export declare const ProductVariantSKU: React.ForwardRefExoticComponent<ProductVariantSKUProps & React.RefAttributes<HTMLElement>>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Props for ProductVariantWeight component
|
|
1002
|
+
*/
|
|
1003
|
+
export interface ProductVariantWeightProps {
|
|
1004
|
+
/** Whether to render as a child component */
|
|
1005
|
+
asChild?: boolean;
|
|
1006
|
+
/** Custom render function when using asChild */
|
|
1007
|
+
children?: AsChildChildren<{
|
|
1008
|
+
weight: string | null;
|
|
1009
|
+
}>;
|
|
1010
|
+
/** CSS classes to apply to the default element */
|
|
1011
|
+
className?: string;
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Displays the selected variant weight with customizable rendering following the documented API.
|
|
1015
|
+
*
|
|
1016
|
+
* @component
|
|
1017
|
+
* @example
|
|
1018
|
+
* ```tsx
|
|
1019
|
+
* // Default usage
|
|
1020
|
+
* <Product.ProductVariant.Weight className="text-content-secondary" />
|
|
1021
|
+
*
|
|
1022
|
+
* // asChild with primitive
|
|
1023
|
+
* <Product.ProductVariant.Weight asChild>
|
|
1024
|
+
* <span className="weight-value" />
|
|
1025
|
+
* </Product.ProductVariant.Weight>
|
|
1026
|
+
*
|
|
1027
|
+
* // asChild with react component
|
|
1028
|
+
* <Product.ProductVariant.Weight asChild>
|
|
1029
|
+
* {React.forwardRef(({weight, ...props}, ref) => (
|
|
1030
|
+
* <span ref={ref} {...props}>
|
|
1031
|
+
* {weight}
|
|
1032
|
+
* </span>
|
|
1033
|
+
* ))}
|
|
1034
|
+
* </Product.ProductVariant.Weight>
|
|
1035
|
+
* ```
|
|
1036
|
+
*/
|
|
1037
|
+
export declare const ProductVariantWeight: React.ForwardRefExoticComponent<ProductVariantWeightProps & React.RefAttributes<HTMLElement>>;
|
|
1038
|
+
/**
|
|
1039
|
+
* ProductVariant namespace containing product variant components
|
|
1040
|
+
* following the compound component pattern: Product.ProductVariant.Stock, Product.ProductVariant.SKU, Product.ProductVariant.Weight
|
|
1041
|
+
*/
|
|
1042
|
+
export declare const ProductVariant: {
|
|
1043
|
+
/** Product variant stock component */
|
|
1044
|
+
readonly Stock: React.ForwardRefExoticComponent<ProductVariantStockProps & React.RefAttributes<HTMLElement>>;
|
|
1045
|
+
/** Product variant SKU component */
|
|
1046
|
+
readonly SKU: React.ForwardRefExoticComponent<ProductVariantSKUProps & React.RefAttributes<HTMLElement>>;
|
|
1047
|
+
/** Product variant weight component */
|
|
1048
|
+
readonly Weight: React.ForwardRefExoticComponent<ProductVariantWeightProps & React.RefAttributes<HTMLElement>>;
|
|
1049
|
+
};
|
|
1050
|
+
/**
|
|
1051
|
+
* Quantity namespace containing all product quantity components
|
|
1052
|
+
* following the compound component pattern: Product.Quantity.Root, Product.Quantity.Decrement, etc.
|
|
1053
|
+
*/
|
|
1054
|
+
export declare const Quantity: {
|
|
1055
|
+
/** Product quantity selector component */
|
|
1056
|
+
readonly Root: React.ForwardRefExoticComponent<ProductQuantityProps & React.RefAttributes<HTMLDivElement>>;
|
|
1057
|
+
/** Product quantity decrement component */
|
|
1058
|
+
readonly Decrement: React.ForwardRefExoticComponent<ProductQuantitySubComponentProps & React.RefAttributes<HTMLButtonElement>>;
|
|
1059
|
+
/** Product quantity input component */
|
|
1060
|
+
readonly Input: React.ForwardRefExoticComponent<ProductQuantitySubComponentProps & React.RefAttributes<HTMLInputElement>>;
|
|
1061
|
+
/** Product quantity increment component */
|
|
1062
|
+
readonly Increment: React.ForwardRefExoticComponent<ProductQuantitySubComponentProps & React.RefAttributes<HTMLButtonElement>>;
|
|
1063
|
+
/** Product quantity raw component */
|
|
1064
|
+
readonly Raw: React.ForwardRefExoticComponent<ProductQuantityRawSubComponentProps & React.RefAttributes<HTMLElement>>;
|
|
1065
|
+
};
|