emoji-picker-react 4.9.0 → 4.9.1

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.
@@ -17358,7 +17358,7 @@ function scrollTo(root, top) {
17358
17358
  return;
17359
17359
  }
17360
17360
  requestAnimationFrame(function () {
17361
- $eprBody.scrollTop = top + 1;
17361
+ $eprBody.scrollTop = top;
17362
17362
  });
17363
17363
  }
17364
17364
  function scrollBy(root, by) {
@@ -18371,29 +18371,43 @@ function getElementInPrevRow(allElements, currentRow, elementsInRow, index) {
18371
18371
  // default to last
18372
18372
  return prevRowElements[index] || prevRowElements[prevRowElements.length - 1] || null;
18373
18373
  }
18374
- function firstVisibleElementInContainer(parent, elements) {
18374
+ function firstVisibleElementInContainer(parent, elements, maxVisibilityDiffThreshold) {
18375
+ if (maxVisibilityDiffThreshold === void 0) {
18376
+ maxVisibilityDiffThreshold = 0;
18377
+ }
18375
18378
  if (!parent || !elements.length) {
18376
18379
  return null;
18377
18380
  }
18378
18381
  var parentTop = parent.getBoundingClientRect().top;
18379
18382
  var parentBottom = parent.getBoundingClientRect().bottom;
18380
- var parentTopWithLabel = parentTop + getLabelHight(parent);
18383
+ var parentTopWithLabel = parentTop + getLabelHeight(parent);
18381
18384
  var visibleElements = elements.find(function (element) {
18382
18385
  var elementTop = element.getBoundingClientRect().top;
18383
18386
  var elementBottom = element.getBoundingClientRect().bottom;
18384
- if (elementTop < parentTopWithLabel) {
18387
+ var maxVisibilityDiffPixels = element.clientHeight * maxVisibilityDiffThreshold;
18388
+ var elementTopWithAllowedDiff = elementTop + maxVisibilityDiffPixels;
18389
+ var elementBottomWithAllowedDiff = elementBottom - maxVisibilityDiffPixels;
18390
+ if (elementTopWithAllowedDiff < parentTopWithLabel) {
18385
18391
  return false;
18386
18392
  }
18387
- return elementTop >= parentTop && elementTop <= parentBottom || elementBottom >= parentTop && elementBottom <= parentBottom;
18393
+ return elementTopWithAllowedDiff >= parentTop && elementTopWithAllowedDiff <= parentBottom || elementBottomWithAllowedDiff >= parentTop && elementBottomWithAllowedDiff <= parentBottom;
18388
18394
  });
18389
18395
  return visibleElements || null;
18390
18396
  }
18391
18397
  function hasNextElementSibling(element) {
18392
18398
  return !!element.nextElementSibling;
18393
18399
  }
18394
- function getLabelHight(parentNode) {
18395
- var _parentNode$querySele, _parentNode$querySele2;
18396
- return (_parentNode$querySele = (_parentNode$querySele2 = parentNode.querySelector(asSelectors(ClassNames.label))) == null ? void 0 : _parentNode$querySele2.getBoundingClientRect().height) != null ? _parentNode$querySele : DEFAULT_LABEL_HEIGHT /* default */;
18400
+ function getLabelHeight(parentNode) {
18401
+ var labels = Array.from(parentNode.querySelectorAll(asSelectors(ClassNames.label)));
18402
+ for (var _i = 0, _labels = labels; _i < _labels.length; _i++) {
18403
+ var label = _labels[_i];
18404
+ var height = label.getBoundingClientRect().height;
18405
+ // return height if label is not hidden
18406
+ if (height > 0) {
18407
+ return height;
18408
+ }
18409
+ }
18410
+ return DEFAULT_LABEL_HEIGHT;
18397
18411
  }
18398
18412
 
18399
18413
  var EmojiButtonSelector = "button" + /*#__PURE__*/asSelectors(ClassNames.emoji);
@@ -18559,7 +18573,7 @@ function firstVisibleEmoji(parent) {
18559
18573
  return null;
18560
18574
  }
18561
18575
  var allEmojis = allVisibleEmojis(parent);
18562
- return firstVisibleElementInContainer(parent, allEmojis);
18576
+ return firstVisibleElementInContainer(parent, allEmojis, 0.1);
18563
18577
  }
18564
18578
  function prevCategory(element) {
18565
18579
  var category = closestCategory(element);