@propeller-commerce/propeller-v2-react-ui 0.15.11 → 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/CHANGELOG.md +107 -0
- package/README.md +17 -5
- package/dist/index.cjs +149 -114
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -5
- package/dist/index.d.ts +78 -5
- package/dist/index.js +149 -114
- package/dist/index.js.map +1 -1
- package/dist/pure.cjs +24 -19
- package/dist/pure.cjs.map +1 -1
- package/dist/pure.d.cts +10 -0
- package/dist/pure.d.ts +10 -0
- package/dist/pure.js +25 -20
- package/dist/pure.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/pure.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var propellerV2CoreUi = require('@propeller-commerce/propeller-v2-core-ui');
|
|
4
|
+
var clsx = require('clsx');
|
|
5
|
+
var tailwindMerge = require('tailwind-merge');
|
|
4
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
7
|
var React = require('react');
|
|
6
8
|
var propellerSdkV2 = require('@propeller-commerce/propeller-sdk-v2');
|
|
@@ -26,6 +28,9 @@ function _interopNamespace(e) {
|
|
|
26
28
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
29
|
|
|
28
30
|
// src/components/Breadcrumbs.tsx
|
|
31
|
+
function cn(...inputs) {
|
|
32
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
33
|
+
}
|
|
29
34
|
function Breadcrumbs(props) {
|
|
30
35
|
const lang = props.language || "NL";
|
|
31
36
|
const path = props.categoryPath || [];
|
|
@@ -58,7 +63,7 @@ function Breadcrumbs(props) {
|
|
|
58
63
|
return index === displayItems.length - 1;
|
|
59
64
|
}
|
|
60
65
|
const showSeparatorBefore = (index) => props.showHome !== false || index > 0;
|
|
61
|
-
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": propellerV2CoreUi.getLabel(props.labels, "breadcrumbAriaLabel", "Breadcrumb"), className: `propeller-breadcrumbs ${props.className || ""}
|
|
66
|
+
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": propellerV2CoreUi.getLabel(props.labels, "breadcrumbAriaLabel", "Breadcrumb"), className: cn(`propeller-breadcrumbs ${props.className || ""}`), children: /* @__PURE__ */ jsxRuntime.jsxs("ol", { className: "propeller-breadcrumbs__list flex flex-wrap items-center text-sm text-muted-foreground", children: [
|
|
62
67
|
props.showHome !== false ? /* @__PURE__ */ jsxRuntime.jsx("li", { className: "propeller-breadcrumbs__item flex items-center", "data-home": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
63
68
|
"a",
|
|
64
69
|
{
|
|
@@ -164,7 +169,7 @@ function CategoryShortDescription(props) {
|
|
|
164
169
|
(d) => d.language === props.language
|
|
165
170
|
);
|
|
166
171
|
const html = match?.value || "";
|
|
167
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: !!html ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: `propeller-category-short-description mb-6 ${props.className || ""}
|
|
172
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: !!html ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(`propeller-category-short-description mb-6 ${props.className || ""}`), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
168
173
|
"div",
|
|
169
174
|
{
|
|
170
175
|
className: "propeller-category-short-description__content prose prose-slate max-w-none text-muted-foreground",
|
|
@@ -174,7 +179,7 @@ function CategoryShortDescription(props) {
|
|
|
174
179
|
}
|
|
175
180
|
var CategoryShortDescription_default = CategoryShortDescription;
|
|
176
181
|
function GridTitle(props) {
|
|
177
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `propeller-grid-title mb-8 ${props.className || ""}
|
|
182
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(`propeller-grid-title mb-8 ${props.className || ""}`), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-grid-title__row flex items-baseline gap-3 mb-3", children: [
|
|
178
183
|
props.headingLevel === "h2" ? /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "propeller-grid-title__heading text-3xl sm:text-4xl font-bold tracking-tight", children: props.title }) : null,
|
|
179
184
|
props.headingLevel !== "h2" ? /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "propeller-grid-title__heading text-3xl sm:text-4xl font-bold tracking-tight", children: props.title }) : null
|
|
180
185
|
] }) });
|
|
@@ -222,7 +227,7 @@ function ItemStock(props) {
|
|
|
222
227
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: hasInventory() ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
223
228
|
"div",
|
|
224
229
|
{
|
|
225
|
-
className: `propeller-item-stock flex flex-wrap items-center gap-1.5 ${props.className || ""}
|
|
230
|
+
className: cn(`propeller-item-stock flex flex-wrap items-center gap-1.5 ${props.className || ""}`),
|
|
226
231
|
"data-available": isAvailable() ? "true" : "false",
|
|
227
232
|
"data-stock": getStockStatusData(),
|
|
228
233
|
children: [
|
|
@@ -261,22 +266,22 @@ function ItemStock(props) {
|
|
|
261
266
|
) }) : null });
|
|
262
267
|
}
|
|
263
268
|
var ItemStock_default = React__namespace.memo(ItemStock);
|
|
264
|
-
function getProductName(orderItem) {
|
|
265
|
-
return orderItem?.product?.names
|
|
269
|
+
function getProductName(orderItem, language) {
|
|
270
|
+
return propellerV2CoreUi.getLocalizedValue(orderItem?.product?.names, language, "") || orderItem?.name || "Unknown Product";
|
|
266
271
|
}
|
|
267
|
-
function getClusterUrl(orderItem) {
|
|
272
|
+
function getClusterUrl(orderItem, language) {
|
|
268
273
|
const cluster = orderItem?.product?.cluster;
|
|
269
274
|
if (!cluster) return "";
|
|
270
275
|
const id = cluster.clusterId;
|
|
271
|
-
const slug = cluster.slugs
|
|
276
|
+
const slug = propellerV2CoreUi.getLocalizedValue(cluster.slugs, language, "");
|
|
272
277
|
if (!id || !slug) return "";
|
|
273
278
|
return `/cluster/${id}/${slug}`;
|
|
274
279
|
}
|
|
275
|
-
function getProductUrl(orderItem) {
|
|
276
|
-
const cu = getClusterUrl(orderItem);
|
|
280
|
+
function getProductUrl(orderItem, language) {
|
|
281
|
+
const cu = getClusterUrl(orderItem, language);
|
|
277
282
|
if (cu) return cu;
|
|
278
283
|
const id = orderItem?.product?.productId;
|
|
279
|
-
const slug = orderItem?.product?.slugs
|
|
284
|
+
const slug = propellerV2CoreUi.getLocalizedValue(orderItem?.product?.slugs, language, "");
|
|
280
285
|
if (id && slug) return `/product/${id}/${slug}`;
|
|
281
286
|
return "";
|
|
282
287
|
}
|
|
@@ -291,10 +296,10 @@ function OrderItemCard(props) {
|
|
|
291
296
|
const showDiscount = props.showDiscount !== void 0 ? props.showDiscount : false;
|
|
292
297
|
const showStockComponent = props.showStockComponent !== void 0 ? props.showStockComponent : false;
|
|
293
298
|
const showItemNotes = props.showItemNotes !== void 0 ? props.showItemNotes : false;
|
|
294
|
-
const productName = getProductName(item);
|
|
299
|
+
const productName = getProductName(item, props.language);
|
|
295
300
|
const productSku = item?.product?.sku || item?.sku || "";
|
|
296
301
|
const productImage = item?.product?.media?.images?.items?.[0]?.imageVariants?.[0]?.url || "";
|
|
297
|
-
const productUrl = getProductUrl(item);
|
|
302
|
+
const productUrl = getProductUrl(item, props.language);
|
|
298
303
|
const quantity = item?.quantity || 0;
|
|
299
304
|
const priceTotal = item?.priceTotal || 0;
|
|
300
305
|
const discount = item?.discount || 0;
|
|
@@ -409,7 +414,7 @@ function OrderItemCard(props) {
|
|
|
409
414
|
className: "propeller-order-item-card__child-row border-0",
|
|
410
415
|
"data-child": "true",
|
|
411
416
|
children: [
|
|
412
|
-
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--product px-6 py-2 pl-28", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-order-item-card__child-title text-sm text-muted-foreground", children: child.product?.names
|
|
417
|
+
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--product px-6 py-2 pl-28", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "propeller-order-item-card__child-title text-sm text-muted-foreground", children: propellerV2CoreUi.getLocalizedValue(child.product?.names, props.language, "") || child.name || "Unknown" }) }),
|
|
413
418
|
showQuantity ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--quantity px-6 py-2 text-center text-sm text-muted-foreground", children: child.quantity || 0 }) : null,
|
|
414
419
|
showDiscount ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--discount px-6 py-2 text-right text-sm text-muted-foreground" }) : null,
|
|
415
420
|
showPrice ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: "propeller-order-item-card__cell propeller-order-item-card__cell--price px-6 py-2 text-right whitespace-nowrap text-sm text-muted-foreground", children: formatItemPrice(child.priceTotal || 0) }) : null
|
|
@@ -698,7 +703,7 @@ function ProductBulkPrices(props) {
|
|
|
698
703
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: !isHidden && hasItems ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
699
704
|
"div",
|
|
700
705
|
{
|
|
701
|
-
className: `propeller-product-bulk-prices ${props.className || ""}
|
|
706
|
+
className: cn(`propeller-product-bulk-prices ${props.className || ""}`),
|
|
702
707
|
"data-include-tax": includeTax ? "true" : "false",
|
|
703
708
|
children: [
|
|
704
709
|
propellerV2CoreUi.getLabel(props.labels, "title", "Volume pricing") ? /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "propeller-product-bulk-prices__title text-base font-semibold text-foreground mb-3", children: propellerV2CoreUi.getLabel(props.labels, "title", "Volume pricing") }) : null,
|
|
@@ -738,7 +743,7 @@ function ProductDownloads(props) {
|
|
|
738
743
|
const match = alts.find((a) => a.language === lang);
|
|
739
744
|
return match?.value || alts?.[0]?.value || "Download";
|
|
740
745
|
}
|
|
741
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `propeller-product-downloads ${props.className || ""}
|
|
746
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(`propeller-product-downloads ${props.className || ""}`), children: [
|
|
742
747
|
hasItems ? /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "propeller-product-downloads__title text-base font-semibold text-foreground mb-3", children: propellerV2CoreUi.getLabel(props.labels, "title", "Downloads") }) : null,
|
|
743
748
|
hasItems ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "propeller-product-downloads__list space-y-2", children: items.map((doc, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "propeller-product-downloads__item", children: !!getDocumentUrl(doc) ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
744
749
|
"a",
|
|
@@ -841,7 +846,7 @@ function ProductPriceDisplay(props) {
|
|
|
841
846
|
function getSecondaryTaxLabel() {
|
|
842
847
|
return props.includeTax ? propellerV2CoreUi.getLabel(props.labels, "exclTax", "excl. VAT") : propellerV2CoreUi.getLabel(props.labels, "inclTax", "incl. VAT");
|
|
843
848
|
}
|
|
844
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `propeller-product-price ${props.className || ""}
|
|
849
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(`propeller-product-price ${props.className || ""}`), "data-hidden": isHidden() ? "true" : "false", children: [
|
|
845
850
|
isHidden() && props.showLoginPrompt !== false ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "propeller-product-price__login-prompt text-sm text-muted-foreground italic", children: propellerV2CoreUi.getLabel(props.labels, "loginToSeePrices", "Log in to see prices") }) : null,
|
|
846
851
|
!isHidden() && !!getLeadingPrice() ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-product-price__content flex flex-col gap-0.5", children: [
|
|
847
852
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "propeller-product-price__primary flex items-baseline gap-2", children: [
|
|
@@ -875,7 +880,7 @@ function ProductShortDescription(props) {
|
|
|
875
880
|
"div",
|
|
876
881
|
{
|
|
877
882
|
dangerouslySetInnerHTML: { __html: html },
|
|
878
|
-
className: `propeller-product-short-description prose prose-slate max-w-none text-muted-foreground ${props.className || ""}`
|
|
883
|
+
className: cn(`propeller-product-short-description prose prose-slate max-w-none text-muted-foreground ${props.className || ""}`)
|
|
879
884
|
}
|
|
880
885
|
) : null });
|
|
881
886
|
}
|
|
@@ -918,7 +923,7 @@ function ProductVideos(props) {
|
|
|
918
923
|
}
|
|
919
924
|
return uri;
|
|
920
925
|
}
|
|
921
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `propeller-product-videos ${props.className || ""}
|
|
926
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(`propeller-product-videos ${props.className || ""}`), children: [
|
|
922
927
|
hasItems ? /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "propeller-product-videos__title text-base font-semibold text-foreground mb-3", children: propellerV2CoreUi.getLabel(props.labels, "title", "Videos") }) : null,
|
|
923
928
|
hasItems ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "propeller-product-videos__list space-y-4", children: items.map((video, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
924
929
|
"div",
|