@propeller-commerce/propeller-v2-react-ui 0.26.0 → 0.26.1

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.js CHANGED
@@ -7,7 +7,7 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
7
7
  import { ProductStatus, ProductSortField, SortOrder, CrossupsellType, PriceDisplay, CartStatus, CartAddressType, Gender, YesNo, AddressType, MagicTokenService, PaymentStatuses, OrderSearchFields, OrderItemClass, ProductSearchableField, machineService, PurchaseRole, AttributeType, OrderSortField, OrderType, BundleCondition, OrderDiscountType } from '@propeller-commerce/propeller-sdk-v2';
8
8
  import { clsx } from 'clsx';
9
9
  import { twMerge } from 'tailwind-merge';
10
- import { User, Trash2, MessageSquareQuote } from 'lucide-react';
10
+ import { User, Trash2, Tag } from 'lucide-react';
11
11
 
12
12
  // src/index.ts
13
13
  var PropellerDepsContext = createContext(null);
@@ -7638,7 +7638,7 @@ function CartIconAndSidebar(rawProps) {
7638
7638
  ]
7639
7639
  }
7640
7640
  ),
7641
- props.showTotals && isHovered && totalItems > 0 ? /* @__PURE__ */ jsxs("div", { className: "propeller-cart-icon__popover absolute top-full right-0 mt-1 z-40 bg-popover border border-border rounded-container shadow-lg px-3 py-2 min-w-[140px] text-sm whitespace-nowrap", children: [
7641
+ props.showTotals && isHovered && totalItems > 0 ? /* @__PURE__ */ jsxs("div", { className: "propeller-cart-icon__popover absolute top-full right-0 mt-1 z-40 bg-popover text-foreground border border-border rounded-container shadow-lg px-3 py-2 min-w-[140px] text-sm whitespace-nowrap", children: [
7642
7642
  /* @__PURE__ */ jsxs("div", { className: "flex justify-between gap-4", children: [
7643
7643
  /* @__PURE__ */ jsx("span", { className: "propeller-cart-icon__popover-label text-muted-foreground", children: totalLabel("totalLabel") }),
7644
7644
  /* @__PURE__ */ jsx("span", { className: "propeller-cart-icon__popover-total font-semibold text-foreground", children: totalPrice })
@@ -7666,7 +7666,7 @@ function CartIconAndSidebar(rawProps) {
7666
7666
  "aria-modal": "true",
7667
7667
  "aria-label": sidebarTitle,
7668
7668
  "data-open": sidebarOpen ? "true" : "false",
7669
- className: cn(`propeller-cart-icon__sidebar fixed inset-y-0 right-0 z-[70] w-full max-w-md bg-card shadow-2xl transform transition-transform duration-300 ease-in-out border-l border-border${sidebarOpen ? " translate-x-0" : " translate-x-full"}${props.sidebarClassName ? " " + props.sidebarClassName : ""}`),
7669
+ className: cn(`propeller-cart-icon__sidebar fixed inset-y-0 right-0 z-[70] w-full max-w-md bg-card text-foreground shadow-2xl transform transition-transform duration-300 ease-in-out border-l border-border${sidebarOpen ? " translate-x-0" : " translate-x-full"}${props.sidebarClassName ? " " + props.sidebarClassName : ""}`),
7670
7670
  children: /* @__PURE__ */ jsx("div", { className: "flex flex-col h-full", children: isMounted ? /* @__PURE__ */ jsxs(Fragment, { children: [
7671
7671
  /* @__PURE__ */ jsxs("div", { className: "propeller-cart-icon__sidebar-header flex items-center justify-between px-5 py-4 border-b border-border", children: [
7672
7672
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
@@ -9327,7 +9327,7 @@ function ProductCardPrice(props) {
9327
9327
  ) });
9328
9328
  }
9329
9329
  function ProductCardAddToCart(props) {
9330
- const { product, resolved } = useProductCard();
9330
+ const { product, derived, resolved, handleProductClick } = useProductCard();
9331
9331
  if (isContentHidden(resolved.portalMode, resolved.user, resolved.isAuthenticated)) {
9332
9332
  return /* @__PURE__ */ jsx(
9333
9333
  LoginToOrderButton_default,
@@ -9338,6 +9338,19 @@ function ProductCardAddToCart(props) {
9338
9338
  }
9339
9339
  );
9340
9340
  }
9341
+ if (isPriceOnRequest(product)) {
9342
+ return /* @__PURE__ */ jsx(
9343
+ "a",
9344
+ {
9345
+ href: derived.productUrl,
9346
+ onClick: handleProductClick,
9347
+ className: cn(
9348
+ `propeller-product-card__view-product inline-flex h-10 w-full items-center justify-center rounded-control bg-primary px-4 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90 ${props.className || ""}`
9349
+ ),
9350
+ children: getLabel(resolved.priceLabels, "requestPrice", "Request a price")
9351
+ }
9352
+ );
9353
+ }
9341
9354
  const InjectedAddToCart = resolved.addToCartComponent;
9342
9355
  if (InjectedAddToCart) {
9343
9356
  return /* @__PURE__ */ jsx(
@@ -11893,7 +11906,7 @@ function FavoriteListItemActions(props) {
11893
11906
  className: props.className ?? "propeller-favorite-list-item__actions flex items-center gap-2 flex-shrink-0",
11894
11907
  onClick: (e) => e.stopPropagation(),
11895
11908
  children: [
11896
- resolved.allowAddToCart !== false && isProduct && !!resolved.graphqlClient ? /* @__PURE__ */ jsx(
11909
+ resolved.allowAddToCart !== false && isProduct && !!resolved.graphqlClient && !isPriceOnRequest(product) ? /* @__PURE__ */ jsx(
11897
11910
  AddToCart_default,
11898
11911
  {
11899
11912
  className: "flex items-center gap-2",
@@ -14656,7 +14669,7 @@ function RequestPriceButton(props) {
14656
14669
  if (props.onRequestPrice) props.onRequestPrice();
14657
14670
  },
14658
14671
  children: [
14659
- /* @__PURE__ */ jsx(MessageSquareQuote, { className: "propeller-request-price__icon w-4 h-4", "aria-hidden": "true" }),
14672
+ /* @__PURE__ */ jsx(Tag, { className: "propeller-request-price__icon w-4 h-4", "aria-hidden": "true" }),
14660
14673
  label
14661
14674
  ]
14662
14675
  }
@@ -19332,7 +19345,7 @@ function SearchBar(rawProps) {
19332
19345
  // boilerplate's dark header band happened to make work: on a
19333
19346
  // light header `bg-white/95 border-white/20` rendered as an
19334
19347
  // invisible input.
19335
- "propeller-search-bar__input w-full pl-10 pr-10 py-2 bg-card border border-input rounded-container focus:outline-none focus:ring-2 focus:ring-secondary placeholder:text-muted-foreground",
19348
+ "propeller-search-bar__input w-full pl-10 pr-10 py-2 bg-card text-foreground border border-input rounded-container focus:outline-none focus:ring-2 focus:ring-secondary placeholder:text-muted-foreground",
19336
19349
  props.inputClassName
19337
19350
  ),
19338
19351
  placeholder: props.placeholder || "Search products...",
@@ -19342,7 +19355,7 @@ function SearchBar(rawProps) {
19342
19355
  ),
19343
19356
  searchLoading ? /* @__PURE__ */ jsx("div", { className: "propeller-search-bar__spinner-wrapper absolute right-3 top-1/2 transform -translate-y-1/2", children: /* @__PURE__ */ jsx("div", { className: "propeller-search-bar__spinner animate-spin rounded-full h-5 w-5 border-b-2 border-primary" }) }) : null
19344
19357
  ] }) }),
19345
- showDropdown ? /* @__PURE__ */ jsxs("div", { className: "propeller-search-bar__dropdown absolute top-full left-0 right-0 mt-2 bg-card rounded-container shadow-xl border border-border z-50 flex flex-col max-h-96", children: [
19358
+ showDropdown ? /* @__PURE__ */ jsxs("div", { className: "propeller-search-bar__dropdown absolute top-full left-0 right-0 mt-2 bg-card text-foreground rounded-container shadow-xl border border-border z-50 flex flex-col max-h-96", children: [
19346
19359
  results.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
19347
19360
  /* @__PURE__ */ jsx("div", { className: "propeller-search-bar__results flex-1 overflow-y-auto", children: results?.map((result, index) => {
19348
19361
  const ResultTag = props.getResultHref ? "a" : "div";