@bigbinary/neeto-site-blocks 1.8.20 → 1.8.22

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.cjs.js CHANGED
@@ -14595,6 +14595,36 @@ var useElementClick = function useElementClick(_ref) {
14595
14595
  index = _ref$index === void 0 ? undefined : _ref$index,
14596
14596
  _ref$isTitle = _ref.isTitle,
14597
14597
  isTitle = _ref$isTitle === void 0 ? false : _ref$isTitle;
14598
+ var getScrollableParent = function getScrollableParent(element) {
14599
+ if (!element) return null;
14600
+ var isScrollable = function isScrollable(el) {
14601
+ var style = getComputedStyle(el);
14602
+ return style.overflowY === "auto" || style.overflowY === "scroll";
14603
+ };
14604
+ var parent = element.parentElement;
14605
+ while (parent) {
14606
+ if (isScrollable(parent)) {
14607
+ return parent;
14608
+ }
14609
+ parent = parent.parentElement;
14610
+ }
14611
+ return document.documentElement; // Fallback to document
14612
+ };
14613
+
14614
+ var scrollToCenter = function scrollToCenter(element) {
14615
+ var scrollableParent = getScrollableParent(element);
14616
+ if (!scrollableParent) return;
14617
+ var parentRect = scrollableParent.getBoundingClientRect();
14618
+ var elementRect = element.getBoundingClientRect();
14619
+ var elementCenterY = elementRect.top + elementRect.height / 2;
14620
+ var parentCenterY = parentRect.top + parentRect.height / 2;
14621
+ var scrollOptions = {
14622
+ top: elementCenterY - parentCenterY + scrollableParent.scrollTop,
14623
+ behavior: "smooth"
14624
+ };
14625
+ scrollableParent.scrollTo(scrollOptions);
14626
+ };
14627
+
14598
14628
  // This function is used as the click handler for "Link" and "Button" elements in the to highlight the element
14599
14629
  var handleClick = function handleClick(event) {
14600
14630
  event.preventDefault();
@@ -14607,14 +14637,11 @@ var useElementClick = function useElementClick(_ref) {
14607
14637
  // If the element is inside an accordion, open the accordion and scroll to the element
14608
14638
  if (neetoCist.isPresent(index)) {
14609
14639
  if (!accordion) return;
14610
- accordion.scrollIntoView({
14611
- behavior: "smooth",
14612
- block: "nearest"
14613
- });
14614
14640
  accordion.classList.add("open-accordion__".concat(index));
14615
14641
  setTimeout(function () {
14616
14642
  element = document.querySelector("[data-element-id=".concat(id, "]"));
14617
14643
  if (!element) return;
14644
+ scrollToCenter(element);
14618
14645
  element.classList.add("highlight-element");
14619
14646
  element.focus();
14620
14647
  }, 350);
@@ -14628,10 +14655,7 @@ var useElementClick = function useElementClick(_ref) {
14628
14655
  if (!(element && card)) return;
14629
14656
  var inputWrapper = card.querySelector(".neeto-ui-input");
14630
14657
  if (!inputWrapper) return;
14631
- card.scrollIntoView({
14632
- behavior: "smooth",
14633
- block: "nearest"
14634
- });
14658
+ scrollToCenter(card);
14635
14659
  card.classList.add("highlight-element");
14636
14660
  inputWrapper.classList.add("highlight-element");
14637
14661
  element.focus();
@@ -14655,15 +14679,12 @@ var useElementClick = function useElementClick(_ref) {
14655
14679
  // If the element is inside an accordion, open the accordion and scroll to the element
14656
14680
  if (neetoCist.isPresent(index)) {
14657
14681
  if (!accordion) return;
14658
- accordion.scrollIntoView({
14659
- behavior: "smooth",
14660
- block: "nearest"
14661
- });
14662
14682
  accordion.classList.add("open-accordion__".concat(index));
14663
14683
  setTimeout(function () {
14664
14684
  var _element2;
14665
14685
  element = document.querySelector("[data-element-id=".concat(id, "]"));
14666
14686
  if (!element) return;
14687
+ scrollToCenter(element);
14667
14688
  if (!isTitle) inputWrapper = element;
14668
14689
  card === null || card === void 0 ? void 0 : card.classList.add("highlight-element");
14669
14690
  (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.classList.add("highlight-element");
@@ -14681,10 +14702,7 @@ var useElementClick = function useElementClick(_ref) {
14681
14702
  inputWrapper = _element3;
14682
14703
  }
14683
14704
  if (!(_element3 && card && inputWrapper)) return;
14684
- card.scrollIntoView({
14685
- behavior: "smooth",
14686
- block: "nearest"
14687
- });
14705
+ scrollToCenter(inputWrapper);
14688
14706
  inputWrapper.classList.add("highlight-element");
14689
14707
  card.classList.add("highlight-element");
14690
14708
  _element3.focus();
@@ -14705,14 +14723,11 @@ var useElementClick = function useElementClick(_ref) {
14705
14723
  if (neetoCist.isPresent(index)) {
14706
14724
  var accordion = document.querySelector("[data-accordion-id=".concat(id === null || id === void 0 ? void 0 : id.replace(/-[^-]+$/, ""), "]"));
14707
14725
  if (!accordion) return;
14708
- accordion.scrollIntoView({
14709
- behavior: "smooth",
14710
- block: "nearest"
14711
- });
14712
14726
  accordion.classList.add("open-accordion__".concat(index));
14713
14727
  setTimeout(function () {
14714
14728
  var imageWrapper = document.querySelector("[data-highlight-id=".concat(id, "]"));
14715
14729
  if (!imageWrapper) return;
14730
+ scrollToCenter(imageWrapper);
14716
14731
  imageWrapper.classList.add("highlight-element");
14717
14732
  }, 350);
14718
14733
  setTimeout(function () {
@@ -14723,10 +14738,7 @@ var useElementClick = function useElementClick(_ref) {
14723
14738
  } else {
14724
14739
  var imageWrapper = document.querySelector("[data-highlight-id=".concat(id, "]"));
14725
14740
  if (!imageWrapper) return;
14726
- imageWrapper.scrollIntoView({
14727
- behavior: "smooth",
14728
- block: "nearest"
14729
- });
14741
+ scrollToCenter(imageWrapper);
14730
14742
  setTimeout(function () {
14731
14743
  imageWrapper.classList.add("highlight-element");
14732
14744
  }, 350);
@@ -43269,9 +43281,11 @@ var LogoClouds = function LogoClouds(_ref) {
43269
43281
  design: design.body,
43270
43282
  nestedClassName: baseClasses
43271
43283
  }, /*#__PURE__*/React__default["default"].createElement(Typography$1, {
43284
+ disableButtonAndLinks: disableButtonAndLinks,
43272
43285
  isTitle: true,
43273
43286
  className: "col-span-12",
43274
43287
  component: "h3",
43288
+ id: "logo-clouds-title",
43275
43289
  style: design.title
43276
43290
  }, title), logos.map(function (_ref2, index) {
43277
43291
  var src = _ref2.src,
@@ -43284,17 +43298,20 @@ var LogoClouds = function LogoClouds(_ref) {
43284
43298
  key: getUniqueKey(title, index)
43285
43299
  }, /*#__PURE__*/React__default["default"].createElement(StyledImage$1, {
43286
43300
  alt: alt,
43301
+ disableButtonAndLinks: disableButtonAndLinks,
43302
+ index: index,
43287
43303
  src: src,
43288
43304
  title: title,
43289
43305
  className: "logo-image",
43290
43306
  design: design.logo,
43307
+ id: "logo-clouds-".concat(index, "-image"),
43291
43308
  wrapperClassName: "max-w-56 max-h-28"
43292
43309
  }));
43293
43310
  }));
43294
43311
  };
43295
43312
 
43296
43313
  var _excluded$3 = ["configurations", "className", "id"],
43297
- _excluded2 = ["link", "index", "disableButtonAndLinks", "design"];
43314
+ _excluded2 = ["feature", "index", "disableButtonAndLinks", "design"];
43298
43315
  function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
43299
43316
  function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
43300
43317
  var Paragraph = function Paragraph(_ref) {
@@ -43345,18 +43362,19 @@ var Paragraph = function Paragraph(_ref) {
43345
43362
  "list-decimal": isOrdered,
43346
43363
  "list-disc": !isOrdered
43347
43364
  })
43348
- }, features.map(function (link, index) {
43349
- return /*#__PURE__*/React__default["default"].createElement(ListItem, _extends__default["default"]({
43350
- index: index,
43351
- link: link,
43365
+ }, features.map(function (feature, index) {
43366
+ return /*#__PURE__*/React__default["default"].createElement(ListItem, _extends__default["default"]({}, _objectSpread$1(_objectSpread$1({}, otherProps), {}, {
43367
+ feature: feature,
43368
+ index: index
43369
+ }), {
43352
43370
  design: design.featureTitle,
43353
43371
  disableButtonAndLinks: otherProps.disableButtonAndLinks,
43354
- key: getUniqueKey(link.label, index)
43355
- }, otherProps));
43372
+ key: getUniqueKey(feature.label, index)
43373
+ }));
43356
43374
  })))));
43357
43375
  };
43358
43376
  var ListItem = function ListItem(_ref2) {
43359
- var link = _ref2.link,
43377
+ var feature = _ref2.feature,
43360
43378
  index = _ref2.index,
43361
43379
  disableButtonAndLinks = _ref2.disableButtonAndLinks,
43362
43380
  design = _ref2.design,
@@ -43371,7 +43389,7 @@ var ListItem = function ListItem(_ref2) {
43371
43389
  }, _objectSpread$1(_objectSpread$1({
43372
43390
  disableButtonAndLinks: disableButtonAndLinks,
43373
43391
  index: index
43374
- }, link), otherProps))));
43392
+ }, feature), otherProps))));
43375
43393
  };
43376
43394
 
43377
43395
  var _excluded$2 = ["configurations", "className", "id"];