luna-one 3.1.437 → 3.1.440

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.
@@ -1,14 +1,16 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
-
5
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
6
4
 
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
6
+
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
13
+
12
14
  var _react = _interopRequireWildcard(require("react"));
13
15
 
14
16
  require("./Carousel.scss");
@@ -29,7 +31,18 @@ var Carousel = function Carousel(_ref) {
29
31
  motion = _ref.motion;
30
32
  var GatsbyImage = content === null || content === void 0 ? void 0 : content.GatsbyImage;
31
33
  var Link = content === null || content === void 0 ? void 0 : content.Link;
32
- var carouselWrapper = (0, _react.useRef)(); // split all cards into grouped cells
34
+ var carouselWrapper = (0, _react.useRef)();
35
+
36
+ var _useState = (0, _react.useState)(false),
37
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
38
+ cardsLoaded = _useState2[0],
39
+ setCardsLoaded = _useState2[1];
40
+
41
+ var _useState3 = (0, _react.useState)(false),
42
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
43
+ slideCountMessage = _useState4[0],
44
+ setSlideCountMessage = _useState4[1]; // split all cards into grouped cells
45
+
33
46
 
34
47
  var largeCards = _lodash["default"].chunk(content === null || content === void 0 ? void 0 : content.cards, 4);
35
48
 
@@ -44,14 +57,19 @@ var Carousel = function Carousel(_ref) {
44
57
  cellAlign: "center",
45
58
  wrapAround: true,
46
59
  adaptiveHeight: false,
47
- imagesLoaded: true
60
+ imagesLoaded: false,
61
+ setGallerySize: false
48
62
  };
49
63
 
50
- if (carouselWrapper) {
64
+ if (cardsLoaded) {
51
65
  var carouselElemSelector = ".ter-carousel--xsmall";
52
66
  var carousel = new _flickity["default"](carouselElemSelector, carouselParams);
53
67
  var carouselElemSelectorSmall = ".ter-carousel--small";
54
68
  var carouselSmall = new _flickity["default"](carouselElemSelectorSmall, carouselParams);
69
+ var activeCarousel = window.innerWidth >= 580 ? carouselSmall : carousel;
70
+ activeCarousel.on("change", function () {
71
+ updateSlideCounter(activeCarousel.selectedIndex + 1, activeCarousel);
72
+ });
55
73
  var carouselElemSelectorMedium = ".ter-carousel--medium";
56
74
  var carouselMedium = new _flickity["default"](carouselElemSelectorMedium, carouselParams);
57
75
  var carouselElemSelectorLarge = ".ter-carousel--large";
@@ -59,27 +77,23 @@ var Carousel = function Carousel(_ref) {
59
77
 
60
78
  if (document !== null) {
61
79
  addPaginationLabels();
62
- updateSlideCountMessage(carousel.selectedIndex + 1);
63
- carousel.on("change", function () {
64
- updateSlideCountMessage(carousel.selectedIndex + 1);
65
- });
80
+ updateSlideCounter(activeCarousel.selectedIndex + 1, activeCarousel);
66
81
  }
67
- }
68
- }, [carouselWrapper]);
69
82
 
70
- var updateSlideCountMessage = function updateSlideCountMessage(slideIndex) {
71
- if (document !== null) {
72
- document.querySelector(".ter-carousel__counter").innerText = updateSlideCounter(document.querySelector(".ter-carousel--xsmall .flickity-page-dots"), slideIndex);
83
+ document.querySelectorAll(".carousel-cell").forEach(function (elem) {
84
+ elem.setAttribute('height', elem.clientHeight);
85
+ });
73
86
  }
74
- };
75
-
76
- var updateSlideCounter = function updateSlideCounter(selector, currentIndex) {
77
- var _selector$childNodes;
78
-
79
- if (selector && selector !== null && selector !== void 0 && selector.childNodes && (selector === null || selector === void 0 ? void 0 : (_selector$childNodes = selector.childNodes) === null || _selector$childNodes === void 0 ? void 0 : _selector$childNodes.length) > 0) {
80
- var _selector$childNodes2;
87
+ }, [cardsLoaded]);
88
+ (0, _react.useEffect)(function () {
89
+ if (document) {
90
+ setCardsLoaded(true);
91
+ }
92
+ });
81
93
 
82
- return "Slide ".concat(currentIndex, " of ").concat(selector === null || selector === void 0 ? void 0 : (_selector$childNodes2 = selector.childNodes) === null || _selector$childNodes2 === void 0 ? void 0 : _selector$childNodes2.length);
94
+ var updateSlideCounter = function updateSlideCounter(currentIndex, carousel) {
95
+ if (currentIndex && carousel) {
96
+ setSlideCountMessage("Slide ".concat(currentIndex, " of ").concat(carousel.getCellElements().length));
83
97
  }
84
98
  };
85
99
 
@@ -108,13 +122,13 @@ var Carousel = function Carousel(_ref) {
108
122
  }
109
123
  };
