@asantemedia-org/edwardsvacuum-design-system 1.6.53 → 1.6.55
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 +6 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +45 -44
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactFontawesome = require('@fortawesome/react-fontawesome');
|
|
5
|
+
var proSolidSvgIcons = require('@fortawesome/pro-solid-svg-icons');
|
|
6
|
+
var uuid = require('uuid');
|
|
7
|
+
var reactInternationalPhone = require('react-international-phone');
|
|
6
8
|
|
|
7
9
|
/******************************************************************************
|
|
8
10
|
Copyright (c) Microsoft Corporation.
|
|
@@ -249,15 +251,15 @@ var AccordionSection = function (_a) {
|
|
|
249
251
|
defaultOpen = _c === void 0 ? false : _c,
|
|
250
252
|
_d = _a.lazyLoad,
|
|
251
253
|
lazyLoad = _d === void 0 ? false : _d;
|
|
252
|
-
var _e = useState(defaultOpen),
|
|
254
|
+
var _e = React.useState(defaultOpen),
|
|
253
255
|
isOpen = _e[0],
|
|
254
256
|
setIsOpen = _e[1];
|
|
255
|
-
var _f = useState(defaultOpen),
|
|
257
|
+
var _f = React.useState(defaultOpen),
|
|
256
258
|
hasBeenOpened = _f[0],
|
|
257
259
|
setHasBeenOpened = _f[1];
|
|
258
260
|
// Prevent rapid clicks
|
|
259
|
-
var isToggling = useRef(false);
|
|
260
|
-
var toggleAccordion = useCallback(function (e) {
|
|
261
|
+
var isToggling = React.useRef(false);
|
|
262
|
+
var toggleAccordion = React.useCallback(function (e) {
|
|
261
263
|
// Stop event propagation to prevent AEM handlers
|
|
262
264
|
e.stopPropagation();
|
|
263
265
|
e.preventDefault();
|
|
@@ -278,7 +280,7 @@ var AccordionSection = function (_a) {
|
|
|
278
280
|
}, 300);
|
|
279
281
|
});
|
|
280
282
|
}, [hasBeenOpened]);
|
|
281
|
-
var handleKeyDown = useCallback(function (e) {
|
|
283
|
+
var handleKeyDown = React.useCallback(function (e) {
|
|
282
284
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
283
285
|
toggleAccordion(e);
|
|
284
286
|
}
|
|
@@ -302,8 +304,8 @@ var AccordionSection = function (_a) {
|
|
|
302
304
|
transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
303
305
|
transition: 'transform 0.2s ease'
|
|
304
306
|
}
|
|
305
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
306
|
-
icon: faChevronDown,
|
|
307
|
+
}, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
308
|
+
icon: proSolidSvgIcons.faChevronDown,
|
|
307
309
|
color: "#C4262E"
|
|
308
310
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
309
311
|
className: "accordion-section__content",
|
|
@@ -405,12 +407,12 @@ var Card = function (_a) {
|
|
|
405
407
|
className: getClassName("cmp-card__city-country")
|
|
406
408
|
}, city, " ", city && country ? ", " : "", " ", country), cardStyle === "type-card-panel" ? /*#__PURE__*/React.createElement("span", {
|
|
407
409
|
className: classnames(getClassName("cmp-card__footer"), cardFooterColour)
|
|
408
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
409
|
-
icon: faChevronRight
|
|
410
|
+
}, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
411
|
+
icon: proSolidSvgIcons.faChevronRight
|
|
410
412
|
})) : cardStyle === "label" ? /*#__PURE__*/React.createElement("span", {
|
|
411
413
|
className: getClassName("cmp-card__footer")
|
|
412
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
413
|
-
icon: faArrowRight
|
|
414
|
+
}, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
415
|
+
icon: proSolidSvgIcons.faArrowRight
|
|
414
416
|
})) : /*#__PURE__*/React.createElement("span", {
|
|
415
417
|
className: getClassName("cmp-card__footer")
|
|
416
418
|
}, /*#__PURE__*/React.createElement("span", null, cta))))));
|
|
@@ -462,8 +464,8 @@ var ProductCard = function (_a) {
|
|
|
462
464
|
className: getClassName("cmp-card--type-card-product__prices")
|
|
463
465
|
}, productPrice) : "", /*#__PURE__*/React.createElement("p", {
|
|
464
466
|
className: getClassName("cmp-card--type-card-product__cta")
|
|
465
|
-
}, cta ? cta : /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
466
|
-
icon: faArrowRight
|
|
467
|
+
}, cta ? cta : /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
468
|
+
icon: proSolidSvgIcons.faArrowRight
|
|
467
469
|
}))))));
|
|
468
470
|
};
|
|
469
471
|
// Maximum spares to render to prevent browser freeze
|
|
@@ -670,16 +672,16 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
670
672
|
var ProductDetailsCard$1 = (innerComponents === null || innerComponents === void 0 ? void 0 : innerComponents.ProductDetailsCard) || ProductDetailsCard;
|
|
671
673
|
var Button$1 = (innerComponents === null || innerComponents === void 0 ? void 0 : innerComponents.Button) || Button;
|
|
672
674
|
// Helper to resolve CSS module class names properly
|
|
673
|
-
var getClass = useCallback(function (suffix) {
|
|
675
|
+
var getClass = React.useCallback(function (suffix) {
|
|
674
676
|
var fullClassName = "cmpAlgoliaDynamicSearchWidget".concat(suffix);
|
|
675
677
|
return useScopedStyles && styles ? styles[fullClassName] : fullClassName;
|
|
676
678
|
}, [useScopedStyles, styles]);
|
|
677
679
|
// Helper for modifier classes (without the base prefix)
|
|
678
|
-
var getModifierClass = useCallback(function (modifier) {
|
|
680
|
+
var getModifierClass = React.useCallback(function (modifier) {
|
|
679
681
|
return useScopedStyles && styles ? styles[modifier] : modifier;
|
|
680
682
|
}, [useScopedStyles, styles]);
|
|
681
683
|
// Memoize background styling to prevent re-renders
|
|
682
|
-
var widgetStyleProps = useMemo(function () {
|
|
684
|
+
var widgetStyleProps = React.useMemo(function () {
|
|
683
685
|
var backgroundStyles = {
|
|
684
686
|
"dark-grey": {
|
|
685
687
|
buttonStyle: "outlineWhite",
|
|
@@ -703,7 +705,7 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
703
705
|
}
|
|
704
706
|
var baseClass = getClass('');
|
|
705
707
|
// Memoize wrapper class names
|
|
706
|
-
var wrapperClasses = useMemo(function () {
|
|
708
|
+
var wrapperClasses = React.useMemo(function () {
|
|
707
709
|
return [baseClass, widgetStyleProps.containerBackground, isLoading ? getModifierClass('isLoading') : '', queryType === 'content' ? getModifierClass('isQueryContent') : ''].filter(Boolean).join(' ');
|
|
708
710
|
}, [baseClass, widgetStyleProps.containerBackground, isLoading, queryType, getModifierClass]);
|
|
709
711
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -843,7 +845,7 @@ function RenderField(field) {
|
|
|
843
845
|
maxLength: field.maxLength
|
|
844
846
|
});
|
|
845
847
|
case "tel":
|
|
846
|
-
return /*#__PURE__*/React.createElement(PhoneInput, {
|
|
848
|
+
return /*#__PURE__*/React.createElement(reactInternationalPhone.PhoneInput, {
|
|
847
849
|
value: field.value || '',
|
|
848
850
|
onChange: function (phone) {
|
|
849
851
|
if (field.onPhoneChange) {
|
|
@@ -934,11 +936,11 @@ var FormFieldRenderer = function (props) {
|
|
|
934
936
|
};
|
|
935
937
|
|
|
936
938
|
var QrFormField = function (props) {
|
|
937
|
-
var _a = useState(''),
|
|
939
|
+
var _a = React.useState(''),
|
|
938
940
|
inputId = _a[0],
|
|
939
941
|
setInputId = _a[1];
|
|
940
|
-
useEffect(function () {
|
|
941
|
-
setInputId(v4());
|
|
942
|
+
React.useEffect(function () {
|
|
943
|
+
setInputId(uuid.v4());
|
|
942
944
|
}, []);
|
|
943
945
|
var supportsValue = props.type !== "checkbox";
|
|
944
946
|
return props.type ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -980,10 +982,10 @@ var QrFormField = function (props) {
|
|
|
980
982
|
function useIsMobile() {
|
|
981
983
|
var query = "(max-width: 960px)";
|
|
982
984
|
var media = typeof window !== "undefined" ? window.matchMedia(query) : null;
|
|
983
|
-
var _a = useState(media ? media.matches : false),
|
|
985
|
+
var _a = React.useState(media ? media.matches : false),
|
|
984
986
|
isMobile = _a[0],
|
|
985
987
|
setIsMobile = _a[1];
|
|
986
|
-
useEffect(function () {
|
|
988
|
+
React.useEffect(function () {
|
|
987
989
|
if (!media) return;
|
|
988
990
|
var handler = function () {
|
|
989
991
|
return setIsMobile(media.matches);
|
|
@@ -1032,23 +1034,23 @@ var defaultQrFormTranslations = {
|
|
|
1032
1034
|
|
|
1033
1035
|
var QrForm = function (props) {
|
|
1034
1036
|
var _a;
|
|
1035
|
-
var _b = useState(0),
|
|
1037
|
+
var _b = React.useState(0),
|
|
1036
1038
|
currentPage = _b[0],
|
|
1037
1039
|
setCurrentPage = _b[1];
|
|
1038
|
-
var _c = useState({}),
|
|
1040
|
+
var _c = React.useState({}),
|
|
1039
1041
|
formValues = _c[0],
|
|
1040
1042
|
setFormValues = _c[1];
|
|
1041
|
-
var _d = useState({}),
|
|
1043
|
+
var _d = React.useState({}),
|
|
1042
1044
|
errors = _d[0],
|
|
1043
1045
|
setErrors = _d[1];
|
|
1044
|
-
var _e = useState(false);
|
|
1046
|
+
var _e = React.useState(false);
|
|
1045
1047
|
_e[0];
|
|
1046
1048
|
var setShowErrors = _e[1];
|
|
1047
1049
|
var isMobile = useIsMobile();
|
|
1048
|
-
var _f = useState(null),
|
|
1050
|
+
var _f = React.useState(null),
|
|
1049
1051
|
countryOptions = _f[0],
|
|
1050
1052
|
setCountryOptions = _f[1];
|
|
1051
|
-
var _g = useState(true);
|
|
1053
|
+
var _g = React.useState(true);
|
|
1052
1054
|
_g[0];
|
|
1053
1055
|
var setIsLoadingCountries = _g[1];
|
|
1054
1056
|
// Use custom Button component if provided, otherwise use default
|
|
@@ -1065,14 +1067,14 @@ var QrForm = function (props) {
|
|
|
1065
1067
|
errorMessage: consent.policyMandatory ? i18n.consent_requiredMessage : ""
|
|
1066
1068
|
};
|
|
1067
1069
|
})) || [];
|
|
1068
|
-
useEffect(function () {
|
|
1070
|
+
React.useEffect(function () {
|
|
1069
1071
|
var initialValues = {};
|
|
1070
1072
|
props.fields.forEach(function (field) {
|
|
1071
1073
|
initialValues[field.name] = field.value || '';
|
|
1072
1074
|
});
|
|
1073
1075
|
setFormValues(initialValues);
|
|
1074
1076
|
}, [props.fields]);
|
|
1075
|
-
useEffect(function () {
|
|
1077
|
+
React.useEffect(function () {
|
|
1076
1078
|
function loadCountries() {
|
|
1077
1079
|
return __awaiter(this, void 0, void 0, function () {
|
|
1078
1080
|
var fallbackCountries, res, data, err_1;
|
|
@@ -1126,7 +1128,7 @@ var QrForm = function (props) {
|
|
|
1126
1128
|
}
|
|
1127
1129
|
loadCountries();
|
|
1128
1130
|
}, []);
|
|
1129
|
-
useEffect(function () {
|
|
1131
|
+
React.useEffect(function () {
|
|
1130
1132
|
function fetchCity() {
|
|
1131
1133
|
return __awaiter(this, void 0, void 0, function () {
|
|
1132
1134
|
var res, data_1, err_2;
|
|
@@ -1334,6 +1336,12 @@ var QrForm = function (props) {
|
|
|
1334
1336
|
}
|
|
1335
1337
|
}
|
|
1336
1338
|
var renderQrFormField = function (field) {
|
|
1339
|
+
// if field name is equal to "serial-number", "product-number", "software-version", or "running-time", don't render the field if the value is empty
|
|
1340
|
+
if (field.name === "serial-number" || field.name === "product-number" || field.name === "software-version" || field.name === "running-time") {
|
|
1341
|
+
if (!formValues[field.name]) {
|
|
1342
|
+
return null;
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1337
1345
|
return /*#__PURE__*/React.createElement(QrFormField, _extends({}, field, {
|
|
1338
1346
|
key: field.name,
|
|
1339
1347
|
label: field.label,
|
|
@@ -1477,13 +1485,6 @@ var QrForm = function (props) {
|
|
|
1477
1485
|
})));
|
|
1478
1486
|
};
|
|
1479
1487
|
|
|
1480
|
-
export { AccordionSection, AlgoliaDynamicSearchEdwards as AlgoliaDynamicSearch, AlgoliaDynamicSearchRaw, Card, ProductCard, ProductDetailsCard, QrForm };
|
|
1481
|
-
rl,
|
|
1482
|
-
target: buttonProps.newTab ? '_blank' : '',
|
|
1483
|
-
buttonStyle: "primary"
|
|
1484
|
-
})));
|
|
1485
|
-
};
|
|
1486
|
-
|
|
1487
1488
|
exports.AccordionSection = AccordionSection;
|
|
1488
1489
|
exports.AlgoliaDynamicSearch = AlgoliaDynamicSearchEdwards;
|
|
1489
1490
|
exports.AlgoliaDynamicSearchRaw = AlgoliaDynamicSearchRaw;
|