@asantemedia-org/edwardsvacuum-design-system 1.6.48 → 1.6.49
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 +12 -3
- package/dist/index.esm.css +12 -3
- package/dist/index.esm.js +28 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +71 -48
- package/dist/index.js.map +1 -1
- package/dist/index.scss +12 -3
- package/dist/stories/components/Card/card.d.ts +1 -0
- package/dist/stories/experiences/Algolia-dynamic-search/algolia-dynamic-search-base.d.ts +3 -25
- package/dist/stories/experiences/Algolia-dynamic-search/algolia-dynamic-search.d.ts +1 -2
- package/dist/stories/experiences/Algolia-dynamic-search/algolia-dynamic-search.types.d.ts +34 -0
- package/dist/stories/experiences/QRFormJourney/Qr-form/Qr-form.d.ts +3 -0
- 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",
|
|
@@ -399,12 +401,12 @@ var Card = function (_a) {
|
|
|
399
401
|
className: getStyle$1("cmp-card__city-country")
|
|
400
402
|
}, city, " ", city && country ? ", " : "", " ", country), cardStyle === "type-card-panel" ? /*#__PURE__*/React.createElement("span", {
|
|
401
403
|
className: classnames(getStyle$1("cmp-card__footer"), cardFooterColour)
|
|
402
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
403
|
-
icon: faChevronRight
|
|
404
|
+
}, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
405
|
+
icon: proSolidSvgIcons.faChevronRight
|
|
404
406
|
})) : cardStyle === "label" ? /*#__PURE__*/React.createElement("span", {
|
|
405
407
|
className: getStyle$1("cmp-card__footer")
|
|
406
|
-
}, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
407
|
-
icon: faArrowRight
|
|
408
|
+
}, /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
409
|
+
icon: proSolidSvgIcons.faArrowRight
|
|
408
410
|
})) : /*#__PURE__*/React.createElement("span", {
|
|
409
411
|
className: getStyle$1("cmp-card__footer")
|
|
410
412
|
}, /*#__PURE__*/React.createElement("span", null, cta))))));
|
|
@@ -450,8 +452,8 @@ var ProductCard = function (_a) {
|
|
|
450
452
|
className: getStyle$1("cmp-card--type-card-product__prices")
|
|
451
453
|
}, productPrice) : "", /*#__PURE__*/React.createElement("p", {
|
|
452
454
|
className: getStyle$1("cmp-card--type-card-product__cta")
|
|
453
|
-
}, cta ? cta : /*#__PURE__*/React.createElement(FontAwesomeIcon, {
|
|
454
|
-
icon: faArrowRight
|
|
455
|
+
}, cta ? cta : /*#__PURE__*/React.createElement(reactFontawesome.FontAwesomeIcon, {
|
|
456
|
+
icon: proSolidSvgIcons.faArrowRight
|
|
455
457
|
}))))));
|
|
456
458
|
};
|
|
457
459
|
// Maximum spares to render to prevent browser freeze
|
|
@@ -638,18 +640,24 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
638
640
|
isLoading = _f === void 0 ? false : _f,
|
|
639
641
|
placeholder = _a.placeholder,
|
|
640
642
|
analytics = _a.analytics,
|
|
641
|
-
facets = _a.facets
|
|
643
|
+
facets = _a.facets,
|
|
644
|
+
innerComponents = _a.innerComponents;
|
|
645
|
+
// Extract components from innerComponents with defaults
|
|
646
|
+
var Card$1 = (innerComponents === null || innerComponents === void 0 ? void 0 : innerComponents.Card) || Card;
|
|
647
|
+
var ProductCard$1 = (innerComponents === null || innerComponents === void 0 ? void 0 : innerComponents.ProductCard) || ProductCard;
|
|
648
|
+
var ProductDetailsCard$1 = (innerComponents === null || innerComponents === void 0 ? void 0 : innerComponents.ProductDetailsCard) || ProductDetailsCard;
|
|
649
|
+
var Button$1 = (innerComponents === null || innerComponents === void 0 ? void 0 : innerComponents.Button) || Button;
|
|
642
650
|
// Helper to resolve CSS module class names properly
|
|
643
|
-
var getClass = useCallback(function (suffix) {
|
|
651
|
+
var getClass = React.useCallback(function (suffix) {
|
|
644
652
|
var fullClassName = "cmpAlgoliaDynamicSearchWidget".concat(suffix);
|
|
645
653
|
return useScopedStyles && styles ? styles[fullClassName] : fullClassName;
|
|
646
654
|
}, [useScopedStyles, styles]);
|
|
647
655
|
// Helper for modifier classes (without the base prefix)
|
|
648
|
-
var getModifierClass = useCallback(function (modifier) {
|
|
656
|
+
var getModifierClass = React.useCallback(function (modifier) {
|
|
649
657
|
return useScopedStyles && styles ? styles[modifier] : modifier;
|
|
650
658
|
}, [useScopedStyles, styles]);
|
|
651
659
|
// Memoize background styling to prevent re-renders
|
|
652
|
-
var widgetStyleProps = useMemo(function () {
|
|
660
|
+
var widgetStyleProps = React.useMemo(function () {
|
|
653
661
|
var backgroundStyles = {
|
|
654
662
|
"dark-grey": {
|
|
655
663
|
buttonStyle: "outlineWhite",
|
|
@@ -673,7 +681,7 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
673
681
|
}
|
|
674
682
|
var baseClass = getClass('');
|
|
675
683
|
// Memoize wrapper class names
|
|
676
|
-
var wrapperClasses = useMemo(function () {
|
|
684
|
+
var wrapperClasses = React.useMemo(function () {
|
|
677
685
|
return [baseClass, widgetStyleProps.containerBackground, isLoading ? getModifierClass('isLoading') : '', queryType === 'content' ? getModifierClass('isQueryContent') : ''].filter(Boolean).join(' ');
|
|
678
686
|
}, [baseClass, widgetStyleProps.containerBackground, isLoading, queryType, getModifierClass]);
|
|
679
687
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -697,7 +705,7 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
697
705
|
finalUrl = _a.finalUrl,
|
|
698
706
|
target = _a.target;
|
|
699
707
|
var isAnchor = !!callToActionTargetSelector || (callToActionType === null || callToActionType === void 0 ? void 0 : callToActionType.toLowerCase()) !== 'internal';
|
|
700
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
708
|
+
return /*#__PURE__*/React.createElement(Button$1, {
|
|
701
709
|
element: isAnchor ? 'a' : 'button',
|
|
702
710
|
buttonStyle: widgetStyleProps === null || widgetStyleProps === void 0 ? void 0 : widgetStyleProps.buttonStyle,
|
|
703
711
|
label: callToActionText,
|
|
@@ -714,7 +722,7 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
714
722
|
}()))), /*#__PURE__*/React.createElement("div", {
|
|
715
723
|
className: queryType == PRODUCT_DETAILS ? getClass('__cards__cardSingle') : getClass('__cards')
|
|
716
724
|
}, hits.slice(0, maxResults).map(function (hit, index) {
|
|
717
|
-
var Component = Card;
|
|
725
|
+
var Component = Card$1;
|
|
718
726
|
var title = hit.title;
|
|
719
727
|
var cardStyle = "";
|
|
720
728
|
var imageUrl = hit.imageUrl || placeholder;
|
|
@@ -731,7 +739,7 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
731
739
|
var cardClassName = styles === null || styles === void 0 ? void 0 : styles.cmpCard;
|
|
732
740
|
switch (queryType) {
|
|
733
741
|
case "products":
|
|
734
|
-
Component = ProductCard;
|
|
742
|
+
Component = ProductCard$1;
|
|
735
743
|
cardStyle = "type-card-product";
|
|
736
744
|
break;
|
|
737
745
|
case "content":
|
|
@@ -744,7 +752,7 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
744
752
|
break;
|
|
745
753
|
case PRODUCT_DETAILS:
|
|
746
754
|
cardStyle = "type-card-panel";
|
|
747
|
-
Component = ProductDetailsCard;
|
|
755
|
+
Component = ProductDetailsCard$1;
|
|
748
756
|
break;
|
|
749
757
|
default:
|
|
750
758
|
return null;
|
|
@@ -781,8 +789,17 @@ var AlgoliaDynamicSearch = function (_a, useScopedStyles, styles) {
|
|
|
781
789
|
|
|
782
790
|
var styles = {"cmpAlgoliaDynamicSearchWidget":"algolia-dynamic-search-module__cmpAlgoliaDynamicSearchWidget___WY9hc","isLoading":"algolia-dynamic-search-module__isLoading___X6nUw","cmpAlgoliaDynamicSearchWidget__placeholder":"algolia-dynamic-search-module__cmpAlgoliaDynamicSearchWidget__placeholder___IWqoU","cmpAlgoliaDynamicSearchWidget__container":"algolia-dynamic-search-module__cmpAlgoliaDynamicSearchWidget__container___HB7g0","cmpAlgoliaDynamicSearchWidget__header":"algolia-dynamic-search-module__cmpAlgoliaDynamicSearchWidget__header___vxNjS","cmpAlgoliaDynamicSearchWidget__header__text":"algolia-dynamic-search-module__cmpAlgoliaDynamicSearchWidget__header__text___23-nk","cmpAlgoliaDynamicSearchWidget__cards":"algolia-dynamic-search-module__cmpAlgoliaDynamicSearchWidget__cards___wOPVj","cmpAlgoliaDynamicSearchWidget__cards__cardSingle":"algolia-dynamic-search-module__cmpAlgoliaDynamicSearchWidget__cards__cardSingle___fcWfV","isQueryContent":"algolia-dynamic-search-module__isQueryContent___KXy6j","hasStyleSilverGradientBackground":"algolia-dynamic-search-module__hasStyleSilverGradientBackground___D3SQQ","hasStyleGreyBackground":"algolia-dynamic-search-module__hasStyleGreyBackground___SuPIH","cmpAlgoliaDynamicSearchWidget__placeholder__loading":"algolia-dynamic-search-module__cmpAlgoliaDynamicSearchWidget__placeholder__loading___hbH4m","loading":"algolia-dynamic-search-module__loading___Hb3Uw"};
|
|
783
791
|
|
|
792
|
+
// Edwards-specific components
|
|
793
|
+
var edwardsComponents = {
|
|
794
|
+
Card: Card,
|
|
795
|
+
ProductCard: ProductCard,
|
|
796
|
+
ProductDetailsCard: ProductDetailsCard,
|
|
797
|
+
Button: Button
|
|
798
|
+
};
|
|
784
799
|
var AlgoliaDynamicSearchEdwards = function (props) {
|
|
785
|
-
return AlgoliaDynamicSearch(
|
|
800
|
+
return AlgoliaDynamicSearch(__assign(__assign({}, props), {
|
|
801
|
+
innerComponents: edwardsComponents
|
|
802
|
+
}), true, styles);
|
|
786
803
|
};
|
|
787
804
|
var AlgoliaDynamicSearchRaw = function (props) {
|
|
788
805
|
return AlgoliaDynamicSearch(props, false);
|
|
@@ -804,7 +821,7 @@ function RenderField(field) {
|
|
|
804
821
|
maxLength: field.maxLength
|
|
805
822
|
});
|
|
806
823
|
case "tel":
|
|
807
|
-
return /*#__PURE__*/React.createElement(PhoneInput, {
|
|
824
|
+
return /*#__PURE__*/React.createElement(reactInternationalPhone.PhoneInput, {
|
|
808
825
|
value: field.value || '',
|
|
809
826
|
onChange: function (phone) {
|
|
810
827
|
if (field.onPhoneChange) {
|
|
@@ -895,11 +912,11 @@ var FormFieldRenderer = function (props) {
|
|
|
895
912
|
};
|
|
896
913
|
|
|
897
914
|
var QrFormField = function (props) {
|
|
898
|
-
var _a = useState(''),
|
|
915
|
+
var _a = React.useState(''),
|
|
899
916
|
inputId = _a[0],
|
|
900
917
|
setInputId = _a[1];
|
|
901
|
-
useEffect(function () {
|
|
902
|
-
setInputId(v4());
|
|
918
|
+
React.useEffect(function () {
|
|
919
|
+
setInputId(uuid.v4());
|
|
903
920
|
}, []);
|
|
904
921
|
var supportsValue = props.type !== "checkbox";
|
|
905
922
|
return props.type ? /*#__PURE__*/React.createElement("div", {
|
|
@@ -941,10 +958,10 @@ var QrFormField = function (props) {
|
|
|
941
958
|
function useIsMobile() {
|
|
942
959
|
var query = "(max-width: 960px)";
|
|
943
960
|
var media = typeof window !== "undefined" ? window.matchMedia(query) : null;
|
|
944
|
-
var _a = useState(media ? media.matches : false),
|
|
961
|
+
var _a = React.useState(media ? media.matches : false),
|
|
945
962
|
isMobile = _a[0],
|
|
946
963
|
setIsMobile = _a[1];
|
|
947
|
-
useEffect(function () {
|
|
964
|
+
React.useEffect(function () {
|
|
948
965
|
if (!media) return;
|
|
949
966
|
var handler = function () {
|
|
950
967
|
return setIsMobile(media.matches);
|
|
@@ -993,25 +1010,27 @@ var defaultQrFormTranslations = {
|
|
|
993
1010
|
|
|
994
1011
|
var QrForm = function (props) {
|
|
995
1012
|
var _a;
|
|
996
|
-
var _b = useState(0),
|
|
1013
|
+
var _b = React.useState(0),
|
|
997
1014
|
currentPage = _b[0],
|
|
998
1015
|
setCurrentPage = _b[1];
|
|
999
|
-
var _c = useState({}),
|
|
1016
|
+
var _c = React.useState({}),
|
|
1000
1017
|
formValues = _c[0],
|
|
1001
1018
|
setFormValues = _c[1];
|
|
1002
|
-
var _d = useState({}),
|
|
1019
|
+
var _d = React.useState({}),
|
|
1003
1020
|
errors = _d[0],
|
|
1004
1021
|
setErrors = _d[1];
|
|
1005
|
-
var _e = useState(false);
|
|
1022
|
+
var _e = React.useState(false);
|
|
1006
1023
|
_e[0];
|
|
1007
1024
|
var setShowErrors = _e[1];
|
|
1008
1025
|
var isMobile = useIsMobile();
|
|
1009
|
-
var _f = useState(null),
|
|
1026
|
+
var _f = React.useState(null),
|
|
1010
1027
|
countryOptions = _f[0],
|
|
1011
1028
|
setCountryOptions = _f[1];
|
|
1012
|
-
var _g = useState(true);
|
|
1029
|
+
var _g = React.useState(true);
|
|
1013
1030
|
_g[0];
|
|
1014
1031
|
var setIsLoadingCountries = _g[1];
|
|
1032
|
+
// Use custom Button component if provided, otherwise use default
|
|
1033
|
+
var Button$1 = props.ButtonComponent || Button;
|
|
1015
1034
|
var i18n = __assign(__assign({}, defaultQrFormTranslations), props);
|
|
1016
1035
|
var buttonProps = props;
|
|
1017
1036
|
var consentFields = ((_a = props.consents) === null || _a === void 0 ? void 0 : _a.map(function (consent, index) {
|
|
@@ -1024,14 +1043,14 @@ var QrForm = function (props) {
|
|
|
1024
1043
|
errorMessage: consent.policyMandatory ? i18n.consent_requiredMessage : ""
|
|
1025
1044
|
};
|
|
1026
1045
|
})) || [];
|
|
1027
|
-
useEffect(function () {
|
|
1046
|
+
React.useEffect(function () {
|
|
1028
1047
|
var initialValues = {};
|
|
1029
1048
|
props.fields.forEach(function (field) {
|
|
1030
1049
|
initialValues[field.name] = field.value || '';
|
|
1031
1050
|
});
|
|
1032
1051
|
setFormValues(initialValues);
|
|
1033
1052
|
}, [props.fields]);
|
|
1034
|
-
useEffect(function () {
|
|
1053
|
+
React.useEffect(function () {
|
|
1035
1054
|
function loadCountries() {
|
|
1036
1055
|
return __awaiter(this, void 0, void 0, function () {
|
|
1037
1056
|
var fallbackCountries, res, data, err_1;
|
|
@@ -1085,7 +1104,7 @@ var QrForm = function (props) {
|
|
|
1085
1104
|
}
|
|
1086
1105
|
loadCountries();
|
|
1087
1106
|
}, []);
|
|
1088
|
-
useEffect(function () {
|
|
1107
|
+
React.useEffect(function () {
|
|
1089
1108
|
function fetchCity() {
|
|
1090
1109
|
return __awaiter(this, void 0, void 0, function () {
|
|
1091
1110
|
var res, data_1, err_2;
|
|
@@ -1336,17 +1355,17 @@ var QrForm = function (props) {
|
|
|
1336
1355
|
var isLastPage = pageIndex === pages.length - 1;
|
|
1337
1356
|
var navButtons = generateButtons && /*#__PURE__*/React.createElement("div", {
|
|
1338
1357
|
className: "qr-form-navigation"
|
|
1339
|
-
}, !isFirstPage ? /*#__PURE__*/React.createElement(Button, {
|
|
1358
|
+
}, !isFirstPage ? /*#__PURE__*/React.createElement(Button$1, {
|
|
1340
1359
|
label: i18n === null || i18n === void 0 ? void 0 : i18n.previous,
|
|
1341
1360
|
onClick: formNavigate,
|
|
1342
1361
|
"data-page_target": pageIndex - 1,
|
|
1343
1362
|
buttonStyle: "secondary"
|
|
1344
|
-
}) : /*#__PURE__*/React.createElement("div", null), !isLastPage ? /*#__PURE__*/React.createElement(Button, {
|
|
1363
|
+
}) : /*#__PURE__*/React.createElement("div", null), !isLastPage ? /*#__PURE__*/React.createElement(Button$1, {
|
|
1345
1364
|
label: i18n === null || i18n === void 0 ? void 0 : i18n.next,
|
|
1346
1365
|
onClick: formNavigate,
|
|
1347
1366
|
"data-page_target": pageIndex + 1,
|
|
1348
1367
|
buttonStyle: "primary"
|
|
1349
|
-
}) : /*#__PURE__*/React.createElement(Button, {
|
|
1368
|
+
}) : /*#__PURE__*/React.createElement(Button$1, {
|
|
1350
1369
|
label: i18n === null || i18n === void 0 ? void 0 : i18n.submit,
|
|
1351
1370
|
onClick: handleSubmit,
|
|
1352
1371
|
buttonStyle: "primary",
|
|
@@ -1425,7 +1444,7 @@ var QrForm = function (props) {
|
|
|
1425
1444
|
className: "title-wrapper"
|
|
1426
1445
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1427
1446
|
className: "submitted-checked"
|
|
1428
|
-
}), /*#__PURE__*/React.createElement("h2", null, props.thankYouTitle)), /*#__PURE__*/React.createElement("p", null, props.thankYouText), /*#__PURE__*/React.createElement(Button, {
|
|
1447
|
+
}), /*#__PURE__*/React.createElement("h2", null, props.thankYouTitle)), /*#__PURE__*/React.createElement("p", null, props.thankYouText), /*#__PURE__*/React.createElement(Button$1, {
|
|
1429
1448
|
label: buttonProps.buttonText,
|
|
1430
1449
|
href: buttonProps.url,
|
|
1431
1450
|
target: buttonProps.newTab ? '_blank' : '',
|
|
@@ -1433,4 +1452,8 @@ var QrForm = function (props) {
|
|
|
1433
1452
|
})));
|
|
1434
1453
|
};
|
|
1435
1454
|
|
|
1436
|
-
|
|
1455
|
+
exports.AccordionSection = AccordionSection;
|
|
1456
|
+
exports.AlgoliaDynamicSearch = AlgoliaDynamicSearchEdwards;
|
|
1457
|
+
exports.AlgoliaDynamicSearchRaw = AlgoliaDynamicSearchRaw;
|
|
1458
|
+
exports.QrForm = QrForm;
|
|
1459
|
+
//# sourceMappingURL=index.js.map
|