luna-one 3.1.326 → 3.1.330

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.
@@ -34,6 +34,7 @@ var CTAButtons = function CTAButtons(_ref) {
34
34
  className: "cta-buttons"
35
35
  }, buttons.map(function (button, index) {
36
36
  return (button === null || button === void 0 ? void 0 : button.url) && (button === null || button === void 0 ? void 0 : button.text) && /*#__PURE__*/_react.default.createElement(_terraOne.Button, {
37
+ key: "button-".concat(variant ? variant + "-" : '').concat(index),
37
38
  className: (index + 1) % 2 !== 0 ? buttonsVariants === null || buttonsVariants === void 0 ? void 0 : buttonsVariants.primary : buttonsVariants === null || buttonsVariants === void 0 ? void 0 : buttonsVariants.secondary,
38
39
  url: button.url
39
40
  }, button.text);
@@ -91,14 +91,16 @@ var CtaWithHeader = function CtaWithHeader(_ref) {
91
91
  var _buttonsVarians, _buttonsVarians2;
92
92
 
93
93
  return (button === null || button === void 0 ? void 0 : button.url) && (button === null || button === void 0 ? void 0 : button.text) && (textLinks ? /*#__PURE__*/_react.default.createElement("div", {
94
+ key: index,
94
95
  className: "text-link-container"
95
96
  }, /*#__PURE__*/_react.default.createElement("a", {
96
97
  className: (0, _checkForExternalLink.default)(button.url) ? "text-link-external" : "text-link",
97
98
  href: button.url
98
99
  }, button.text)) : /*#__PURE__*/_react.default.createElement(_terraOne.Button, {
100
+ key: index,
99
101
  className: (index + 1) % 2 !== 0 ? (_buttonsVarians = buttonsVarians) === null || _buttonsVarians === void 0 ? void 0 : _buttonsVarians.primary : (_buttonsVarians2 = buttonsVarians) === null || _buttonsVarians2 === void 0 ? void 0 : _buttonsVarians2.secondary,
100
102
  url: button.url
101
- }, button.text));
103
+ }, button.text && button.text));
102
104
  })));
103
105
  };
104
106
 
