emoji-picker-react 4.9.0 → 4.9.2
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/DomUtils/elementPositionInRow.d.ts +1 -1
- package/dist/emoji-picker-react.cjs.development.js +28 -10
- package/dist/emoji-picker-react.cjs.development.js.map +1 -1
- package/dist/emoji-picker-react.cjs.production.min.js +1 -1
- package/dist/emoji-picker-react.cjs.production.min.js.map +1 -1
- package/dist/emoji-picker-react.esm.js +28 -10
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/DomUtils/elementPositionInRow.ts +27 -11
- package/src/DomUtils/scrollTo.ts +1 -1
- package/src/DomUtils/selectors.ts +1 -1
- package/src/components/emoji/ClickableEmojiButton.tsx +7 -1
|
@@ -17358,7 +17358,7 @@ function scrollTo(root, top) {
|
|
|
17358
17358
|
return;
|
|
17359
17359
|
}
|
|
17360
17360
|
requestAnimationFrame(function () {
|
|
17361
|
-
$eprBody.scrollTop = top
|
|
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 +
|
|
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
|
-
|
|
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
|
|
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
|
|
18395
|
-
var
|
|
18396
|
-
|
|
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);
|
|
@@ -18824,10 +18838,14 @@ function ClickableEmojiButton(_ref) {
|
|
|
18824
18838
|
return createElement(Button, {
|
|
18825
18839
|
className: cx(styles$2.emoji, hidden && commonStyles.hidden, hiddenOnSearch && commonInteractionStyles.hiddenOnSearch, (_cx = {}, _cx[ClassNames.visible] = !hidden && !hiddenOnSearch, _cx), !!(hasVariations && showVariations) && styles$2.hasVariations, noBackground && styles$2.noBackground, className),
|
|
18826
18840
|
"data-unified": unified,
|
|
18827
|
-
"aria-label": emojiNames
|
|
18841
|
+
"aria-label": getAriaLabel(emojiNames),
|
|
18828
18842
|
"data-full-name": emojiNames
|
|
18829
18843
|
}, children);
|
|
18830
18844
|
}
|
|
18845
|
+
function getAriaLabel(emojiNames) {
|
|
18846
|
+
var _emojiNames$;
|
|
18847
|
+
return emojiNames[0].match('flag-') ? (_emojiNames$ = emojiNames[1]) != null ? _emojiNames$ : emojiNames[0] : emojiNames[0];
|
|
18848
|
+
}
|
|
18831
18849
|
var styles$2 = /*#__PURE__*/stylesheet.create({
|
|
18832
18850
|
emoji: {
|
|
18833
18851
|
'.': ClassNames.emoji,
|