@asantemedia-org/edwardsvacuum-design-system 1.2.9 → 1.3.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.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React$1, { useState, useEffect } from 'react';
2
2
 
3
3
  /******************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -4487,7 +4487,7 @@ var defaultProps = {
4487
4487
  transform: null,
4488
4488
  swapOpacity: false
4489
4489
  };
4490
- var FontAwesomeIcon = /*#__PURE__*/React.forwardRef(function (props, ref) {
4490
+ var FontAwesomeIcon = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
4491
4491
  var allProps = _objectSpread2(_objectSpread2({}, defaultProps), props);
4492
4492
  var iconArgs = allProps.icon,
4493
4493
  maskArgs = allProps.mask,
@@ -4552,7 +4552,7 @@ FontAwesomeIcon.propTypes = {
4552
4552
  transform: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
4553
4553
  swapOpacity: PropTypes.bool
4554
4554
  };
4555
- var convertCurry = convert.bind(null, React.createElement);
4555
+ var convertCurry = convert.bind(null, React$1.createElement);
4556
4556
 
4557
4557
  /*!
4558
4558
  * Font Awesome Pro 6.7.2 by @fontawesome - https://fontawesome.com
@@ -4570,8 +4570,6 @@ const faChevronRight = {
4570
4570
  icon: [320, 512, [9002], "f054", "M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"]
4571
4571
  };
4572
4572
 
4573
- var placeHolderImage = "3697809e28f9e0fe.png";
4574
-
4575
4573
  // Utility function to retrieve correct SCSS module class names
4576
4574
  var getStyle = function (className) {
4577
4575
  if (styles$3[className]) return styles$3[className];
@@ -4593,6 +4591,23 @@ var cardSizeMapping = function (size) {
4593
4591
  }
4594
4592
  return classSrting;
4595
4593
  };
4594
+ var getImageUrl = function (imageUrl) {
4595
+ if (imageUrl) {
4596
+ return imageUrl; // If an image URL is provided, use it.
4597
+ }
4598
+ try {
4599
+ // Try loading from local assets (works in Storybook)
4600
+ return require('../../../assets/edwards-webshop-placeholder.png').default.src;
4601
+ } catch (error) {
4602
+ // If that fails, load from node_modules (works in host app)
4603
+ try {
4604
+ return require('@asantemedia-org/edwardsvacuum-design-system/dist/assets/3697809e28f9e0fe.png').default;
4605
+ } catch (error) {
4606
+ console.error("Placeholder image not found in either local assets or node_modules.", error);
4607
+ return ''; // Fallback empty string if no image is found
4608
+ }
4609
+ }
4610
+ };
4596
4611
  var Card = function (_a) {
4597
4612
  var contentCategoryLabel = _a.contentCategoryLabel,
4598
4613
  className = _a.className,
@@ -4611,7 +4626,7 @@ var Card = function (_a) {
4611
4626
  var mode = getStyle("cmp-card--".concat(cardStyle));
4612
4627
  var width = cardSizeMapping(size);
4613
4628
  var categoryColour = colour ? "cmp-card__content-category-wrapper__colour-".concat(colour) : '';
4614
- var contentImage = imageUrl ? imageUrl : placeHolderImage.src;
4629
+ var contentImage = getImageUrl(imageUrl);
4615
4630
  return /*#__PURE__*/React.createElement("div", {
4616
4631
  className: classnames(getStyle('cmp-card'), mode, width, getStyle(className))
4617
4632
  }, /*#__PURE__*/React.createElement("a", {
@@ -4659,10 +4674,9 @@ var ProductCard = function (_a) {
4659
4674
  cta = _a.cta,
4660
4675
  cardStyle = _a.cardStyle,
4661
4676
  onClick = _a.onClick;
4662
- console.log(imageUrl);
4663
4677
  var width = cardSizeMapping(size);
4664
4678
  var mode = getStyle("cmp-card--".concat(cardStyle));
4665
- var productImage = imageUrl ? imageUrl : placeHolderImage.src;
4679
+ var productImage = getImageUrl(imageUrl);
4666
4680
  return /*#__PURE__*/React.createElement("div", {
4667
4681
  className: classnames(getStyle('cmp-card'), mode, width, className)
4668
4682
  }, /*#__PURE__*/React.createElement("a", {
@@ -4708,7 +4722,7 @@ var Button = function (_a) {
4708
4722
  label = _a.label,
4709
4723
  props = __rest(_a, ["style", "label"]);
4710
4724
  var mode = style ? "cmp-button--style-".concat(style) : '';
4711
- return /*#__PURE__*/React.createElement("button", _extends({
4725
+ return /*#__PURE__*/React$1.createElement("button", _extends({
4712
4726
  className: ['cmp-button', mode].join(' ')
4713
4727
  }, props), label);
4714
4728
  };
@@ -4728,7 +4742,7 @@ var DynamicHeading = function (_a) {
4728
4742
  children = _a.children,
4729
4743
  props = __rest(_a, ["titleSize", "children"]);
4730
4744
  var Tag = ["h2", "h3", "h4", "h5", "h6"].includes(titleSize) ? titleSize : "h2";
4731
- return /*#__PURE__*/React.createElement(Tag, props, children);
4745
+ return /*#__PURE__*/React$1.createElement(Tag, props, children);
4732
4746
  };
4733
4747
  var AlgoliaDynamicSearch = function (_a) {
4734
4748
  var _b = _a.className,
@@ -4780,29 +4794,29 @@ var AlgoliaDynamicSearch = function (_a) {
4780
4794
  if (!hits || hits.length === 0) {
4781
4795
  return null;
4782
4796
  }
4783
- return /*#__PURE__*/React.createElement("div", {
4797
+ return /*#__PURE__*/React$1.createElement("div", {
4784
4798
  className: componentClassNames
4785
- }, isLoadingState && /*#__PURE__*/React.createElement("div", {
4799
+ }, isLoadingState && /*#__PURE__*/React$1.createElement("div", {
4786
4800
  className: styles$4.cmpAlgoliaDynamicSearchWidget__placeholder
4787
- }, /*#__PURE__*/React.createElement("div", {
4801
+ }, /*#__PURE__*/React$1.createElement("div", {
4788
4802
  className: styles$4.cmpAlgoliaDynamicSearchWidget__placeholder__loading
4789
- })), /*#__PURE__*/React.createElement("div", {
4803
+ })), /*#__PURE__*/React$1.createElement("div", {
4790
4804
  className: styles$4.cmpAlgoliaDynamicSearchWidget__container
4791
- }, /*#__PURE__*/React.createElement("div", {
4805
+ }, /*#__PURE__*/React$1.createElement("div", {
4792
4806
  className: styles$4.cmpAlgoliaDynamicSearchWidget__header
4793
- }, /*#__PURE__*/React.createElement("div", {
4807
+ }, /*#__PURE__*/React$1.createElement("div", {
4794
4808
  className: styles$4.cmpAlgoliaDynamicSearchWidget__header__text
4795
- }, /*#__PURE__*/React.createElement(DynamicHeading, {
4809
+ }, /*#__PURE__*/React$1.createElement(DynamicHeading, {
4796
4810
  titleSize: titleSize
4797
- }, heading), /*#__PURE__*/React.createElement("p", null, subtext)), callToActionUrl && /*#__PURE__*/React.createElement("div", {
4811
+ }, heading), /*#__PURE__*/React$1.createElement("p", null, subtext)), callToActionUrl && /*#__PURE__*/React$1.createElement("div", {
4798
4812
  className: styles$4.cmpAlgoliaDynamicSearchWidget__header__cta
4799
- }, /*#__PURE__*/React.createElement(Button, {
4813
+ }, /*#__PURE__*/React$1.createElement(Button, {
4800
4814
  style: widgetStyleProps.buttonStyle,
4801
4815
  label: callToActionText,
4802
4816
  onClick: function () {
4803
4817
  return window.open(callToActionUrl, "_blank", "noopener,noreferrer");
4804
4818
  }
4805
- }))), /*#__PURE__*/React.createElement("div", {
4819
+ }))), /*#__PURE__*/React$1.createElement("div", {
4806
4820
  className: styles$4.cmpAlgoliaDynamicSearchWidget__cards
4807
4821
  }, hits.slice(0, maxResults).map(function (hit, index) {
4808
4822
  var Component = Card;
@@ -4830,7 +4844,7 @@ var AlgoliaDynamicSearch = function (_a) {
4830
4844
  default:
4831
4845
  return null;
4832
4846
  }
4833
- return /*#__PURE__*/React.createElement(Component, {
4847
+ return /*#__PURE__*/React$1.createElement(Component, {
4834
4848
  key: index,
4835
4849
  className: cardClassName,
4836
4850
  title: title,