luna-one 3.1.404 → 3.1.407
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/luna/components/MegaMenu/MegaMenu.js +3 -2
- package/dist/luna/components/MegaMenu/MegaMenu.scss +2 -1
- package/dist/luna/other-organisms/NavBar/NavBar.js +48 -9
- package/dist/luna/other-organisms/NavBar/NavBar.scss +4 -2
- package/dist/luna/other-organisms/NavBar/NavMiniMenu.js +4 -3
- package/package.json +2 -2
|
@@ -48,7 +48,8 @@ var MegaMenu = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
48
48
|
isOpen = props.isOpen,
|
|
49
49
|
Link = props.Link,
|
|
50
50
|
displayIcons = props.displayIcons,
|
|
51
|
-
theme = props.theme
|
|
51
|
+
theme = props.theme,
|
|
52
|
+
active = props.active;
|
|
52
53
|
|
|
53
54
|
var _useState = (0, _react.useState)(null),
|
|
54
55
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -262,7 +263,7 @@ var MegaMenu = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
262
263
|
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
263
264
|
"data-depth": 1,
|
|
264
265
|
id: (0, _formatID.default)("".concat(content.text, "-mega-menu-nav-text")),
|
|
265
|
-
className: "ter-mega-menu__nav-text ".concat(isOpen ? "ter-mega-menu__nav-text--is-open" : "", "\n ").concat(theme ? "ter-mega-menu__nav-text--".concat(theme) : "", "\n ").concat(displayIcons ? "ter-mega-menu__nav-text--with-icon" : "", "\n ").concat(displayIcons && theme ? "ter-mega-menu__nav-text--with-icon" : "", "\n ")
|
|
266
|
+
className: "ter-mega-menu__nav-text ".concat(isOpen ? "ter-mega-menu__nav-text--is-open" : "", "\n ").concat(active ? "active" : "", "\n ").concat(theme ? "ter-mega-menu__nav-text--".concat(theme) : "", "\n ").concat(displayIcons ? "ter-mega-menu__nav-text--with-icon" : "", "\n ").concat(displayIcons && theme ? "ter-mega-menu__nav-text--with-icon" : "", "\n ")
|
|
266
267
|
}, content.text, /*#__PURE__*/_react.default.createElement("img", {
|
|
267
268
|
id: _lodash.default.uniqueId("cross-icon-"),
|
|
268
269
|
src: theme === "blue" ? _crossMediumWhite.default : _crossMediumBlue.default,
|
|
@@ -151,16 +151,27 @@ var NavBar = function NavBar(props) {
|
|
|
151
151
|
|
|
152
152
|
var lastPositionRef = (0, _react.useRef)(lastPosition);
|
|
153
153
|
|
|
154
|
+
var _useState15 = (0, _react.useState)(false),
|
|
155
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
156
|
+
pathname = _useState16[0],
|
|
157
|
+
setPathname = _useState16[1];
|
|
158
|
+
|
|
159
|
+
(0, _react.useEffect)(function () {
|
|
160
|
+
if (window) {
|
|
161
|
+
setPathname(window.location.pathname);
|
|
162
|
+
}
|
|
163
|
+
}, []);
|
|
164
|
+
|
|
154
165
|
var setLastPosition = function setLastPosition(data) {
|
|
155
166
|
lastPositionRef.current = data;
|
|
156
167
|
|
|
157
168
|
_setLastPosition(data);
|
|
158
169
|
};
|
|
159
170
|
|
|
160
|
-
var
|
|
161
|
-
|
|
162
|
-
isBottomBarActive =
|
|
163
|
-
setIsBottomBarActive =
|
|
171
|
+
var _useState17 = (0, _react.useState)(true),
|
|
172
|
+
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
173
|
+
isBottomBarActive = _useState18[0],
|
|
174
|
+
setIsBottomBarActive = _useState18[1];
|
|
164
175
|
|
|
165
176
|
var subNavDisplay = (subNavData === null || subNavData === void 0 ? void 0 : (_subNavData$breadcrum = subNavData.breadcrumbs) === null || _subNavData$breadcrum === void 0 ? void 0 : _subNavData$breadcrum.length) || (subNavData === null || subNavData === void 0 ? void 0 : (_subNavData$siblingPa = subNavData.siblingPages) === null || _subNavData$siblingPa === void 0 ? void 0 : _subNavData$siblingPa.length);
|
|
166
177
|
|
|
@@ -267,11 +278,37 @@ var NavBar = function NavBar(props) {
|
|
|
267
278
|
e.stopPropagation();
|
|
268
279
|
};
|
|
269
280
|
|
|
281
|
+
var getUrl = function getUrl(option) {
|
|
282
|
+
var _option$links;
|
|
283
|
+
|
|
284
|
+
if (option && option.url) {
|
|
285
|
+
return option.url;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (option && option !== null && option !== void 0 && (_option$links = option.links) !== null && _option$links !== void 0 && _option$links.length) {
|
|
289
|
+
if (option.links[0].url) {
|
|
290
|
+
return option.links[0].url;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (option.links[0].links[0].url) {
|
|
294
|
+
return option.links[0].links[0].url;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (option.links[0].links[0].links[0].url) {
|
|
298
|
+
return option.links[0].links[0].links[0].url;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
|
|
270
303
|
var generateNavOptions = function generateNavOptions() {
|
|
271
304
|
return navOptions === null || navOptions === void 0 ? void 0 : navOptions.map(function (option) {
|
|
272
|
-
var _option$
|
|
305
|
+
var _option$links2;
|
|
306
|
+
|
|
307
|
+
var isCollapsed = (option === null || option === void 0 ? void 0 : (_option$links2 = option.links) === null || _option$links2 === void 0 ? void 0 : _option$links2.length) > 4 ? true : false;
|
|
308
|
+
var url = getUrl(option).split('/')[2];
|
|
309
|
+
var path = pathname && pathname.split('/')[2]; // to determine if active, check if nav url is in the first breadcrumb after the local of the pathname
|
|
273
310
|
|
|
274
|
-
var
|
|
311
|
+
var active = path && (path === null || path === void 0 ? void 0 : path.includes(url));
|
|
275
312
|
return /*#__PURE__*/_react.default.createElement(_NavOption.default, {
|
|
276
313
|
key: option.text,
|
|
277
314
|
displayIcons: displayIcons,
|
|
@@ -287,7 +324,8 @@ var NavBar = function NavBar(props) {
|
|
|
287
324
|
currentOpenMenu: currentOpenMenu,
|
|
288
325
|
displayIcons: displayIcons,
|
|
289
326
|
icon: option.icon,
|
|
290
|
-
theme: menuBarTheme
|
|
327
|
+
theme: menuBarTheme,
|
|
328
|
+
active: active
|
|
291
329
|
}) : option.type === "links" ? /*#__PURE__*/_react.default.createElement(_NavMiniMenu.default, {
|
|
292
330
|
navText: option.text,
|
|
293
331
|
links: option.links,
|
|
@@ -297,14 +335,15 @@ var NavBar = function NavBar(props) {
|
|
|
297
335
|
displayIcons: displayIcons,
|
|
298
336
|
icon: option.icon,
|
|
299
337
|
theme: menuBarTheme,
|
|
300
|
-
currentOpenMenu: currentOpenMenu
|
|
338
|
+
currentOpenMenu: currentOpenMenu,
|
|
339
|
+
active: active
|
|
301
340
|
}) : /*#__PURE__*/_react.default.createElement(_terraOne.LunaLink, {
|
|
302
341
|
to: option.url,
|
|
303
342
|
depth: 1,
|
|
304
343
|
tabIndex: mouse ? "" : "0",
|
|
305
344
|
href: option.url,
|
|
306
345
|
key: option.text,
|
|
307
|
-
className: "".concat(mouse ? "ter-navbar__nav-link" : "ter-navbar__nav-link tabFocus", " \n ").concat(menuBarTheme ? "ter-navbar__nav-link--".concat(menuBarTheme) : "", "\n ").concat(displayIcons ? "ter-navbar__nav-link--with-icon" : "", "\n ").concat(displayIcons && menuBarTheme ? "ter-navbar__nav-link--with-icon--".concat(menuBarTheme) : ""),
|
|
346
|
+
className: "".concat(mouse ? "ter-navbar__nav-link" : "ter-navbar__nav-link tabFocus", " \n ").concat(active ? "active" : "", "\n ").concat(menuBarTheme ? "ter-navbar__nav-link--".concat(menuBarTheme) : "", "\n ").concat(displayIcons ? "ter-navbar__nav-link--with-icon" : "", "\n ").concat(displayIcons && menuBarTheme ? "ter-navbar__nav-link--with-icon--".concat(menuBarTheme) : ""),
|
|
308
347
|
id: (0, _formatID.default)("".concat(option.text, "-navbar-nav-link")),
|
|
309
348
|
Link: Link,
|
|
310
349
|
onClick: closeAllDropDowns,
|
|
@@ -300,7 +300,8 @@
|
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
&--is-open,
|
|
303
|
-
&:hover
|
|
303
|
+
&:hover,
|
|
304
|
+
&.active {
|
|
304
305
|
border-bottom: 3px solid brand-color("brand-5");
|
|
305
306
|
cursor: pointer;
|
|
306
307
|
}
|
|
@@ -388,7 +389,8 @@
|
|
|
388
389
|
}
|
|
389
390
|
}
|
|
390
391
|
|
|
391
|
-
&:hover
|
|
392
|
+
&:hover,
|
|
393
|
+
&.active {
|
|
392
394
|
text-decoration: none;
|
|
393
395
|
border-bottom: 3px solid brand-color("brand-5");
|
|
394
396
|
}
|
|
@@ -41,7 +41,8 @@ var NavMiniMenu = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
41
41
|
Link = props.Link,
|
|
42
42
|
isOpen = props.isOpen,
|
|
43
43
|
displayIcons = props.displayIcons,
|
|
44
|
-
theme = props.theme
|
|
44
|
+
theme = props.theme,
|
|
45
|
+
active = props.active;
|
|
45
46
|
(0, _react.useImperativeHandle)(ref, function (e) {
|
|
46
47
|
return {
|
|
47
48
|
handleClick: function handleClick() {
|
|
@@ -94,7 +95,7 @@ var NavMiniMenu = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
94
95
|
return mouseLeave();
|
|
95
96
|
}
|
|
96
97
|
}, /*#__PURE__*/_react.default.createElement(_terraOne.LunaLink, {
|
|
97
|
-
className: "".concat(mouse ? "ter-nav-mini-menu__drop-down__link" : "ter-nav-mini-menu__drop-down__link tabFocus", " ").concat(link.text === open ? "ter-nav-mini-menu__drop-down__link--is-open" : "", " \n "),
|
|
98
|
+
className: "".concat(mouse ? "ter-nav-mini-menu__drop-down__link" : "ter-nav-mini-menu__drop-down__link tabFocus", " ").concat(link.text === open ? "ter-nav-mini-menu__drop-down__link--is-open" : "", " ").concat(active ? "active" : "", "\n "),
|
|
98
99
|
to: link.url,
|
|
99
100
|
onClick: closeAllDropDowns,
|
|
100
101
|
target: link.external ? "_blank" : "_self",
|
|
@@ -122,7 +123,7 @@ var NavMiniMenu = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
122
123
|
"aria-label": "".concat(navText, " menu")
|
|
123
124
|
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
124
125
|
id: (0, _formatID.default)("".concat(navText, "-ter-nav-mini-menu-text")),
|
|
125
|
-
className: "ter-nav-mini-menu__text ".concat(isOpen && " ter-nav-mini-menu__text--is-open", "\n ").concat(displayIcons ? "ter-nav-mini-menu__text--with-icons" : "", "\n ").concat(theme ? "ter-nav-mini-menu__text--".concat(theme) : "", "\n "),
|
|
126
|
+
className: "ter-nav-mini-menu__text ".concat(isOpen && " ter-nav-mini-menu__text--is-open", "\n ").concat(active ? "active" : "", "\n ").concat(displayIcons ? "ter-nav-mini-menu__text--with-icons" : "", "\n ").concat(theme ? "ter-nav-mini-menu__text--".concat(theme) : "", "\n "),
|
|
126
127
|
"data-depth": 1
|
|
127
128
|
}, navText, /*#__PURE__*/_react.default.createElement("img", {
|
|
128
129
|
id: _lodash.default.uniqueId("cross-icon-"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "luna-one",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.407",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@storybook/addon-knobs": "^6.3.1",
|
|
6
6
|
"@testing-library/jest-dom": "^5.11.9",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"react-scroll": "^1.7.14",
|
|
25
25
|
"react-slidedown": "^2.4.5",
|
|
26
26
|
"smoothscroll-polyfill": "^0.4.4",
|
|
27
|
-
"terra-one": "^3.0.
|
|
27
|
+
"terra-one": "^3.0.139"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"node-sass": "^4.12.0",
|