luna-one 3.1.512 → 3.1.514

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.
@@ -108,7 +108,8 @@ var MobileNav = function MobileNav(props) {
108
108
  handleSearchSubmit = _useContext.handleSearchSubmit,
109
109
  searchField = _useContext.searchField,
110
110
  closeHamburger = _useContext.closeHamburger,
111
- isBottomBarActive = _useContext.isBottomBarActive;
111
+ isBottomBarActive = _useContext.isBottomBarActive,
112
+ sectorFlyoutData = _useContext.sectorFlyoutData;
112
113
 
113
114
  var _useState = (0, _react.useState)(null),
114
115
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
@@ -236,7 +237,7 @@ var MobileNav = function MobileNav(props) {
236
237
  userProfile: userProfile,
237
238
  logout: logout,
238
239
  authLabels: authLabels
239
- })), !disableLogin && /*#__PURE__*/_react["default"].createElement("section", {
240
+ })), (sectorFlyoutData === null || sectorFlyoutData === void 0 ? void 0 : sectorFlyoutData.authenticated) && /*#__PURE__*/_react["default"].createElement("section", {
240
241
  className: "ter-mobile-mega-menu ".concat(isOpen !== null ? "ter-mobile-mega-menu--inactive" : ""),
241
242
  onClick: function onClick() {
242
243
  return handleSectorFlyoutDeployed();
@@ -252,7 +253,7 @@ var MobileNav = function MobileNav(props) {
252
253
  className: "ter-mobile-menu__caret ter-mobile-menu__caret--down",
253
254
  src: _downCaretDarkBlue["default"],
254
255
  alt: "caret icon"
255
- }))), /*#__PURE__*/_react["default"].createElement(MobileDashboardMenu, {
256
+ }))), (sectorFlyoutData === null || sectorFlyoutData === void 0 ? void 0 : sectorFlyoutData.authenticated) && /*#__PURE__*/_react["default"].createElement(MobileDashboardMenu, {
256
257
  text: myDashboardLabel,
257
258
  links: waffleMenu === null || waffleMenu === void 0 ? void 0 : waffleMenu.links,
258
259
  cta: waffleMenu === null || waffleMenu === void 0 ? void 0 : waffleMenu.cta,
@@ -11,6 +11,7 @@
11
11
  }
12
12
  &__selector {
13
13
  &__button {
14
+ cursor: pointer;
14
15
  padding: 10px 4px 4px 4px;
15
16
  border-bottom: 3px solid transparent;
16
17
  &--active, &:hover {
@@ -114,7 +114,8 @@ var NavBarContext = /*#__PURE__*/(0, _react.createContext)({
114
114
  setMouse: function setMouse() {},
115
115
  closeAllDropDowns: function closeAllDropDowns() {},
116
116
  checkScroll: function checkScroll() {},
117
- closeHamburger: function closeHamburger() {}
117
+ closeHamburger: function closeHamburger() {},
118
+ sectorFlyoutData: null
118
119
  });
119
120
  exports.NavBarContext = NavBarContext;
120
121
 
@@ -494,7 +495,8 @@ var NavBar = function NavBar(props) {
494
495
  desktopSearchDeployed: desktopSearchDeployed,
495
496
  setDesktopSearchDeployed: setDesktopSearchDeployed,
496
497
  isWaffleMenuDeployed: isWaffleMenuDeployed,
497
- setWaffleMenuDeployed: setWaffleMenuDeployed
498
+ setWaffleMenuDeployed: setWaffleMenuDeployed,
499
+ sectorFlyoutData: sectorFlyoutData
498
500
  }
499
501
  }, /*#__PURE__*/_react["default"].createElement("nav", {
500
502
  className: "ter-navbar ter-navbar".concat(isHidden && ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.scrollY) > 100 && !desktopSearchDeployed ? "--is-hidden" : "--is-showing"),
@@ -528,11 +530,11 @@ var NavBar = function NavBar(props) {
528
530
  globalSearch: globalSearch,
529
531
  setGlobalSearch: setGlobalSearch,
530
532
  waffleMenu: true
531
- }, /*#__PURE__*/_react["default"].createElement(_WaffleMenu["default"], {
533
+ }, (sectorFlyoutData === null || sectorFlyoutData === void 0 ? void 0 : sectorFlyoutData.authenticated) && /*#__PURE__*/_react["default"].createElement(_WaffleMenu["default"], {
532
534
  links: waffleMenu === null || waffleMenu === void 0 ? void 0 : waffleMenu.links,
533
535
  cta: waffleMenu === null || waffleMenu === void 0 ? void 0 : waffleMenu.cta,
534
536
  Link: Link
535
- }), !disableLogin && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("button", {
537
+ }), (sectorFlyoutData === null || sectorFlyoutData === void 0 ? void 0 : sectorFlyoutData.authenticated) && /*#__PURE__*/_react["default"].createElement("button", {
536
538
  type: "button",
537
539
  className: "ter-utility-nav__my-account",
538
540
  onClick: function onClick() {
@@ -543,7 +545,7 @@ var NavBar = function NavBar(props) {
543
545
  width: "20",
544
546
  height: "20",
545
547
  alt: ""
546
- })))), /*#__PURE__*/_react["default"].createElement("div", {
548
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
547
549
  className: "luna-layout__navigation-padding ".concat(menuBarTheme ? "luna-layout__navigation-padding--".concat(menuBarTheme) : "")
548
550
  }, !disableMenus && /*#__PURE__*/_react["default"].createElement("div", {
549
551
  className: "ter-navbar__wrapper \n ".concat(menuBarTheme ? "ter-navbar__wrapper--".concat(menuBarTheme) : "", "\n ").concat(displayIcons ? "ter-navbar__wrapper--with-icons" : "", "\n ").concat(displayIcons && menuBarTheme ? "ter-navbar__wrapper--with-icons--".concat(menuBarTheme) : "", "\n ")
@@ -576,6 +576,7 @@
576
576
  @media screen and (max-width: $breakpoint-sm) {
577
577
  display: none;
578
578
  }
579
+ cursor: pointer;
579
580
  align-items: center;
580
581
  margin: 0 25px;
581
582
  padding: 7px 4px 7px 4px;
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard3 = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
4
+
3
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
6
 
5
7
  Object.defineProperty(exports, "__esModule", {
@@ -9,9 +11,11 @@ exports["default"] = void 0;
9
11
 
10
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
11
13
 
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
15
+
12
16
  var _interopRequireWildcard2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/interopRequireWildcard"));
13
17
 
14
- var _react = _interopRequireDefault(require("react"));
18
+ var _react = _interopRequireWildcard3(require("react"));
15
19
 
16
20
  var _useMouse2 = _interopRequireDefault(require("../../utils/hooks/useMouse"));
17
21
 
@@ -25,7 +29,7 @@ var _caratUp = _interopRequireDefault(require("../../../application/assets/image
25
29
 
26
30
  var _close = _interopRequireDefault(require("../../../application/assets/images/close.svg"));
27
31
 
28
- var _lodash = _interopRequireDefault(require("lodash"));
32
+ var _lodash = require("lodash");
29
33
 
30
34
  var _component = _interopRequireDefault(require("@loadable/component"));
31
35
 
@@ -39,8 +43,8 @@ var LunaLink = (0, _component["default"])(function () {
39
43
  }
40
44
  });
41
45
 
42
- var SubNavSiblingsMenu = function SubNavSiblingsMenu(_ref) {
43
- var _window;
46
+ var SiblingsMenu = function SiblingsMenu(_ref) {
47
+ var _window, _window$location, _window2;
44
48
 
45
49
  var title = _ref.title,
46
50
  _ref$siblings = _ref.siblings,
@@ -48,7 +52,6 @@ var SubNavSiblingsMenu = function SubNavSiblingsMenu(_ref) {
48
52
  isOpen = _ref.isOpen,
49
53
  width = _ref.width,
50
54
  closeSiblingsWithEnter = _ref.closeSiblingsWithEnter,
51
- path = _ref.path,
52
55
  _onClick = _ref.onClick,
53
56
  onClose = _ref.onClose,
54
57
  Link = _ref.Link;
@@ -56,32 +59,47 @@ var SubNavSiblingsMenu = function SubNavSiblingsMenu(_ref) {
56
59
  var _useMouse = (0, _useMouse2["default"])(),
57
60
  mouse = _useMouse.mouse;
58
61
 
62
+ var path = (_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname;
63
+
64
+ var _useState = (0, _react.useState)([]),
65
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
66
+ orderedSiblings = _useState2[0],
67
+ setOrderedSiblings = _useState2[1];
68
+
69
+ (0, _react.useEffect)(function () {
70
+ var equals = function equals(arr) {
71
+ return (0, _lodash.orderBy)(siblings === null || siblings === void 0 ? void 0 : siblings.filter(function (d) {
72
+ return arr.map(function (str) {
73
+ var _d$pageName, _d$pageName$toLowerCa;
74
+
75
+ return (d === null || d === void 0 ? void 0 : (_d$pageName = d.pageName) === null || _d$pageName === void 0 ? void 0 : (_d$pageName$toLowerCa = _d$pageName.toLowerCase()) === null || _d$pageName$toLowerCa === void 0 ? void 0 : _d$pageName$toLowerCa.indexOf(str)) === 0;
76
+ }).reduce(function (a, b) {
77
+ return a && b;
78
+ });
79
+ }), ['pageName']);
80
+ };
81
+
82
+ var notEquals = function notEquals(arr) {
83
+ return (0, _lodash.orderBy)(siblings === null || siblings === void 0 ? void 0 : siblings.filter(function (d) {
84
+ return arr.map(function (str) {
85
+ var _d$pageName2, _d$pageName2$toLowerC;
86
+
87
+ return (d === null || d === void 0 ? void 0 : (_d$pageName2 = d.pageName) === null || _d$pageName2 === void 0 ? void 0 : (_d$pageName2$toLowerC = _d$pageName2.toLowerCase()) === null || _d$pageName2$toLowerC === void 0 ? void 0 : _d$pageName2$toLowerC.indexOf(str)) !== 0;
88
+ }).reduce(function (a, b) {
89
+ return a && b;
90
+ });
91
+ }), ['pageName']);
92
+ };
93
+
94
+ setOrderedSiblings([].concat((0, _toConsumableArray2["default"])(equals(['overview'])), (0, _toConsumableArray2["default"])(notEquals(['overview', 'contact'])), (0, _toConsumableArray2["default"])(equals(['contact']))));
95
+ }, [siblings]);
96
+
59
97
  if ((siblings === null || siblings === void 0 ? void 0 : siblings.length) <= 1) {
60
98
  return /*#__PURE__*/_react["default"].createElement("p", {
61
99
  className: "ter-sub-nav__breadcrumbs__text ter-sub-nav__breadcrumbs__text--last"
62
100
  }, title);
63
- } // REORDER SIBLINGS MENU
64
-
65
-
66
- var siblingsOverview = siblings === null || siblings === void 0 ? void 0 : siblings.filter(function (d) {
67
- var _d$pageName, _d$pageName$toLowerCa;
68
-
69
- return (d === null || d === void 0 ? void 0 : (_d$pageName = d.pageName) === null || _d$pageName === void 0 ? void 0 : (_d$pageName$toLowerCa = _d$pageName.toLowerCase()) === null || _d$pageName$toLowerCa === void 0 ? void 0 : _d$pageName$toLowerCa.indexOf('overview')) === 0;
70
- });
71
- var siblingsContact = siblings === null || siblings === void 0 ? void 0 : siblings.filter(function (d) {
72
- var _d$pageName2, _d$pageName2$toLowerC;
73
-
74
- return (d === null || d === void 0 ? void 0 : (_d$pageName2 = d.pageName) === null || _d$pageName2 === void 0 ? void 0 : (_d$pageName2$toLowerC = _d$pageName2.toLowerCase()) === null || _d$pageName2$toLowerC === void 0 ? void 0 : _d$pageName2$toLowerC.indexOf('contact')) === 0;
75
- });
76
- var siblingsSubset = siblings === null || siblings === void 0 ? void 0 : siblings.filter(function (d) {
77
- var _d$pageName3, _d$pageName3$toLowerC, _d$pageName4, _d$pageName4$toLowerC;
78
-
79
- return (d === null || d === void 0 ? void 0 : (_d$pageName3 = d.pageName) === null || _d$pageName3 === void 0 ? void 0 : (_d$pageName3$toLowerC = _d$pageName3.toLowerCase()) === null || _d$pageName3$toLowerC === void 0 ? void 0 : _d$pageName3$toLowerC.indexOf('overview')) !== 0 && (d === null || d === void 0 ? void 0 : (_d$pageName4 = d.pageName) === null || _d$pageName4 === void 0 ? void 0 : (_d$pageName4$toLowerC = _d$pageName4.toLowerCase()) === null || _d$pageName4$toLowerC === void 0 ? void 0 : _d$pageName4$toLowerC.indexOf('contact')) !== 0;
80
- });
81
-
82
- var siblingsSubsetOrdered = _lodash["default"].orderBy(siblingsSubset, ['pageName']);
101
+ }
83
102
 
84
- var siblingsOrdered = [].concat((0, _toConsumableArray2["default"])(siblingsOverview), (0, _toConsumableArray2["default"])(siblingsSubsetOrdered), (0, _toConsumableArray2["default"])(siblingsContact));
85
103
  return /*#__PURE__*/_react["default"].createElement("div", {
86
104
  style: {
87
105
  position: "relative",
@@ -117,7 +135,7 @@ var SubNavSiblingsMenu = function SubNavSiblingsMenu(_ref) {
117
135
  flexDirection: "column",
118
136
  flexWrap: "wrap",
119
137
  position: width > 600 ? "absolute" : "fixed",
120
- top: width > 600 ? "46px" : ((_window = window) === null || _window === void 0 ? void 0 : _window.scrollY) > 0 ? "48px" : "108px",
138
+ top: width > 600 ? "46px" : ((_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.scrollY) > 0 ? "48px" : "108px",
121
139
  left: width < 600 && "0px",
122
140
  width: width > 600 ? "280px" : "100vw"
123
141
  }
@@ -153,8 +171,8 @@ var SubNavSiblingsMenu = function SubNavSiblingsMenu(_ref) {
153
171
  }
154
172
  })), /*#__PURE__*/_react["default"].createElement("ul", {
155
173
  className: "ter-sub-nav__siblings__list"
156
- }, siblingsOrdered && (siblingsOrdered === null || siblingsOrdered === void 0 ? void 0 : siblingsOrdered.map(function (sibling, i) {
157
- var active = sibling.slug.includes(path);
174
+ }, orderedSiblings && (orderedSiblings === null || orderedSiblings === void 0 ? void 0 : orderedSiblings.map(function (sibling, i) {
175
+ var active = sibling.slug === path;
158
176
  return sibling.slug && !active ? /*#__PURE__*/_react["default"].createElement("li", {
159
177
  key: "sibling-item-".concat(i),
160
178
  className: "ter-sub-nav__siblings__list__list-item"
@@ -177,5 +195,5 @@ var SubNavSiblingsMenu = function SubNavSiblingsMenu(_ref) {
177
195
  })))));
178
196
  };
179
197
 
180
- var _default = SubNavSiblingsMenu;
198
+ var _default = SiblingsMenu;
181
199
  exports["default"] = _default;
@@ -29,9 +29,9 @@ var _ellipses = _interopRequireDefault(require("../../../application/assets/imag
29
29
 
30
30
  var _close = _interopRequireDefault(require("../../../application/assets/images/close.svg"));
31
31
 
32
- var SubNavSiblingsMenu = (0, _component["default"])(function () {
32
+ var SiblingsMenu = (0, _component["default"])(function () {
33
33
  return Promise.resolve().then(function () {
34
- return (0, _interopRequireWildcard2["default"])(require('./SubNavSiblingsMenu'));
34
+ return (0, _interopRequireWildcard2["default"])(require('./SiblingsMenu'));
35
35
  });
36
36
  });
37
37
  var LunaLink = (0, _component["default"])(function () {
@@ -45,7 +45,7 @@ var LunaLink = (0, _component["default"])(function () {
45
45
  });
46
46
 
47
47
  var SubNav = function SubNav(_ref) {
48
- var _window, _window$location, _breadcrumbs, _breadcrumbs2;
48
+ var _breadcrumbs, _breadcrumbs2;
49
49
 
50
50
  var _ref$breadcrumbs = _ref.breadcrumbs,
51
51
  breadcrumbs = _ref$breadcrumbs === void 0 ? [] : _ref$breadcrumbs,
@@ -57,8 +57,6 @@ var SubNav = function SubNav(_ref) {
57
57
  var _useMouse = (0, _useMouse2["default"])(),
58
58
  mouse = _useMouse.mouse;
59
59
 
60
- var path = (_window = window) === null || _window === void 0 ? void 0 : (_window$location = _window.location) === null || _window$location === void 0 ? void 0 : _window$location.pathname.replace(/(\/(.*?)\/)/, "");
61
-
62
60
  var _useState = (0, _react.useState)(false),
63
61
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
64
62
  openBreadcrumbs = _useState2[0],
@@ -91,9 +89,9 @@ var SubNav = function SubNav(_ref) {
91
89
  var width = 0;
92
90
 
93
91
  if (typeof window !== "undefined") {
94
- var _window2 = window,
95
- innerWidth = _window2.innerWidth,
96
- innerHeight = _window2.innerHeight;
92
+ var _window = window,
93
+ innerWidth = _window.innerWidth,
94
+ innerHeight = _window.innerHeight;
97
95
  width = innerWidth;
98
96
  height = innerHeight;
99
97
  }
@@ -171,13 +169,12 @@ var SubNav = function SubNav(_ref) {
171
169
  }, breadcrumbs && (breadcrumbs === null || breadcrumbs === void 0 ? void 0 : breadcrumbs.length) <= 3 && width > 600 ? breadcrumbs === null || breadcrumbs === void 0 ? void 0 : breadcrumbs.map(function (breadcrumb, i) {
172
170
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
173
171
  key: "breadcrumb-".concat(i)
174
- }, (breadcrumbs === null || breadcrumbs === void 0 ? void 0 : breadcrumbs.length) === i + 1 ? /*#__PURE__*/_react["default"].createElement(SubNavSiblingsMenu, {
172
+ }, (breadcrumbs === null || breadcrumbs === void 0 ? void 0 : breadcrumbs.length) === i + 1 ? /*#__PURE__*/_react["default"].createElement(SiblingsMenu, {
175
173
  title: breadcrumb.title,
176
174
  siblings: siblings,
177
175
  isOpen: openSiblings,
178
176
  width: width,
179
177
  closeSiblingsWithEnter: closeSiblingsWithEnter,
180
- path: path,
181
178
  Link: Link,
182
179
  onClose: function onClose() {
183
180
  setOpenSiblings(false);
@@ -253,13 +250,12 @@ var SubNav = function SubNav(_ref) {
253
250
  "aria-controls": "sub-nav-siblings",
254
251
  role: "button",
255
252
  id: (0, _formatID["default"])("".concat((_breadcrumbs = breadcrumbs[(breadcrumbs === null || breadcrumbs === void 0 ? void 0 : breadcrumbs.length) - 1]) === null || _breadcrumbs === void 0 ? void 0 : _breadcrumbs.title, "-subnav-breadcumb"))
256
- }, /*#__PURE__*/_react["default"].createElement(SubNavSiblingsMenu, {
253
+ }, /*#__PURE__*/_react["default"].createElement(SiblingsMenu, {
257
254
  title: (_breadcrumbs2 = breadcrumbs[(breadcrumbs === null || breadcrumbs === void 0 ? void 0 : breadcrumbs.length) - 1]) === null || _breadcrumbs2 === void 0 ? void 0 : _breadcrumbs2.title,
258
255
  siblings: siblings,
259
256
  isOpen: openSiblings,
260
257
  width: width,
261
258
  closeSiblingsWithEnter: closeSiblingsWithEnter,
262
- path: path,
263
259
  Link: Link,
264
260
  onClose: function onClose() {
265
261
  setOpenSiblings(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luna-one",
3
- "version": "3.1.512",
3
+ "version": "3.1.514",
4
4
  "peerDependencies": {
5
5
  "react": "^17.0.2",
6
6
  "react-dom": "^17.0.2",