emoji-picker-react 4.0.0-rc.21 → 4.0.0-rc.24
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/emoji/Emoji.d.ts +8 -5
- package/dist/emoji-picker-react.cjs.development.css +2 -2
- package/dist/emoji-picker-react.cjs.development.js +74 -58
- 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 +77 -61
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/body/EmojiList.tsx +2 -2
- package/src/components/body/EmojiVariationPicker.tsx +2 -2
- package/src/components/body/Suggested.tsx +2 -2
- package/src/components/emoji/Emoji.css +3 -1
- package/src/components/emoji/Emoji.tsx +41 -20
- package/src/components/footer/Preview.tsx +3 -7
- package/src/components/header/SkinTonePicker.css +1 -1
- package/src/components/header/SkinTonePicker.tsx +6 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useRef, createElement, createContext, createRef, useContext, useCallback, useState, useEffect,
|
|
1
|
+
import { useRef, createElement, createContext, createRef, useContext, useCallback, useState, useEffect, Fragment, useMemo, Component } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
|
|
4
4
|
function _extends() {
|
|
@@ -16079,10 +16079,10 @@ function styleInject(css, ref) {
|
|
|
16079
16079
|
}
|
|
16080
16080
|
}
|
|
16081
16081
|
|
|
16082
|
-
var css_248z = ".EmojiPickerReact button.epr-emoji{border-radius:8px;padding:var(--epr-emoji-padding);position:relative}.EmojiPickerReact button.epr-emoji.epr-emoji-has-variations:after{border-bottom:4px solid var(--epr-emoji-variation-indicator-color);border-left:4px solid transparent;border-right:4px solid transparent;bottom:0;content:\"\";display:block;height:0;position:absolute;right:-2px;transform:rotate(135deg);width:0;z-index:var(--epr-emoji-variations-indictator-z-index)}.EmojiPickerReact button.epr-emoji>*{display:block;height:var(--epr-emoji-size);width:var(--epr-emoji-size)}.EmojiPickerReact button.epr-emoji.epr-emoji-has-variations:hover:after{border-bottom:4px solid var(--epr-emoji-variation-indicator-color-hover)}.EmojiPickerReact button.epr-emoji>.epr-emoji-img{font-size:0}.EmojiPickerReact button.epr-emoji>.epr-emoji-native{font-family:Noto Color Emoji,Apple Color Emoji,Segoe UI Emoji,Times,Symbola,Aegyptus,Code2000,Code2001,Code2002,Musica,serif,LastResort;font-size:var(--epr-emoji-size);line-height:100%}.EmojiPickerReact button.epr-emoji:hover{background-color:var(--epr-emoji-hover-color)}.EmojiPickerReact button.epr-emoji:focus
|
|
16082
|
+
var css_248z = ".EmojiPickerReact button.epr-emoji{border-radius:8px;height:var(--epr-emoji-fullsize);padding:var(--epr-emoji-padding);position:relative;width:var(--epr-emoji-fullsize)}.EmojiPickerReact button.epr-emoji.epr-emoji-has-variations:after{border-bottom:4px solid var(--epr-emoji-variation-indicator-color);border-left:4px solid transparent;border-right:4px solid transparent;bottom:0;content:\"\";display:block;height:0;position:absolute;right:-2px;transform:rotate(135deg);width:0;z-index:var(--epr-emoji-variations-indictator-z-index)}.EmojiPickerReact button.epr-emoji>*{display:block;height:var(--epr-emoji-size);width:var(--epr-emoji-size)}.EmojiPickerReact button.epr-emoji.epr-emoji-has-variations:hover:after{border-bottom:4px solid var(--epr-emoji-variation-indicator-color-hover)}.EmojiPickerReact button.epr-emoji>.epr-emoji-img{font-size:0}.EmojiPickerReact button.epr-emoji>.epr-emoji-native{font-family:Noto Color Emoji,Apple Color Emoji,Segoe UI Emoji,Times,Symbola,Aegyptus,Code2000,Code2001,Code2002,Musica,serif,LastResort;font-size:var(--epr-emoji-size);line-height:100%}.EmojiPickerReact button.epr-emoji:hover{background-color:var(--epr-emoji-hover-color)}.EmojiPickerReact button.epr-emoji:focus{background-color:var(--epr-focus-bg-color)}";
|
|
16083
16083
|
styleInject(css_248z);
|
|
16084
16084
|
|
|
16085
|
-
function
|
|
16085
|
+
function ClickableEmoji(_ref) {
|
|
16086
16086
|
var _clsx;
|
|
16087
16087
|
|
|
16088
16088
|
var emoji = _ref.emoji,
|
|
@@ -16095,31 +16095,46 @@ function Emoji(_ref) {
|
|
|
16095
16095
|
emojiRef = _ref.emojiRef,
|
|
16096
16096
|
lazyLoad = _ref.lazyLoad;
|
|
16097
16097
|
var hasVariations = emojiHasVariations(emoji);
|
|
16098
|
+
return createElement("button", {
|
|
16099
|
+
className: clsx(ClassNames.emoji, (_clsx = {}, _clsx[ClassNames.hidden] = hidden, _clsx[ClassNames.visible] = !hidden, _clsx['epr-emoji-has-variations'] = hasVariations && showVariations, _clsx)),
|
|
16100
|
+
"data-unified": unified,
|
|
16101
|
+
// @ts-ignore - let's ignore the fact this is not a real react ref, ok?
|
|
16102
|
+
ref: emojiRef
|
|
16103
|
+
}, createElement(ViewOnlyEmoji, {
|
|
16104
|
+
unified: unified,
|
|
16105
|
+
emoji: emoji,
|
|
16106
|
+
size: size,
|
|
16107
|
+
emojiStyle: emojiStyle,
|
|
16108
|
+
lazyLoad: lazyLoad
|
|
16109
|
+
}));
|
|
16110
|
+
}
|
|
16111
|
+
function ViewOnlyEmoji(_ref2) {
|
|
16112
|
+
var emoji = _ref2.emoji,
|
|
16113
|
+
unified = _ref2.unified,
|
|
16114
|
+
emojiStyle = _ref2.emojiStyle,
|
|
16115
|
+
size = _ref2.size,
|
|
16116
|
+
lazyLoad = _ref2.lazyLoad;
|
|
16098
16117
|
var style = {};
|
|
16099
16118
|
|
|
16100
16119
|
if (size) {
|
|
16101
16120
|
style.width = style.height = style.fontSize = size + "px";
|
|
16102
16121
|
}
|
|
16103
16122
|
|
|
16104
|
-
|
|
16123
|
+
return createElement(Fragment, null, emojiStyle === EmojiStyle.NATIVE ? createElement(NativeEmoji, {
|
|
16124
|
+
unified: unified,
|
|
16125
|
+
style: style
|
|
16126
|
+
}) : createElement(EmojiImg, {
|
|
16127
|
+
unified: unified,
|
|
16105
16128
|
style: style,
|
|
16106
|
-
unified: unified
|
|
16107
|
-
};
|
|
16108
|
-
return createElement("button", {
|
|
16109
|
-
className: clsx(ClassNames.emoji, (_clsx = {}, _clsx[ClassNames.hidden] = hidden, _clsx[ClassNames.visible] = !hidden, _clsx['epr-emoji-has-variations'] = hasVariations && showVariations, _clsx)),
|
|
16110
|
-
"data-unified": unified,
|
|
16111
|
-
// @ts-ignore - let's ignore the fact this is not a real react ref, ok?
|
|
16112
|
-
ref: emojiRef
|
|
16113
|
-
}, emojiStyle === EmojiStyle.NATIVE ? createElement(NativeEmoji, Object.assign({}, base)) : createElement(EmojiImg, Object.assign({}, base, {
|
|
16114
16129
|
emoji: emoji,
|
|
16115
16130
|
emojiStyle: emojiStyle,
|
|
16116
16131
|
lazyLoad: lazyLoad
|
|
16117
|
-
}))
|
|
16132
|
+
}));
|
|
16118
16133
|
}
|
|
16119
16134
|
|
|
16120
|
-
function NativeEmoji(
|
|
16121
|
-
var unified =
|
|
16122
|
-
style =
|
|
16135
|
+
function NativeEmoji(_ref3) {
|
|
16136
|
+
var unified = _ref3.unified,
|
|
16137
|
+
style = _ref3.style;
|
|
16123
16138
|
return createElement("span", {
|
|
16124
16139
|
className: "epr-emoji-native",
|
|
16125
16140
|
"data-unified": unified,
|
|
@@ -16127,13 +16142,13 @@ function NativeEmoji(_ref2) {
|
|
|
16127
16142
|
}, parseNativeEmoji(unified));
|
|
16128
16143
|
}
|
|
16129
16144
|
|
|
16130
|
-
function EmojiImg(
|
|
16131
|
-
var emoji =
|
|
16132
|
-
unified =
|
|
16133
|
-
emojiStyle =
|
|
16134
|
-
style =
|
|
16135
|
-
|
|
16136
|
-
lazyLoad =
|
|
16145
|
+
function EmojiImg(_ref4) {
|
|
16146
|
+
var emoji = _ref4.emoji,
|
|
16147
|
+
unified = _ref4.unified,
|
|
16148
|
+
emojiStyle = _ref4.emojiStyle,
|
|
16149
|
+
style = _ref4.style,
|
|
16150
|
+
_ref4$lazyLoad = _ref4.lazyLoad,
|
|
16151
|
+
lazyLoad = _ref4$lazyLoad === void 0 ? false : _ref4$lazyLoad;
|
|
16137
16152
|
|
|
16138
16153
|
var _useEmojisThatFailedT = useEmojisThatFailedToLoadState(),
|
|
16139
16154
|
setEmojisThatFailedToLoad = _useEmojisThatFailedT[1];
|
|
@@ -16205,7 +16220,7 @@ function Suggested(_ref) {
|
|
|
16205
16220
|
return null;
|
|
16206
16221
|
}
|
|
16207
16222
|
|
|
16208
|
-
return createElement(
|
|
16223
|
+
return createElement(ClickableEmoji, {
|
|
16209
16224
|
showVariations: false,
|
|
16210
16225
|
unified: suggestedItem.unified,
|
|
16211
16226
|
emojiStyle: emojiStyle,
|
|
@@ -16267,7 +16282,7 @@ function RenderCategory(_ref) {
|
|
|
16267
16282
|
hiddenCounter++;
|
|
16268
16283
|
}
|
|
16269
16284
|
|
|
16270
|
-
return createElement(
|
|
16285
|
+
return createElement(ClickableEmoji, {
|
|
16271
16286
|
key: unified,
|
|
16272
16287
|
emoji: emoji,
|
|
16273
16288
|
unified: unified,
|
|
@@ -16333,7 +16348,7 @@ function EmojiVariationPicker() {
|
|
|
16333
16348
|
top: top
|
|
16334
16349
|
}
|
|
16335
16350
|
}, visible ? [emojiUnified(safeEmoji)].concat(emojiVariations(safeEmoji)).slice(0, 6).map(function (unified) {
|
|
16336
|
-
return createElement(
|
|
16351
|
+
return createElement(ClickableEmoji, {
|
|
16337
16352
|
key: unified,
|
|
16338
16353
|
emoji: safeEmoji,
|
|
16339
16354
|
unified: unified,
|
|
@@ -16583,19 +16598,15 @@ function Preview() {
|
|
|
16583
16598
|
function PreviewContent() {
|
|
16584
16599
|
var defaultEmoji = asEmoji(variationPickerEmoji != null ? variationPickerEmoji : emojiByUnified(previewConfig.defaultEmoji));
|
|
16585
16600
|
var defaultText = variationPickerEmoji ? emojiName(variationPickerEmoji) : previewConfig.defaultCaption;
|
|
16586
|
-
return createElement(Fragment, null, createElement("div", null, show ? createElement(
|
|
16601
|
+
return createElement(Fragment, null, createElement("div", null, show ? createElement(ViewOnlyEmoji, {
|
|
16587
16602
|
unified: previewEmoji == null ? void 0 : previewEmoji.unified,
|
|
16588
16603
|
emoji: asEmoji(emoji),
|
|
16589
|
-
showVariations: false,
|
|
16590
16604
|
emojiStyle: emojiStyle,
|
|
16591
|
-
hidden: false,
|
|
16592
16605
|
size: 45
|
|
16593
|
-
}) : defaultEmoji ? createElement(
|
|
16606
|
+
}) : defaultEmoji ? createElement(ViewOnlyEmoji, {
|
|
16594
16607
|
unified: emojiUnified(defaultEmoji),
|
|
16595
16608
|
emoji: defaultEmoji,
|
|
16596
|
-
showVariations: false,
|
|
16597
16609
|
emojiStyle: emojiStyle,
|
|
16598
|
-
hidden: false,
|
|
16599
16610
|
size: 45
|
|
16600
16611
|
}) : null), show ? createElement("div", {
|
|
16601
16612
|
className: "epr-preview-emoji-label"
|
|
@@ -16680,7 +16691,34 @@ function Search() {
|
|
|
16680
16691
|
}) : null);
|
|
16681
16692
|
}
|
|
16682
16693
|
|
|
16683
|
-
|
|
16694
|
+
function useFocusSearchInput() {
|
|
16695
|
+
var SearchInputRef = useSearchInputRef();
|
|
16696
|
+
return useCallback(function () {
|
|
16697
|
+
focusElement(SearchInputRef.current);
|
|
16698
|
+
}, [SearchInputRef]);
|
|
16699
|
+
}
|
|
16700
|
+
function useFocusSkinTonePicker() {
|
|
16701
|
+
var SkinTonePickerRef = useSkinTonePickerRef();
|
|
16702
|
+
return useCallback(function () {
|
|
16703
|
+
if (!SkinTonePickerRef.current) {
|
|
16704
|
+
return;
|
|
16705
|
+
}
|
|
16706
|
+
|
|
16707
|
+
focusFirstElementChild(SkinTonePickerRef.current);
|
|
16708
|
+
}, [SkinTonePickerRef]);
|
|
16709
|
+
}
|
|
16710
|
+
function useFocusCategoryNavigation() {
|
|
16711
|
+
var CategoryNavigationRef = useCategoryNavigationRef();
|
|
16712
|
+
return useCallback(function () {
|
|
16713
|
+
if (!CategoryNavigationRef.current) {
|
|
16714
|
+
return;
|
|
16715
|
+
}
|
|
16716
|
+
|
|
16717
|
+
focusFirstElementChild(CategoryNavigationRef.current);
|
|
16718
|
+
}, [CategoryNavigationRef]);
|
|
16719
|
+
}
|
|
16720
|
+
|
|
16721
|
+
var css_248z$9 = ".EmojiPickerReact .epr-skin-tones{--epr-skin-tone-size:16px;align-items:center;display:flex;flex-basis:30px;justify-content:flex-end;transition:all .3s ease-in-out}.EmojiPickerReact .epr-skin-tones.open{flex-basis:170px}.EmojiPickerReact .epr-skin-tone-select{height:var(--epr-skin-tone-size);position:relative;width:var(--epr-skin-tone-size)}.EmojiPickerReact .epr-skin-tones.open .epr-tone{transition:transform .3s ease-in-out,opacity .3s ease-in-out}.EmojiPickerReact .epr-skin-tones:not(.open) .epr-tone{opacity:0;z-index:0}.EmojiPickerReact .epr-skin-tones .epr-tone{border-radius:4px;box-shadow:0 0 0 0 var(--epr-active-skin-hover-color);cursor:pointer;display:block;height:var(--epr-skin-tone-size);position:absolute;right:0;transition:transform .3s ease-in-out,opacity .5s ease-in-out;width:var(--epr-skin-tone-size);z-index:1}.EmojiPickerReact .epr-skin-tones .epr-tone:hover{box-shadow:0 0 0 5px var(--epr-active-skin-hover-color)}.EmojiPickerReact .epr-skin-tones .epr-tone:focus{box-shadow:0 0 0 5px var(--epr-focus-bg-color)}.EmojiPickerReact .epr-skin-tones.open .epr-skin-tone-select .epr-tone.epr-active:after{border:1px solid var(--epr-active-skin-tone-indicator-border-color);border-radius:5px;bottom:-2px;content:\"\";left:-2px;position:absolute;right:-2px;top:-2px}.EmojiPickerReact .epr-skin-tones .epr-tone.epr-active{opacity:1;z-index:1}.EmojiPickerReact .epr-skin-tones .epr-tone.epr-tone-neutral{background-color:#ffd225}.EmojiPickerReact .epr-skin-tones .epr-tone.epr-tone-1f3fb{background-color:#ffdfbd}.EmojiPickerReact .epr-skin-tones .epr-tone.epr-tone-1f3fc{background-color:#e9c197}.EmojiPickerReact .epr-skin-tones .epr-tone.epr-tone-1f3fd{background-color:#c88e62}.EmojiPickerReact .epr-skin-tones .epr-tone.epr-tone-1f3fe{background-color:#a86637}.EmojiPickerReact .epr-skin-tones .epr-tone.epr-tone-1f3ff{background-color:#60463a}";
|
|
16684
16722
|
styleInject(css_248z$9);
|
|
16685
16723
|
|
|
16686
16724
|
function SkinTonePicker() {
|
|
@@ -16696,6 +16734,7 @@ function SkinTonePicker() {
|
|
|
16696
16734
|
setActiveSkinTone = _useActiveSkinToneSta[1];
|
|
16697
16735
|
|
|
16698
16736
|
var closeAllOpenToggles = useCloseAllOpenToggles();
|
|
16737
|
+
var focusSearchInput = useFocusSearchInput();
|
|
16699
16738
|
|
|
16700
16739
|
if (isDisabled) {
|
|
16701
16740
|
return null;
|
|
@@ -16720,7 +16759,11 @@ function SkinTonePicker() {
|
|
|
16720
16759
|
transform: clsx("translateX(-" + i * (isOpen ? 28 : 0) + "px)", isOpen && active && 'scale(1.3)')
|
|
16721
16760
|
},
|
|
16722
16761
|
onClick: function onClick() {
|
|
16723
|
-
|
|
16762
|
+
if (isOpen) {
|
|
16763
|
+
setActiveSkinTone(skinToneVariation);
|
|
16764
|
+
focusSearchInput();
|
|
16765
|
+
}
|
|
16766
|
+
|
|
16724
16767
|
closeAllOpenToggles();
|
|
16725
16768
|
},
|
|
16726
16769
|
key: skinToneVariation,
|
|
@@ -16859,33 +16902,6 @@ function visibleEmojiOneRowDown(element) {
|
|
|
16859
16902
|
return itemInNextRow;
|
|
16860
16903
|
}
|
|
16861
16904
|
|
|
16862
|
-
function useFocusSearchInput() {
|
|
16863
|
-
var SearchInputRef = useSearchInputRef();
|
|
16864
|
-
return useCallback(function () {
|
|
16865
|
-
focusElement(SearchInputRef.current);
|
|
16866
|
-
}, [SearchInputRef]);
|
|
16867
|
-
}
|
|
16868
|
-
function useFocusSkinTonePicker() {
|
|
16869
|
-
var SkinTonePickerRef = useSkinTonePickerRef();
|
|
16870
|
-
return useCallback(function () {
|
|
16871
|
-
if (!SkinTonePickerRef.current) {
|
|
16872
|
-
return;
|
|
16873
|
-
}
|
|
16874
|
-
|
|
16875
|
-
focusFirstElementChild(SkinTonePickerRef.current);
|
|
16876
|
-
}, [SkinTonePickerRef]);
|
|
16877
|
-
}
|
|
16878
|
-
function useFocusCategoryNavigation() {
|
|
16879
|
-
var CategoryNavigationRef = useCategoryNavigationRef();
|
|
16880
|
-
return useCallback(function () {
|
|
16881
|
-
if (!CategoryNavigationRef.current) {
|
|
16882
|
-
return;
|
|
16883
|
-
}
|
|
16884
|
-
|
|
16885
|
-
focusFirstElementChild(CategoryNavigationRef.current);
|
|
16886
|
-
}, [CategoryNavigationRef]);
|
|
16887
|
-
}
|
|
16888
|
-
|
|
16889
16905
|
var KeyboardEvents;
|
|
16890
16906
|
|
|
16891
16907
|
(function (KeyboardEvents) {
|