@asante-org/atlascopco-vt-litesitegenerator 1.6.0 → 1.6.4

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
@@ -570,6 +570,31 @@ var hasOpenNavItem = function (items) {
570
570
  return item.open || hasOpenNavItem(item.children || []);
571
571
  });
572
572
  };
573
+ var clearMegaMenuBranch = function (scope) {
574
+ if (scope instanceof HTMLElement) {
575
+ scope.classList.remove("lsg-header__mega-item--open");
576
+ scope.classList.remove("lsg-header__mega-column--open");
577
+ }
578
+ scope.querySelectorAll(".lsg-header__mega-item--open").forEach(function (item) {
579
+ item.classList.remove("lsg-header__mega-item--open");
580
+ });
581
+ scope.querySelectorAll(".lsg-header__mega-column--open").forEach(function (column) {
582
+ column.classList.remove("lsg-header__mega-column--open");
583
+ });
584
+ };
585
+ var activateMegaMenuItem = function (item) {
586
+ var _a;
587
+ var parentColumn = item.parentElement;
588
+ if (parentColumn) {
589
+ Array.from(parentColumn.children).forEach(function (openItem) {
590
+ if (openItem !== item) {
591
+ clearMegaMenuBranch(openItem);
592
+ }
593
+ });
594
+ }
595
+ item.classList.add("lsg-header__mega-item--open");
596
+ (_a = item.querySelector(":scope > .lsg-header__mega-column")) === null || _a === void 0 ? void 0 : _a.classList.add("lsg-header__mega-column--open");
597
+ };
573
598
  var HeaderActionButton = function (_a) {
574
599
  var label = _a.label,
575
600
  icon = _a.icon,
@@ -614,13 +639,14 @@ var LsgHeader = function (_a) {
614
639
  onDropdownClose = _a.onDropdownClose,
615
640
  onMegaItemHover = _a.onMegaItemHover,
616
641
  onMobileItemClick = _a.onMobileItemClick,
617
- onMobileBreadcrumbClick = _a.onMobileBreadcrumbClick;
642
+ onMobileBreadcrumbClick = _a.onMobileBreadcrumbClick,
643
+ children = _a.children;
618
644
  var _l = useState(false),
619
645
  searchOpen = _l[0],
620
646
  setSearchOpen = _l[1];
621
647
  var headerRef = useRef(null);
622
648
  var mobileOpen = menuOpen || mobileLevel > 0;
623
- var columns = getMegaColumns(navItems, activePath);
649
+ var columns = children ? [] : getMegaColumns(navItems, activePath);
624
650
  var mobileItems = getItemsAtLevel(navItems, activePath, mobileLevel || 1);
625
651
  var dropdownOpen = variant === "dropdown" && hasOpenNavItem(navItems);
626
652
  useEffect(function () {
@@ -646,6 +672,34 @@ var LsgHeader = function (_a) {
646
672
  document.removeEventListener("touchstart", closeOnOutsidePointerDown);
647
673
  };
648
674
  }, [dropdownOpen, menuOpen, onDropdownClose, onMenuToggle]);
675
+ useEffect(function () {
676
+ if (variant !== "mega" || !children || !menuOpen || !headerRef.current) {
677
+ return undefined;
678
+ }
679
+ var megaItems = Array.from(headerRef.current.querySelectorAll(".lsg-header__mega-item--has-children"));
680
+ var removeListeners = megaItems.map(function (item) {
681
+ var onMouseEnter = function () {
682
+ return activateMegaMenuItem(item);
683
+ };
684
+ var onFocusIn = function () {
685
+ return activateMegaMenuItem(item);
686
+ };
687
+ item.addEventListener("mouseenter", onMouseEnter);
688
+ item.addEventListener("focusin", onFocusIn);
689
+ return function () {
690
+ item.removeEventListener("mouseenter", onMouseEnter);
691
+ item.removeEventListener("focusin", onFocusIn);
692
+ };
693
+ });
694
+ return function () {
695
+ removeListeners.forEach(function (removeListener) {
696
+ return removeListener();
697
+ });
698
+ if (headerRef.current) {
699
+ clearMegaMenuBranch(headerRef.current);
700
+ }
701
+ };
702
+ }, [children, menuOpen, variant]);
649
703
  var openSearch = function () {
650
704
  return setSearchOpen(true);
651
705
  };
@@ -810,7 +864,7 @@ var LsgHeader = function (_a) {
810
864
  "data-lsg-menu-trigger": true
811
865
  }, /*#__PURE__*/React.createElement(LsgHeaderIcon, {
812
866
  name: mobileOpen ? "close" : "bars"
813
- })))), variant === "mega" && menuOpen && renderMegaPanel(), mobileOpen && renderMobileMenu()), /*#__PURE__*/React.createElement(LsgSearchOverlay, {
867
+ })))), variant === "mega" && menuOpen && (children || renderMegaPanel()), mobileOpen && renderMobileMenu()), /*#__PURE__*/React.createElement(LsgSearchOverlay, {
814
868
  id: SEARCH_OVERLAY_ID,
815
869
  isOpen: searchOpen,
816
870
  onClose: function () {
@@ -904,37 +958,145 @@ var LsgSocialMediaIcons = function (_a) {
904
958
  }));
905
959
  };