110
124
 
111
- var imageSizes = {
125
+ var carouselImageSizes = {
112
126
  desktop: {
113
127
  width: 275,
114
- height: 180,
128
+ height: 206,
115
129
  ratio: {
116
- width: 55,
117
- height: 36
130
+ width: 4,
131
+ height: 3
118
132
  }
119
133
  },
120
134
  tablet: {
@@ -127,10 +141,10 @@ var Carousel = function Carousel(_ref) {
127
141
  },
128
142
  mobile: {
129
143
  width: 240,
130
- height: 200,
144
+ height: 180,
131
145
  ratio: {
132
- width: 6,
133
- height: 5
146
+ width: 4,
147
+ height: 3
134
148
  }
135
149
  }
136
150
  };
@@ -146,7 +160,7 @@ var Carousel = function Carousel(_ref) {
146
160
  eyebrow: card === null || card === void 0 ? void 0 : card.eyebrow,
147
161
  header: card === null || card === void 0 ? void 0 : card.header,
148
162
  image: card === null || card === void 0 ? void 0 : card.image,
149
- imageSizes: imageSizes,
163
+ imageSizes: carouselImageSizes,
150
164
  displayButton: content === null || content === void 0 ? void 0 : content.displayButton,
151
165
  cardLink: card === null || card === void 0 ? void 0 : card.cardLink,
152
166
  bgColor: !(card !== null && card !== void 0 && card.image) ? "grey" : "",
@@ -175,16 +189,20 @@ var Carousel = function Carousel(_ref) {
175
189
  onClick: function onClick(e) {
176
190
  return skipCarousel(e);
177
191
  }
178
- }, "Skip carousel of ", content === null || content === void 0 ? void 0 : (_content$cards2 = content.cards) === null || _content$cards2 === void 0 ? void 0 : _content$cards2.length, " items"), /*#__PURE__*/_react["default"].createElement("div", {
192
+ }, "Skip carousel of ", content === null || content === void 0 ? void 0 : (_content$cards2 = content.cards) === null || _content$cards2 === void 0 ? void 0 : _content$cards2.length, " items"), slideCountMessage && /*#__PURE__*/_react["default"].createElement("div", {
179
193
  className: "ter-carousel__counter"
180
- }))), /*#__PURE__*/_react["default"].createElement("section", {
181
- className: "ter-carousel ter-carousel--large ".concat(paddingClass)
194
+ }, slideCountMessage))), /*#__PURE__*/_react["default"].createElement("section", {
195
+ className: "ter-carousel ter-carousel--large ".concat(paddingClass),
196
+ height: "100%"
182
197
  }, renderCards(largeCards)), /*#__PURE__*/_react["default"].createElement("section", {
183
- className: "ter-carousel ter-carousel--medium ".concat(paddingClass)
198
+ className: "ter-carousel ter-carousel--medium ".concat(paddingClass),
199
+ height: "100%"
184
200
  }, renderCards(mediumCards)), /*#__PURE__*/_react["default"].createElement("section", {
185
- className: "ter-carousel ter-carousel--small ".concat(paddingClass)
201
+ className: "ter-carousel ter-carousel--small ".concat(paddingClass),
202
+ height: "100%"
186
203
  }, renderCards(smallCards)), /*#__PURE__*/_react["default"].createElement("section", {
187
- className: "ter-carousel ter-carousel--xsmall ".concat(paddingClass)
204
+ className: "ter-carousel ter-carousel--xsmall ".concat(paddingClass),
205
+ height: "100%"
188
206
  }, renderCards(xSmallCards)), /*#__PURE__*/_react["default"].createElement("span", {
189
207
  id: "skip-link"
190
208
  })));
