@propeller-commerce/propeller-v2-react-ui 0.16.0 → 0.18.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/dist/pure.js CHANGED
@@ -1,9 +1,14 @@
1
1
  import { buildClusterJsonLd, safeJsonStringify, buildItemListJsonLd, buildProductJsonLd, getLabel, getLocalizedValue, isContentHidden, formatPrice, getCountryName } from '@propeller-commerce/propeller-v2-core-ui';
2
+ import { clsx } from 'clsx';
3
+ import { twMerge } from 'tailwind-merge';
2
4
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
5
  import * as React from 'react';
4
6
  import { OrderDiscountType, YesNo } from '@propeller-commerce/propeller-sdk-v2';
5
7
 
6
8
  // src/components/Breadcrumbs.tsx
9
+ function cn(...inputs) {
10
+ return twMerge(clsx(inputs));
11
+ }
7
12
  function Breadcrumbs(props) {
8
13
  const lang = props.language || "NL";
9
14
  const path = props.categoryPath || [];
@@ -36,7 +41,7 @@ function Breadcrumbs(props) {
36
41
  return index === displayItems.length - 1;
37
42
  }
38
43
  const showSeparatorBefore = (index) => props.showHome !== false || index > 0;
39
- return /* @__PURE__ */ jsx("nav", { "aria-label": getLabel(props.labels, "breadcrumbAriaLabel", "Breadcrumb"), className: `propeller-breadcrumbs ${props.className || ""}`, children: /* @__PURE__ */ jsxs("ol", { className: "propeller-breadcrumbs__list flex flex-wrap items-center text-sm text-muted-foreground", children: [
44
+ return /* @__PURE__ */ jsx("nav", { "aria-label": getLabel(props.labels, "breadcrumbAriaLabel", "Breadcrumb"), className: cn(`propeller-breadcrumbs ${props.className || ""}`), children: /* @__PURE__ */ jsxs("ol", { className: "propeller-breadcrumbs__list flex flex-wrap items-center text-sm text-muted-foreground", children: [
40
45
  props.showHome !== false ? /* @__PURE__ */ jsx("li", { className: "propeller-breadcrumbs__item flex items-center", "data-home": "true", children: /* @__PURE__ */ jsx(
41
46
  "a",
42
47
  {
@@ -142,7 +147,7 @@ function CategoryShortDescription(props) {
142
147
  (d) => d.language === props.language
143
148
  );
144
149
  const html = match?.value || "";
145
- return /* @__PURE__ */ jsx(Fragment, { children: !!html ? /* @__PURE__ */ jsx("div", { className: `propeller-category-short-description mb-6 ${props.className || ""}`, children: /* @__PURE__ */ jsx(
150
+ return /* @__PURE__ */ jsx(Fragment, { children: !!html ? /* @__PURE__ */ jsx("div", { className: cn(`propeller-category-short-description mb-6 ${props.className || ""}`), children: /* @__PURE__ */ jsx(
146
151
  "div",
147
152
  {
148
153
  className: "propeller-category-short-description__content prose prose-slate max-w-none text-muted-foreground",
@@ -152,7 +157,7 @@ function CategoryShortDescription(props) {
152
157
  }
153
158
  var CategoryShortDescription_default = CategoryShortDescription;
154
159
  function GridTitle(props) {
155
- return /* @__PURE__ */ jsx("div", { className: `propeller-grid-title mb-8 ${props.className || ""}`, children: /* @__PURE__ */ jsxs("div", { className: "propeller-grid-title__row flex items-baseline gap-3 mb-3", children: [
160
+ return /* @__PURE__ */ jsx("div", { className: cn(`propeller-grid-title mb-8 ${props.className || ""}`), children: /* @__PURE__ */ jsxs("div", { className: "propeller-grid-title__row flex items-baseline gap-3 mb-3", children: [
156
161
  props.headingLevel === "h2" ? /* @__PURE__ */ jsx("h2", { className: "propeller-grid-title__heading text-3xl sm:text-4xl font-bold tracking-tight", children: props.title }) : null,
157
162
  props.headingLevel !== "h2" ? /* @__PURE__ */ jsx("h1", { className: "propeller-grid-title__heading text-3xl sm:text-4xl font-bold tracking-tight", children: props.title }) : null
158
163
  ] }) });
@@ -200,7 +205,7 @@ function ItemStock(props) {
200
205
  return /* @__PURE__ */ jsx(Fragment, { children: hasInventory() ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
201
206
  "div",
202
207
  {
203
- className: `propeller-item-stock flex flex-wrap items-center gap-1.5 ${props.className || ""}`,
208
+ className: cn(`propeller-item-stock flex flex-wrap items-center gap-1.5 ${props.className || ""}`),
204
209
  "data-available": isAvailable() ? "true" : "false",
205
210
  "data-stock": getStockStatusData(),
206
211
  children: [
@@ -676,7 +681,7 @@ function ProductBulkPrices(props) {
676
681
  return /* @__PURE__ */ jsx(Fragment, { children: !isHidden && hasItems ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
677
682
  "div",
678
683
  {
679
- className: `propeller-product-bulk-prices ${props.className || ""}`,
684
+ className: cn(`propeller-product-bulk-prices ${props.className || ""}`),
680
685
  "data-include-tax": includeTax ? "true" : "false",
681
686
  children: [
682
687
  getLabel(props.labels, "title", "Volume pricing") ? /* @__PURE__ */ jsx("h3", { className: "propeller-product-bulk-prices__title text-base font-semibold text-foreground mb-3", children: getLabel(props.labels, "title", "Volume pricing") }) : null,
@@ -716,7 +721,7 @@ function ProductDownloads(props) {
716
721
  const match = alts.find((a) => a.language === lang);
717
722
  return match?.value || alts?.[0]?.value || "Download";
718
723
  }
719
- return /* @__PURE__ */ jsxs("div", { className: `propeller-product-downloads ${props.className || ""}`, children: [
724
+ return /* @__PURE__ */ jsxs("div", { className: cn(`propeller-product-downloads ${props.className || ""}`), children: [
720
725
  hasItems ? /* @__PURE__ */ jsx("h3", { className: "propeller-product-downloads__title text-base font-semibold text-foreground mb-3", children: getLabel(props.labels, "title", "Downloads") }) : null,
721
726
  hasItems ? /* @__PURE__ */ jsx("ul", { className: "propeller-product-downloads__list space-y-2", children: items.map((doc, index) => /* @__PURE__ */ jsx("li", { className: "propeller-product-downloads__item", children: !!getDocumentUrl(doc) ? /* @__PURE__ */ jsxs(
722
727
  "a",
@@ -819,7 +824,7 @@ function ProductPriceDisplay(props) {
819
824
  function getSecondaryTaxLabel() {
820
825
  return props.includeTax ? getLabel(props.labels, "exclTax", "excl. VAT") : getLabel(props.labels, "inclTax", "incl. VAT");
821
826
  }
822
- return /* @__PURE__ */ jsxs("div", { className: `propeller-product-price ${props.className || ""}`, "data-hidden": isHidden() ? "true" : "false", children: [
827
+ return /* @__PURE__ */ jsxs("div", { className: cn(`propeller-product-price ${props.className || ""}`), "data-hidden": isHidden() ? "true" : "false", children: [
823
828
  isHidden() && props.showLoginPrompt !== false ? /* @__PURE__ */ jsx("p", { className: "propeller-product-price__login-prompt text-sm text-muted-foreground italic", children: getLabel(props.labels, "loginToSeePrices", "Log in to see prices") }) : null,
824
829
  !isHidden() && !!getLeadingPrice() ? /* @__PURE__ */ jsxs("div", { className: "propeller-product-price__content flex flex-col gap-0.5", children: [
825
830
  /* @__PURE__ */ jsxs("div", { className: "propeller-product-price__primary flex items-baseline gap-2", children: [
@@ -853,7 +858,7 @@ function ProductShortDescription(props) {
853
858
  "div",
854
859
  {
855
860
  dangerouslySetInnerHTML: { __html: html },
856
- className: `propeller-product-short-description prose prose-slate max-w-none text-muted-foreground ${props.className || ""}`
861
+ className: cn(`propeller-product-short-description prose prose-slate max-w-none text-muted-foreground ${props.className || ""}`)
857
862
  }
858
863
  ) : null });
859
864
  }
@@ -896,7 +901,7 @@ function ProductVideos(props) {
896
901
  }
897
902
  return uri;
898
903
  }
899
- return /* @__PURE__ */ jsxs("div", { className: `propeller-product-videos ${props.className || ""}`, children: [
904
+ return /* @__PURE__ */ jsxs("div", { className: cn(`propeller-product-videos ${props.className || ""}`), children: [
900
905
  hasItems ? /* @__PURE__ */ jsx("h3", { className: "propeller-product-videos__title text-base font-semibold text-foreground mb-3", children: getLabel(props.labels, "title", "Videos") }) : null,
901
906
  hasItems ? /* @__PURE__ */ jsx("div", { className: "propeller-product-videos__list space-y-4", children: items.map((video, index) => /* @__PURE__ */ jsx(
902
907
  "div",