@propeller-commerce/propeller-v2-react-ui 0.11.2 → 0.11.4

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/dist/index.d.cts CHANGED
@@ -6688,6 +6688,11 @@ interface ProductSliderProps {
6688
6688
  * add-to-cart in a semi-closed portal. The host owns navigation.
6689
6689
  */
6690
6690
  onLoginClick?: () => void;
6691
+ /**
6692
+ * Show the add-to-cart control on each card. Defaults to true; a semi-closed
6693
+ * portal still withholds it from anonymous visitors regardless.
6694
+ */
6695
+ allowAddToCart?: boolean;
6691
6696
  /** Called when "Request a Quote" is clicked in the AddToCart modal. */ onRequestQuoteClick?: (cart: Cart) => void;
6692
6697
  /** * Label overrides forwarded to the embedded AddToCart component. * Keys: add, adding, addedToCart, outOfStock, noCartId, errorAdding, * modalTitle, quantity, continueShopping, proceedToCheckout */ addToCartLabels?: Record<string, string>;
6693
6698
  /** Translated labels forwarded to embedded `<ProductCard>` instances. */
package/dist/index.d.ts CHANGED
@@ -6688,6 +6688,11 @@ interface ProductSliderProps {
6688
6688
  * add-to-cart in a semi-closed portal. The host owns navigation.
6689
6689
  */
6690
6690
  onLoginClick?: () => void;
6691
+ /**
6692
+ * Show the add-to-cart control on each card. Defaults to true; a semi-closed
6693
+ * portal still withholds it from anonymous visitors regardless.
6694
+ */
6695
+ allowAddToCart?: boolean;
6691
6696
  /** Called when "Request a Quote" is clicked in the AddToCart modal. */ onRequestQuoteClick?: (cart: Cart) => void;
6692
6697
  /** * Label overrides forwarded to the embedded AddToCart component. * Keys: add, adding, addedToCart, outOfStock, noCartId, errorAdding, * modalTitle, quantity, continueShopping, proceedToCheckout */ addToCartLabels?: Record<string, string>;
6693
6698
  /** Translated labels forwarded to embedded `<ProductCard>` instances. */
package/dist/index.js CHANGED
@@ -4587,7 +4587,7 @@ function AddToCart(rawProps) {
4587
4587
  "button",
4588
4588
  {
4589
4589
  type: "button",
4590
- className: "propeller-add-to-cart__submit flex-1 basis-full md:basis-auto inline-flex justify-center items-center gap-2 h-10 px-6 border border-transparent text-sm font-medium rounded-control text-secondary-foreground bg-secondary hover:bg-secondary/90 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-secondary disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
4590
+ className: "propeller-add-to-cart__submit flex-1 min-w-0 basis-full md:basis-auto inline-flex justify-center items-center gap-2 h-10 px-3 sm:px-6 border border-transparent text-sm font-medium rounded-control text-secondary-foreground bg-secondary hover:bg-secondary/80 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-secondary disabled:opacity-50 disabled:cursor-not-allowed transition-colors",
4591
4591
  onClick: () => handleAddToCart(),
4592
4592
  disabled: loading,
4593
4593
  children: [
@@ -4609,8 +4609,7 @@ function AddToCart(rawProps) {
4609
4609
  ]
4610
4610
  }
4611
4611
  ),
4612
- loading ? /* @__PURE__ */ jsx(Fragment, { children: getLabel(props.labels, "adding", "Adding...") }) : null,
4613
- !loading ? /* @__PURE__ */ jsx(Fragment, { children: getLabel(props.labels, "add", "Add") }) : null
4612
+ /* @__PURE__ */ jsx("span", { className: "propeller-add-to-cart__submit-label min-w-0 truncate", children: loading ? getLabel(props.labels, "adding", "Adding...") : getLabel(props.labels, "add", "Add") })
4614
4613
  ]
4615
4614
  }
4616
4615
  )
@@ -8363,8 +8362,8 @@ function ClusterCardViewClusterLink(props) {
8363
8362
  {
8364
8363
  href: derived.clusterUrl,
8365
8364
  onClick: handleClusterClick,
8366
- className: props.className ?? "propeller-cluster-card__cta-link flex w-full items-center justify-center rounded-control bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",
8367
- children: props.label ?? derived.viewClusterLabel
8365
+ className: props.className ?? "propeller-cluster-card__cta-link flex w-full min-w-0 items-center justify-center rounded-control bg-primary px-3 sm:px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/80 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",
8366
+ children: /* @__PURE__ */ jsx("span", { className: "propeller-cluster-card__cta-label min-w-0 truncate", children: props.label ?? derived.viewClusterLabel })
8368
8367
  }
8369
8368
  );
8370
8369
  }
@@ -16061,8 +16060,9 @@ function ProductSlider(rawProps) {
16061
16060
  function desktopCount() {
16062
16061
  return props.itemsPerView?.desktop || 4;
16063
16062
  }
16064
- function portalMode() {
16065
- return props.portalMode || "open";
16063
+ function showAddToCart() {
16064
+ const allow = props.allowAddToCart !== false;
16065
+ return !isContentHidden(props.portalMode, props.user) && allow;
16066
16066
  }
16067
16067
  function isCluster(item) {
16068
16068
  return "clusterId" in item && !("productId" in item);
@@ -16211,7 +16211,7 @@ function ProductSlider(rawProps) {
16211
16211
  ProductCardImpl,
16212
16212
  {
16213
16213
  product: item,
16214
- allowAddToCart: portalMode() === "open",
16214
+ allowAddToCart: showAddToCart(),
16215
16215
  labels: props.productCardLabels,
16216
16216
  stockLabels: props.stockLabels,
16217
16217
  priceLabels: props.priceLabels,