@@ -2,6 +2,7 @@
2
2
 
3
3
  .ter-carousel {
4
4
  overflow: hidden;
5
+ height: 100%;
5
6
  padding-top: 72px;
6
7
  padding-bottom: 72px;
7
8
  &:focus-visible {
@@ -34,6 +35,7 @@
34
35
  }
35
36
  &-outer {
36
37
  position: relative;
38
+ display: grid;
37
39
  }
38
40
  &__skip {
39
41
  display: inline-block;
@@ -60,6 +62,8 @@
60
62
  }
61
63
  }
62
64
  .ter-bounded-card {
65
+ display: flex;
66
+ text-align: left;
63
67
  width: 23%;
64
68
  margin-left: 1%;
65
69
  margin-right: 1%;
@@ -105,7 +109,7 @@
105
109
  @media screen and (max-width: $breakpoint-xs) {
106
110
  display: none;
107
111
  }
108
- .dot {
112
+ .flickity-page-dot {
109
113
  color: $trimble-blue;
110
114
  display: inline-block;
111
115
  text-align: center;
@@ -125,10 +129,17 @@
125
129
  }
126
130
  }
127
131
  }
132
+ .flickity-slider {
133
+ width: 100%;
134
+ display: block;
135
+ }
128
136
  .carousel-cell {
129
137
  display: flex;
130
138
  width: 100%;
131
139
  justify-content: center;
132
- margin: 0 auto;
140
+ &:not(.is-selected){
141
+ height: 0;
142
+ visibility: hidden;
143
+ }
133
144
  }
134
145
  }
@@ -352,56 +352,64 @@ var NavBar = function NavBar(props) {
352
352
  };
353
353
 