@@ -46,12 +46,7 @@ var MegaMenu = function MegaMenu(props) {
46
46
  currentOpenMenu = props.currentOpenMenu,
47
47
  collapsed = props.collapsed,
48
48
  isOpen = props.isOpen,
49
- Link = props.Link,
50
- updateNavHeightStyles = props.updateNavHeightStyles,
51
- navHeightStyles = props.navHeightStyles,
52
- subNavHeightStyles = props.subNavHeightStyles,
53
- maxActiveNavItems = props.maxActiveNavItems,
54
- setMaxActiveNavItems = props.setMaxActiveNavItems;
49
+ Link = props.Link;
55
50
 
56
51
  var _useState = (0, _react.useState)(null),
57
52
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -68,6 +63,26 @@ var MegaMenu = function MegaMenu(props) {
68
63
  hoveredFeature = _useState6[0],
69
64
  setHoveredFeature = _useState6[1];
70
65
 
66
+ var _useState7 = (0, _react.useState)(0),
67
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
68
+ maxActiveNavItems = _useState8[0],
69
+ setMaxActiveNavItems = _useState8[1];
70
+
71
+ var _useState9 = (0, _react.useState)(null),
72
+ _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
73
+ navHeightStyles = _useState10[0],
74
+ setNavHeightStyles = _useState10[1];
75
+
76
+ var _useState11 = (0, _react.useState)(null),
77
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
78
+ subNavHeightStyles = _useState12[0],
79
+ setSubNavHeightStyles = _useState12[1];
80
+
81
+ (0, _react.useEffect)(function () {
82
+ updateNavHeightStyles();
83
+ updateSubNavHeightStyles();
84
+ }, [maxActiveNavItems]);
85
+
71
86
  var mouseLeave = function mouseLeave(source) {
72
87
  hideSubsection();
73
88
  unselectFeature();
@@ -91,6 +106,42 @@ var MegaMenu = function MegaMenu(props) {
91
106
  returnDeployedChildClass();
92
107
  };
93
108
 
109
+ var updateNavHeightStyles = function updateNavHeightStyles() {
110
+ var currentMinHeight,
111
+ currentHeight,
112
+ // extra margin within dropdown menu
113
+ internalMarginHeight = 52,
114
+ // extra space for nav parent title - e.g. "Products" or "Solutions"
115
+ navExtraSpace = 39,
116
+ // height of single nav menu item
117
+ singleItemHeight = 34; //update heights based on max nav items
118
+
119
+ currentMinHeight = maxActiveNavItems * singleItemHeight + navExtraSpace + internalMarginHeight;
120
+ currentHeight = maxActiveNavItems * singleItemHeight + navExtraSpace + internalMarginHeight;
121
+ setNavHeightStyles({
122
+ minHeight: currentMinHeight + "px",
123
+ height: currentHeight + "px"
124
+ });
125
+ };
126
+
127
+ var updateSubNavHeightStyles = function updateSubNavHeightStyles() {
128
+ var currentMinHeight,
129
+ currentHeight,
130
+ // extra margin within dropdown menu
131
+ internalMarginHeight = 32,
132
+ // height of single nav menu item
133
+ singleItemHeight = 34,
134
+ //extra space for sub-menus
135
+ subNavExtraSpace = 71; //update heights based on max nav items
136
+
137
+ currentMinHeight = maxActiveNavItems * singleItemHeight + internalMarginHeight + subNavExtraSpace;
138
+ currentHeight = maxActiveNavItems * singleItemHeight + internalMarginHeight + subNavExtraSpace;
139
+ setSubNavHeightStyles({
140
+ minHeight: currentMinHeight + "px",
141
+ height: currentHeight + "px"
142
+ });
143
+ };
144
+
94
145
  var hideSubsection = function hideSubsection() {
95
146
  setDeployedSubsection(null);
96
147
  setDeployedTertiary(null);
@@ -9,6 +9,8 @@ exports.FullSubMenu = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
11
11
 
12
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
13
+
12
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
13
15
 
14
16
  var _lodash = _interopRequireDefault(require("lodash"));
@@ -30,7 +32,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
30
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
33
 
32
34
  var FullSubMenu = function FullSubMenu(props) {
33
- var _React$createElement;
35
+ var _category$links, _React$createElement;
34
36
 
35
37
  var menuProps = props.menuProps;
36
38
  var category = menuProps.category,
@@ -38,10 +40,8 @@ var FullSubMenu = function FullSubMenu(props) {
38
40
  mouseOverSubsection = menuProps.mouseOverSubsection,
39
41
  mouseOverTertiary = menuProps.mouseOverTertiary,
40
42
  mouseOverWithKeysMegaMenu = menuProps.mouseOverWithKeysMegaMenu,
41
- maxActiveNavItems = menuProps.maxActiveNavItems,
42
43
  setMaxActiveNavItems = menuProps.setMaxActiveNavItems,
43
- megaMenuParentValue = menuProps.megaMenuParentValue,
44
- fullSubMenuParentValue = menuProps.fullSubMenuParentValue;
44
+ megaMenuParentValue = menuProps.megaMenuParentValue;
45
45
 
46
46
  var _useState = (0, _react.useState)(false),
47
47
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -53,28 +53,21 @@ var FullSubMenu = function FullSubMenu(props) {
53
53
  subMenuClicked = _useState4[0],
54
54
  setSubMenuClicked = _useState4[1];
55
55
 
56
- var _useState5 = (0, _react.useState)(0),
57
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
58
- maxSubmenuItems = _useState6[0],
59
- setMaxSubmenuItems = _useState6[1];
60
-
61
56
  var _useContext = (0, _react.useContext)(_NavBar.NavBarContext),
62
57
  mouse = _useContext.mouse;
63
58
 
64
59
  var isOpen = (0, _react.useMemo)(function () {
65
60
  return deployedSubsection === category.text;
66
61
  }, [deployedSubsection, category]);
62
+ var fullSubMenuParents = category === null || category === void 0 ? void 0 : (_category$links = category.links) === null || _category$links === void 0 ? void 0 : _category$links.length;
63
+ var fullSubMenuProps = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, menuProps), {}, {
64
+ fullSubMenuParents: fullSubMenuParents
65
+ });
67
66
 
68
- var updateMaxActiveNavItems = function updateMaxActiveNavItems(currentLinks, megaMenuParentValue, e) {
67
+ var updateMaxActiveNavItems = function updateMaxActiveNavItems(currentLinks, megaMenuValue, e) {
69
68
  e.stopPropagation();
70
- setMaxSubmenuItems(currentLinks.length);
71
-
72
- if (currentLinks && currentLinks.length > megaMenuParentValue) {
73
- // check parent
74
- setMaxActiveNavItems(currentLinks.length);
75
- } else {
76
- setMaxActiveNavItems(megaMenuParentValue);
77
- }
69
+ var highest = currentLinks > megaMenuValue ? currentLinks : megaMenuValue;
70
+ setMaxActiveNavItems(highest);
78
71
  };
79
72
 
80
73
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
@@ -89,10 +82,12 @@ var FullSubMenu = function FullSubMenu(props) {
89
82
  setIsMousedOver(false);
90
83
  },
91
84
  onClick: function onClick(e) {
85
+ var _category$links2;
86
+
92
87
  mouseOverSubsection(category.text);
93
88
  mouseOverTertiary(null);
94
89
  setSubMenuClicked(true);
95
- updateMaxActiveNavItems(category.links, megaMenuParentValue, e);
90
+ updateMaxActiveNavItems(category === null || category === void 0 ? void 0 : (_category$links2 = category.links) === null || _category$links2 === void 0 ? void 0 : _category$links2.length, megaMenuParentValue, e);
96
91
  },
97
92
  onKeyDown: function onKeyDown(e) {
98
93
  return mouseOverWithKeysMegaMenu(e, category.text);
@@ -110,7 +105,7 @@ var FullSubMenu = function FullSubMenu(props) {
110
105
  "aria-label": isOpen ? "Expanded" : "Collapsed",
111
106
  className: "ter-mega-menu__left-title-caret"
112
107
  }))), /*#__PURE__*/_react.default.createElement(_SubMenu.default, {
113
- menuProps: menuProps,
108
+ menuProps: fullSubMenuProps,
114
109
  isOpen: isOpen,
115
110
  links: category.links
116
111
  }));
@@ -46,9 +46,9 @@ var SubMenu = function SubMenu(props) {
46
46
  hasFeatures = menuProps.hasFeatures,
47
47
  mouseLeave = menuProps.mouseLeave,
48
48
  subNavHeightStyles = menuProps.subNavHeightStyles,
49
- maxActiveNavItems = menuProps.maxActiveNavItems,
50
49
  setMaxActiveNavItems = menuProps.setMaxActiveNavItems,
51
- fullSubMenuParents = menuProps.fullSubMenuParents;
50
+ fullSubMenuParents = menuProps.fullSubMenuParents,
51
+ megaMenuParentValue = menuProps.megaMenuParentValue;
52
52
 
53
53
  var _useContext = (0, _react.useContext)(_NavBar.NavBarContext),
54
54
  mouse = _useContext.mouse,
@@ -64,11 +64,6 @@ var SubMenu = function SubMenu(props) {
64
64
  childOpen = _useState4[0],
65
65
  setChildOpen = _useState4[1];
66
66
 
67
- var _useState5 = (0, _react.useState)(0),
68
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
69
- maxSubmenuItems = _useState6[0],
70
- setMaxSubmenuItems = _useState6[1];
71
-
72
67
  var subMouseLeave = function subMouseLeave() {
73
68
  setChildOpen(null);
74
69
  };
@@ -86,14 +81,10 @@ var SubMenu = function SubMenu(props) {
86
81
  }
87
82
  };
88
83
 
89
- var updateMaxActiveNavItems = function updateMaxActiveNavItems(currentLinks, fullSubMenuParents, e) {
84
+ var updateMaxActiveNavItems = function updateMaxActiveNavItems(currentLinks, megaMenuCount, fullSubMenuParents, e) {
90
85
  e.stopPropagation();
91
-
92
- if (currentLinks.length > maxActiveNavItems) {
93
- setMaxActiveNavItems(currentLinks.length);
94
- } else {
95
- setMaxActiveNavItems(fullSubMenuParents);
96
- }
86
+ var highest = currentLinks > megaMenuCount && currentLinks > fullSubMenuParents ? currentLinks : megaMenuCount > currentLinks && megaMenuCount > fullSubMenuParents ? megaMenuCount : fullSubMenuParents;
87
+ setMaxActiveNavItems(highest);
97
88
  };
98
89
 
99
90
  var generateTertiaryMenu = function generateTertiaryMenu(category) {
@@ -114,9 +105,11 @@ var SubMenu = function SubMenu(props) {
114
105
  setIsMousedOver(null);
115
106
  },
116
107
  onClick: function onClick(e) {
108
+ var _category$links;
109
+
117
110
  mouseOverSubsection(deployedSubsection);
118
111
  mouseOverTertiary(category.text);
119
- updateMaxActiveNavItems(category.links, fullSubMenuParents, e);
112
+ updateMaxActiveNavItems(category === null || category === void 0 ? void 0 : (_category$links = category.links) === null || _category$links === void 0 ? void 0 : _category$links.length, megaMenuParentValue, fullSubMenuParents, e);
120
113
  },
121
114
  onKeyDown: function onKeyDown(e) {
122
115
  return navigateWithKeys(e, category.text);
@@ -91,6 +91,9 @@
91
91
  }
92
92
  .nav-text {
93
93
  color: $dark-navy;
94
+ @media screen and (max-width: $breakpoint-sm) {
95
+ color: $white;
96
+ }
94
97
  }
95
98
  }
96
99
 
@@ -139,31 +139,16 @@ var NavBar = function NavBar(props) {
139
139
 
140
140
  var lastPositionRef = (0, _react.useRef)(lastPosition);
141
141
 
142
- var _useState15 = (0, _react.useState)(0),
143
- _useState16 = (0, _slicedToArray2.default)(_useState15, 2),
144
- maxActiveNavItems = _useState16[0],
145
- setMaxActiveNavItems = _useState16[1];
146
-
147
- var _useState17 = (0, _react.useState)(null),
148
- _useState18 = (0, _slicedToArray2.default)(_useState17, 2),
149
- navHeightStyles = _useState18[0],
150
- setNavHeightStyles = _useState18[1];
151
-
152
- var _useState19 = (0, _react.useState)(null),
153
- _useState20 = (0, _slicedToArray2.default)(_useState19, 2),
154
- subNavHeightStyles = _useState20[0],
155
- setSubNavHeightStyles = _useState20[1];
156
-
157
142
  var setLastPosition = function setLastPosition(data) {
158
143
  lastPositionRef.current = data;
159
144
 
160
145
  _setLastPosition(data);
161
146
  };
162
147
 
163
- var _useState21 = (0, _react.useState)(true),
164
- _useState22 = (0, _slicedToArray2.default)(_useState21, 2),
165
- isBottomBarActive = _useState22[0],
166
- setIsBottomBarActive = _useState22[1];
148
+ var _useState15 = (0, _react.useState)(true),
149
+ _useState16 = (0, _slicedToArray2.default)(_useState15, 2),
150
+ isBottomBarActive = _useState16[0],
151
+ setIsBottomBarActive = _useState16[1];
167
152
 
168
153
  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);
169
154
 
@@ -229,10 +214,6 @@ var NavBar = function NavBar(props) {
229
214
  }
230
215
  };
231
216
  }, []);
232
- (0, _react.useEffect)(function () {
233
- updateNavHeightStyles();
234
- updateSubNavHeightStyles();
235
- }, [maxActiveNavItems]);
236
217
 
237
218
  var closeAllDropDowns = function closeAllDropDowns() {
238
219
  setCurrentOpenMenu(null);
@@ -265,7 +246,6 @@ var NavBar = function NavBar(props) {
265
246
  var closeDropDown = function closeDropDown(menu) {
266
247
  if (currentOpenMenu === menu || !menu) {
267
248
  setCurrentOpenMenu(null);
268
- setMaxActiveNavItems(0);
269
249
  }
270
250
  };
271
251
 
@@ -273,44 +253,6 @@ var NavBar = function NavBar(props) {
273
253
  e.stopPropagation();
274
254
  };
275
255
 
276
- var updateNavHeightStyles = function updateNavHeightStyles() {
277
- var currentMinHeight,
278
- currentHeight,
279
- // extra margin within dropdown menu
280
- internalMarginHeight = 52,
281
- // extra space for nav parent title - e.g. "Products" or "Solutions"
282
- navExtraSpace = 39,
283
- // height of single nav menu item
284
- singleItemHeight = 34; //update heights based on max nav items
285
-
286
- currentMinHeight = maxActiveNavItems * singleItemHeight + navExtraSpace + internalMarginHeight;
287
- currentHeight = maxActiveNavItems * singleItemHeight + navExtraSpace + internalMarginHeight;
288
- setNavHeightStyles({
289
- minHeight: currentMinHeight + "px",
290
- height: currentHeight + "px"
291
- });
292
- };
293
-
294
- var updateSubNavHeightStyles = function updateSubNavHeightStyles() {
295
- var currentMinHeight,
296
- currentHeight,
297
- // extra margin within dropdown menu
298
- internalMarginHeight = 32,
299
- // extra space for nav parent title - e.g. "Products" or "Solutions"
300
- // navExtraSpace = 39,
301
- // height of single nav menu item
302
- singleItemHeight = 34,
303
- //extra space for sub-menus
304
- subNavExtraSpace = 71; //update heights based on max nav items
305
-
306
- currentMinHeight = maxActiveNavItems * singleItemHeight + internalMarginHeight + subNavExtraSpace;
307
- currentHeight = maxActiveNavItems * singleItemHeight + internalMarginHeight + subNavExtraSpace;
308
- setSubNavHeightStyles({
309
- minHeight: currentMinHeight + "px",
310
- height: currentHeight + "px"
311
- });
312
- };
313
-
314
256
  var generateNavOptions = function generateNavOptions() {
315
257
  return navOptions.map(function (option) {
316
258
  if (option.type === "category") {
@@ -323,12 +265,7 @@ var NavBar = function NavBar(props) {
323
265
  content: option,
324
266
  Link: Link,
325
267
  collapsed: isCollapsed ? true : !isExpanded,
326
- currentOpenMenu: currentOpenMenu,
327
- updateNavHeightStyles: updateNavHeightStyles,
328
- navHeightStyles: navHeightStyles,
329
- subNavHeightStyles: subNavHeightStyles,
330
- maxActiveNavItems: maxActiveNavItems,
331
- setMaxActiveNavItems: setMaxActiveNavItems
268
+ currentOpenMenu: currentOpenMenu
332
269
  });
333
270
  } else if (option.type === "links") {
334
271
  return /*#__PURE__*/_react.default.createElement(_NavMiniMenu.default, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luna-one",
3
- "version": "3.1.326",
3
+ "version": "3.1.330",
4
4
  "dependencies": {
5
5
  "@storybook/addon-knobs": "^6.3.1",
6
6
  "@testing-library/jest-dom": "^5.11.9",
@@ -23,7 +23,7 @@
23
23
  "react-scroll": "^1.7.14",
24
24
  "react-slidedown": "^2.4.5",
25
25
  "smoothscroll-polyfill": "^0.4.4",
26
- "terra-one": "^3.0.107"
26
+ "terra-one": "~3.0.108"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "node-sass": "^4.12.0",