@thorprovider/blocks 3.0.2 → 4.1.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/README.md +61 -21
- package/dist/blocks/designs/checkout-commerce-v1/block.d.ts +49 -0
- package/dist/blocks/designs/checkout-commerce-v1/block.d.ts.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/block.js +2487 -0
- package/dist/blocks/designs/checkout-commerce-v1/block.js.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/block.mjs +2467 -0
- package/dist/blocks/designs/checkout-commerce-v1/block.mjs.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/data-context.d.ts +8 -0
- package/dist/blocks/designs/checkout-commerce-v1/data-context.d.ts.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/data-context.js +44 -0
- package/dist/blocks/designs/checkout-commerce-v1/data-context.js.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/data-context.mjs +19 -0
- package/dist/blocks/designs/checkout-commerce-v1/data-context.mjs.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/index.d.ts +3 -0
- package/dist/blocks/designs/checkout-commerce-v1/index.d.ts.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/index.js +36 -0
- package/dist/blocks/designs/checkout-commerce-v1/index.js.map +1 -0
- package/dist/blocks/designs/checkout-commerce-v1/index.mjs +6 -0
- package/dist/blocks/designs/checkout-commerce-v1/index.mjs.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/block.d.ts +12 -0
- package/dist/blocks/designs/marketplace-product-card/block.d.ts.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/block.js +243 -0
- package/dist/blocks/designs/marketplace-product-card/block.js.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/block.mjs +233 -0
- package/dist/blocks/designs/marketplace-product-card/block.mjs.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/index.d.ts +3 -0
- package/dist/blocks/designs/marketplace-product-card/index.d.ts.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/index.js +36 -0
- package/dist/blocks/designs/marketplace-product-card/index.js.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/index.mjs +6 -0
- package/dist/blocks/designs/marketplace-product-card/index.mjs.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/normalize.d.ts +13 -0
- package/dist/blocks/designs/marketplace-product-card/normalize.d.ts.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/normalize.js +36 -0
- package/dist/blocks/designs/marketplace-product-card/normalize.js.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/normalize.mjs +12 -0
- package/dist/blocks/designs/marketplace-product-card/normalize.mjs.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/variants.d.ts +72 -0
- package/dist/blocks/designs/marketplace-product-card/variants.d.ts.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/variants.js +123 -0
- package/dist/blocks/designs/marketplace-product-card/variants.js.map +1 -0
- package/dist/blocks/designs/marketplace-product-card/variants.mjs +89 -0
- package/dist/blocks/designs/marketplace-product-card/variants.mjs.map +1 -0
- package/dist/blocks/e-commerce/account/account-frame.d.ts +38 -0
- package/dist/blocks/e-commerce/account/account-frame.d.ts.map +1 -0
- package/dist/blocks/e-commerce/account/account-frame.js +102 -0
- package/dist/blocks/e-commerce/account/account-frame.js.map +1 -0
- package/dist/blocks/e-commerce/account/account-frame.mjs +78 -0
- package/dist/blocks/e-commerce/account/account-frame.mjs.map +1 -0
- package/dist/blocks/e-commerce/account/address-book.d.ts +79 -0
- package/dist/blocks/e-commerce/account/address-book.d.ts.map +1 -0
- package/dist/blocks/e-commerce/account/address-book.js +250 -0
- package/dist/blocks/e-commerce/account/address-book.js.map +1 -0
- package/dist/blocks/e-commerce/account/address-book.mjs +225 -0
- package/dist/blocks/e-commerce/account/address-book.mjs.map +1 -0
- package/dist/blocks/e-commerce/account/profile-form.d.ts +35 -0
- package/dist/blocks/e-commerce/account/profile-form.d.ts.map +1 -0
- package/dist/blocks/e-commerce/account/profile-form.js +100 -0
- package/dist/blocks/e-commerce/account/profile-form.js.map +1 -0
- package/dist/blocks/e-commerce/account/profile-form.mjs +76 -0
- package/dist/blocks/e-commerce/account/profile-form.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkbox-check.js +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkbox-check.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkbox-check.mjs +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkbox-check.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.d.ts +11 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.js +46 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.mjs +22 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-equality.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.d.ts +28 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.js +278 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.mjs +260 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-address-fields.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.d.ts +12 -9
- package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.js +49 -71
- package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.mjs +50 -72
- package/dist/blocks/e-commerce/checkout-forms/checkout-contact-step.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.js +6 -3
- package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.mjs +6 -3
- package/dist/blocks/e-commerce/checkout-forms/checkout-country-field.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.d.ts +7 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.js +41 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.mjs +16 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-id-context.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.d.ts +24 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.js +75 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.mjs +58 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-location-select.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.d.ts +3 -2
- package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.js +9 -2
- package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.mjs +9 -2
- package/dist/blocks/e-commerce/checkout-forms/checkout-order-summary.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.d.ts +23 -8
- package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.js +136 -31
- package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.mjs +143 -32
- package/dist/blocks/e-commerce/checkout-forms/checkout-payment-step.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.d.ts +13 -7
- package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.js +179 -28
- package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.mjs +180 -29
- package/dist/blocks/e-commerce/checkout-forms/checkout-review-step.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.d.ts +20 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.js +199 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.mjs +175 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-saved-addresses.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.d.ts +14 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.js +136 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.mjs +109 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-section-nav.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.d.ts +32 -10
- package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.js +265 -147
- package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.mjs +272 -148
- package/dist/blocks/e-commerce/checkout-forms/checkout-shipping-step.mjs.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.d.ts +13 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.js +74 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.mjs +50 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-header.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.d.ts +7 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.d.ts.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.js +91 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.js.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.mjs +65 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout-step-summary.mjs.map +1 -0
- package/dist/blocks/e-commerce/checkout-forms/checkout.d.ts +174 -44
- package/dist/blocks/e-commerce/checkout-forms/checkout.d.ts.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout.js +532 -108
- package/dist/blocks/e-commerce/checkout-forms/checkout.js.map +1 -1
- package/dist/blocks/e-commerce/checkout-forms/checkout.mjs +542 -109
- package/dist/blocks/e-commerce/checkout-forms/checkout.mjs.map +1 -1
- package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.d.ts.map +1 -1
- package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.js +44 -20
- package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.js.map +1 -1
- package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.mjs +44 -20
- package/dist/blocks/e-commerce/navigation/storefront-navbar-cart-sheet.mjs.map +1 -1
- package/dist/blocks/e-commerce/navigation/storefront-navbar.d.ts.map +1 -1
- package/dist/blocks/e-commerce/navigation/storefront-navbar.js +21 -10
- package/dist/blocks/e-commerce/navigation/storefront-navbar.js.map +1 -1
- package/dist/blocks/e-commerce/navigation/storefront-navbar.mjs +21 -10
- package/dist/blocks/e-commerce/navigation/storefront-navbar.mjs.map +1 -1
- package/dist/blocks/e-commerce/product-list/product-card.d.ts.map +1 -1
- package/dist/blocks/e-commerce/product-list/product-card.js +36 -9
- package/dist/blocks/e-commerce/product-list/product-card.js.map +1 -1
- package/dist/blocks/e-commerce/product-list/product-card.mjs +36 -9
- package/dist/blocks/e-commerce/product-list/product-card.mjs.map +1 -1
- package/dist/blocks/e-commerce/product-list/product-showcase-1.d.ts.map +1 -1
- package/dist/blocks/e-commerce/product-list/product-showcase-1.js +7 -2
- package/dist/blocks/e-commerce/product-list/product-showcase-1.js.map +1 -1
- package/dist/blocks/e-commerce/product-list/product-showcase-1.mjs +7 -2
- package/dist/blocks/e-commerce/product-list/product-showcase-1.mjs.map +1 -1
- package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.d.ts.map +1 -1
- package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.js +5 -1
- package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.js.map +1 -1
- package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.mjs +5 -1
- package/dist/blocks/e-commerce/product-overview/product-quick-view-dialog.mjs.map +1 -1
- package/dist/blocks/e-commerce/storefront-hero/storefront-hero.d.ts.map +1 -1
- package/dist/blocks/e-commerce/storefront-hero/storefront-hero.js +71 -51
- package/dist/blocks/e-commerce/storefront-hero/storefront-hero.js.map +1 -1
- package/dist/blocks/e-commerce/storefront-hero/storefront-hero.mjs +71 -51
- package/dist/blocks/e-commerce/storefront-hero/storefront-hero.mjs.map +1 -1
- package/dist/blocks/marketing/banners/banner-1.d.ts.map +1 -1
- package/dist/blocks/marketing/banners/banner-1.js +15 -27
- package/dist/blocks/marketing/banners/banner-1.js.map +1 -1
- package/dist/blocks/marketing/banners/banner-1.mjs +16 -28
- package/dist/blocks/marketing/banners/banner-1.mjs.map +1 -1
- package/dist/index.d.ts +16 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -1
- package/dist/lib/contracts/checkout-commerce-v1.d.ts +2350 -0
- package/dist/lib/contracts/checkout-commerce-v1.d.ts.map +1 -0
- package/dist/lib/contracts/checkout-commerce-v1.js +417 -0
- package/dist/lib/contracts/checkout-commerce-v1.js.map +1 -0
- package/dist/lib/contracts/checkout-commerce-v1.mjs +392 -0
- package/dist/lib/contracts/checkout-commerce-v1.mjs.map +1 -0
- package/dist/lib/contracts/marketplace-product-card.d.ts +324 -0
- package/dist/lib/contracts/marketplace-product-card.d.ts.map +1 -0
- package/dist/lib/contracts/marketplace-product-card.js +85 -0
- package/dist/lib/contracts/marketplace-product-card.js.map +1 -0
- package/dist/lib/contracts/marketplace-product-card.mjs +61 -0
- package/dist/lib/contracts/marketplace-product-card.mjs.map +1 -0
- package/dist/lib/contracts.d.ts +2289 -178
- package/dist/lib/contracts.d.ts.map +1 -1
- package/dist/lib/contracts.js +332 -25
- package/dist/lib/contracts.js.map +1 -1
- package/dist/lib/contracts.mjs +278 -5
- package/dist/lib/contracts.mjs.map +1 -1
- package/dist/lib/money-schema.d.ts +19 -0
- package/dist/lib/money-schema.d.ts.map +1 -0
- package/dist/lib/money-schema.js +33 -0
- package/dist/lib/money-schema.js.map +1 -0
- package/dist/lib/money-schema.mjs +9 -0
- package/dist/lib/money-schema.mjs.map +1 -0
- package/dist/lib/motion.d.ts +29 -0
- package/dist/lib/motion.d.ts.map +1 -0
- package/dist/lib/motion.js +65 -0
- package/dist/lib/motion.js.map +1 -0
- package/dist/lib/motion.mjs +41 -0
- package/dist/lib/motion.mjs.map +1 -0
- package/dist/ui/accordion.d.ts +3 -1
- package/dist/ui/accordion.d.ts.map +1 -1
- package/dist/ui/accordion.js +21 -5
- package/dist/ui/accordion.js.map +1 -1
- package/dist/ui/accordion.mjs +21 -5
- package/dist/ui/accordion.mjs.map +1 -1
- package/dist/ui/input-group.d.ts +1 -1
- package/package.json +18 -3
- package/dist/.tsbuildinfo +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var checkout_commerce_v1_exports = {};
|
|
31
|
+
__export(checkout_commerce_v1_exports, {
|
|
32
|
+
default: () => import_block.default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(checkout_commerce_v1_exports);
|
|
35
|
+
var import_block = __toESM(require("./block.js"));
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/designs/checkout-commerce-v1/index.tsx"],"sourcesContent":["'use client'\n\nexport { default } from './block'\nexport type { CheckoutCommerceV1Props } from './block'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAwB;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/designs/checkout-commerce-v1/index.tsx"],"sourcesContent":["'use client'\n\nexport { default } from './block'\nexport type { CheckoutCommerceV1Props } from './block'\n"],"mappings":";AAEA,SAAS,WAAAA,gBAAe;","names":["default"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MarketplaceProductCardData } from '../../../lib/contracts/marketplace-product-card';
|
|
2
|
+
import { type CardLabels, type Glyphs, type Product, type ProductVariant } from './variants';
|
|
3
|
+
export type MarketplaceProductCardProps = {
|
|
4
|
+
data: MarketplaceProductCardData;
|
|
5
|
+
product?: Product;
|
|
6
|
+
labels?: CardLabels;
|
|
7
|
+
glyphs?: Glyphs;
|
|
8
|
+
onAddToCart?: (variant: ProductVariant, product: Product) => void;
|
|
9
|
+
onToggleWishlist?: (product: Product, nextState: boolean) => void;
|
|
10
|
+
};
|
|
11
|
+
export default function MarketplaceProductCard(__designProps: MarketplaceProductCardProps): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../../src/blocks/designs/marketplace-product-card/block.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAIjG,OAAO,EAUL,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,KAAK,cAAc,EAGpB,MAAM,YAAY,CAAA;AAEnB,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACjE,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAA;CAClE,CAAA;AAYD,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,aAAa,EAAE,2BAA2B,+BAyPxF"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var block_exports = {};
|
|
21
|
+
__export(block_exports, {
|
|
22
|
+
default: () => MarketplaceProductCard
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(block_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_normalize = require("./normalize.js");
|
|
27
|
+
var import_badge = require("../../../ui/badge.js");
|
|
28
|
+
var import_button = require("../../../ui/button.js");
|
|
29
|
+
var import_card = require("../../../ui/card.js");
|
|
30
|
+
var import_contracts = require("../../../lib/contracts.js");
|
|
31
|
+
var import_utils = require("../../../lib/utils.js");
|
|
32
|
+
var import_react = require("react");
|
|
33
|
+
var import_variants = require("./variants.js");
|
|
34
|
+
const STOCK_TONE_CLASS = {
|
|
35
|
+
success: "text-success",
|
|
36
|
+
attention: "text-destructive",
|
|
37
|
+
destructive: "text-destructive"
|
|
38
|
+
};
|
|
39
|
+
function formatReviewCount(count, locale) {
|
|
40
|
+
return new Intl.NumberFormat(locale).format(count);
|
|
41
|
+
}
|
|
42
|
+
function MarketplaceProductCard(__designProps) {
|
|
43
|
+
const data = (0, import_normalize.normalizeData)(__designProps.data);
|
|
44
|
+
const {
|
|
45
|
+
product = data.product,
|
|
46
|
+
labels = data.labels,
|
|
47
|
+
glyphs = data.glyphs,
|
|
48
|
+
onAddToCart,
|
|
49
|
+
onToggleWishlist
|
|
50
|
+
} = __designProps;
|
|
51
|
+
const [selection, setSelection] = (0, import_react.useState)(() => (0, import_variants.firstAvailableSelection)(product));
|
|
52
|
+
const [wishlisted, setWishlisted] = (0, import_react.useState)(false);
|
|
53
|
+
const [renderedProductId, setRenderedProductId] = (0, import_react.useState)(product.id);
|
|
54
|
+
const baseId = (0, import_react.useId)();
|
|
55
|
+
if (product.id !== renderedProductId) {
|
|
56
|
+
setRenderedProductId(product.id);
|
|
57
|
+
setSelection((0, import_variants.firstAvailableSelection)(product));
|
|
58
|
+
setWishlisted(false);
|
|
59
|
+
}
|
|
60
|
+
const activeSelection = (0, import_variants.findVariant)(product, selection) ? selection : (0, import_variants.firstAvailableSelection)(product);
|
|
61
|
+
const variant = (0, import_variants.findVariant)(product, activeSelection) ?? product.variants[0];
|
|
62
|
+
const image = (0, import_variants.resolveVariantImage)(product, variant, activeSelection);
|
|
63
|
+
const discount = variant ? (0, import_variants.discountPercent)(variant.price, variant.compareAtPrice) : null;
|
|
64
|
+
const priceLabel = variant ? (0, import_variants.formatPrice)(variant.price, product.locale, product.currency) : labels.unavailablePrice;
|
|
65
|
+
const compareLabel = variant?.compareAtPrice !== void 0 && discount !== null ? (0, import_variants.formatPrice)(variant.compareAtPrice, product.locale, product.currency) : null;
|
|
66
|
+
const discountLabel = discount !== null ? (0, import_variants.formatDiscount)(discount, product.locale) : null;
|
|
67
|
+
const reviews = formatReviewCount(product.reviewCount, product.locale);
|
|
68
|
+
const filledStars = Math.round(product.rating);
|
|
69
|
+
const stars = Array.from(
|
|
70
|
+
{ length: 5 },
|
|
71
|
+
(_, index) => index < filledStars ? glyphs.fullStar : glyphs.emptyStar
|
|
72
|
+
);
|
|
73
|
+
const selectedLabels = product.options.map((option) => option.values.find((value) => value.id === activeSelection[option.id])?.label).filter((label) => Boolean(label)).join(", ");
|
|
74
|
+
const stockLabel = variant?.stockLabel ?? labels.outOfStock;
|
|
75
|
+
const liveSummary = [product.title, selectedLabels, priceLabel, stockLabel].filter((part) => Boolean(part)).join(", ");
|
|
76
|
+
const stockTone = variant ? STOCK_TONE_CLASS[variant.stockTone] : STOCK_TONE_CLASS.destructive;
|
|
77
|
+
const handleAddToCart = () => {
|
|
78
|
+
if (variant?.available) onAddToCart?.(variant, product);
|
|
79
|
+
};
|
|
80
|
+
const handleWishlist = () => {
|
|
81
|
+
const next = !wishlisted;
|
|
82
|
+
setWishlisted(next);
|
|
83
|
+
onToggleWishlist?.(product, next);
|
|
84
|
+
};
|
|
85
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("article", { "aria-label": product.title, className: "w-full sm:mx-auto sm:max-w-xs", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.Card, { className: "group/card gap-0 overflow-hidden py-0 shadow-sm transition-shadow hover:shadow-md", children: [
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative aspect-square overflow-hidden bg-muted", children: [
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
|
+
"img",
|
|
89
|
+
{
|
|
90
|
+
"data-testid": "image",
|
|
91
|
+
src: image.src ?? import_contracts.PRODUCT_IMAGE_FALLBACK,
|
|
92
|
+
alt: image.alt,
|
|
93
|
+
width: 800,
|
|
94
|
+
height: 800,
|
|
95
|
+
className: "size-full object-cover transition-transform duration-300 group-hover/card:scale-105"
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_badge.Badge, { className: "absolute left-3 top-3 rounded-full bg-accent px-2 text-accent-foreground", children: product.badge }),
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
100
|
+
import_button.Button,
|
|
101
|
+
{
|
|
102
|
+
type: "button",
|
|
103
|
+
size: "icon-sm",
|
|
104
|
+
"data-testid": "wishlist",
|
|
105
|
+
"aria-label": wishlisted ? labels.wishlistRemove : labels.wishlistAdd,
|
|
106
|
+
"aria-pressed": wishlisted,
|
|
107
|
+
onClick: handleWishlist,
|
|
108
|
+
className: "absolute right-3 top-3 rounded-full border border-border bg-card/90 text-foreground shadow-sm backdrop-blur hover:bg-card",
|
|
109
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
110
|
+
"span",
|
|
111
|
+
{
|
|
112
|
+
"aria-hidden": "true",
|
|
113
|
+
className: (0, import_utils.cn)("text-base leading-none", wishlisted && "text-accent"),
|
|
114
|
+
children: wishlisted ? glyphs.heartFilled : glyphs.heart
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] }),
|
|
120
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_card.CardContent, { className: "flex flex-col gap-2 p-3", children: [
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs uppercase tracking-wide text-muted-foreground", children: product.brand }),
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "line-clamp-2 min-h-10 text-sm font-medium leading-snug", children: product.title }),
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs", children: [
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-warning", "aria-hidden": "true", children: stars.join("") }),
|
|
125
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-medium", children: product.rating.toFixed(1) }),
|
|
126
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground", children: `(${reviews})` }),
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground", children: product.soldLabel }),
|
|
128
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: product.ratingLabel })
|
|
129
|
+
] }),
|
|
130
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-baseline gap-x-2", children: [
|
|
131
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
132
|
+
"span",
|
|
133
|
+
{
|
|
134
|
+
"data-testid": "price",
|
|
135
|
+
className: (0, import_utils.cn)(
|
|
136
|
+
"text-xl font-semibold tracking-tight",
|
|
137
|
+
!variant && "text-sm font-normal text-muted-foreground"
|
|
138
|
+
),
|
|
139
|
+
children: priceLabel
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
compareLabel !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "data-testid": "compare", className: "text-xs text-muted-foreground line-through", children: compareLabel }) : null,
|
|
143
|
+
discountLabel !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "data-testid": "discount", className: "text-xs font-semibold text-accent", children: discountLabel }) : null
|
|
144
|
+
] }),
|
|
145
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-x-1.5 text-xs", children: [
|
|
146
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-medium text-success", children: product.shippingLabel }),
|
|
147
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground", children: product.deliveryLabel })
|
|
148
|
+
] }),
|
|
149
|
+
product.options.map((option, optionIndex) => {
|
|
150
|
+
const labelId = `${baseId}-${option.id}`;
|
|
151
|
+
const selectedValue = option.values.find(
|
|
152
|
+
(value) => value.id === activeSelection[option.id]
|
|
153
|
+
);
|
|
154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
155
|
+
"div",
|
|
156
|
+
{
|
|
157
|
+
role: "group",
|
|
158
|
+
"aria-labelledby": labelId,
|
|
159
|
+
className: "flex flex-col gap-1.5",
|
|
160
|
+
children: [
|
|
161
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { id: labelId, className: "text-xs text-muted-foreground", children: `${option.name}${labels.optionSeparator} ${selectedValue?.label ?? ""}` }),
|
|
162
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-wrap gap-1.5", children: option.values.map((value) => {
|
|
163
|
+
const disabled = (0, import_variants.isValueDisabled)(
|
|
164
|
+
product,
|
|
165
|
+
activeSelection,
|
|
166
|
+
optionIndex,
|
|
167
|
+
value.id
|
|
168
|
+
);
|
|
169
|
+
const selected = activeSelection[option.id] === value.id;
|
|
170
|
+
if (option.kind === "image") {
|
|
171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
172
|
+
"button",
|
|
173
|
+
{
|
|
174
|
+
type: "button",
|
|
175
|
+
"aria-label": value.label,
|
|
176
|
+
"aria-pressed": selected,
|
|
177
|
+
disabled,
|
|
178
|
+
title: disabled ? labels.unavailableOption : void 0,
|
|
179
|
+
"data-testid": `option-${option.id}-${value.id}`,
|
|
180
|
+
onClick: () => setSelection(
|
|
181
|
+
(0, import_variants.selectValue)(product, activeSelection, optionIndex, value.id)
|
|
182
|
+
),
|
|
183
|
+
className: (0, import_utils.cn)(
|
|
184
|
+
"relative size-9 overflow-hidden rounded-md border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card disabled:cursor-not-allowed disabled:opacity-40",
|
|
185
|
+
selected ? "border-ring ring-2 ring-ring ring-offset-2 ring-offset-card" : "border-border"
|
|
186
|
+
),
|
|
187
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
188
|
+
"img",
|
|
189
|
+
{
|
|
190
|
+
src: (0, import_variants.firstNonEmpty)(value.image) ?? import_contracts.PRODUCT_IMAGE_FALLBACK,
|
|
191
|
+
alt: value.label,
|
|
192
|
+
"aria-hidden": "true",
|
|
193
|
+
width: 36,
|
|
194
|
+
height: 36,
|
|
195
|
+
className: "size-full object-cover"
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
},
|
|
199
|
+
value.id
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
203
|
+
import_button.Button,
|
|
204
|
+
{
|
|
205
|
+
type: "button",
|
|
206
|
+
"aria-pressed": selected,
|
|
207
|
+
disabled,
|
|
208
|
+
title: disabled ? labels.unavailableOption : void 0,
|
|
209
|
+
"data-testid": `option-${option.id}-${value.id}`,
|
|
210
|
+
onClick: () => setSelection(
|
|
211
|
+
(0, import_variants.selectValue)(product, activeSelection, optionIndex, value.id)
|
|
212
|
+
),
|
|
213
|
+
className: (0, import_utils.cn)(
|
|
214
|
+
"h-7 min-w-8 rounded-md border px-2 py-0 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card disabled:cursor-not-allowed disabled:opacity-40 disabled:line-through",
|
|
215
|
+
selected ? "border-primary bg-primary text-primary-foreground" : "border-border bg-card text-foreground hover:border-foreground hover:bg-card"
|
|
216
|
+
),
|
|
217
|
+
children: value.label
|
|
218
|
+
},
|
|
219
|
+
value.id
|
|
220
|
+
);
|
|
221
|
+
}) })
|
|
222
|
+
]
|
|
223
|
+
},
|
|
224
|
+
option.id
|
|
225
|
+
);
|
|
226
|
+
}),
|
|
227
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
228
|
+
import_button.Button,
|
|
229
|
+
{
|
|
230
|
+
type: "button",
|
|
231
|
+
"data-testid": "add-to-cart",
|
|
232
|
+
disabled: !variant?.available,
|
|
233
|
+
onClick: handleAddToCart,
|
|
234
|
+
className: "w-full bg-accent text-accent-foreground hover:bg-accent/90",
|
|
235
|
+
children: labels.addToCart
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { "data-testid": "stock", className: (0, import_utils.cn)("text-xs font-medium", stockTone), children: stockLabel }),
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "sr-only", "aria-live": "polite", children: liveSummary })
|
|
240
|
+
] })
|
|
241
|
+
] }) });
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/designs/marketplace-product-card/block.tsx"],"sourcesContent":["'use client'\n\nimport { normalizeData } from './normalize'\nimport { Badge } from '../../../ui/badge'\nimport { Button } from '../../../ui/button'\nimport { Card, CardContent } from '../../../ui/card'\nimport { PRODUCT_IMAGE_FALLBACK } from '../../../lib/contracts'\nimport { cn } from '../../../lib/utils'\nimport type { MarketplaceProductCardData } from '../../../lib/contracts/marketplace-product-card'\n\nimport { useId, useState } from 'react'\n\nimport {\n discountPercent,\n findVariant,\n firstAvailableSelection,\n firstNonEmpty,\n formatDiscount,\n formatPrice,\n isValueDisabled,\n resolveVariantImage,\n selectValue,\n type CardLabels,\n type Glyphs,\n type Product,\n type ProductVariant,\n type Selection,\n type StockTone,\n} from './variants'\n\nexport type MarketplaceProductCardProps = {\n data: MarketplaceProductCardData;\n product?: Product\n labels?: CardLabels\n glyphs?: Glyphs\n onAddToCart?: (variant: ProductVariant, product: Product) => void\n onToggleWishlist?: (product: Product, nextState: boolean) => void\n}\n\nconst STOCK_TONE_CLASS: Record<StockTone, string> = {\n success: 'text-success',\n attention: 'text-destructive',\n destructive: 'text-destructive',\n}\n\nfunction formatReviewCount(count: number, locale: string): string {\n return new Intl.NumberFormat(locale).format(count)\n}\n\nexport default function MarketplaceProductCard(__designProps: MarketplaceProductCardProps) {\n const data = normalizeData(__designProps.data)\n const {\n product = data.product,\n labels = data.labels,\n glyphs = data.glyphs,\n onAddToCart,\n onToggleWishlist,\n } = __designProps\n const [selection, setSelection] = useState<Selection>(() => firstAvailableSelection(product))\n const [wishlisted, setWishlisted] = useState(false)\n const [renderedProductId, setRenderedProductId] = useState(product.id)\n const baseId = useId()\n\n if (product.id !== renderedProductId) {\n setRenderedProductId(product.id)\n setSelection(firstAvailableSelection(product))\n setWishlisted(false)\n }\n\n const activeSelection = findVariant(product, selection)\n ? selection\n : firstAvailableSelection(product)\n const variant = findVariant(product, activeSelection) ?? product.variants[0]\n const image = resolveVariantImage(product, variant, activeSelection)\n const discount = variant ? discountPercent(variant.price, variant.compareAtPrice) : null\n const priceLabel = variant\n ? formatPrice(variant.price, product.locale, product.currency)\n : labels.unavailablePrice\n const compareLabel =\n variant?.compareAtPrice !== undefined && discount !== null\n ? formatPrice(variant.compareAtPrice, product.locale, product.currency)\n : null\n const discountLabel = discount !== null ? formatDiscount(discount, product.locale) : null\n\n const reviews = formatReviewCount(product.reviewCount, product.locale)\n const filledStars = Math.round(product.rating)\n const stars = Array.from({ length: 5 }, (_, index) =>\n index < filledStars ? glyphs.fullStar : glyphs.emptyStar,\n )\n\n const selectedLabels = product.options\n .map((option) => option.values.find((value) => value.id === activeSelection[option.id])?.label)\n .filter((label): label is string => Boolean(label))\n .join(', ')\n\n const stockLabel = variant?.stockLabel ?? labels.outOfStock\n const liveSummary = [product.title, selectedLabels, priceLabel, stockLabel]\n .filter((part): part is string => Boolean(part))\n .join(', ')\n const stockTone = variant ? STOCK_TONE_CLASS[variant.stockTone] : STOCK_TONE_CLASS.destructive\n\n const handleAddToCart = () => {\n if (variant?.available) onAddToCart?.(variant, product)\n }\n\n const handleWishlist = () => {\n const next = !wishlisted\n setWishlisted(next)\n onToggleWishlist?.(product, next)\n }\n\n return (\n <article aria-label={product.title} className=\"w-full sm:mx-auto sm:max-w-xs\">\n <Card className=\"group/card gap-0 overflow-hidden py-0 shadow-sm transition-shadow hover:shadow-md\">\n <div className=\"relative aspect-square overflow-hidden bg-muted\">\n <img\n data-testid=\"image\"\n src={image.src ?? PRODUCT_IMAGE_FALLBACK}\n alt={image.alt}\n width={800}\n height={800}\n className=\"size-full object-cover transition-transform duration-300 group-hover/card:scale-105\"\n />\n <Badge className=\"absolute left-3 top-3 rounded-full bg-accent px-2 text-accent-foreground\">\n {product.badge}\n </Badge>\n <Button\n type=\"button\"\n size=\"icon-sm\"\n data-testid=\"wishlist\"\n aria-label={wishlisted ? labels.wishlistRemove : labels.wishlistAdd}\n aria-pressed={wishlisted}\n onClick={handleWishlist}\n className=\"absolute right-3 top-3 rounded-full border border-border bg-card/90 text-foreground shadow-sm backdrop-blur hover:bg-card\"\n >\n <span\n aria-hidden=\"true\"\n className={cn('text-base leading-none', wishlisted && 'text-accent')}\n >\n {wishlisted ? glyphs.heartFilled : glyphs.heart}\n </span>\n </Button>\n </div>\n\n <CardContent className=\"flex flex-col gap-2 p-3\">\n <p className=\"text-xs uppercase tracking-wide text-muted-foreground\">{product.brand}</p>\n\n <h3 className=\"line-clamp-2 min-h-10 text-sm font-medium leading-snug\">\n {product.title}\n </h3>\n\n <div className=\"flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs\">\n <span className=\"text-warning\" aria-hidden=\"true\">\n {stars.join('')}\n </span>\n <span className=\"font-medium\">{product.rating.toFixed(1)}</span>\n <span className=\"text-muted-foreground\">{`(${reviews})`}</span>\n <span className=\"text-muted-foreground\">{product.soldLabel}</span>\n <span className=\"sr-only\">{product.ratingLabel}</span>\n </div>\n\n <div className=\"flex flex-wrap items-baseline gap-x-2\">\n <span\n data-testid=\"price\"\n className={cn(\n 'text-xl font-semibold tracking-tight',\n !variant && 'text-sm font-normal text-muted-foreground',\n )}\n >\n {priceLabel}\n </span>\n {compareLabel !== null ? (\n <span data-testid=\"compare\" className=\"text-xs text-muted-foreground line-through\">\n {compareLabel}\n </span>\n ) : null}\n {discountLabel !== null ? (\n <span data-testid=\"discount\" className=\"text-xs font-semibold text-accent\">\n {discountLabel}\n </span>\n ) : null}\n </div>\n\n <div className=\"flex flex-wrap items-center gap-x-1.5 text-xs\">\n <span className=\"font-medium text-success\">{product.shippingLabel}</span>\n <span className=\"text-muted-foreground\">{product.deliveryLabel}</span>\n </div>\n\n {product.options.map((option, optionIndex) => {\n const labelId = `${baseId}-${option.id}`\n const selectedValue = option.values.find(\n (value) => value.id === activeSelection[option.id],\n )\n\n return (\n <div\n key={option.id}\n role=\"group\"\n aria-labelledby={labelId}\n className=\"flex flex-col gap-1.5\"\n >\n <p id={labelId} className=\"text-xs text-muted-foreground\">\n {`${option.name}${labels.optionSeparator} ${selectedValue?.label ?? ''}`}\n </p>\n <div className=\"flex flex-wrap gap-1.5\">\n {option.values.map((value) => {\n const disabled = isValueDisabled(\n product,\n activeSelection,\n optionIndex,\n value.id,\n )\n const selected = activeSelection[option.id] === value.id\n\n if (option.kind === 'image') {\n return (\n <button\n key={value.id}\n type=\"button\"\n aria-label={value.label}\n aria-pressed={selected}\n disabled={disabled}\n title={disabled ? labels.unavailableOption : undefined}\n data-testid={`option-${option.id}-${value.id}`}\n onClick={() =>\n setSelection(\n selectValue(product, activeSelection, optionIndex, value.id),\n )\n }\n className={cn(\n 'relative size-9 overflow-hidden rounded-md border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card disabled:cursor-not-allowed disabled:opacity-40',\n selected\n ? 'border-ring ring-2 ring-ring ring-offset-2 ring-offset-card'\n : 'border-border',\n )}\n >\n <img\n src={firstNonEmpty(value.image) ?? PRODUCT_IMAGE_FALLBACK}\n alt={value.label}\n aria-hidden=\"true\"\n width={36}\n height={36}\n className=\"size-full object-cover\"\n />\n </button>\n )\n }\n\n return (\n <Button\n key={value.id}\n type=\"button\"\n aria-pressed={selected}\n disabled={disabled}\n title={disabled ? labels.unavailableOption : undefined}\n data-testid={`option-${option.id}-${value.id}`}\n onClick={() =>\n setSelection(\n selectValue(product, activeSelection, optionIndex, value.id),\n )\n }\n className={cn(\n 'h-7 min-w-8 rounded-md border px-2 py-0 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card disabled:cursor-not-allowed disabled:opacity-40 disabled:line-through',\n selected\n ? 'border-primary bg-primary text-primary-foreground'\n : 'border-border bg-card text-foreground hover:border-foreground hover:bg-card',\n )}\n >\n {value.label}\n </Button>\n )\n })}\n </div>\n </div>\n )\n })}\n\n <Button\n type=\"button\"\n data-testid=\"add-to-cart\"\n disabled={!variant?.available}\n onClick={handleAddToCart}\n className=\"w-full bg-accent text-accent-foreground hover:bg-accent/90\"\n >\n {labels.addToCart}\n </Button>\n\n <p data-testid=\"stock\" className={cn('text-xs font-medium', stockTone)}>\n {stockLabel}\n </p>\n\n <p className=\"sr-only\" aria-live=\"polite\">\n {liveSummary}\n </p>\n </CardContent>\n </Card>\n </article>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkHQ;AAhHR,uBAA8B;AAC9B,mBAAsB;AACtB,oBAAuB;AACvB,kBAAkC;AAClC,uBAAuC;AACvC,mBAAmB;AAGnB,mBAAgC;AAEhC,sBAgBO;AAWP,MAAM,mBAA8C;AAAA,EAClD,SAAS;AAAA,EACT,WAAW;AAAA,EACX,aAAa;AACf;AAEA,SAAS,kBAAkB,OAAe,QAAwB;AAChE,SAAO,IAAI,KAAK,aAAa,MAAM,EAAE,OAAO,KAAK;AACnD;AAEe,SAAR,uBAAwC,eAA4C;AACzF,QAAM,WAAO,gCAAc,cAAc,IAAI;AAC7C,QAAM;AAAA,IACJ,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,IACd,SAAS,KAAK;AAAA,IACd;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAoB,UAAM,yCAAwB,OAAO,CAAC;AAC5F,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAS,KAAK;AAClD,QAAM,CAAC,mBAAmB,oBAAoB,QAAI,uBAAS,QAAQ,EAAE;AACrE,QAAM,aAAS,oBAAM;AAErB,MAAI,QAAQ,OAAO,mBAAmB;AACpC,yBAAqB,QAAQ,EAAE;AAC/B,qBAAa,yCAAwB,OAAO,CAAC;AAC7C,kBAAc,KAAK;AAAA,EACrB;AAEA,QAAM,sBAAkB,6BAAY,SAAS,SAAS,IAClD,gBACA,yCAAwB,OAAO;AACnC,QAAM,cAAU,6BAAY,SAAS,eAAe,KAAK,QAAQ,SAAS,CAAC;AAC3E,QAAM,YAAQ,qCAAoB,S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 -0,0 +1,233 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { normalizeData } from "./normalize.mjs";
|
|
4
|
+
import { Badge } from "../../../ui/badge.mjs";
|
|
5
|
+
import { Button } from "../../../ui/button.mjs";
|
|
6
|
+
import { Card, CardContent } from "../../../ui/card.mjs";
|
|
7
|
+
import { PRODUCT_IMAGE_FALLBACK } from "../../../lib/contracts.mjs";
|
|
8
|
+
import { cn } from "../../../lib/utils.mjs";
|
|
9
|
+
import { useId, useState } from "react";
|
|
10
|
+
import {
|
|
11
|
+
discountPercent,
|
|
12
|
+
findVariant,
|
|
13
|
+
firstAvailableSelection,
|
|
14
|
+
firstNonEmpty,
|
|
15
|
+
formatDiscount,
|
|
16
|
+
formatPrice,
|
|
17
|
+
isValueDisabled,
|
|
18
|
+
resolveVariantImage,
|
|
19
|
+
selectValue
|
|
20
|
+
} from "./variants.mjs";
|
|
21
|
+
const STOCK_TONE_CLASS = {
|
|
22
|
+
success: "text-success",
|
|
23
|
+
attention: "text-destructive",
|
|
24
|
+
destructive: "text-destructive"
|
|
25
|
+
};
|
|
26
|
+
function formatReviewCount(count, locale) {
|
|
27
|
+
return new Intl.NumberFormat(locale).format(count);
|
|
28
|
+
}
|
|
29
|
+
function MarketplaceProductCard(__designProps) {
|
|
30
|
+
const data = normalizeData(__designProps.data);
|
|
31
|
+
const {
|
|
32
|
+
product = data.product,
|
|
33
|
+
labels = data.labels,
|
|
34
|
+
glyphs = data.glyphs,
|
|
35
|
+
onAddToCart,
|
|
36
|
+
onToggleWishlist
|
|
37
|
+
} = __designProps;
|
|
38
|
+
const [selection, setSelection] = useState(() => firstAvailableSelection(product));
|
|
39
|
+
const [wishlisted, setWishlisted] = useState(false);
|
|
40
|
+
const [renderedProductId, setRenderedProductId] = useState(product.id);
|
|
41
|
+
const baseId = useId();
|
|
42
|
+
if (product.id !== renderedProductId) {
|
|
43
|
+
setRenderedProductId(product.id);
|
|
44
|
+
setSelection(firstAvailableSelection(product));
|
|
45
|
+
setWishlisted(false);
|
|
46
|
+
}
|
|
47
|
+
const activeSelection = findVariant(product, selection) ? selection : firstAvailableSelection(product);
|
|
48
|
+
const variant = findVariant(product, activeSelection) ?? product.variants[0];
|
|
49
|
+
const image = resolveVariantImage(product, variant, activeSelection);
|
|
50
|
+
const discount = variant ? discountPercent(variant.price, variant.compareAtPrice) : null;
|
|
51
|
+
const priceLabel = variant ? formatPrice(variant.price, product.locale, product.currency) : labels.unavailablePrice;
|
|
52
|
+
const compareLabel = variant?.compareAtPrice !== void 0 && discount !== null ? formatPrice(variant.compareAtPrice, product.locale, product.currency) : null;
|
|
53
|
+
const discountLabel = discount !== null ? formatDiscount(discount, product.locale) : null;
|
|
54
|
+
const reviews = formatReviewCount(product.reviewCount, product.locale);
|
|
55
|
+
const filledStars = Math.round(product.rating);
|
|
56
|
+
const stars = Array.from(
|
|
57
|
+
{ length: 5 },
|
|
58
|
+
(_, index) => index < filledStars ? glyphs.fullStar : glyphs.emptyStar
|
|
59
|
+
);
|
|
60
|
+
const selectedLabels = product.options.map((option) => option.values.find((value) => value.id === activeSelection[option.id])?.label).filter((label) => Boolean(label)).join(", ");
|
|
61
|
+
const stockLabel = variant?.stockLabel ?? labels.outOfStock;
|
|
62
|
+
const liveSummary = [product.title, selectedLabels, priceLabel, stockLabel].filter((part) => Boolean(part)).join(", ");
|
|
63
|
+
const stockTone = variant ? STOCK_TONE_CLASS[variant.stockTone] : STOCK_TONE_CLASS.destructive;
|
|
64
|
+
const handleAddToCart = () => {
|
|
65
|
+
if (variant?.available) onAddToCart?.(variant, product);
|
|
66
|
+
};
|
|
67
|
+
const handleWishlist = () => {
|
|
68
|
+
const next = !wishlisted;
|
|
69
|
+
setWishlisted(next);
|
|
70
|
+
onToggleWishlist?.(product, next);
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */ jsx("article", { "aria-label": product.title, className: "w-full sm:mx-auto sm:max-w-xs", children: /* @__PURE__ */ jsxs(Card, { className: "group/card gap-0 overflow-hidden py-0 shadow-sm transition-shadow hover:shadow-md", children: [
|
|
73
|
+
/* @__PURE__ */ jsxs("div", { className: "relative aspect-square overflow-hidden bg-muted", children: [
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
"img",
|
|
76
|
+
{
|
|
77
|
+
"data-testid": "image",
|
|
78
|
+
src: image.src ?? PRODUCT_IMAGE_FALLBACK,
|
|
79
|
+
alt: image.alt,
|
|
80
|
+
width: 800,
|
|
81
|
+
height: 800,
|
|
82
|
+
className: "size-full object-cover transition-transform duration-300 group-hover/card:scale-105"
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ jsx(Badge, { className: "absolute left-3 top-3 rounded-full bg-accent px-2 text-accent-foreground", children: product.badge }),
|
|
86
|
+
/* @__PURE__ */ jsx(
|
|
87
|
+
Button,
|
|
88
|
+
{
|
|
89
|
+
type: "button",
|
|
90
|
+
size: "icon-sm",
|
|
91
|
+
"data-testid": "wishlist",
|
|
92
|
+
"aria-label": wishlisted ? labels.wishlistRemove : labels.wishlistAdd,
|
|
93
|
+
"aria-pressed": wishlisted,
|
|
94
|
+
onClick: handleWishlist,
|
|
95
|
+
className: "absolute right-3 top-3 rounded-full border border-border bg-card/90 text-foreground shadow-sm backdrop-blur hover:bg-card",
|
|
96
|
+
children: /* @__PURE__ */ jsx(
|
|
97
|
+
"span",
|
|
98
|
+
{
|
|
99
|
+
"aria-hidden": "true",
|
|
100
|
+
className: cn("text-base leading-none", wishlisted && "text-accent"),
|
|
101
|
+
children: wishlisted ? glyphs.heartFilled : glyphs.heart
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] }),
|
|
107
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "flex flex-col gap-2 p-3", children: [
|
|
108
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs uppercase tracking-wide text-muted-foreground", children: product.brand }),
|
|
109
|
+
/* @__PURE__ */ jsx("h3", { className: "line-clamp-2 min-h-10 text-sm font-medium leading-snug", children: product.title }),
|
|
110
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs", children: [
|
|
111
|
+
/* @__PURE__ */ jsx("span", { className: "text-warning", "aria-hidden": "true", children: stars.join("") }),
|
|
112
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: product.rating.toFixed(1) }),
|
|
113
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: `(${reviews})` }),
|
|
114
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: product.soldLabel }),
|
|
115
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: product.ratingLabel })
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-x-2", children: [
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
"span",
|
|
120
|
+
{
|
|
121
|
+
"data-testid": "price",
|
|
122
|
+
className: cn(
|
|
123
|
+
"text-xl font-semibold tracking-tight",
|
|
124
|
+
!variant && "text-sm font-normal text-muted-foreground"
|
|
125
|
+
),
|
|
126
|
+
children: priceLabel
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
compareLabel !== null ? /* @__PURE__ */ jsx("span", { "data-testid": "compare", className: "text-xs text-muted-foreground line-through", children: compareLabel }) : null,
|
|
130
|
+
discountLabel !== null ? /* @__PURE__ */ jsx("span", { "data-testid": "discount", className: "text-xs font-semibold text-accent", children: discountLabel }) : null
|
|
131
|
+
] }),
|
|
132
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-1.5 text-xs", children: [
|
|
133
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-success", children: product.shippingLabel }),
|
|
134
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: product.deliveryLabel })
|
|
135
|
+
] }),
|
|
136
|
+
product.options.map((option, optionIndex) => {
|
|
137
|
+
const labelId = `${baseId}-${option.id}`;
|
|
138
|
+
const selectedValue = option.values.find(
|
|
139
|
+
(value) => value.id === activeSelection[option.id]
|
|
140
|
+
);
|
|
141
|
+
return /* @__PURE__ */ jsxs(
|
|
142
|
+
"div",
|
|
143
|
+
{
|
|
144
|
+
role: "group",
|
|
145
|
+
"aria-labelledby": labelId,
|
|
146
|
+
className: "flex flex-col gap-1.5",
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ jsx("p", { id: labelId, className: "text-xs text-muted-foreground", children: `${option.name}${labels.optionSeparator} ${selectedValue?.label ?? ""}` }),
|
|
149
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: option.values.map((value) => {
|
|
150
|
+
const disabled = isValueDisabled(
|
|
151
|
+
product,
|
|
152
|
+
activeSelection,
|
|
153
|
+
optionIndex,
|
|
154
|
+
value.id
|
|
155
|
+
);
|
|
156
|
+
const selected = activeSelection[option.id] === value.id;
|
|
157
|
+
if (option.kind === "image") {
|
|
158
|
+
return /* @__PURE__ */ jsx(
|
|
159
|
+
"button",
|
|
160
|
+
{
|
|
161
|
+
type: "button",
|
|
162
|
+
"aria-label": value.label,
|
|
163
|
+
"aria-pressed": selected,
|
|
164
|
+
disabled,
|
|
165
|
+
title: disabled ? labels.unavailableOption : void 0,
|
|
166
|
+
"data-testid": `option-${option.id}-${value.id}`,
|
|
167
|
+
onClick: () => setSelection(
|
|
168
|
+
selectValue(product, activeSelection, optionIndex, value.id)
|
|
169
|
+
),
|
|
170
|
+
className: cn(
|
|
171
|
+
"relative size-9 overflow-hidden rounded-md border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card disabled:cursor-not-allowed disabled:opacity-40",
|
|
172
|
+
selected ? "border-ring ring-2 ring-ring ring-offset-2 ring-offset-card" : "border-border"
|
|
173
|
+
),
|
|
174
|
+
children: /* @__PURE__ */ jsx(
|
|
175
|
+
"img",
|
|
176
|
+
{
|
|
177
|
+
src: firstNonEmpty(value.image) ?? PRODUCT_IMAGE_FALLBACK,
|
|
178
|
+
alt: value.label,
|
|
179
|
+
"aria-hidden": "true",
|
|
180
|
+
width: 36,
|
|
181
|
+
height: 36,
|
|
182
|
+
className: "size-full object-cover"
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
},
|
|
186
|
+
value.id
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
return /* @__PURE__ */ jsx(
|
|
190
|
+
Button,
|
|
191
|
+
{
|
|
192
|
+
type: "button",
|
|
193
|
+
"aria-pressed": selected,
|
|
194
|
+
disabled,
|
|
195
|
+
title: disabled ? labels.unavailableOption : void 0,
|
|
196
|
+
"data-testid": `option-${option.id}-${value.id}`,
|
|
197
|
+
onClick: () => setSelection(
|
|
198
|
+
selectValue(product, activeSelection, optionIndex, value.id)
|
|
199
|
+
),
|
|
200
|
+
className: cn(
|
|
201
|
+
"h-7 min-w-8 rounded-md border px-2 py-0 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card disabled:cursor-not-allowed disabled:opacity-40 disabled:line-through",
|
|
202
|
+
selected ? "border-primary bg-primary text-primary-foreground" : "border-border bg-card text-foreground hover:border-foreground hover:bg-card"
|
|
203
|
+
),
|
|
204
|
+
children: value.label
|
|
205
|
+
},
|
|
206
|
+
value.id
|
|
207
|
+
);
|
|
208
|
+
}) })
|
|
209
|
+
]
|
|
210
|
+
},
|
|
211
|
+
option.id
|
|
212
|
+
);
|
|
213
|
+
}),
|
|
214
|
+
/* @__PURE__ */ jsx(
|
|
215
|
+
Button,
|
|
216
|
+
{
|
|
217
|
+
type: "button",
|
|
218
|
+
"data-testid": "add-to-cart",
|
|
219
|
+
disabled: !variant?.available,
|
|
220
|
+
onClick: handleAddToCart,
|
|
221
|
+
className: "w-full bg-accent text-accent-foreground hover:bg-accent/90",
|
|
222
|
+
children: labels.addToCart
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
/* @__PURE__ */ jsx("p", { "data-testid": "stock", className: cn("text-xs font-medium", stockTone), children: stockLabel }),
|
|
226
|
+
/* @__PURE__ */ jsx("p", { className: "sr-only", "aria-live": "polite", children: liveSummary })
|
|
227
|
+
] })
|
|
228
|
+
] }) });
|
|
229
|
+
}
|
|
230
|
+
export {
|
|
231
|
+
MarketplaceProductCard as default
|
|
232
|
+
};
|
|
233
|
+
//# sourceMappingURL=block.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/blocks/designs/marketplace-product-card/block.tsx"],"sourcesContent":["'use client'\n\nimport { normalizeData } from './normalize'\nimport { Badge } from '../../../ui/badge'\nimport { Button } from '../../../ui/button'\nimport { Card, CardContent } from '../../../ui/card'\nimport { PRODUCT_IMAGE_FALLBACK } from '../../../lib/contracts'\nimport { cn } from '../../../lib/utils'\nimport type { MarketplaceProductCardData } from '../../../lib/contracts/marketplace-product-card'\n\nimport { useId, useState } from 'react'\n\nimport {\n discountPercent,\n findVariant,\n firstAvailableSelection,\n firstNonEmpty,\n formatDiscount,\n formatPrice,\n isValueDisabled,\n resolveVariantImage,\n selectValue,\n type CardLabels,\n type Glyphs,\n type Product,\n type ProductVariant,\n type Selection,\n type StockTone,\n} from './variants'\n\nexport type MarketplaceProductCardProps = {\n data: MarketplaceProductCardData;\n product?: Product\n labels?: CardLabels\n glyphs?: Glyphs\n onAddToCart?: (variant: ProductVariant, product: Product) => void\n onToggleWishlist?: (product: Product, nextState: boolean) => void\n}\n\nconst STOCK_TONE_CLASS: Record<StockTone, string> = {\n success: 'text-success',\n attention: 'text-destructive',\n destructive: 'text-destructive',\n}\n\nfunction formatReviewCount(count: number, locale: string): string {\n return new Intl.NumberFormat(locale).format(count)\n}\n\nexport default function MarketplaceProductCard(__designProps: MarketplaceProductCardProps) {\n const data = normalizeData(__designProps.data)\n const {\n product = data.product,\n labels = data.labels,\n glyphs = data.glyphs,\n onAddToCart,\n onToggleWishlist,\n } = __designProps\n const [selection, setSelection] = useState<Selection>(() => firstAvailableSelection(product))\n const [wishlisted, setWishlisted] = useState(false)\n const [renderedProductId, setRenderedProductId] = useState(product.id)\n const baseId = useId()\n\n if (product.id !== renderedProductId) {\n setRenderedProductId(product.id)\n setSelection(firstAvailableSelection(product))\n setWishlisted(false)\n }\n\n const activeSelection = findVariant(product, selection)\n ? selection\n : firstAvailableSelection(product)\n const variant = findVariant(product, activeSelection) ?? product.variants[0]\n const image = resolveVariantImage(product, variant, activeSelection)\n const discount = variant ? discountPercent(variant.price, variant.compareAtPrice) : null\n const priceLabel = variant\n ? formatPrice(variant.price, product.locale, product.currency)\n : labels.unavailablePrice\n const compareLabel =\n variant?.compareAtPrice !== undefined && discount !== null\n ? formatPrice(variant.compareAtPrice, product.locale, product.currency)\n : null\n const discountLabel = discount !== null ? formatDiscount(discount, product.locale) : null\n\n const reviews = formatReviewCount(product.reviewCount, product.locale)\n const filledStars = Math.round(product.rating)\n const stars = Array.from({ length: 5 }, (_, index) =>\n index < filledStars ? glyphs.fullStar : glyphs.emptyStar,\n )\n\n const selectedLabels = product.options\n .map((option) => option.values.find((value) => value.id === activeSelection[option.id])?.label)\n .filter((label): label is string => Boolean(label))\n .join(', ')\n\n const stockLabel = variant?.stockLabel ?? labels.outOfStock\n const liveSummary = [product.title, selectedLabels, priceLabel, stockLabel]\n .filter((part): part is string => Boolean(part))\n .join(', ')\n const stockTone = variant ? STOCK_TONE_CLASS[variant.stockTone] : STOCK_TONE_CLASS.destructive\n\n const handleAddToCart = () => {\n if (variant?.available) onAddToCart?.(variant, product)\n }\n\n const handleWishlist = () => {\n const next = !wishlisted\n setWishlisted(next)\n onToggleWishlist?.(product, next)\n }\n\n return (\n <article aria-label={product.title} className=\"w-full sm:mx-auto sm:max-w-xs\">\n <Card className=\"group/card gap-0 overflow-hidden py-0 shadow-sm transition-shadow hover:shadow-md\">\n <div className=\"relative aspect-square overflow-hidden bg-muted\">\n <img\n data-testid=\"image\"\n src={image.src ?? PRODUCT_IMAGE_FALLBACK}\n alt={image.alt}\n width={800}\n height={800}\n className=\"size-full object-cover transition-transform duration-300 group-hover/card:scale-105\"\n />\n <Badge className=\"absolute left-3 top-3 rounded-full bg-accent px-2 text-accent-foreground\">\n {product.badge}\n </Badge>\n <Button\n type=\"button\"\n size=\"icon-sm\"\n data-testid=\"wishlist\"\n aria-label={wishlisted ? labels.wishlistRemove : labels.wishlistAdd}\n aria-pressed={wishlisted}\n onClick={handleWishlist}\n className=\"absolute right-3 top-3 rounded-full border border-border bg-card/90 text-foreground shadow-sm backdrop-blur hover:bg-card\"\n >\n <span\n aria-hidden=\"true\"\n className={cn('text-base leading-none', wishlisted && 'text-accent')}\n >\n {wishlisted ? glyphs.heartFilled : glyphs.heart}\n </span>\n </Button>\n </div>\n\n <CardContent className=\"flex flex-col gap-2 p-3\">\n <p className=\"text-xs uppercase tracking-wide text-muted-foreground\">{product.brand}</p>\n\n <h3 className=\"line-clamp-2 min-h-10 text-sm font-medium leading-snug\">\n {product.title}\n </h3>\n\n <div className=\"flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs\">\n <span className=\"text-warning\" aria-hidden=\"true\">\n {stars.join('')}\n </span>\n <span className=\"font-medium\">{product.rating.toFixed(1)}</span>\n <span className=\"text-muted-foreground\">{`(${reviews})`}</span>\n <span className=\"text-muted-foreground\">{product.soldLabel}</span>\n <span className=\"sr-only\">{product.ratingLabel}</span>\n </div>\n\n <div className=\"flex flex-wrap items-baseline gap-x-2\">\n <span\n data-testid=\"price\"\n className={cn(\n 'text-xl font-semibold tracking-tight',\n !variant && 'text-sm font-normal text-muted-foreground',\n )}\n >\n {priceLabel}\n </span>\n {compareLabel !== null ? (\n <span data-testid=\"compare\" className=\"text-xs text-muted-foreground line-through\">\n {compareLabel}\n </span>\n ) : null}\n {discountLabel !== null ? (\n <span data-testid=\"discount\" className=\"text-xs font-semibold text-accent\">\n {discountLabel}\n </span>\n ) : null}\n </div>\n\n <div className=\"flex flex-wrap items-center gap-x-1.5 text-xs\">\n <span className=\"font-medium text-success\">{product.shippingLabel}</span>\n <span className=\"text-muted-foreground\">{product.deliveryLabel}</span>\n </div>\n\n {product.options.map((option, optionIndex) => {\n const labelId = `${baseId}-${option.id}`\n const selectedValue = option.values.find(\n (value) => value.id === activeSelection[option.id],\n )\n\n return (\n <div\n key={option.id}\n role=\"group\"\n aria-labelledby={labelId}\n className=\"flex flex-col gap-1.5\"\n >\n <p id={labelId} className=\"text-xs text-muted-foreground\">\n {`${option.name}${labels.optionSeparator} ${selectedValue?.label ?? ''}`}\n </p>\n <div className=\"flex flex-wrap gap-1.5\">\n {option.values.map((value) => {\n const disabled = isValueDisabled(\n product,\n activeSelection,\n optionIndex,\n value.id,\n )\n const selected = activeSelection[option.id] === value.id\n\n if (option.kind === 'image') {\n return (\n <button\n key={value.id}\n type=\"button\"\n aria-label={value.label}\n aria-pressed={selected}\n disabled={disabled}\n title={disabled ? labels.unavailableOption : undefined}\n data-testid={`option-${option.id}-${value.id}`}\n onClick={() =>\n setSelection(\n selectValue(product, activeSelection, optionIndex, value.id),\n )\n }\n className={cn(\n 'relative size-9 overflow-hidden rounded-md border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card disabled:cursor-not-allowed disabled:opacity-40',\n selected\n ? 'border-ring ring-2 ring-ring ring-offset-2 ring-offset-card'\n : 'border-border',\n )}\n >\n <img\n src={firstNonEmpty(value.image) ?? PRODUCT_IMAGE_FALLBACK}\n alt={value.label}\n aria-hidden=\"true\"\n width={36}\n height={36}\n className=\"size-full object-cover\"\n />\n </button>\n )\n }\n\n return (\n <Button\n key={value.id}\n type=\"button\"\n aria-pressed={selected}\n disabled={disabled}\n title={disabled ? labels.unavailableOption : undefined}\n data-testid={`option-${option.id}-${value.id}`}\n onClick={() =>\n setSelection(\n selectValue(product, activeSelection, optionIndex, value.id),\n )\n }\n className={cn(\n 'h-7 min-w-8 rounded-md border px-2 py-0 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-card disabled:cursor-not-allowed disabled:opacity-40 disabled:line-through',\n selected\n ? 'border-primary bg-primary text-primary-foreground'\n : 'border-border bg-card text-foreground hover:border-foreground hover:bg-card',\n )}\n >\n {value.label}\n </Button>\n )\n })}\n </div>\n </div>\n )\n })}\n\n <Button\n type=\"button\"\n data-testid=\"add-to-cart\"\n disabled={!variant?.available}\n onClick={handleAddToCart}\n className=\"w-full bg-accent text-accent-foreground hover:bg-accent/90\"\n >\n {labels.addToCart}\n </Button>\n\n <p data-testid=\"stock\" className={cn('text-xs font-medium', stockTone)}>\n {stockLabel}\n </p>\n\n <p className=\"sr-only\" aria-live=\"polite\">\n {liveSummary}\n </p>\n </CardContent>\n </Card>\n </article>\n )\n}\n"],"mappings":";AAkHQ,SACE,KADF;AAhHR,SAAS,qBAAqB;AAC9B,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,MAAM,mBAAmB;AAClC,SAAS,8BAA8B;AACvC,SAAS,UAAU;AAGnB,SAAS,OAAO,gBAAgB;AAEhC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOK;AAWP,MAAM,mBAA8C;AAAA,EAClD,SAAS;AAAA,EACT,WAAW;AAAA,EACX,aAAa;AACf;AAEA,SAAS,kBAAkB,OAAe,QAAwB;AAChE,SAAO,IAAI,KAAK,aAAa,MAAM,EAAE,OAAO,KAAK;AACnD;AAEe,SAAR,uBAAwC,eAA4C;AACzF,QAAM,OAAO,cAAc,cAAc,IAAI;AAC7C,QAAM;AAAA,IACJ,UAAU,KAAK;AAAA,IACf,SAAS,KAAK;AAAA,IACd,SAAS,KAAK;AAAA,IACd;AAAA,I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AAA,oBAEC,gBAAM;AAAA;AAAA,kBAlBF,MAAM;AAAA,gBAmBb;AAAA,cAEJ,CAAC,GACH;AAAA;AAAA;AAAA,UA5EK,OAAO;AAAA,QA6Ed;AAAA,MAEJ,CAAC;AAAA,MAED;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,eAAY;AAAA,UACZ,UAAU,CAAC,SAAS;AAAA,UACpB,SAAS;AAAA,UACT,WAAU;AAAA,UAET,iBAAO;AAAA;AAAA,MACV;AAAA,MAEA,oBAAC,OAAE,eAAY,SAAQ,WAAW,GAAG,uBAAuB,SAAS,GAClE,sBACH;AAAA,MAEA,oBAAC,OAAE,WAAU,WAAU,aAAU,UAC9B,uBACH;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/blocks/designs/marketplace-product-card/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,YAAY,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA"}
|