@asantemedia-org/edwardsvacuum-design-system 1.3.1 → 1.3.3
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 +24 -21
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +26 -23
- package/dist/index.js.map +1 -1
- package/dist/stories/components/Card/card.d.ts +2 -2
- package/dist/stories/components/Card/card.types.d.ts +1 -0
- package/dist/stories/experiences/Algolia-dynamic-search/algolia-dynamic-search.d.ts +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React, { 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
|
|
4490
|
+
var FontAwesomeIcon = /*#__PURE__*/React.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
|
|
4555
|
+
var convertCurry = convert.bind(null, React.createElement);
|
|
4556
4556
|
|
|
4557
4557
|
/*!
|
|
4558
4558
|
* Font Awesome Pro 6.7.2 by @fontawesome - https://fontawesome.com
|
|
@@ -4601,7 +4601,7 @@ var getImageUrl = function (imageUrl) {
|
|
|
4601
4601
|
} catch (error) {
|
|
4602
4602
|
// If that fails, load from node_modules (works in host app)
|
|
4603
4603
|
try {
|
|
4604
|
-
return require('@asantemedia-org/edwardsvacuum-design-system/dist/assets/
|
|
4604
|
+
return require('@asantemedia-org/edwardsvacuum-design-system/dist/assets/edwards-webshop-placeholder.pngg').default;
|
|
4605
4605
|
} catch (error) {
|
|
4606
4606
|
console.error("Placeholder image not found in either local assets or node_modules.", error);
|
|
4607
4607
|
return ''; // Fallback empty string if no image is found
|
|
@@ -4622,6 +4622,7 @@ var Card = function (_a) {
|
|
|
4622
4622
|
cardLink = _a.cardLink,
|
|
4623
4623
|
city = _a.city,
|
|
4624
4624
|
country = _a.country,
|
|
4625
|
+
placeholder = _a.placeholder,
|
|
4625
4626
|
onClick = _a.onClick;
|
|
4626
4627
|
var mode = getStyle("cmp-card--".concat(cardStyle));
|
|
4627
4628
|
var width = cardSizeMapping(size);
|
|
@@ -4636,7 +4637,7 @@ var Card = function (_a) {
|
|
|
4636
4637
|
}, /*#__PURE__*/React.createElement("div", {
|
|
4637
4638
|
className: getStyle('cmp-card__content-wrapper')
|
|
4638
4639
|
}, /*#__PURE__*/React.createElement("div", {
|
|
4639
|
-
className: "".concat(getStyle('cmp-card__image-wrapper'), " ").concat(!imageUrl ? getStyle('placeholderImage') : '')
|
|
4640
|
+
className: "".concat(getStyle('cmp-card__image-wrapper'), " ").concat(!imageUrl || placeholder ? getStyle('placeholderImage') : '')
|
|
4640
4641
|
}, /*#__PURE__*/React.createElement("picture", null, /*#__PURE__*/React.createElement("img", {
|
|
4641
4642
|
src: contentImage,
|
|
4642
4643
|
alt: imageAlt
|
|
@@ -4673,6 +4674,7 @@ var ProductCard = function (_a) {
|
|
|
4673
4674
|
cardLink = _a.cardLink,
|
|
4674
4675
|
cta = _a.cta,
|
|
4675
4676
|
cardStyle = _a.cardStyle,
|
|
4677
|
+
placeholder = _a.placeholder,
|
|
4676
4678
|
onClick = _a.onClick;
|
|
4677
4679
|
var width = cardSizeMapping(size);
|
|
4678
4680
|
var mode = getStyle("cmp-card--".concat(cardStyle));
|
|
@@ -4690,7 +4692,7 @@ var ProductCard = function (_a) {
|
|
|
4690
4692
|
}, /*#__PURE__*/React.createElement("figure", null, /*#__PURE__*/React.createElement("img", {
|
|
4691
4693
|
src: productImage,
|
|
4692
4694
|
alt: imageAlt,
|
|
4693
|
-
className: !imageUrl ? 'placeholderImage' : undefined
|
|
4695
|
+
className: !imageUrl || placeholder ? 'placeholderImage' : undefined
|
|
4694
4696
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
4695
4697
|
className: getStyle('cmp-card--type-card-product__meta')
|
|
4696
4698
|
}, /*#__PURE__*/React.createElement("p", {
|
|
@@ -4722,7 +4724,7 @@ var Button = function (_a) {
|
|
|
4722
4724
|
label = _a.label,
|
|
4723
4725
|
props = __rest(_a, ["style", "label"]);
|
|
4724
4726
|
var mode = style ? "cmp-button--style-".concat(style) : '';
|
|
4725
|
-
return /*#__PURE__*/React
|
|
4727
|
+
return /*#__PURE__*/React.createElement("button", _extends({
|
|
4726
4728
|
className: ['cmp-button', mode].join(' ')
|
|
4727
4729
|
}, props), label);
|
|
4728
4730
|
};
|
|
@@ -4742,7 +4744,7 @@ var DynamicHeading = function (_a) {
|
|
|
4742
4744
|
children = _a.children,
|
|
4743
4745
|
props = __rest(_a, ["titleSize", "children"]);
|
|
4744
4746
|
var Tag = ["h2", "h3", "h4", "h5", "h6"].includes(titleSize) ? titleSize : "h2";
|
|
4745
|
-
return /*#__PURE__*/React
|
|
4747
|
+
return /*#__PURE__*/React.createElement(Tag, props, children);
|
|
4746
4748
|
};
|
|
4747
4749
|
var AlgoliaDynamicSearch = function (_a) {
|
|
4748
4750
|
var _b = _a.className,
|
|
@@ -4764,6 +4766,7 @@ var AlgoliaDynamicSearch = function (_a) {
|
|
|
4764
4766
|
maxResults = _e === void 0 ? 10 : _e,
|
|
4765
4767
|
_f = _a.isLoading,
|
|
4766
4768
|
isLoading = _f === void 0 ? false : _f,
|
|
4769
|
+
placeholder = _a.placeholder,
|
|
4767
4770
|
analytics = _a.analytics;
|
|
4768
4771
|
var _g = useState(isLoading),
|
|
4769
4772
|
isLoadingState = _g[0],
|
|
@@ -4794,35 +4797,35 @@ var AlgoliaDynamicSearch = function (_a) {
|
|
|
4794
4797
|
if (!hits || hits.length === 0) {
|
|
4795
4798
|
return null;
|
|
4796
4799
|
}
|
|
4797
|
-
return /*#__PURE__*/React
|
|
4800
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4798
4801
|
className: componentClassNames
|
|
4799
|
-
}, isLoadingState && /*#__PURE__*/React
|
|
4802
|
+
}, isLoadingState && /*#__PURE__*/React.createElement("div", {
|
|
4800
4803
|
className: styles$4.cmpAlgoliaDynamicSearchWidget__placeholder
|
|
4801
|
-
}, /*#__PURE__*/React
|
|
4804
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4802
4805
|
className: styles$4.cmpAlgoliaDynamicSearchWidget__placeholder__loading
|
|
4803
|
-
})), /*#__PURE__*/React
|
|
4806
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
4804
4807
|
className: styles$4.cmpAlgoliaDynamicSearchWidget__container
|
|
4805
|
-
}, /*#__PURE__*/React
|
|
4808
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4806
4809
|
className: styles$4.cmpAlgoliaDynamicSearchWidget__header
|
|
4807
|
-
}, /*#__PURE__*/React
|
|
4810
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4808
4811
|
className: styles$4.cmpAlgoliaDynamicSearchWidget__header__text
|
|
4809
|
-
}, /*#__PURE__*/React
|
|
4812
|
+
}, /*#__PURE__*/React.createElement(DynamicHeading, {
|
|
4810
4813
|
titleSize: titleSize
|
|
4811
|
-
}, heading), /*#__PURE__*/React
|
|
4814
|
+
}, heading), /*#__PURE__*/React.createElement("p", null, subtext)), callToActionUrl && /*#__PURE__*/React.createElement("div", {
|
|
4812
4815
|
className: styles$4.cmpAlgoliaDynamicSearchWidget__header__cta
|
|
4813
|
-
}, /*#__PURE__*/React
|
|
4816
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
4814
4817
|
style: widgetStyleProps.buttonStyle,
|
|
4815
4818
|
label: callToActionText,
|
|
4816
4819
|
onClick: function () {
|
|
4817
4820
|
return window.open(callToActionUrl, "_blank", "noopener,noreferrer");
|
|
4818
4821
|
}
|
|
4819
|
-
}))), /*#__PURE__*/React
|
|
4822
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
4820
4823
|
className: styles$4.cmpAlgoliaDynamicSearchWidget__cards
|
|
4821
4824
|
}, hits.slice(0, maxResults).map(function (hit, index) {
|
|
4822
4825
|
var Component = Card;
|
|
4823
4826
|
var title = hit.title;
|
|
4824
4827
|
var cardStyle = "";
|
|
4825
|
-
var imageUrl = hit.image;
|
|
4828
|
+
var imageUrl = hit.image || placeholder;
|
|
4826
4829
|
var cardLink = hitUtm ? "".concat(hit.link, "?").concat(hitUtm) : hit.link;
|
|
4827
4830
|
var contentCategoryLabel = hit.contentCategoryLabel || "";
|
|
4828
4831
|
var contentCategoryColour = hit.contentCategoryColour || "";
|
|
@@ -4844,11 +4847,12 @@ var AlgoliaDynamicSearch = function (_a) {
|
|
|
4844
4847
|
default:
|
|
4845
4848
|
return null;
|
|
4846
4849
|
}
|
|
4847
|
-
return /*#__PURE__*/React
|
|
4850
|
+
return /*#__PURE__*/React.createElement(Component, {
|
|
4848
4851
|
key: index,
|
|
4849
4852
|
className: cardClassName,
|
|
4850
4853
|
title: title,
|
|
4851
4854
|
imageUrl: imageUrl,
|
|
4855
|
+
placeholder: hit.image ? false : true,
|
|
4852
4856
|
cta: hitCta,
|
|
4853
4857
|
size: "",
|
|
4854
4858
|
cardStyle: cardStyle,
|
|
@@ -4861,7 +4865,6 @@ var AlgoliaDynamicSearch = function (_a) {
|
|
|
4861
4865
|
country: hit.country,
|
|
4862
4866
|
onClick: function () {
|
|
4863
4867
|
if (!analytics) return;
|
|
4864
|
-
console.log(hit);
|
|
4865
4868
|
var objectID = hit.objectID,
|
|
4866
4869
|
__position = hit.__position,
|
|
4867
4870
|
__queryID = hit.__queryID;
|