@asantemedia-org/edwardsvacuum-design-system 1.6.52 → 1.6.54
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.css +11 -3
- package/dist/index.esm.css +11 -3
- package/dist/index.esm.js +33 -26
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +80 -64
- package/dist/index.js.map +1 -1
- package/dist/index.scss +11 -3
- package/dist/stories/experiences/QRFormJourney/Qr-form/i18n.d.ts +2 -2
- 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
|
|
@@ -526,13 +528,14 @@ var ProductDetailsCard = function (_a) {
|
|
|
526
528
|
className: getClassName("cmp-card--type-product_details__header__title")
|
|
527
529
|
}, title), /*#__PURE__*/React.createElement("p", {
|
|
528
530
|
className: getClassName("cmp-card--type-product_details__header__product-code")
|
|
529
|
-
}, "Product:", hit === null || hit === void 0 ? void 0 : hit.code), /*#__PURE__*/React.createElement("img", {
|
|
531
|
+
}, "Product: ", hit === null || hit === void 0 ? void 0 : hit.code), /*#__PURE__*/React.createElement("img", {
|
|
530
532
|
src: hit === null || hit === void 0 ? void 0 : hit.image,
|
|
531
533
|
alt: imageAlt,
|
|
532
534
|
className: getClassName("cmp-card--type-product_details__header__product-image")
|
|
533
535
|
})), facets && /*#__PURE__*/React.createElement(AccordionSection, {
|
|
534
536
|
title: "Specifications",
|
|
535
|
-
className: getClassName("folding-specification-holder")
|
|
537
|
+
className: getClassName("folding-specification-holder"),
|
|
538
|
+
defaultOpen: true
|
|
536
539
|
}, /*#__PURE__*/React.createElement("ul", {
|
|
537
540
|
className: getClassName("folding-specification-list")
|
|
538
541
|
}, facets && facets.map(function (facet) {
|
|
@@ -669,16 +672,16 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
669
672
|
var ProductDetailsCard$1 = (innerComponents === null || innerComponents === void 0 ? void 0 : innerComponents.ProductDetailsCard) || ProductDetailsCard;
|
|
670
673
|
var Button$1 = (innerComponents === null || innerComponents === void 0 ? void 0 : innerComponents.Button) || Button;
|
|
671
674
|
// Helper to resolve CSS module class names properly
|
|
672
|
-
var getClass = useCallback(function (suffix) {
|
|
675
|
+
var getClass = React.useCallback(function (suffix) {
|
|
673
676
|
var fullClassName = "cmpAlgoliaDynamicSearchWidget".concat(suffix);
|
|
674
677
|
return useScopedStyles && styles ? styles[fullClassName] : fullClassName;
|
|
675
678
|
}, [useScopedStyles, styles]);
|
|
676
679
|
// Helper for modifier classes (without the base prefix)
|
|
677
|
-
var getModifierClass = useCallback(function (modifier) {
|
|
680
|
+
var getModifierClass = React.useCallback(function (modifier) {
|
|
678
681
|
return useScopedStyles && styles ? styles[modifier] : modifier;
|
|
679
682
|
}, [useScopedStyles, styles]);
|
|
680
683
|
// Memoize background styling to prevent re-renders
|
|
681
|
-
var widgetStyleProps = useMemo(function () {
|
|
684
|
+
var widgetStyleProps = React.useMemo(function () {
|
|
682
685
|
var backgroundStyles = {
|
|
683
686
|
"dark-grey": {
|
|
684
687
|
buttonStyle: "outlineWhite",
|
|
@@ -702,7 +705,7 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
702
705
|
}
|
|
703
706
|
var baseClass = getClass('');
|
|
704
707
|
// Memoize wrapper class names
|
|
705
|
-
var wrapperClasses = useMemo(function () {
|
|
708
|
+
var wrapperClasses = React.useMemo(function () {
|
|
706
709
|
return [baseClass, widgetStyleProps.containerBackground, isLoading ? getModifierClass('isLoading') : '', queryType === 'content' ? getModifierClass('isQueryContent') : ''].filter(Boolean).join(' ');
|
|
707
710
|
}, [baseClass, widgetStyleProps.containerBackground, isLoading, queryType, getModifierClass]);
|
|
708
711
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -842,7 +845,7 @@ function RenderField(field) {
|
|
|
842
845
|
maxLength: field.maxLength
|
|
843
846
|
});
|
|
844
847
|
case "tel":
|
|
845
|
-
return /*#__PURE__*/React.createElement(PhoneInput, {
|
|
848
|
+
return /*#__PURE__*/React.createElement(reactInternationalPhone.PhoneInput, {
|
|
846
849
|
value: field.value || '',
|
|
847
850
|
onChange: function (phone) {
|
|
848
851
|
if (field.onPhoneChange) {
|
|
@@ -933,11 +936,11 @@ var FormFieldRenderer = function (props) {
|
|
|
933
936
|
};
|
|
934
937
|
|
|
935
938
|
var QrFormField = function (props) {
|
|
936
|
-
var _a = useState(''),
|
|
939
|
+
var _a = React.useState(''),
|
|
937
940
|
inputId = _a[0],
|
|
938
941
|
setInputId = _a[1];
|
|
939
|
-
useEffect(function () {
|
|
940
|
-
setInputId(v4());
|
|
942
|
+
React.useEffect(function () {
|
|
943
|
+
setInputId(uuid.v4());
|
|
941
944
|
}, []);
|
|
942
945
|
var supportsValue = props.type !== "checkbox";
|
|
943
946
|
return props.type ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -969,7 +972,7 @@ var QrFormField = function (props) {
|
|
|
969
972
|
} : {}, props.type === "select" ? {
|
|
970
973
|
options: props.options
|
|
971
974
|
} : {}, {
|
|
972
|
-
placeholder: props.placeholder,
|
|
975
|
+
placeholder: "".concat(props.placeholder, " ").concat(props.required ? "*" : ""),
|
|
973
976
|
maxLength: props.maxLength
|
|
974
977
|
}))), props.errorMessage && props.hasError && /*#__PURE__*/React.createElement("span", {
|
|
975
978
|
className: "formfield-error"
|
|
@@ -979,10 +982,10 @@ var QrFormField = function (props) {
|
|
|
979
982
|
function useIsMobile() {
|
|
980
983
|
var query = "(max-width: 960px)";
|
|
981
984
|
var media = typeof window !== "undefined" ? window.matchMedia(query) : null;
|
|
982
|
-
var _a = useState(media ? media.matches : false),
|
|
985
|
+
var _a = React.useState(media ? media.matches : false),
|
|
983
986
|
isMobile = _a[0],
|
|
984
987
|
setIsMobile = _a[1];
|
|
985
|
-
useEffect(function () {
|
|
988
|
+
React.useEffect(function () {
|
|
986
989
|
if (!media) return;
|
|
987
990
|
var handler = function () {
|
|
988
991
|
return setIsMobile(media.matches);
|
|
@@ -1004,10 +1007,10 @@ var defaultQrFormTranslations = {
|
|
|
1004
1007
|
pageTitle_aboutYou: "About you",
|
|
1005
1008
|
pageTitle_contactDetails: "Your contact details",
|
|
1006
1009
|
pageTitle_consents: "Consents",
|
|
1007
|
-
|
|
1008
|
-
label_customerSupport: "Customer
|
|
1009
|
-
label_technicalSupport: "Technical
|
|
1010
|
-
label_ProductDetails: "Product
|
|
1010
|
+
label_howMayWeHelpYou: "How may we help you?",
|
|
1011
|
+
label_customerSupport: "Customer support",
|
|
1012
|
+
label_technicalSupport: "Technical support",
|
|
1013
|
+
label_ProductDetails: "Product information",
|
|
1011
1014
|
label_warrantyClaim: "Warranty claim",
|
|
1012
1015
|
label_serviceRequest: "Service request",
|
|
1013
1016
|
label_oilAndSpares: "Oil and spares",
|
|
@@ -1023,7 +1026,7 @@ var defaultQrFormTranslations = {
|
|
|
1023
1026
|
label_email: "Email",
|
|
1024
1027
|
label_phone: "Phone",
|
|
1025
1028
|
label_city: "City",
|
|
1026
|
-
|
|
1029
|
+
label_postcodeOrZip: "Postcode or ZIP",
|
|
1027
1030
|
consent_acceptPolicy: "I accept the policy",
|
|
1028
1031
|
consent_default: "Consent",
|
|
1029
1032
|
consent_requiredMessage: "Please acknowledge this consent"
|
|
@@ -1031,23 +1034,23 @@ var defaultQrFormTranslations = {
|
|
|
1031
1034
|
|
|
1032
1035
|
var QrForm = function (props) {
|
|
1033
1036
|
var _a;
|
|
1034
|
-
var _b = useState(0),
|
|
1037
|
+
var _b = React.useState(0),
|
|
1035
1038
|
currentPage = _b[0],
|
|
1036
1039
|
setCurrentPage = _b[1];
|
|
1037
|
-
var _c = useState({}),
|
|
1040
|
+
var _c = React.useState({}),
|
|
1038
1041
|
formValues = _c[0],
|
|
1039
1042
|
setFormValues = _c[1];
|
|
1040
|
-
var _d = useState({}),
|
|
1043
|
+
var _d = React.useState({}),
|
|
1041
1044
|
errors = _d[0],
|
|
1042
1045
|
setErrors = _d[1];
|
|
1043
|
-
var _e = useState(false);
|
|
1046
|
+
var _e = React.useState(false);
|
|
1044
1047
|
_e[0];
|
|
1045
1048
|
var setShowErrors = _e[1];
|
|
1046
1049
|
var isMobile = useIsMobile();
|
|
1047
|
-
var _f = useState(null),
|
|
1050
|
+
var _f = React.useState(null),
|
|
1048
1051
|
countryOptions = _f[0],
|
|
1049
1052
|
setCountryOptions = _f[1];
|
|
1050
|
-
var _g = useState(true);
|
|
1053
|
+
var _g = React.useState(true);
|
|
1051
1054
|
_g[0];
|
|
1052
1055
|
var setIsLoadingCountries = _g[1];
|
|
1053
1056
|
// Use custom Button component if provided, otherwise use default
|
|
@@ -1064,14 +1067,14 @@ var QrForm = function (props) {
|
|
|
1064
1067
|
errorMessage: consent.policyMandatory ? i18n.consent_requiredMessage : ""
|
|
1065
1068
|
};
|
|
1066
1069
|
})) || [];
|
|
1067
|
-
useEffect(function () {
|
|
1070
|
+
React.useEffect(function () {
|
|
1068
1071
|
var initialValues = {};
|
|
1069
1072
|
props.fields.forEach(function (field) {
|
|
1070
1073
|
initialValues[field.name] = field.value || '';
|
|
1071
1074
|
});
|
|
1072
1075
|
setFormValues(initialValues);
|
|
1073
1076
|
}, [props.fields]);
|
|
1074
|
-
useEffect(function () {
|
|
1077
|
+
React.useEffect(function () {
|
|
1075
1078
|
function loadCountries() {
|
|
1076
1079
|
return __awaiter(this, void 0, void 0, function () {
|
|
1077
1080
|
var fallbackCountries, res, data, err_1;
|
|
@@ -1125,7 +1128,7 @@ var QrForm = function (props) {
|
|
|
1125
1128
|
}
|
|
1126
1129
|
loadCountries();
|
|
1127
1130
|
}, []);
|
|
1128
|
-
useEffect(function () {
|
|
1131
|
+
React.useEffect(function () {
|
|
1129
1132
|
function fetchCity() {
|
|
1130
1133
|
return __awaiter(this, void 0, void 0, function () {
|
|
1131
1134
|
var res, data_1, err_2;
|
|
@@ -1165,10 +1168,13 @@ var QrForm = function (props) {
|
|
|
1165
1168
|
type: "select",
|
|
1166
1169
|
name: "how_can_we_help",
|
|
1167
1170
|
options: [{
|
|
1168
|
-
label: i18n.
|
|
1171
|
+
label: i18n.label_howMayWeHelpYou,
|
|
1169
1172
|
value: "",
|
|
1170
1173
|
selected: true,
|
|
1171
1174
|
disabled: true
|
|
1175
|
+
}, {
|
|
1176
|
+
label: i18n.label_technicalSupport,
|
|
1177
|
+
value: "technical support"
|
|
1172
1178
|
}, {
|
|
1173
1179
|
label: i18n.label_warrantyClaim,
|
|
1174
1180
|
value: "warranty claim"
|
|
@@ -1235,9 +1241,9 @@ var QrForm = function (props) {
|
|
|
1235
1241
|
required: false
|
|
1236
1242
|
}, {
|
|
1237
1243
|
type: "text",
|
|
1238
|
-
name: "
|
|
1239
|
-
label: i18n.
|
|
1240
|
-
placeholder: i18n.
|
|
1244
|
+
name: "postcodeOrZip",
|
|
1245
|
+
label: i18n.label_postcodeOrZip,
|
|
1246
|
+
placeholder: i18n.label_postcodeOrZip,
|
|
1241
1247
|
required: false
|
|
1242
1248
|
}], __spreadArray([], consentFields, true)];
|
|
1243
1249
|
var handleChange = function (name, value) {
|
|
@@ -1330,20 +1336,23 @@ var QrForm = function (props) {
|
|
|
1330
1336
|
}
|
|
1331
1337
|
}
|
|
1332
1338
|
var renderQrFormField = function (field) {
|
|
1333
|
-
return
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1339
|
+
return (
|
|
1340
|
+
// if no label, don't render the field
|
|
1341
|
+
field.value ? /*#__PURE__*/React.createElement(QrFormField, _extends({}, field, {
|
|
1342
|
+
key: field.name,
|
|
1343
|
+
label: field.label,
|
|
1344
|
+
value: formValues[field.name],
|
|
1345
|
+
onChange: function (e) {
|
|
1346
|
+
return handleChange(field.name, e.target.value);
|
|
1347
|
+
},
|
|
1348
|
+
isDisabled: field.isDisabled,
|
|
1349
|
+
errorMessage: field.errorMessage,
|
|
1350
|
+
hasError: errors[field.name] || false,
|
|
1351
|
+
required: field.required
|
|
1352
|
+
}, field.type === "text" || field.type === "email" || field.type === "tel" || field.type === "textarea" || field.type === "number" ? {
|
|
1353
|
+
regex: field.regex
|
|
1354
|
+
} : {})) : null
|
|
1355
|
+
);
|
|
1347
1356
|
};
|
|
1348
1357
|
var renderProgressBar = function (pageIndex) {
|
|
1349
1358
|
return isMobile ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -1473,4 +1482,11 @@ var QrForm = function (props) {
|
|
|
1473
1482
|
})));
|
|
1474
1483
|
};
|
|
1475
1484
|
|
|
1476
|
-
|
|
1485
|
+
exports.AccordionSection = AccordionSection;
|
|
1486
|
+
exports.AlgoliaDynamicSearch = AlgoliaDynamicSearchEdwards;
|
|
1487
|
+
exports.AlgoliaDynamicSearchRaw = AlgoliaDynamicSearchRaw;
|
|
1488
|
+
exports.Card = Card;
|
|
1489
|
+
exports.ProductCard = ProductCard;
|
|
1490
|
+
exports.ProductDetailsCard = ProductDetailsCard;
|
|
1491
|
+
exports.QrForm = QrForm;
|
|
1492
|
+
//# sourceMappingURL=index.js.map
|