906
960
 
961
+ var PhoneIcon = function () {
962
+ return /*#__PURE__*/React.createElement("svg", {
963
+ width: "20",
964
+ height: "20",
965
+ viewBox: "0 0 20 20",
966
+ fill: "none",
967
+ xmlns: "http://www.w3.org/2000/svg",
968
+ "aria-hidden": "true"
969
+ }, /*#__PURE__*/React.createElement("path", {
970
+ d: "M15.833 13.483c-.417-.416-1.25-.833-1.875-1.083-.625-.25-1.042-.167-1.458.208l-.834.833c-.208.209-.5.209-.708.042-.625-.5-1.833-1.583-2.583-2.333-.75-.75-1.75-1.875-2.25-2.583-.167-.208-.125-.5.083-.709l.834-.833c.416-.417.5-.833.25-1.458-.25-.625-.667-1.458-1.084-1.875C8.791 3.25 8.208 3 7.583 3c-.416 0-.833.167-1.125.458L5.625 4.292C4.5 5.417 4.708 7.125 5.333 8.833c.625 1.708 2 3.833 3.625 5.458 1.625 1.625 3.75 3 5.458 3.625 1.709.625 3.417.833 4.542-.292l.833-.833c.292-.292.458-.708.458-1.125 0-.625-.25-1.208-.416-1.583z",
971
+ fill: "currentColor"
972
+ }));
973
+ };
974
+ var FaxIcon = function () {
975
+ return /*#__PURE__*/React.createElement("svg", {
976
+ width: "20",
977
+ height: "20",
978
+ viewBox: "0 0 20 20",
979
+ fill: "none",
980
+ xmlns: "http://www.w3.org/2000/svg",
981
+ "aria-hidden": "true"
982
+ }, /*#__PURE__*/React.createElement("path", {
983
+ d: "M16 6h-1V2H5v4H4c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h1v2h10v-2h1c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zM7 4h6v2H7V4zm6 12H7v-4h6v4zm3-5H4V8h12v3z",
984
+ fill: "currentColor"
985
+ }));
986
+ };
987
+ var MailIcon = function () {
988
+ return /*#__PURE__*/React.createElement("svg", {
989
+ width: "24",
990
+ height: "20",
991
+ viewBox: "0 0 24 20",
992
+ fill: "none",
993
+ xmlns: "http://www.w3.org/2000/svg",
994
+ "aria-hidden": "true"
995
+ }, /*#__PURE__*/React.createElement("path", {
996
+ d: "M20 0H4C2.9 0 2 .9 2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V2l8 5 8-5v2z",
997
+ fill: "currentColor"
998
+ }));
999
+ };
1000
+ var LocationIcon = function () {
1001
+ return /*#__PURE__*/React.createElement("svg", {
1002
+ width: "18",
1003
+ height: "21",
1004
+ viewBox: "0 0 18 24",
1005
+ fill: "none",
1006
+ xmlns: "http://www.w3.org/2000/svg",
1007
+ "aria-hidden": "true"
1008
+ }, /*#__PURE__*/React.createElement("path", {
1009
+ d: "M9 0C5.13 0 2 3.13 2 7c0 5.25 7 13 7 13s7-7.75 7-13C16 3.13 12.87 0 9 0zm0 9.5C7.62 9.5 6.5 8.38 6.5 7S7.62 4.5 9 4.5 11.5 5.62 11.5 7 10.38 9.5 9 9.5z",
1010
+ fill: "currentColor"
1011
+ }));
1012
+ };
907
1013
  var LsgFooter = function (_a) {
908
- var logo = _a.logo,
909
- tagline = _a.tagline,
910
- _b = _a.quickLinksGroups,
911
- quickLinksGroups = _b === void 0 ? [] : _b,
912
- _c = _a.socialItems,
913
- socialItems = _c === void 0 ? [] : _c,
1014
+ var _b = _a.variant,
1015
+ variant = _b === void 0 ? "simple" : _b,
1016
+ logo = _a.logo,
1017
+ _c = _a.navItems,
1018
+ navItems = _c === void 0 ? [] : _c,
1019
+ contact = _a.contact,
1020
+ _d = _a.quickLinks,
1021
+ quickLinks = _d === void 0 ? [] : _d,
914
1022
  copyright = _a.copyright;
915
1023
  var year = new Date().getFullYear();
1024
+ var copyrightText = copyright !== null && copyright !== void 0 ? copyright : "\u00A9 ".concat(year, " Brand - Part of Atlas Copco Group");
1025
+ if (variant === "simple") {
1026
+ return /*#__PURE__*/React.createElement("footer", {
1027
+ className: "lsg-footer lsg-footer--simple"
1028
+ }, /*#__PURE__*/React.createElement("div", {
1029
+ className: "lsg-footer__simple-inner"
1030
+ }, /*#__PURE__*/React.createElement("p", {
1031
+ className: "lsg-footer__copyright"
1032
+ }, copyrightText), navItems.length > 0 && /*#__PURE__*/React.createElement("nav", {
1033
+ className: "lsg-footer__simple-nav",
1034
+ "aria-label": "Footer navigation"
1035
+ }, navItems.map(function (item, i) {
1036
+ return /*#__PURE__*/React.createElement(React.Fragment, {
1037
+ key: item.href
1038
+ }, i > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
1039
+ className: "lsg-footer__pipe",
1040
+ "aria-hidden": "true"
1041
+ }, "|"), /*#__PURE__*/React.createElement("hr", {
1042
+ className: "lsg-footer__mobile-divider",
1043
+ "aria-hidden": "true"
1044
+ })), /*#__PURE__*/React.createElement("a", {
1045
+ href: item.href,
1046
+ className: "lsg-footer__simple-nav-item"
1047
+ }, item.label));
1048
+ }))));
1049
+ }
916
1050
  return /*#__PURE__*/React.createElement("footer", {
917
- className: "lsg-footer"
1051
+ className: "lsg-footer lsg-footer--complex"
918
1052
  }, /*#__PURE__*/React.createElement("div", {
919
- className: "lsg-footer__inner"
920
- }, /*#__PURE__*/React.createElement("div", {
921
- className: "lsg-footer__brand"
922
- }, /*#__PURE__*/React.createElement(LsgLogo, logo), tagline && /*#__PURE__*/React.createElement("p", {
923
- className: "lsg-footer__tagline"
924
- }, tagline), socialItems.length > 0 && /*#__PURE__*/React.createElement(LsgSocialMediaIcons, {
925
- items: socialItems
926
- })), quickLinksGroups.length > 0 && /*#__PURE__*/React.createElement("div", {
927
- className: "lsg-footer__nav"
928
- }, quickLinksGroups.map(function (group, i) {
1053
+ className: "lsg-footer__complex-inner"
1054
+ }, logo && /*#__PURE__*/React.createElement("div", {
1055
+ className: "lsg-footer__logo-col"
1056
+ }, /*#__PURE__*/React.createElement(LsgLogo, logo)), /*#__PURE__*/React.createElement("div", {
1057
+ className: "lsg-footer__content-cols"
1058
+ }, contact && /*#__PURE__*/React.createElement("div", {
1059
+ className: "lsg-footer__contact-col"
1060
+ }, /*#__PURE__*/React.createElement("h3", {
1061
+ className: "lsg-footer__col-heading"
1062
+ }, "CONTACT"), contact.address && /*#__PURE__*/React.createElement("div", {
1063
+ className: "lsg-footer__address"
1064
+ }, /*#__PURE__*/React.createElement(LocationIcon, null), /*#__PURE__*/React.createElement("p", null, contact.address)), /*#__PURE__*/React.createElement("hr", {
1065
+ className: "lsg-footer__divider"
1066
+ }), /*#__PURE__*/React.createElement("div", {
1067
+ className: "lsg-footer__contact-items"
1068
+ }, contact.phone && /*#__PURE__*/React.createElement("div", {
1069
+ className: "lsg-footer__contact-item"
1070
+ }, /*#__PURE__*/React.createElement(PhoneIcon, null), /*#__PURE__*/React.createElement("span", null, contact.phone)), contact.fax && /*#__PURE__*/React.createElement("div", {
1071
+ className: "lsg-footer__contact-item"
1072
+ }, /*#__PURE__*/React.createElement(FaxIcon, null), /*#__PURE__*/React.createElement("span", null, contact.fax)), contact.email && /*#__PURE__*/React.createElement("div", {
1073
+ className: "lsg-footer__contact-item"
1074
+ }, /*#__PURE__*/React.createElement(MailIcon, null), /*#__PURE__*/React.createElement("a", {
1075
+ href: "mailto:".concat(contact.email)
1076
+ }, contact.email)))), quickLinks.length > 0 && /*#__PURE__*/React.createElement("div", {
1077
+ className: "lsg-footer__quicklinks-col"
1078
+ }, /*#__PURE__*/React.createElement("h3", {
1079
+ className: "lsg-footer__col-heading"
1080
+ }, "QUICK LINKS"), /*#__PURE__*/React.createElement("ul", {
1081
+ className: "lsg-footer__quicklinks-list"
1082
+ }, quickLinks.map(function (link, i) {
929
1083
  var _a;
930
- return /*#__PURE__*/React.createElement(LsgQuickLinks, _extends({
931
- key: (_a = group.heading) !== null && _a !== void 0 ? _a : i
932
- }, group));
933
- }))), /*#__PURE__*/React.createElement("div", {
1084
+ return /*#__PURE__*/React.createElement("li", {
1085
+ key: (_a = link.href) !== null && _a !== void 0 ? _a : i,
1086
+ className: "lsg-footer__quicklink-item"
1087
+ }, /*#__PURE__*/React.createElement("a", {
1088
+ href: link.href,
1089
+ className: "lsg-footer__quicklink"
1090
+ }, link.label), /*#__PURE__*/React.createElement("hr", {
1091
+ className: "lsg-footer__divider"
1092
+ }));
1093
+ }))))), /*#__PURE__*/React.createElement("hr", {
1094
+ className: "lsg-footer__bottom-divider"
1095
+ }), /*#__PURE__*/React.createElement("div", {
934
1096
  className: "lsg-footer__bottom"
935
1097
  }, /*#__PURE__*/React.createElement("p", {
936
1098
  className: "lsg-footer__copyright"
937
- }, copyright !== null && copyright !== void 0 ? copyright : "\u00A9 ".concat(year, " Atlas Copco AB. All rights reserved."))));
1099
+ }, copyrightText)));
938
1100
  };
939
1101
 
940
1102
  var BASE_COMPONENTS = {