@propeller-commerce/propeller-v2-react-ui 0.26.1 → 0.28.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/CHANGELOG.md +83 -0
- package/dist/index.cjs +201 -76
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +201 -78
- package/dist/index.js.map +1 -1
- package/dist/pure.cjs +46 -4
- package/dist/pure.cjs.map +1 -1
- package/dist/pure.d.cts +18 -3
- package/dist/pure.d.ts +18 -3
- package/dist/pure.js +46 -5
- package/dist/pure.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -3
package/dist/pure.d.cts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Category, Cluster, Product, ProductInventory, OrderItem, Order, ProductPrice, Contact, Customer, PaginatedMediaDocumentResponse, ClusterOption, PaginatedMediaVideoResponse } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
2
|
import * as _propeller_commerce_propeller_v2_core_ui from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
|
-
import { JsonLdContext } from '@propeller-commerce/propeller-v2-core-ui';
|
|
3
|
+
import { ImgComponentProps, JsonLdContext } from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
|
+
import { Category, Cluster, Product, ProductInventory, OrderItem, Order, ProductPrice, Contact, Customer, PaginatedMediaDocumentResponse, ClusterOption, PaginatedMediaVideoResponse } from '@propeller-commerce/propeller-sdk-v2';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @rsc-safe — Pure display component. No React hooks, no event handlers, no
|
|
8
|
+
* browser APIs, no context reads. Renders directly from props and can be
|
|
9
|
+
* imported into a React Server Component without a 'use client' boundary.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface PropellerImgProps extends ImgComponentProps {
|
|
13
|
+
/** The host's image component. RSC-safe callers pass it; others use `useImgComponent()`. */
|
|
14
|
+
as?: React.ComponentType<ImgComponentProps>;
|
|
15
|
+
}
|
|
16
|
+
/** The package's single `<img>` site. Falls back to `<img>` when nothing is injected. */
|
|
17
|
+
declare function PropellerImg({ as: Injected, ...props }: PropellerImgProps): React.JSX.Element;
|
|
5
18
|
|
|
6
19
|
/**
|
|
7
20
|
* @rsc-safe — Pure display component. No React hooks, no event handlers, no
|
|
@@ -295,6 +308,8 @@ interface OrderItemCardProps {
|
|
|
295
308
|
labels?: Record<string, string>;
|
|
296
309
|
priceComponent?: React.ComponentType<_propeller_commerce_propeller_v2_core_ui.PriceComponentProps>;
|
|
297
310
|
stockComponent?: React.ComponentType<_propeller_commerce_propeller_v2_core_ui.StockComponentProps>;
|
|
311
|
+
/** Replaces the `<img>`. Passed directly: this component reads no context. */
|
|
312
|
+
imgComponent?: React.ComponentType<_propeller_commerce_propeller_v2_core_ui.ImgComponentProps>;
|
|
298
313
|
}
|
|
299
314
|
/**
|
|
300
315
|
* Renders a single order line item as a table row (with optional indented
|
|
@@ -649,4 +664,4 @@ interface ProductVideosProps {
|
|
|
649
664
|
*/
|
|
650
665
|
declare function ProductVideos(props: ProductVideosProps): React.JSX.Element;
|
|
651
666
|
|
|
652
|
-
export { Breadcrumbs, type BreadcrumbsProps, CategoryShortDescription, type CategoryShortDescriptionProps, _default$3 as ClusterJsonLd, type ClusterJsonLdProps, GridTitle, type GridTitleProps, _default$2 as ItemListJsonLd, type ItemListJsonLdProps, _default as ItemStock, type ItemStockProps, OrderItemCard, type OrderItemCardProps, OrderSummary, type OrderSummaryProps, OrderTotals, type OrderTotalsProps, ProductBulkPrices, type ProductBulkPricesProps, ProductDownloads, type ProductDownloadsProps, _default$1 as ProductJsonLd, type ProductJsonLdProps, ProductPriceDisplay as ProductPrice, type ProductPriceProps, ProductShortDescription, type ProductShortDescriptionProps, ProductVideos, type ProductVideosProps };
|
|
667
|
+
export { Breadcrumbs, type BreadcrumbsProps, CategoryShortDescription, type CategoryShortDescriptionProps, _default$3 as ClusterJsonLd, type ClusterJsonLdProps, GridTitle, type GridTitleProps, _default$2 as ItemListJsonLd, type ItemListJsonLdProps, _default as ItemStock, type ItemStockProps, OrderItemCard, type OrderItemCardProps, OrderSummary, type OrderSummaryProps, OrderTotals, type OrderTotalsProps, ProductBulkPrices, type ProductBulkPricesProps, ProductDownloads, type ProductDownloadsProps, _default$1 as ProductJsonLd, type ProductJsonLdProps, ProductPriceDisplay as ProductPrice, type ProductPriceProps, ProductShortDescription, type ProductShortDescriptionProps, ProductVideos, type ProductVideosProps, PropellerImg, type PropellerImgProps };
|
package/dist/pure.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Category, Cluster, Product, ProductInventory, OrderItem, Order, ProductPrice, Contact, Customer, PaginatedMediaDocumentResponse, ClusterOption, PaginatedMediaVideoResponse } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
2
|
import * as _propeller_commerce_propeller_v2_core_ui from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
|
-
import { JsonLdContext } from '@propeller-commerce/propeller-v2-core-ui';
|
|
3
|
+
import { ImgComponentProps, JsonLdContext } from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
|
+
import { Category, Cluster, Product, ProductInventory, OrderItem, Order, ProductPrice, Contact, Customer, PaginatedMediaDocumentResponse, ClusterOption, PaginatedMediaVideoResponse } from '@propeller-commerce/propeller-sdk-v2';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @rsc-safe — Pure display component. No React hooks, no event handlers, no
|
|
8
|
+
* browser APIs, no context reads. Renders directly from props and can be
|
|
9
|
+
* imported into a React Server Component without a 'use client' boundary.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
interface PropellerImgProps extends ImgComponentProps {
|
|
13
|
+
/** The host's image component. RSC-safe callers pass it; others use `useImgComponent()`. */
|
|
14
|
+
as?: React.ComponentType<ImgComponentProps>;
|
|
15
|
+
}
|
|
16
|
+
/** The package's single `<img>` site. Falls back to `<img>` when nothing is injected. */
|
|
17
|
+
declare function PropellerImg({ as: Injected, ...props }: PropellerImgProps): React.JSX.Element;
|
|
5
18
|
|
|
6
19
|
/**
|
|
7
20
|
* @rsc-safe — Pure display component. No React hooks, no event handlers, no
|
|
@@ -295,6 +308,8 @@ interface OrderItemCardProps {
|
|
|
295
308
|
labels?: Record<string, string>;
|
|
296
309
|
priceComponent?: React.ComponentType<_propeller_commerce_propeller_v2_core_ui.PriceComponentProps>;
|
|
297
310
|
stockComponent?: React.ComponentType<_propeller_commerce_propeller_v2_core_ui.StockComponentProps>;
|
|
311
|
+
/** Replaces the `<img>`. Passed directly: this component reads no context. */
|
|
312
|
+
imgComponent?: React.ComponentType<_propeller_commerce_propeller_v2_core_ui.ImgComponentProps>;
|
|
298
313
|
}
|
|
299
314
|
/**
|
|
300
315
|
* Renders a single order line item as a table row (with optional indented
|
|
@@ -649,4 +664,4 @@ interface ProductVideosProps {
|
|
|
649
664
|
*/
|
|
650
665
|
declare function ProductVideos(props: ProductVideosProps): React.JSX.Element;
|
|
651
666
|
|
|
652
|
-
export { Breadcrumbs, type BreadcrumbsProps, CategoryShortDescription, type CategoryShortDescriptionProps, _default$3 as ClusterJsonLd, type ClusterJsonLdProps, GridTitle, type GridTitleProps, _default$2 as ItemListJsonLd, type ItemListJsonLdProps, _default as ItemStock, type ItemStockProps, OrderItemCard, type OrderItemCardProps, OrderSummary, type OrderSummaryProps, OrderTotals, type OrderTotalsProps, ProductBulkPrices, type ProductBulkPricesProps, ProductDownloads, type ProductDownloadsProps, _default$1 as ProductJsonLd, type ProductJsonLdProps, ProductPriceDisplay as ProductPrice, type ProductPriceProps, ProductShortDescription, type ProductShortDescriptionProps, ProductVideos, type ProductVideosProps };
|
|
667
|
+
export { Breadcrumbs, type BreadcrumbsProps, CategoryShortDescription, type CategoryShortDescriptionProps, _default$3 as ClusterJsonLd, type ClusterJsonLdProps, GridTitle, type GridTitleProps, _default$2 as ItemListJsonLd, type ItemListJsonLdProps, _default as ItemStock, type ItemStockProps, OrderItemCard, type OrderItemCardProps, OrderSummary, type OrderSummaryProps, OrderTotals, type OrderTotalsProps, ProductBulkPrices, type ProductBulkPricesProps, ProductDownloads, type ProductDownloadsProps, _default$1 as ProductJsonLd, type ProductJsonLdProps, ProductPriceDisplay as ProductPrice, type ProductPriceProps, ProductShortDescription, type ProductShortDescriptionProps, ProductVideos, type ProductVideosProps, PropellerImg, type PropellerImgProps };
|
package/dist/pure.js
CHANGED
|
@@ -1,11 +1,27 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
1
2
|
import { buildClusterJsonLd, safeJsonStringify, buildItemListJsonLd, buildProductJsonLd, getLabel, getLocalizedValue, isContentHidden, formatPrice, localeForLanguage, getCountryName, resolveLanguageEntry, getLanguageString, getLanguageUri } from '@propeller-commerce/propeller-v2-core-ui';
|
|
2
3
|
import { clsx } from 'clsx';
|
|
3
4
|
import { twMerge } from 'tailwind-merge';
|
|
4
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { OrderDiscountType, YesNo } from '@propeller-commerce/propeller-sdk-v2';
|
|
7
7
|
|
|
8
|
-
// src/components/
|
|
8
|
+
// src/components/PropellerImg.tsx
|
|
9
|
+
function PropellerImg({ as: Injected, ...props }) {
|
|
10
|
+
if (Injected) return /* @__PURE__ */ jsx(Injected, { ...props });
|
|
11
|
+
const { src, alt, className, width, height, loading, onClick } = props;
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
"img",
|
|
14
|
+
{
|
|
15
|
+
src,
|
|
16
|
+
alt,
|
|
17
|
+
className,
|
|
18
|
+
width,
|
|
19
|
+
height,
|
|
20
|
+
loading,
|
|
21
|
+
onClick
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
9
25
|
function cn(...inputs) {
|
|
10
26
|
return twMerge(clsx(inputs));
|
|
11
27
|
}
|
|
@@ -245,6 +261,28 @@ function ItemStock(props) {
|
|
|
245
261
|
) }) : null });
|
|
246
262
|
}
|
|
247
263
|
var ItemStock_default = React.memo(ItemStock);
|
|
264
|
+
var warnedOnce = /* @__PURE__ */ new Set();
|
|
265
|
+
function warnOnce(key, message) {
|
|
266
|
+
if (warnedOnce.has(key)) return;
|
|
267
|
+
warnedOnce.add(key);
|
|
268
|
+
console.warn(message);
|
|
269
|
+
}
|
|
270
|
+
function warnMissingProps(props) {
|
|
271
|
+
if (process.env.NODE_ENV === "production") return;
|
|
272
|
+
if (!props.language) {
|
|
273
|
+
warnOnce(
|
|
274
|
+
"language",
|
|
275
|
+
"[OrderItemCard] No `language` prop: product names resolve in the default catalogue language, whatever page they are on. This component reads no context (it ships from the RSC-safe /pure entry), so the host must pass it."
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
const linkable = props.titleLinkable !== void 0 ? props.titleLinkable : true;
|
|
279
|
+
if (linkable && !props.configuration?.urls) {
|
|
280
|
+
warnOnce(
|
|
281
|
+
"urls",
|
|
282
|
+
"[OrderItemCard] Title is linkable but no `configuration.urls` was passed: links fall back to a literal /product/:id/:slug and lose the locale prefix. Pass the url builders from the host, or set titleLinkable={false}."
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
248
286
|
function getProductName(orderItem, language) {
|
|
249
287
|
return getLocalizedValue(orderItem?.product?.names, language, "") || orderItem?.name || "Unknown Product";
|
|
250
288
|
}
|
|
@@ -268,6 +306,7 @@ function getProductUrl(orderItem, language, urls) {
|
|
|
268
306
|
function OrderItemCard(props) {
|
|
269
307
|
const item = props.orderItem;
|
|
270
308
|
const isChildItem = props.isChildItem || false;
|
|
309
|
+
warnMissingProps(props);
|
|
271
310
|
const titleLinkable = props.titleLinkable !== void 0 ? props.titleLinkable : true;
|
|
272
311
|
const showImage = isChildItem ? false : props.showImage !== void 0 ? props.showImage : true;
|
|
273
312
|
const showSku = isChildItem ? false : props.showSku !== void 0 ? props.showSku : true;
|
|
@@ -308,11 +347,13 @@ function OrderItemCard(props) {
|
|
|
308
347
|
className: `propeller-order-item-card__cell propeller-order-item-card__cell--product ${isChildItem ? "px-6 py-2 pl-28" : "px-6 py-4"}`,
|
|
309
348
|
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
310
349
|
showImage ? productImage ? /* @__PURE__ */ jsx("div", { className: "propeller-order-item-card__media relative w-16 h-16 flex-shrink-0 rounded overflow-hidden", children: /* @__PURE__ */ jsx(
|
|
311
|
-
|
|
350
|
+
PropellerImg,
|
|
312
351
|
{
|
|
352
|
+
as: props.imgComponent,
|
|
313
353
|
className: "propeller-order-item-card__image object-cover w-full h-full",
|
|
314
354
|
src: productImage,
|
|
315
|
-
alt: productName
|
|
355
|
+
alt: productName,
|
|
356
|
+
loading: "lazy"
|
|
316
357
|
}
|
|
317
358
|
) }) : /* @__PURE__ */ jsx("div", { className: "propeller-order-item-card__image-placeholder w-16 h-16 bg-surface-hover rounded flex items-center justify-center text-foreground-subtle text-xs", children: getLabel(props.labels, "noImage", "No Img") }) : null,
|
|
318
359
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -935,6 +976,6 @@ function ProductVideos(props) {
|
|
|
935
976
|
}
|
|
936
977
|
var ProductVideos_default = ProductVideos;
|
|
937
978
|
|
|
938
|
-
export { Breadcrumbs_default as Breadcrumbs, CategoryShortDescription_default as CategoryShortDescription, ClusterJsonLd_default as ClusterJsonLd, GridTitle_default as GridTitle, ItemListJsonLd_default as ItemListJsonLd, ItemStock_default as ItemStock, OrderItemCard_default as OrderItemCard, OrderSummary_default as OrderSummary, OrderTotals_default as OrderTotals, ProductBulkPrices_default as ProductBulkPrices, ProductDownloads_default as ProductDownloads, ProductJsonLd_default as ProductJsonLd, ProductPrice_default as ProductPrice, ProductShortDescription_default as ProductShortDescription, ProductVideos_default as ProductVideos };
|
|
979
|
+
export { Breadcrumbs_default as Breadcrumbs, CategoryShortDescription_default as CategoryShortDescription, ClusterJsonLd_default as ClusterJsonLd, GridTitle_default as GridTitle, ItemListJsonLd_default as ItemListJsonLd, ItemStock_default as ItemStock, OrderItemCard_default as OrderItemCard, OrderSummary_default as OrderSummary, OrderTotals_default as OrderTotals, ProductBulkPrices_default as ProductBulkPrices, ProductDownloads_default as ProductDownloads, ProductJsonLd_default as ProductJsonLd, ProductPrice_default as ProductPrice, ProductShortDescription_default as ProductShortDescription, ProductVideos_default as ProductVideos, PropellerImg };
|
|
939
980
|
//# sourceMappingURL=pure.js.map
|
|
940
981
|
//# sourceMappingURL=pure.js.map
|