@asantemedia-org/edwardsvacuum-design-system 1.6.32 → 1.6.34
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.esm.js +62 -24
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +62 -24
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -239,6 +239,8 @@ function requireClassnames() {
|
|
|
239
239
|
var classnamesExports = requireClassnames();
|
|
240
240
|
var classnames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
241
241
|
|
|
242
|
+
// Debug mode - set to true to enable console logging
|
|
243
|
+
var DEBUG_ACCORDION = typeof window !== 'undefined' && window.__DEBUG_ACCORDION__;
|
|
242
244
|
var AccordionSection = function (_a) {
|
|
243
245
|
var title = _a.title,
|
|
244
246
|
children = _a.children,
|
|
@@ -256,13 +258,20 @@ var AccordionSection = function (_a) {
|
|
|
256
258
|
hasBeenOpened = _f[0],
|
|
257
259
|
setHasBeenOpened = _f[1];
|
|
258
260
|
var toggleAccordion = useCallback(function () {
|
|
261
|
+
if (DEBUG_ACCORDION) {
|
|
262
|
+
console.time("[AccordionSection] Toggle \"".concat(title, "\""));
|
|
263
|
+
console.log("[AccordionSection] Toggle clicked for \"".concat(title, "\", lazyLoad=").concat(lazyLoad, ", hasBeenOpened=").concat(hasBeenOpened));
|
|
264
|
+
}
|
|
259
265
|
setIsOpen(function (prev) {
|
|
260
266
|
if (!prev && !hasBeenOpened) {
|
|
261
267
|
setHasBeenOpened(true);
|
|
262
268
|
}
|
|
269
|
+
if (DEBUG_ACCORDION) {
|
|
270
|
+
console.timeEnd("[AccordionSection] Toggle \"".concat(title, "\""));
|
|
271
|
+
}
|
|
263
272
|
return !prev;
|
|
264
273
|
});
|
|
265
|
-
}, [hasBeenOpened]);
|
|
274
|
+
}, [hasBeenOpened, title, lazyLoad]);
|
|
266
275
|
var handleKeyDown = useCallback(function (e) {
|
|
267
276
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
268
277
|
e.preventDefault();
|
|
@@ -313,14 +322,22 @@ var cardSizeMapping = function (size) {
|
|
|
313
322
|
}
|
|
314
323
|
return classSrting;
|
|
315
324
|
};
|
|
316
|
-
|
|
317
|
-
var PLACEHOLDER_IMAGE = "/assets/edwards-webshop-placeholder.png";
|
|
318
|
-
var getImageUrl = function (imageUrl, placeholder) {
|
|
325
|
+
var getImageUrl = function (imageUrl) {
|
|
319
326
|
if (imageUrl) {
|
|
320
|
-
return imageUrl;
|
|
327
|
+
return imageUrl; // If an image URL is provided, use it.
|
|
328
|
+
}
|
|
329
|
+
try {
|
|
330
|
+
// Try loading from local assets (works in Storybook)
|
|
331
|
+
return require("../../../assets/edwards-webshop-placeholder.png").default.src;
|
|
332
|
+
} catch (error) {
|
|
333
|
+
// If that fails, load from node_modules (works in host app)
|
|
334
|
+
try {
|
|
335
|
+
return require("@asantemedia-org/edwardsvacuum-design-system/dist/assets/edwards-webshop-placeholder.png").default;
|
|
336
|
+
} catch (error) {
|
|
337
|
+
console.error("Placeholder image not found in either local assets or node_modules.", error);
|
|
338
|
+
return ""; // Fallback empty string if no image is found
|
|
339
|
+
}
|
|
321
340
|
}
|
|
322
|
-
// Use provided placeholder or default static path
|
|
323
|
-
return PLACEHOLDER_IMAGE;
|
|
324
341
|
};
|
|
325
342
|
var Card = function (_a) {
|
|
326
343
|
var contentCategoryLabel = _a.contentCategoryLabel,
|
|
@@ -421,7 +438,10 @@ var ProductCard = function (_a) {
|
|
|
421
438
|
icon: faArrowRight
|
|
422
439
|
}))))));
|
|
423
440
|
};
|
|
441
|
+
// Debug mode - set to true to enable console logging
|
|
442
|
+
var DEBUG_CARD = typeof window !== 'undefined' && window.__DEBUG_ACCORDION__;
|
|
424
443
|
var ProductDetailsCard = function (_a) {
|
|
444
|
+
var _b;
|
|
425
445
|
var className = _a.className,
|
|
426
446
|
title = _a.title;
|
|
427
447
|
_a.imageUrl;
|
|
@@ -430,6 +450,40 @@ var ProductDetailsCard = function (_a) {
|
|
|
430
450
|
_a.onClick;
|
|
431
451
|
var hit = _a.hit,
|
|
432
452
|
facets = _a.facets;
|
|
453
|
+
if (DEBUG_CARD) {
|
|
454
|
+
console.log("[ProductDetailsCard] Rendering, spares count: ".concat(((_b = hit === null || hit === void 0 ? void 0 : hit.spares) === null || _b === void 0 ? void 0 : _b.length) || 0));
|
|
455
|
+
}
|
|
456
|
+
// Memoize spares rendering to prevent re-computation
|
|
457
|
+
var renderSpares = function () {
|
|
458
|
+
if (!(hit === null || hit === void 0 ? void 0 : hit.spares) || hit.spares.length === 0) return null;
|
|
459
|
+
if (DEBUG_CARD) {
|
|
460
|
+
console.time('[ProductDetailsCard] Rendering spares');
|
|
461
|
+
}
|
|
462
|
+
var result = /*#__PURE__*/React.createElement("ul", {
|
|
463
|
+
className: "folding-spares-list"
|
|
464
|
+
}, hit.spares.map(function (spare, index) {
|
|
465
|
+
if (DEBUG_CARD && index === 0) {
|
|
466
|
+
console.log("[ProductDetailsCard] First spare:", spare);
|
|
467
|
+
}
|
|
468
|
+
return /*#__PURE__*/React.createElement("li", {
|
|
469
|
+
key: spare.objectID || spare.code || index
|
|
470
|
+
}, /*#__PURE__*/React.createElement(ProductCard, {
|
|
471
|
+
cardStyle: "type-card-product",
|
|
472
|
+
className: "cmp-card",
|
|
473
|
+
title: spare.name,
|
|
474
|
+
imageUrl: spare['img-product'] || spare.image,
|
|
475
|
+
imageAlt: spare.name,
|
|
476
|
+
productPrice: spare.priceValue || spare.price,
|
|
477
|
+
showProductPrice: false,
|
|
478
|
+
cardLink: spare.url || spare.link,
|
|
479
|
+
cta: "Go to webshop"
|
|
480
|
+
}));
|
|
481
|
+
}));
|
|
482
|
+
if (DEBUG_CARD) {
|
|
483
|
+
console.timeEnd('[ProductDetailsCard] Rendering spares');
|
|
484
|
+
}
|
|
485
|
+
return result;
|
|
486
|
+
};
|
|
433
487
|
return /*#__PURE__*/React.createElement("div", {
|
|
434
488
|
className: className
|
|
435
489
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -463,23 +517,7 @@ var ProductDetailsCard = function (_a) {
|
|
|
463
517
|
title: "Spares & Parts",
|
|
464
518
|
className: "folding-spares-holder",
|
|
465
519
|
lazyLoad: true
|
|
466
|
-
},
|
|
467
|
-
className: "folding-spares-list"
|
|
468
|
-
}, hit.spares.map(function (spare, index) {
|
|
469
|
-
return /*#__PURE__*/React.createElement("li", {
|
|
470
|
-
key: spare.objectID || spare.code || index
|
|
471
|
-
}, /*#__PURE__*/React.createElement(ProductCard, {
|
|
472
|
-
cardStyle: "type-card-product",
|
|
473
|
-
className: "cmp-card",
|
|
474
|
-
title: spare.name,
|
|
475
|
-
imageUrl: spare['img-product'] || spare.image,
|
|
476
|
-
imageAlt: spare.name,
|
|
477
|
-
productPrice: spare.priceValue || spare.price,
|
|
478
|
-
showProductPrice: false,
|
|
479
|
-
cardLink: spare.url || spare.link,
|
|
480
|
-
cta: "Go to webshop"
|
|
481
|
-
}));
|
|
482
|
-
})))));
|
|
520
|
+
}, renderSpares())));
|
|
483
521
|
};
|
|
484
522
|
|
|
485
523
|
function _extends() {
|