emoji-picker-react 4.4.4 → 4.4.6
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/components/body/EmojiVariationPicker.d.ts +1 -1
- package/dist/components/emoji/Emoji.d.ts +1 -1
- package/dist/dataUtils/emojiSelectors.d.ts +1 -1
- package/dist/emoji-picker-react.cjs.development.js +53 -37
- 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 +53 -37
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/body/EmojiVariationPicker.tsx +6 -7
- package/src/components/context/ElementRefContext.tsx +5 -0
- package/src/components/emoji/Emoji.tsx +4 -2
- package/src/components/footer/Preview.tsx +6 -6
- package/src/dataUtils/emojiSelectors.ts +8 -4
- package/dist/dataUtils/asEmoji.d.ts +0 -2
- package/src/dataUtils/asEmoji.ts +0 -5
|
@@ -17,6 +17,6 @@ declare type BaseProps = {
|
|
|
17
17
|
getEmojiUrl?: GetEmojiUrl;
|
|
18
18
|
};
|
|
19
19
|
export declare function ClickableEmoji({ emoji, unified, hidden, hiddenOnSearch, emojiStyle, showVariations, size, lazyLoad, getEmojiUrl, }: ClickableEmojiProps): JSX.Element;
|
|
20
|
-
export declare function ViewOnlyEmoji({ emoji, unified, emojiStyle, size, lazyLoad, getEmojiUrl, }: BaseProps): JSX.Element;
|
|
20
|
+
export declare function ViewOnlyEmoji({ emoji, unified, emojiStyle, size, lazyLoad, getEmojiUrl, }: BaseProps): JSX.Element | null;
|
|
21
21
|
export declare type GetEmojiUrl = (unified: string, style: EmojiStyle) => string;
|
|
22
22
|
export {};
|
|
@@ -3,7 +3,7 @@ import { EmojiStyle, SkinTones } from '../types/exposedTypes';
|
|
|
3
3
|
import { DataEmoji, DataEmojis } from './DataTypes';
|
|
4
4
|
export declare function emojiNames(emoji: DataEmoji): string[];
|
|
5
5
|
export declare function addedIn(emoji: DataEmoji): number;
|
|
6
|
-
export declare function emojiName(emoji
|
|
6
|
+
export declare function emojiName(emoji?: DataEmoji): string;
|
|
7
7
|
export declare function unifiedWithoutSkinTone(unified: string): string;
|
|
8
8
|
export declare function emojiUnified(emoji: DataEmoji, skinTone?: string): string;
|
|
9
9
|
export declare function emojisByCategory(category: Categories): DataEmojis;
|
|
@@ -40,6 +40,31 @@ function asSelectors() {
|
|
|
40
40
|
}).join('');
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
function focusElement(element) {
|
|
44
|
+
if (!element) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
requestAnimationFrame(function () {
|
|
49
|
+
element.focus();
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function focusPrevElementSibling(element) {
|
|
53
|
+
if (!element) return;
|
|
54
|
+
var prev = element.previousElementSibling;
|
|
55
|
+
focusElement(prev);
|
|
56
|
+
}
|
|
57
|
+
function focusNextElementSibling(element) {
|
|
58
|
+
if (!element) return;
|
|
59
|
+
var next = element.nextElementSibling;
|
|
60
|
+
focusElement(next);
|
|
61
|
+
}
|
|
62
|
+
function focusFirstElementChild(element) {
|
|
63
|
+
if (!element) return;
|
|
64
|
+
var first = element.firstElementChild;
|
|
65
|
+
focusElement(first);
|
|
66
|
+
}
|
|
67
|
+
|
|
43
68
|
function ElementRefContextProvider(_ref) {
|
|
44
69
|
var children = _ref.children;
|
|
45
70
|
var PickerMainRef = React.useRef(null);
|
|
@@ -84,6 +109,10 @@ function useAnchoredEmojiRef() {
|
|
|
84
109
|
function useSetAnchoredEmojiRef() {
|
|
85
110
|
var AnchoredEmojiRef = useAnchoredEmojiRef();
|
|
86
111
|
return function (target) {
|
|
112
|
+
if (target === null && AnchoredEmojiRef.current !== null) {
|
|
113
|
+
focusElement(AnchoredEmojiRef.current);
|
|
114
|
+
}
|
|
115
|
+
|
|
87
116
|
AnchoredEmojiRef.current = target;
|
|
88
117
|
};
|
|
89
118
|
}
|
|
@@ -16613,6 +16642,10 @@ function addedIn(emoji) {
|
|
|
16613
16642
|
return parseFloat(emoji[EmojiProperties.added_in]);
|
|
16614
16643
|
}
|
|
16615
16644
|
function emojiName(emoji) {
|
|
16645
|
+
if (!emoji) {
|
|
16646
|
+
return '';
|
|
16647
|
+
}
|
|
16648
|
+
|
|
16616
16649
|
return emojiNames(emoji)[0];
|
|
16617
16650
|
}
|
|
16618
16651
|
function unifiedWithoutSkinTone(unified) {
|
|
@@ -17846,31 +17879,6 @@ function scrollEmojiAboveLabel(emoji) {
|
|
|
17846
17879
|
scrollBy(scrollBody, -(categoryLabelHeight(closestCategory(emoji)) - by));
|
|
17847
17880
|
}
|
|
17848
17881
|
|
|
17849
|
-
function focusElement(element) {
|
|
17850
|
-
if (!element) {
|
|
17851
|
-
return;
|
|
17852
|
-
}
|
|
17853
|
-
|
|
17854
|
-
requestAnimationFrame(function () {
|
|
17855
|
-
element.focus();
|
|
17856
|
-
});
|
|
17857
|
-
}
|
|
17858
|
-
function focusPrevElementSibling(element) {
|
|
17859
|
-
if (!element) return;
|
|
17860
|
-
var prev = element.previousElementSibling;
|
|
17861
|
-
focusElement(prev);
|
|
17862
|
-
}
|
|
17863
|
-
function focusNextElementSibling(element) {
|
|
17864
|
-
if (!element) return;
|
|
17865
|
-
var next = element.nextElementSibling;
|
|
17866
|
-
focusElement(next);
|
|
17867
|
-
}
|
|
17868
|
-
function focusFirstElementChild(element) {
|
|
17869
|
-
if (!element) return;
|
|
17870
|
-
var first = element.firstElementChild;
|
|
17871
|
-
focusElement(first);
|
|
17872
|
-
}
|
|
17873
|
-
|
|
17874
17882
|
function useFocusSearchInput() {
|
|
17875
17883
|
var SearchInputRef = useSearchInputRef();
|
|
17876
17884
|
return React.useCallback(function () {
|
|
@@ -18077,10 +18085,6 @@ function useIsEmojiHidden() {
|
|
|
18077
18085
|
};
|
|
18078
18086
|
}
|
|
18079
18087
|
|
|
18080
|
-
function asEmoji(emoji) {
|
|
18081
|
-
return emoji;
|
|
18082
|
-
}
|
|
18083
|
-
|
|
18084
18088
|
function Button(props) {
|
|
18085
18089
|
return React.createElement("button", Object.assign({
|
|
18086
18090
|
type: "button"
|
|
@@ -18132,13 +18136,18 @@ function ViewOnlyEmoji(_ref2) {
|
|
|
18132
18136
|
}
|
|
18133
18137
|
|
|
18134
18138
|
var emojiToRender = emoji ? emoji : emojiByUnified(unified);
|
|
18139
|
+
|
|
18140
|
+
if (!emojiToRender) {
|
|
18141
|
+
return null;
|
|
18142
|
+
}
|
|
18143
|
+
|
|
18135
18144
|
return React.createElement(React.Fragment, null, emojiStyle === exports.EmojiStyle.NATIVE ? React.createElement(NativeEmoji, {
|
|
18136
18145
|
unified: unified,
|
|
18137
18146
|
style: style
|
|
18138
18147
|
}) : React.createElement(EmojiImg, {
|
|
18139
18148
|
unified: unified,
|
|
18140
18149
|
style: style,
|
|
18141
|
-
emoji:
|
|
18150
|
+
emoji: emojiToRender,
|
|
18142
18151
|
emojiStyle: emojiStyle,
|
|
18143
18152
|
lazyLoad: lazyLoad,
|
|
18144
18153
|
getEmojiUrl: getEmojiUrl
|
|
@@ -18459,7 +18468,6 @@ function EmojiVariationPicker() {
|
|
|
18459
18468
|
var visible = emoji && button && emojiHasVariations(emoji) && button.classList.contains(ClassNames.emojiHasVariatios);
|
|
18460
18469
|
React.useEffect(function () {
|
|
18461
18470
|
if (!visible) {
|
|
18462
|
-
focusElement(AnchoredEmojiRef.current);
|
|
18463
18471
|
return;
|
|
18464
18472
|
}
|
|
18465
18473
|
|
|
@@ -18474,7 +18482,10 @@ function EmojiVariationPicker() {
|
|
|
18474
18482
|
pointerStyle = getPointerStyle();
|
|
18475
18483
|
}
|
|
18476
18484
|
|
|
18477
|
-
|
|
18485
|
+
if (!emoji) {
|
|
18486
|
+
return null;
|
|
18487
|
+
}
|
|
18488
|
+
|
|
18478
18489
|
return React.createElement("div", {
|
|
18479
18490
|
ref: VariationPickerRef,
|
|
18480
18491
|
className: clsx(ClassNames.variationPicker, {
|
|
@@ -18484,10 +18495,10 @@ function EmojiVariationPicker() {
|
|
|
18484
18495
|
style: {
|
|
18485
18496
|
top: top
|
|
18486
18497
|
}
|
|
18487
|
-
}, visible ? [emojiUnified(
|
|
18498
|
+
}, visible ? [emojiUnified(emoji)].concat(emojiVariations(emoji)).slice(0, 6).map(function (unified) {
|
|
18488
18499
|
return React.createElement(ClickableEmoji, {
|
|
18489
18500
|
key: unified,
|
|
18490
|
-
emoji:
|
|
18501
|
+
emoji: emoji,
|
|
18491
18502
|
unified: unified,
|
|
18492
18503
|
emojiStyle: emojiStyle,
|
|
18493
18504
|
showVariations: false,
|
|
@@ -18838,11 +18849,16 @@ function PreviewBody() {
|
|
|
18838
18849
|
return React.createElement(PreviewContent, null);
|
|
18839
18850
|
|
|
18840
18851
|
function PreviewContent() {
|
|
18841
|
-
var defaultEmoji =
|
|
18852
|
+
var defaultEmoji = variationPickerEmoji != null ? variationPickerEmoji : emojiByUnified(previewConfig.defaultEmoji);
|
|
18853
|
+
|
|
18854
|
+
if (!defaultEmoji) {
|
|
18855
|
+
return null;
|
|
18856
|
+
}
|
|
18857
|
+
|
|
18842
18858
|
var defaultText = variationPickerEmoji ? emojiName(variationPickerEmoji) : previewConfig.defaultCaption;
|
|
18843
18859
|
return React.createElement(React.Fragment, null, React.createElement("div", null, show ? React.createElement(ViewOnlyEmoji, {
|
|
18844
18860
|
unified: previewEmoji == null ? void 0 : previewEmoji.unified,
|
|
18845
|
-
emoji:
|
|
18861
|
+
emoji: emoji,
|
|
18846
18862
|
emojiStyle: emojiStyle,
|
|
18847
18863
|
size: 45,
|
|
18848
18864
|
getEmojiUrl: getEmojiUrl
|
|
@@ -18854,7 +18870,7 @@ function PreviewBody() {
|
|
|
18854
18870
|
getEmojiUrl: getEmojiUrl
|
|
18855
18871
|
}) : null), show ? React.createElement("div", {
|
|
18856
18872
|
className: "epr-preview-emoji-label"
|
|
18857
|
-
}, emojiName(
|
|
18873
|
+
}, emojiName(emoji)) : React.createElement("div", {
|
|
18858
18874
|
className: "epr-preview-emoji-label"
|
|
18859
18875
|
}, defaultText));
|
|
18860
18876
|
}
|