@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.js CHANGED
@@ -14549,6 +14549,36 @@ var useElementClick = function useElementClick(_ref) {
14549
14549
  index = _ref$index === void 0 ? undefined : _ref$index,
14550
14550
  _ref$isTitle = _ref.isTitle,
14551
14551
  isTitle = _ref$isTitle === void 0 ? false : _ref$isTitle;
14552
+ var getScrollableParent = function getScrollableParent(element) {
14553
+ if (!element) return null;
14554
+ var isScrollable = function isScrollable(el) {
14555
+ var style = getComputedStyle(el);
14556
+ return style.overflowY === "auto" || style.overflowY === "scroll";
14557
+ };
14558
+ var parent = element.parentElement;
14559
+ while (parent) {
14560
+ if (isScrollable(parent)) {
14561
+ return parent;
14562
+ }
14563
+ parent = parent.parentElement;
14564
+ }
14565
+ return document.documentElement; // Fallback to document
14566
+ };
14567
+
14568
+ var scrollToCenter = function scrollToCenter(element) {
14569
+ var scrollableParent = getScrollableParent(element);
14570
+ if (!scrollableParent) return;
14571
+ var parentRect = scrollableParent.getBoundingClientRect();
14572
+ var elementRect = element.getBoundingClientRect();
14573
+ var elementCenterY = elementRect.top + elementRect.height / 2;
14574
+ var parentCenterY = parentRect.top + parentRect.height / 2;
14575
+ var scrollOptions = {
14576
+ top: elementCenterY - parentCenterY + scrollableParent.scrollTop,
14577
+ behavior: "smooth"
14578
+ };
14579
+ scrollableParent.scrollTo(scrollOptions);
14580
+ };
14581
+
14552
14582
  // This function is used as the click handler for "Link" and "Button" elements in the to highlight the element
14553
14583
  var handleClick = function handleClick(event) {
14554
14584
  event.preventDefault();
@@ -14561,14 +14591,11 @@ var useElementClick = function useElementClick(_ref) {
14561
14591
  // If the element is inside an accordion, open the accordion and scroll to the element
14562
14592
  if (isPresent(index)) {
14563
14593
  if (!accordion) return;
14564
- accordion.scrollIntoView({
14565
- behavior: "smooth",
14566
- block: "nearest"
14567
- });
14568
14594
  accordion.classList.add("open-accordion__".concat(index));
14569
14595
  setTimeout(function () {
14570
14596
  element = document.querySelector("[data-element-id=".concat(id, "]"));
14571
14597
  if (!element) return;
14598
+ scrollToCenter(element);
14572
14599
  element.classList.add("highlight-element");
14573
14600
  element.focus();
14574
14601
  }, 350);
@@ -14582,10 +14609,7 @@ var useElementClick = function useElementClick(_ref) {
14582
14609
  if (!(element && card)) return;
14583
14610
  var inputWrapper = card.querySelector(".neeto-ui-input");
14584
14611
  if (!inputWrapper) return;
14585
- card.scrollIntoView({
14586
- behavior: "smooth",
14587
- block: "nearest"
14588
- });
14612
+ scrollToCenter(card);
14589
14613
  card.classList.add("highlight-element");
14590
14614
  inputWrapper.classList.add("highlight-element");
14591
14615
  element.focus();
@@ -14609,15 +14633,12 @@ var useElementClick = function useElementClick(_ref) {
14609
14633
  // If the element is inside an accordion, open the accordion and scroll to the element
14610
14634
  if (isPresent(index)) {
14611
14635
  if (!accordion) return;
14612
- accordion.scrollIntoView({
14613
- behavior: "smooth",
14614
- block: "nearest"
14615
- });
14616
14636
  accordion.classList.add("open-accordion__".concat(index));
14617
14637
  setTimeout(function () {
14618
14638
  var _element2;
14619
14639
  element = document.querySelector("[data-element-id=".concat(id, "]"));
14620
14640
  if (!element) return;
14641
+ scrollToCenter(element);
14621
14642
  if (!isTitle) inputWrapper = element;
14622
14643
  card === null || card === void 0 ? void 0 : card.classList.add("highlight-element");
14623
14644
  (_element2 = element) === null || _element2 === void 0 ? void 0 : _element2.classList.add("highlight-element");
@@ -14635,10 +14656,7 @@ var useElementClick = function useElementClick(_ref) {
14635
14656
  inputWrapper = _element3;
14636
14657
  }
14637
14658
  if (!(_element3 && card && inputWrapper)) return;
14638
- card.scrollIntoView({
14639
- behavior: "smooth",
14640
- block: "nearest"
14641
- });
14659
+ scrollToCenter(inputWrapper);
14642
14660
  inputWrapper.classList.add("highlight-element");
14643
14661
  card.classList.add("highlight-element");
14644
14662
  _element3.focus();
@@ -14659,14 +14677,11 @@ var useElementClick = function useElementClick(_ref) {
14659
14677
  if (isPresent(index)) {
14660
14678
  var accordion = document.querySelector("[data-accordion-id=".concat(id === null || id === void 0 ? void 0 : id.replace(/-[^-]+$/, ""), "]"));
14661
14679
  if (!accordion) return;
14662
- accordion.scrollIntoView({
14663
- behavior: "smooth",
14664
- block: "nearest"
14665
- });
14666
14680
  accordion.classList.add("open-accordion__".concat(index));
14667
14681
  setTimeout(function () {
14668
14682
  var imageWrapper = document.querySelector("[data-highlight-id=".concat(id, "]"));
14669
14683
  if (!imageWrapper) return;
14684
+ scrollToCenter(imageWrapper);
14670
14685
  imageWrapper.classList.add("highlight-element");
14671
14686
  }, 350);
14672
14687
  setTimeout(function () {
@@ -14677,10 +14692,7 @@ var useElementClick = function useElementClick(_ref) {
14677
14692
  } else {
14678
14693
  var imageWrapper = document.querySelector("[data-highlight-id=".concat(id, "]"));
14679
14694
  if (!imageWrapper) return;
14680
- imageWrapper.scrollIntoView({
14681
- behavior: "smooth",
14682
- block: "nearest"
14683
- });
14695
+ scrollToCenter(imageWrapper);
14684
14696
  setTimeout(function () {
14685
14697
  imageWrapper.classList.add("highlight-element");
14686
14698
  }, 350);
@@ -43223,9 +43235,11 @@ var LogoClouds = function LogoClouds(_ref) {
43223
43235
  design: design.body,
43224
43236
  nestedClassName: baseClasses
43225
43237
  }, /*#__PURE__*/React__default.createElement(Typography$1, {
43238
+ disableButtonAndLinks: disableButtonAndLinks,
43226
43239
  isTitle: true,
43227
43240
  className: "col-span-12",
43228
43241
  component: "h3",
43242
+ id: "logo-clouds-title",
43229
43243
  style: design.title
43230
43244
  }, title), logos.map(function (_ref2, index) {
43231
43245
  var src = _ref2.src,
@@ -43238,17 +43252,20 @@ var LogoClouds = function LogoClouds(_ref) {
43238
43252
  key: getUniqueKey(title, index)
43239
43253
  }, /*#__PURE__*/React__default.createElement(StyledImage$1, {
43240
43254
  alt: alt,
43255
+ disableButtonAndLinks: disableButtonAndLinks,
43256
+ index: index,
43241
43257
  src: src,
43242
43258
  title: title,
43243
43259
  className: "logo-image",
43244
43260
  design: design.logo,
43261
+ id: "logo-clouds-".concat(index, "-image"),
43245
43262
  wrapperClassName: "max-w-56 max-h-28"
43246
43263
  }));
43247
43264
  }));
43248
43265
  };
43249
43266
 
43250
43267
  var _excluded$3 = ["configurations", "className", "id"],
43251
- _excluded2 = ["link", "index", "disableButtonAndLinks", "design"];
43268
+ _excluded2 = ["feature", "index", "disableButtonAndLinks", "design"];
43252
43269
  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; }
43253
43270
  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$1(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; }
43254
43271
  var Paragraph = function Paragraph(_ref) {
@@ -43299,18 +43316,19 @@ var Paragraph = function Paragraph(_ref) {
43299
43316
  "list-decimal": isOrdered,
43300
43317
  "list-disc": !isOrdered
43301
43318
  })
43302
- }, features.map(function (link, index) {
43303
- return /*#__PURE__*/React__default.createElement(ListItem, _extends$2({
43304
- index: index,
43305
- link: link,
43319
+ }, features.map(function (feature, index) {
43320
+ return /*#__PURE__*/React__default.createElement(ListItem, _extends$2({}, _objectSpread$1(_objectSpread$1({}, otherProps), {}, {
43321
+ feature: feature,
43322
+ index: index
43323
+ }), {
43306
43324
  design: design.featureTitle,
43307
43325
  disableButtonAndLinks: otherProps.disableButtonAndLinks,
43308
- key: getUniqueKey(link.label, index)
43309
- }, otherProps));
43326
+ key: getUniqueKey(feature.label, index)
43327
+ }));
43310
43328
  })))));
43311
43329
  };
43312
43330
  var ListItem = function ListItem(_ref2) {
43313
- var link = _ref2.link,
43331
+ var feature = _ref2.feature,
43314
43332
  index = _ref2.index,
43315
43333
  disableButtonAndLinks = _ref2.disableButtonAndLinks,
43316
43334
  design = _ref2.design,
@@ -43325,7 +43343,7 @@ var ListItem = function ListItem(_ref2) {
43325
43343
  }, _objectSpread$1(_objectSpread$1({
43326
43344
  disableButtonAndLinks: disableButtonAndLinks,
43327
43345
  index: index
43328
- }, link), otherProps))));
43346
+ }, feature), otherProps))));
43329
43347
  };
43330
43348
 
43331
43349
  var _excluded$2 = ["configurations", "className", "id"];