@propeller-commerce/propeller-v2-react-ui 0.4.16 → 0.4.17
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/CHANGELOG.md +12 -0
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -219,6 +219,13 @@ interface ProductGridConfig {
|
|
|
219
219
|
clusterCardComponent?: ComponentType<{
|
|
220
220
|
cluster: Cluster;
|
|
221
221
|
} & Record<string, unknown>>;
|
|
222
|
+
/**
|
|
223
|
+
* Render arbitrary content directly below each card's product name. Receives
|
|
224
|
+
* the product; return `null`/`undefined` to render nothing. Lets hosts surface
|
|
225
|
+
* extra per-product info (e.g. package descriptions) across the whole grid
|
|
226
|
+
* without swapping the entire card.
|
|
227
|
+
*/
|
|
228
|
+
belowName?: (product: Product) => ReactNode;
|
|
222
229
|
}
|
|
223
230
|
/**
|
|
224
231
|
* Provider — ProductGrid wraps its card subtree with this so descendant
|
|
@@ -5193,6 +5200,14 @@ interface ProductCardProps {
|
|
|
5193
5200
|
badgesComponent?: React$1.ComponentType<_propeller_commerce_propeller_v2_core_ui.BadgesComponentProps>;
|
|
5194
5201
|
/** Replaces the default favorite-toggle. Receives `FavoriteComponentProps`. */
|
|
5195
5202
|
favoriteComponent?: React$1.ComponentType<_propeller_commerce_propeller_v2_core_ui.FavoriteComponentProps>;
|
|
5203
|
+
/**
|
|
5204
|
+
* Render arbitrary content directly below the product name (and above the
|
|
5205
|
+
* short description / price), in both the grid and row layouts. Receives the
|
|
5206
|
+
* product so hosts can surface extra info — e.g. package descriptions, custom
|
|
5207
|
+
* badges — without forking the card. Return `null`/`undefined` to render
|
|
5208
|
+
* nothing for a given product.
|
|
5209
|
+
*/
|
|
5210
|
+
belowName?: (product: Product) => React$1.ReactNode;
|
|
5196
5211
|
}
|
|
5197
5212
|
/**
|
|
5198
5213
|
* Root of the `<ProductCard>` compound component. Renders either the
|
|
@@ -5270,6 +5285,10 @@ declare function ProductCardStock(props: {
|
|
|
5270
5285
|
/** Show only the availability indicator. Defaults to context `showAvailability`. */
|
|
5271
5286
|
showAvailability?: boolean;
|
|
5272
5287
|
}): React$1.JSX.Element | null;
|
|
5288
|
+
/** Renders host-supplied content directly below the name, via the `belowName`
|
|
5289
|
+
* render prop (explicit or from grid context). Renders nothing when unset or
|
|
5290
|
+
* when the render prop returns a nullish value. */
|
|
5291
|
+
declare function ProductCardBelowName(): React$1.JSX.Element | null;
|
|
5273
5292
|
/** Renders the product price via the embedded `ProductPrice` component, or
|
|
5274
5293
|
* the injected `priceComponent` from context when set. */
|
|
5275
5294
|
declare function ProductCardPrice(props: {
|
|
@@ -5317,6 +5336,7 @@ type ProductCardComponent = typeof MemoizedRoot & {
|
|
|
5317
5336
|
Favorite: typeof ProductCardFavorite;
|
|
5318
5337
|
Name: typeof ProductCardName;
|
|
5319
5338
|
Sku: typeof ProductCardSku;
|
|
5339
|
+
BelowName: typeof ProductCardBelowName;
|
|
5320
5340
|
ShortDescription: typeof ProductCardShortDescription;
|
|
5321
5341
|
Manufacturer: typeof ProductCardManufacturer;
|
|
5322
5342
|
TextLabels: typeof ProductCardTextLabels;
|
|
@@ -5583,6 +5603,14 @@ interface ProductGridProps {
|
|
|
5583
5603
|
favoriteComponent?: React$1.ComponentType<_propeller_commerce_propeller_v2_core_ui.FavoriteComponentProps>;
|
|
5584
5604
|
productCardComponent?: React$1.ComponentType<ProductCardProps>;
|
|
5585
5605
|
clusterCardComponent?: React$1.ComponentType<ClusterCardProps>;
|
|
5606
|
+
/**
|
|
5607
|
+
* Render arbitrary content directly below each card's product name (and above
|
|
5608
|
+
* the short description / price). Receives the product; return `null` to
|
|
5609
|
+
* render nothing. Cascades to every ProductCard via ProductGridConfig — lets
|
|
5610
|
+
* hosts surface extra per-product info (e.g. package descriptions) without
|
|
5611
|
+
* swapping the whole card.
|
|
5612
|
+
*/
|
|
5613
|
+
belowName?: (product: Product) => React$1.ReactNode;
|
|
5586
5614
|
beforeItem?: (item: Product | Cluster, index: number) => React$1.ReactNode;
|
|
5587
5615
|
afterItem?: (item: Product | Cluster, index: number) => React$1.ReactNode;
|
|
5588
5616
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -219,6 +219,13 @@ interface ProductGridConfig {
|
|
|
219
219
|
clusterCardComponent?: ComponentType<{
|
|
220
220
|
cluster: Cluster;
|
|
221
221
|
} & Record<string, unknown>>;
|
|
222
|
+
/**
|
|
223
|
+
* Render arbitrary content directly below each card's product name. Receives
|
|
224
|
+
* the product; return `null`/`undefined` to render nothing. Lets hosts surface
|
|
225
|
+
* extra per-product info (e.g. package descriptions) across the whole grid
|
|
226
|
+
* without swapping the entire card.
|
|
227
|
+
*/
|
|
228
|
+
belowName?: (product: Product) => ReactNode;
|
|
222
229
|
}
|
|
223
230
|
/**
|
|
224
231
|
* Provider — ProductGrid wraps its card subtree with this so descendant
|
|
@@ -5193,6 +5200,14 @@ interface ProductCardProps {
|
|
|
5193
5200
|
badgesComponent?: React$1.ComponentType<_propeller_commerce_propeller_v2_core_ui.BadgesComponentProps>;
|
|
5194
5201
|
/** Replaces the default favorite-toggle. Receives `FavoriteComponentProps`. */
|
|
5195
5202
|
favoriteComponent?: React$1.ComponentType<_propeller_commerce_propeller_v2_core_ui.FavoriteComponentProps>;
|
|
5203
|
+
/**
|
|
5204
|
+
* Render arbitrary content directly below the product name (and above the
|
|
5205
|
+
* short description / price), in both the grid and row layouts. Receives the
|
|
5206
|
+
* product so hosts can surface extra info — e.g. package descriptions, custom
|
|
5207
|
+
* badges — without forking the card. Return `null`/`undefined` to render
|
|
5208
|
+
* nothing for a given product.
|
|
5209
|
+
*/
|
|
5210
|
+
belowName?: (product: Product) => React$1.ReactNode;
|
|
5196
5211
|
}
|
|
5197
5212
|
/**
|
|
5198
5213
|
* Root of the `<ProductCard>` compound component. Renders either the
|
|
@@ -5270,6 +5285,10 @@ declare function ProductCardStock(props: {
|
|
|
5270
5285
|
/** Show only the availability indicator. Defaults to context `showAvailability`. */
|
|
5271
5286
|
showAvailability?: boolean;
|
|
5272
5287
|
}): React$1.JSX.Element | null;
|
|
5288
|
+
/** Renders host-supplied content directly below the name, via the `belowName`
|
|
5289
|
+
* render prop (explicit or from grid context). Renders nothing when unset or
|
|
5290
|
+
* when the render prop returns a nullish value. */
|
|
5291
|
+
declare function ProductCardBelowName(): React$1.JSX.Element | null;
|
|
5273
5292
|
/** Renders the product price via the embedded `ProductPrice` component, or
|
|
5274
5293
|
* the injected `priceComponent` from context when set. */
|
|
5275
5294
|
declare function ProductCardPrice(props: {
|
|
@@ -5317,6 +5336,7 @@ type ProductCardComponent = typeof MemoizedRoot & {
|
|
|
5317
5336
|
Favorite: typeof ProductCardFavorite;
|
|
5318
5337
|
Name: typeof ProductCardName;
|
|
5319
5338
|
Sku: typeof ProductCardSku;
|
|
5339
|
+
BelowName: typeof ProductCardBelowName;
|
|
5320
5340
|
ShortDescription: typeof ProductCardShortDescription;
|
|
5321
5341
|
Manufacturer: typeof ProductCardManufacturer;
|
|
5322
5342
|
TextLabels: typeof ProductCardTextLabels;
|
|
@@ -5583,6 +5603,14 @@ interface ProductGridProps {
|
|
|
5583
5603
|
favoriteComponent?: React$1.ComponentType<_propeller_commerce_propeller_v2_core_ui.FavoriteComponentProps>;
|
|
5584
5604
|
productCardComponent?: React$1.ComponentType<ProductCardProps>;
|
|
5585
5605
|
clusterCardComponent?: React$1.ComponentType<ClusterCardProps>;
|
|
5606
|
+
/**
|
|
5607
|
+
* Render arbitrary content directly below each card's product name (and above
|
|
5608
|
+
* the short description / price). Receives the product; return `null` to
|
|
5609
|
+
* render nothing. Cascades to every ProductCard via ProductGridConfig — lets
|
|
5610
|
+
* hosts surface extra per-product info (e.g. package descriptions) without
|
|
5611
|
+
* swapping the whole card.
|
|
5612
|
+
*/
|
|
5613
|
+
belowName?: (product: Product) => React$1.ReactNode;
|
|
5586
5614
|
beforeItem?: (item: Product | Cluster, index: number) => React$1.ReactNode;
|
|
5587
5615
|
afterItem?: (item: Product | Cluster, index: number) => React$1.ReactNode;
|
|
5588
5616
|
}
|
package/dist/index.js
CHANGED
|
@@ -13302,7 +13302,8 @@ var RESOLVE_SPEC2 = {
|
|
|
13302
13302
|
addToCartComponent: { grid: "addToCartComponent" },
|
|
13303
13303
|
imageComponent: { grid: "imageComponent" },
|
|
13304
13304
|
badgesComponent: { grid: "badgesComponent" },
|
|
13305
|
-
favoriteComponent: { grid: "favoriteComponent" }
|
|
13305
|
+
favoriteComponent: { grid: "favoriteComponent" },
|
|
13306
|
+
belowName: { grid: "belowName" }
|
|
13306
13307
|
};
|
|
13307
13308
|
var ProductCardContext = createContext(null);
|
|
13308
13309
|
function useProductCard() {
|
|
@@ -13383,6 +13384,7 @@ function ProductCardRoot(rawProps) {
|
|
|
13383
13384
|
/* @__PURE__ */ jsx("div", { className: "propeller-product-card__body flex flex-1 flex-row items-center gap-4 px-4 py-2 min-w-0", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5 flex-1 min-w-0", children: [
|
|
13384
13385
|
props.showSku !== false && sku ? /* @__PURE__ */ jsx(ProductCardSku, {}) : null,
|
|
13385
13386
|
props.showName !== false ? /* @__PURE__ */ jsx(ProductCardName, { linkable: true }) : null,
|
|
13387
|
+
/* @__PURE__ */ jsx(ProductCardBelowName, {}),
|
|
13386
13388
|
textLabelValues.length > 0 ? /* @__PURE__ */ jsx(ProductCardTextLabels, {}) : null,
|
|
13387
13389
|
props.showManufacturer && manufacturer ? /* @__PURE__ */ jsx(ProductCardManufacturer, {}) : null,
|
|
13388
13390
|
props.showShortDescription && shortDescription ? /* @__PURE__ */ jsx(ProductCardShortDescription, {}) : null
|
|
@@ -13398,6 +13400,7 @@ function ProductCardRoot(rawProps) {
|
|
|
13398
13400
|
/* @__PURE__ */ jsxs("div", { className: "propeller-product-card__body flex flex-1 flex-col gap-1.5 p-3 sm:gap-2 sm:p-4", children: [
|
|
13399
13401
|
props.showSku !== false && sku ? /* @__PURE__ */ jsx(ProductCardSku, {}) : null,
|
|
13400
13402
|
props.showName !== false ? /* @__PURE__ */ jsx(ProductCardName, { linkable: true }) : null,
|
|
13403
|
+
/* @__PURE__ */ jsx(ProductCardBelowName, {}),
|
|
13401
13404
|
textLabelValues.length > 0 ? /* @__PURE__ */ jsx(ProductCardTextLabels, {}) : null,
|
|
13402
13405
|
props.showStock && !!product.inventory ? /* @__PURE__ */ jsx("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx(ProductCardStock, {}) }) : null,
|
|
13403
13406
|
props.showManufacturer && manufacturer ? /* @__PURE__ */ jsx(ProductCardManufacturer, {}) : null,
|
|
@@ -13580,6 +13583,13 @@ function ProductCardStock(props) {
|
|
|
13580
13583
|
}
|
|
13581
13584
|
);
|
|
13582
13585
|
}
|
|
13586
|
+
function ProductCardBelowName() {
|
|
13587
|
+
const { product, resolved } = useProductCard();
|
|
13588
|
+
if (!resolved.belowName) return null;
|
|
13589
|
+
const content = resolved.belowName(product);
|
|
13590
|
+
if (content == null || content === false) return null;
|
|
13591
|
+
return /* @__PURE__ */ jsx("div", { className: "propeller-product-card__below-name", children: content });
|
|
13592
|
+
}
|
|
13583
13593
|
function ProductCardPrice(props) {
|
|
13584
13594
|
const { product, derived, resolved } = useProductCard();
|
|
13585
13595
|
if (!product?.price) return null;
|
|
@@ -13658,6 +13668,7 @@ ProductCard.Badges = ProductCardBadges;
|
|
|
13658
13668
|
ProductCard.Favorite = ProductCardFavorite;
|
|
13659
13669
|
ProductCard.Name = ProductCardName;
|
|
13660
13670
|
ProductCard.Sku = ProductCardSku;
|
|
13671
|
+
ProductCard.BelowName = ProductCardBelowName;
|
|
13661
13672
|
ProductCard.ShortDescription = ProductCardShortDescription;
|
|
13662
13673
|
ProductCard.Manufacturer = ProductCardManufacturer;
|
|
13663
13674
|
ProductCard.TextLabels = ProductCardTextLabels;
|
|
@@ -14040,7 +14051,8 @@ function ProductGrid(rawProps) {
|
|
|
14040
14051
|
badgesComponent: props.badgesComponent,
|
|
14041
14052
|
favoriteComponent: props.favoriteComponent,
|
|
14042
14053
|
productCardComponent: props.productCardComponent,
|
|
14043
|
-
clusterCardComponent: props.clusterCardComponent
|
|
14054
|
+
clusterCardComponent: props.clusterCardComponent,
|
|
14055
|
+
belowName: props.belowName
|
|
14044
14056
|
};
|
|
14045
14057
|
if (rawProps.children !== void 0) {
|
|
14046
14058
|
const compoundCtx = {
|