354
354
  var generateNavOptions = function generateNavOptions() {
355
- return navOptions === null || navOptions === void 0 ? void 0 : navOptions.map(function (option) {
355
+ return navOptions === null || navOptions === void 0 ? void 0 : navOptions.map(function (option, i) {
356
+ var _getUrl;
357
+
358
+ if (!option) {
359
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null);
360
+ }
361
+
356
362
  var isCollapsed = !isExpanded;
357
- var url = getUrl(option).split("/")[2];
363
+ var url = getUrl(option) ? (_getUrl = getUrl(option)) === null || _getUrl === void 0 ? void 0 : _getUrl.split("/")[2] : null;
358
364
  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
359
365
 
360
366
  var active = path && (path === null || path === void 0 ? void 0 : path.includes(url));
361
- return /*#__PURE__*/_react["default"].createElement(NavOption, {
362
- key: option.text,
363
- displayIcons: displayIcons,
364
- option: option,
365
- menuBarTheme: menuBarTheme,
366
- navigate: navigate
367
- }, option.type === "category" ? /*#__PURE__*/_react["default"].createElement(MegaMenu, {
368
- key: option.text,
369
- isOpen: currentOpenMenu === option.text,
370
- content: option,
371
- Link: Link,
372
- collapsed: isCollapsed,
373
- currentOpenMenu: currentOpenMenu,
374
- displayIcons: displayIcons,
375
- icon: option.icon,
376
- theme: menuBarTheme,
377
- active: active
378
- }) : option.type === "links" ? /*#__PURE__*/_react["default"].createElement(NavMiniMenu, {
379
- navText: option.text,
380
- links: option.links,
381
- key: option.text,
382
- isOpen: currentOpenMenu === option.text,
383
- Link: Link,
384
- displayIcons: displayIcons,
385
- icon: option.icon,
386
- theme: menuBarTheme,
387
- currentOpenMenu: currentOpenMenu,
388
- active: active
389
- }) : /*#__PURE__*/_react["default"].createElement(LunaLink, {
390
- to: option.url,
391
- depth: 1,
392
- tabIndex: mouse ? "" : "0",
393
- href: option.url,
394
- key: option.text,
395
- 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) : ""),
396
- id: (0, _formatID["default"])("".concat(option.text, "-navbar-nav-link")),
397
- Link: Link,
398
- onClick: closeAllDropDowns,
399
- displayIcons: displayIcons,
400
- icon: option.icon,
401
- navigate: navigate,
402
- internalLink: option === null || option === void 0 ? void 0 : option.internalLink,
403
- target: typeof (option === null || option === void 0 ? void 0 : option.external) === 'boolean' ? option !== null && option !== void 0 && option.external ? "_blank" : "_self" : null
404
- }, /*#__PURE__*/_react["default"].createElement("p", null, option.text)));
367
+
368
+ if (option.text) {
369
+ return /*#__PURE__*/_react["default"].createElement(NavOption, {
370
+ key: "".concat(option === null || option === void 0 ? void 0 : option.text, "-").concat(i),
371
+ displayIcons: displayIcons,
372
+ option: option,
373
+ menuBarTheme: menuBarTheme,
374
+ navigate: navigate
375
+ }, option.type === "category" ? /*#__PURE__*/_react["default"].createElement(MegaMenu, {
376
+ isOpen: currentOpenMenu === (option === null || option === void 0 ? void 0 : option.text),
377
+ content: option,
378
+ Link: Link,
379
+ collapsed: isCollapsed,
380
+ currentOpenMenu: currentOpenMenu,
381
+ displayIcons: displayIcons,
382
+ icon: option.icon,
383
+ theme: menuBarTheme,
384
+ active: active
385
+ }) : option.type === "links" ? /*#__PURE__*/_react["default"].createElement(NavMiniMenu, {
386
+ navText: option === null || option === void 0 ? void 0 : option.text,
387
+ links: option === null || option === void 0 ? void 0 : option.links,
388
+ isOpen: currentOpenMenu === (option === null || option === void 0 ? void 0 : option.text),
389
+ Link: Link,
390
+ displayIcons: displayIcons,
391
+ icon: option.icon,
392
+ theme: menuBarTheme,
393
+ currentOpenMenu: currentOpenMenu,
394
+ active: active
395
+ }) : /*#__PURE__*/_react["default"].createElement(LunaLink, {
396
+ to: option.url,
397
+ depth: 1,
398
+ tabIndex: mouse ? "" : "0",
399
+ href: option === null || option === void 0 ? void 0 : option.url,
400
+ 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) : ""),
401
+ id: (0, _formatID["default"])("".concat(option.text, "-navbar-nav-link")),
402
+ Link: Link,
403
+ onClick: closeAllDropDowns,
404
+ displayIcons: displayIcons,
405
+ icon: option === null || option === void 0 ? void 0 : option.icon,
406
+ navigate: navigate,
407
+ internalLink: option === null || option === void 0 ? void 0 : option.internalLink,
408
+ target: typeof (option === null || option === void 0 ? void 0 : option.external) === "boolean" ? option !== null && option !== void 0 && option.external ? "_blank" : "_self" : null
409
+ }, /*#__PURE__*/_react["default"].createElement("p", null, option.text)));
410
+ } else {
411
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null);
412
+ }
405
413
  });
406
414
  };
407
415
 
@@ -502,7 +510,6 @@ var NavBar = function NavBar(props) {
502
510
  }, !disableMenus && /*#__PURE__*/_react["default"].createElement("div", {
503
511
  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 ")
504
512
  }, /*#__PURE__*/_react["default"].createElement("div", {
505
- id: _lodash["default"].uniqueId("id-"),
506
513
  className: "ter-navbar__menus-wrapper ".concat(displayIcons ? "ter-navbar__menus-wrapper--with-icons" : "")
507
514
  }, generateNavOptions(), featuredLink && generateFeaturedLink()))), /*#__PURE__*/_react["default"].createElement(MobileNav, {
508
515
  rightLinks: rightLinks,
@@ -545,7 +552,6 @@ var NavBar = function NavBar(props) {
545
552
  })), /*#__PURE__*/_react["default"].createElement("div", {
546
553
  className: "ter-navbar__flyout-logo"
547
554
  }, /*#__PURE__*/_react["default"].createElement("img", {
548
- id: _lodash["default"].uniqueId("id-"),
549
555
  src: _logoIcon["default"],
550
556
  alt: "open flyout"
551
557
  }))))), sectorFlyoutData && sectorFlyoutDeployed && /*#__PURE__*/_react["default"].createElement(Flyout, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "luna-one",
3
- "version": "3.1.437",
3
+ "version": "3.1.440",
4
4
  "peerDependencies": {
5
5
  "react": "^17.0.2",
6
6
  "react-dom": "^17.0.2",