emoji-picker-react 4.6.6 → 4.6.7
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/emoji-picker-react.cjs.development.css +2 -2
- package/dist/emoji-picker-react.cjs.development.js +258 -714
- 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 +260 -722
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/EmojiPickerReact.css +0 -7
- package/src/components/atoms/Button.tsx +17 -1
- package/src/components/navigation/CategoryNavigation.css +2 -53
- package/src/components/navigation/CategoryNavigation.tsx +48 -2
- package/src/svg.d.ts +4 -0
|
@@ -9,7 +9,6 @@ var React__default = _interopDefault(React);
|
|
|
9
9
|
var flairup = require('flairup');
|
|
10
10
|
|
|
11
11
|
var ClassNames;
|
|
12
|
-
|
|
13
12
|
(function (ClassNames) {
|
|
14
13
|
ClassNames["hiddenOnSearch"] = "epr-hidden-on-search";
|
|
15
14
|
ClassNames["searchActive"] = "epr-search-active";
|
|
@@ -32,12 +31,10 @@ var ClassNames;
|
|
|
32
31
|
ClassNames["darkTheme"] = "epr-dark-theme";
|
|
33
32
|
ClassNames["autoTheme"] = "epr-auto-theme";
|
|
34
33
|
})(ClassNames || (ClassNames = {}));
|
|
35
|
-
|
|
36
34
|
function asSelectors() {
|
|
37
35
|
for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
38
36
|
classNames[_key] = arguments[_key];
|
|
39
37
|
}
|
|
40
|
-
|
|
41
38
|
return classNames.map(function (c) {
|
|
42
39
|
return "." + c;
|
|
43
40
|
}).join('');
|
|
@@ -64,7 +61,6 @@ function focusElement(element) {
|
|
|
64
61
|
if (!element) {
|
|
65
62
|
return;
|
|
66
63
|
}
|
|
67
|
-
|
|
68
64
|
requestAnimationFrame(function () {
|
|
69
65
|
element.focus();
|
|
70
66
|
});
|
|
@@ -115,11 +111,9 @@ var ElementRefContext = /*#__PURE__*/React.createContext({
|
|
|
115
111
|
SkinTonePickerRef: /*#__PURE__*/React.createRef(),
|
|
116
112
|
VariationPickerRef: /*#__PURE__*/React.createRef()
|
|
117
113
|
});
|
|
118
|
-
|
|
119
114
|
function useElementRef() {
|
|
120
115
|
return React.useContext(ElementRefContext);
|
|
121
116
|
}
|
|
122
|
-
|
|
123
117
|
function usePickerMainRef() {
|
|
124
118
|
return useElementRef()['PickerMainRef'];
|
|
125
119
|
}
|
|
@@ -132,7 +126,6 @@ function useSetAnchoredEmojiRef() {
|
|
|
132
126
|
if (target === null && AnchoredEmojiRef.current !== null) {
|
|
133
127
|
focusElement(AnchoredEmojiRef.current);
|
|
134
128
|
}
|
|
135
|
-
|
|
136
129
|
AnchoredEmojiRef.current = target;
|
|
137
130
|
};
|
|
138
131
|
}
|
|
@@ -156,26 +149,21 @@ function _extends() {
|
|
|
156
149
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
157
150
|
for (var i = 1; i < arguments.length; i++) {
|
|
158
151
|
var source = arguments[i];
|
|
159
|
-
|
|
160
152
|
for (var key in source) {
|
|
161
153
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
162
154
|
target[key] = source[key];
|
|
163
155
|
}
|
|
164
156
|
}
|
|
165
157
|
}
|
|
166
|
-
|
|
167
158
|
return target;
|
|
168
159
|
};
|
|
169
160
|
return _extends.apply(this, arguments);
|
|
170
161
|
}
|
|
171
|
-
|
|
172
162
|
function _inheritsLoose(subClass, superClass) {
|
|
173
163
|
subClass.prototype = Object.create(superClass.prototype);
|
|
174
164
|
subClass.prototype.constructor = subClass;
|
|
175
|
-
|
|
176
165
|
_setPrototypeOf(subClass, superClass);
|
|
177
166
|
}
|
|
178
|
-
|
|
179
167
|
function _setPrototypeOf(o, p) {
|
|
180
168
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
181
169
|
o.__proto__ = p;
|
|
@@ -183,22 +171,18 @@ function _setPrototypeOf(o, p) {
|
|
|
183
171
|
};
|
|
184
172
|
return _setPrototypeOf(o, p);
|
|
185
173
|
}
|
|
186
|
-
|
|
187
174
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
188
175
|
if (source == null) return {};
|
|
189
176
|
var target = {};
|
|
190
177
|
var sourceKeys = Object.keys(source);
|
|
191
178
|
var key, i;
|
|
192
|
-
|
|
193
179
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
194
180
|
key = sourceKeys[i];
|
|
195
181
|
if (excluded.indexOf(key) >= 0) continue;
|
|
196
182
|
target[key] = source[key];
|
|
197
183
|
}
|
|
198
|
-
|
|
199
184
|
return target;
|
|
200
185
|
}
|
|
201
|
-
|
|
202
186
|
function _unsupportedIterableToArray(o, minLen) {
|
|
203
187
|
if (!o) return;
|
|
204
188
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -207,19 +191,14 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
207
191
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
208
192
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
209
193
|
}
|
|
210
|
-
|
|
211
194
|
function _arrayLikeToArray(arr, len) {
|
|
212
195
|
if (len == null || len > arr.length) len = arr.length;
|
|
213
|
-
|
|
214
196
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
215
|
-
|
|
216
197
|
return arr2;
|
|
217
198
|
}
|
|
218
|
-
|
|
219
199
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
220
200
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
221
201
|
if (it) return (it = it.call(o)).next.bind(it);
|
|
222
|
-
|
|
223
202
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
224
203
|
if (it) o = it;
|
|
225
204
|
var i = 0;
|
|
@@ -233,7 +212,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
233
212
|
};
|
|
234
213
|
};
|
|
235
214
|
}
|
|
236
|
-
|
|
237
215
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
238
216
|
}
|
|
239
217
|
|
|
@@ -241,7 +219,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
241
219
|
SuggestionMode["RECENT"] = "recent";
|
|
242
220
|
SuggestionMode["FREQUENT"] = "frequent";
|
|
243
221
|
})(exports.SuggestionMode || (exports.SuggestionMode = {}));
|
|
244
|
-
|
|
245
222
|
(function (EmojiStyle) {
|
|
246
223
|
EmojiStyle["NATIVE"] = "native";
|
|
247
224
|
EmojiStyle["APPLE"] = "apple";
|
|
@@ -249,13 +226,11 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
249
226
|
EmojiStyle["GOOGLE"] = "google";
|
|
250
227
|
EmojiStyle["FACEBOOK"] = "facebook";
|
|
251
228
|
})(exports.EmojiStyle || (exports.EmojiStyle = {}));
|
|
252
|
-
|
|
253
229
|
(function (Theme) {
|
|
254
230
|
Theme["DARK"] = "dark";
|
|
255
231
|
Theme["LIGHT"] = "light";
|
|
256
232
|
Theme["AUTO"] = "auto";
|
|
257
233
|
})(exports.Theme || (exports.Theme = {}));
|
|
258
|
-
|
|
259
234
|
(function (SkinTones) {
|
|
260
235
|
SkinTones["NEUTRAL"] = "neutral";
|
|
261
236
|
SkinTones["LIGHT"] = "1f3fb";
|
|
@@ -264,7 +239,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
264
239
|
SkinTones["MEDIUM_DARK"] = "1f3fe";
|
|
265
240
|
SkinTones["DARK"] = "1f3ff";
|
|
266
241
|
})(exports.SkinTones || (exports.SkinTones = {}));
|
|
267
|
-
|
|
268
242
|
(function (Categories) {
|
|
269
243
|
Categories["SUGGESTED"] = "suggested";
|
|
270
244
|
Categories["CUSTOM"] = "custom";
|
|
@@ -277,7 +251,6 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
277
251
|
Categories["SYMBOLS"] = "symbols";
|
|
278
252
|
Categories["FLAGS"] = "flags";
|
|
279
253
|
})(exports.Categories || (exports.Categories = {}));
|
|
280
|
-
|
|
281
254
|
(function (SkinTonePickerLocation) {
|
|
282
255
|
SkinTonePickerLocation["SEARCH"] = "SEARCH";
|
|
283
256
|
SkinTonePickerLocation["PREVIEW"] = "PREVIEW";
|
|
@@ -333,41 +306,31 @@ function categoryNameFromCategoryConfig(category) {
|
|
|
333
306
|
}
|
|
334
307
|
function mergeCategoriesConfig(userCategoriesConfig, modifiers) {
|
|
335
308
|
var _userCategoriesConfig;
|
|
336
|
-
|
|
337
309
|
if (userCategoriesConfig === void 0) {
|
|
338
310
|
userCategoriesConfig = [];
|
|
339
311
|
}
|
|
340
|
-
|
|
341
312
|
if (modifiers === void 0) {
|
|
342
313
|
modifiers = {};
|
|
343
314
|
}
|
|
344
|
-
|
|
345
315
|
var extra = {};
|
|
346
|
-
|
|
347
316
|
if (modifiers.suggestionMode === exports.SuggestionMode.RECENT) {
|
|
348
317
|
extra[exports.Categories.SUGGESTED] = SuggestedRecent;
|
|
349
318
|
}
|
|
350
|
-
|
|
351
319
|
var base = baseCategoriesConfig(extra);
|
|
352
|
-
|
|
353
320
|
if (!((_userCategoriesConfig = userCategoriesConfig) != null && _userCategoriesConfig.length)) {
|
|
354
321
|
return base;
|
|
355
322
|
}
|
|
356
|
-
|
|
357
323
|
return userCategoriesConfig.map(function (category) {
|
|
358
324
|
if (typeof category === 'string') {
|
|
359
325
|
return getBaseConfigByCategory(category, extra[category]);
|
|
360
326
|
}
|
|
361
|
-
|
|
362
327
|
return _extends({}, getBaseConfigByCategory(category.category, extra[category.category]), category);
|
|
363
328
|
});
|
|
364
329
|
}
|
|
365
|
-
|
|
366
330
|
function getBaseConfigByCategory(category, modifier) {
|
|
367
331
|
if (modifier === void 0) {
|
|
368
332
|
modifier = {};
|
|
369
333
|
}
|
|
370
|
-
|
|
371
334
|
return Object.assign(configByCategory[category], modifier);
|
|
372
335
|
}
|
|
373
336
|
|
|
@@ -379,13 +342,10 @@ function cdnUrl(emojiStyle) {
|
|
|
379
342
|
switch (emojiStyle) {
|
|
380
343
|
case exports.EmojiStyle.TWITTER:
|
|
381
344
|
return CDN_URL_TWITTER;
|
|
382
|
-
|
|
383
345
|
case exports.EmojiStyle.GOOGLE:
|
|
384
346
|
return CDN_URL_GOOGLE;
|
|
385
|
-
|
|
386
347
|
case exports.EmojiStyle.FACEBOOK:
|
|
387
348
|
return CDN_URL_FACEBOOK;
|
|
388
|
-
|
|
389
349
|
case exports.EmojiStyle.APPLE:
|
|
390
350
|
default:
|
|
391
351
|
return CDN_URL_APPLE;
|
|
@@ -16718,18 +16678,16 @@ var emojis = {
|
|
|
16718
16678
|
var skinToneVariations = [exports.SkinTones.NEUTRAL, exports.SkinTones.LIGHT, exports.SkinTones.MEDIUM_LIGHT, exports.SkinTones.MEDIUM, exports.SkinTones.MEDIUM_DARK, exports.SkinTones.DARK];
|
|
16719
16679
|
var skinTonesNamed = /*#__PURE__*/Object.entries(exports.SkinTones).reduce(function (acc, _ref) {
|
|
16720
16680
|
var key = _ref[0],
|
|
16721
|
-
|
|
16681
|
+
value = _ref[1];
|
|
16722
16682
|
acc[value] = key;
|
|
16723
16683
|
return acc;
|
|
16724
16684
|
}, {});
|
|
16725
16685
|
var skinTonesMapped = /*#__PURE__*/skinToneVariations.reduce(function (mapped, skinTone) {
|
|
16726
16686
|
var _Object$assign;
|
|
16727
|
-
|
|
16728
16687
|
return Object.assign(mapped, (_Object$assign = {}, _Object$assign[skinTone] = skinTone, _Object$assign));
|
|
16729
16688
|
}, {});
|
|
16730
16689
|
|
|
16731
16690
|
var EmojiProperties;
|
|
16732
|
-
|
|
16733
16691
|
(function (EmojiProperties) {
|
|
16734
16692
|
EmojiProperties["name"] = "n";
|
|
16735
16693
|
EmojiProperties["unified"] = "u";
|
|
@@ -16749,7 +16707,6 @@ function indexEmoji(emoji) {
|
|
|
16749
16707
|
var joinedNameString = emojiNames(emoji).flat().join('').toLowerCase().replace(/[^a-zA-Z\d]/g, '').split('');
|
|
16750
16708
|
joinedNameString.forEach(function (_char) {
|
|
16751
16709
|
var _alphaNumericEmojiInd;
|
|
16752
|
-
|
|
16753
16710
|
alphaNumericEmojiIndex[_char] = (_alphaNumericEmojiInd = alphaNumericEmojiIndex[_char]) != null ? _alphaNumericEmojiInd : {};
|
|
16754
16711
|
alphaNumericEmojiIndex[_char][emojiUnified(emoji)] = emoji;
|
|
16755
16712
|
});
|
|
@@ -16757,7 +16714,6 @@ function indexEmoji(emoji) {
|
|
|
16757
16714
|
|
|
16758
16715
|
function emojiNames(emoji) {
|
|
16759
16716
|
var _emoji$EmojiPropertie;
|
|
16760
|
-
|
|
16761
16717
|
return (_emoji$EmojiPropertie = emoji[EmojiProperties.name]) != null ? _emoji$EmojiPropertie : [];
|
|
16762
16718
|
}
|
|
16763
16719
|
function addedIn(emoji) {
|
|
@@ -16767,45 +16723,36 @@ function emojiName(emoji) {
|
|
|
16767
16723
|
if (!emoji) {
|
|
16768
16724
|
return '';
|
|
16769
16725
|
}
|
|
16770
|
-
|
|
16771
16726
|
return emojiNames(emoji)[0];
|
|
16772
16727
|
}
|
|
16773
16728
|
function unifiedWithoutSkinTone(unified) {
|
|
16774
16729
|
var splat = unified.split('-');
|
|
16775
|
-
|
|
16776
16730
|
var _splat$splice = splat.splice(1, 1),
|
|
16777
|
-
|
|
16778
|
-
|
|
16731
|
+
skinTone = _splat$splice[0];
|
|
16779
16732
|
if (skinTonesMapped[skinTone]) {
|
|
16780
16733
|
return splat.join('-');
|
|
16781
16734
|
}
|
|
16782
|
-
|
|
16783
16735
|
return unified;
|
|
16784
16736
|
}
|
|
16785
16737
|
function emojiUnified(emoji, skinTone) {
|
|
16786
16738
|
var _emojiVariationUnifie;
|
|
16787
|
-
|
|
16788
16739
|
var unified = emoji[EmojiProperties.unified];
|
|
16789
|
-
|
|
16790
16740
|
if (!skinTone || !emojiHasVariations(emoji)) {
|
|
16791
16741
|
return unified;
|
|
16792
16742
|
}
|
|
16793
|
-
|
|
16794
16743
|
return (_emojiVariationUnifie = emojiVariationUnified(emoji, skinTone)) != null ? _emojiVariationUnifie : unified;
|
|
16795
16744
|
}
|
|
16796
16745
|
function emojisByCategory(category) {
|
|
16797
16746
|
var _emojis$category;
|
|
16798
|
-
|
|
16799
16747
|
// @ts-ignore
|
|
16800
16748
|
return (_emojis$category = emojis == null ? void 0 : emojis[category]) != null ? _emojis$category : [];
|
|
16801
|
-
}
|
|
16802
|
-
|
|
16749
|
+
}
|
|
16750
|
+
// WARNING: DO NOT USE DIRECTLY
|
|
16803
16751
|
function emojiUrlByUnified(unified, emojiStyle) {
|
|
16804
16752
|
return "" + cdnUrl(emojiStyle) + unified + ".png";
|
|
16805
16753
|
}
|
|
16806
16754
|
function emojiVariations(emoji) {
|
|
16807
16755
|
var _emoji$EmojiPropertie2;
|
|
16808
|
-
|
|
16809
16756
|
return (_emoji$EmojiPropertie2 = emoji[EmojiProperties.variations]) != null ? _emoji$EmojiPropertie2 : [];
|
|
16810
16757
|
}
|
|
16811
16758
|
function emojiHasVariations(emoji) {
|
|
@@ -16820,11 +16767,9 @@ function emojiByUnified(unified) {
|
|
|
16820
16767
|
if (!unified) {
|
|
16821
16768
|
return;
|
|
16822
16769
|
}
|
|
16823
|
-
|
|
16824
16770
|
if (allEmojisByUnified[unified]) {
|
|
16825
16771
|
return allEmojisByUnified[unified];
|
|
16826
16772
|
}
|
|
16827
|
-
|
|
16828
16773
|
var withoutSkinTone = unifiedWithoutSkinTone(unified);
|
|
16829
16774
|
return allEmojisByUnified[withoutSkinTone];
|
|
16830
16775
|
}
|
|
@@ -16834,43 +16779,35 @@ function setCustomEmojis(customEmojis) {
|
|
|
16834
16779
|
customEmojis.forEach(function (emoji) {
|
|
16835
16780
|
var emojiData = customToRegularEmoji(emoji);
|
|
16836
16781
|
emojis[exports.Categories.CUSTOM].push(emojiData);
|
|
16837
|
-
|
|
16838
16782
|
if (allEmojisByUnified[emojiData[EmojiProperties.unified]]) {
|
|
16839
16783
|
return;
|
|
16840
16784
|
}
|
|
16841
|
-
|
|
16842
16785
|
allEmojis.push(emojiData);
|
|
16843
16786
|
allEmojisByUnified[emojiData[EmojiProperties.unified]] = emojiData;
|
|
16844
16787
|
indexEmoji(emojiData);
|
|
16845
16788
|
});
|
|
16846
16789
|
}
|
|
16847
|
-
|
|
16848
16790
|
function customToRegularEmoji(emoji) {
|
|
16849
16791
|
var _ref;
|
|
16850
|
-
|
|
16851
16792
|
return _ref = {}, _ref[EmojiProperties.name] = emoji.names.map(function (name) {
|
|
16852
16793
|
return name.toLowerCase();
|
|
16853
16794
|
}), _ref[EmojiProperties.unified] = emoji.id.toLowerCase(), _ref[EmojiProperties.added_in] = '0', _ref[EmojiProperties.imgUrl] = emoji.imgUrl, _ref;
|
|
16854
16795
|
}
|
|
16855
|
-
|
|
16856
16796
|
var allEmojisByUnified = {};
|
|
16857
16797
|
setTimeout(function () {
|
|
16858
16798
|
allEmojis.reduce(function (allEmojis, Emoji) {
|
|
16859
16799
|
allEmojis[emojiUnified(Emoji)] = Emoji;
|
|
16860
|
-
|
|
16861
16800
|
if (emojiHasVariations(Emoji)) {
|
|
16862
16801
|
emojiVariations(Emoji).forEach(function (variation) {
|
|
16863
16802
|
allEmojis[variation] = Emoji;
|
|
16864
16803
|
});
|
|
16865
16804
|
}
|
|
16866
|
-
|
|
16867
16805
|
return allEmojis;
|
|
16868
16806
|
}, allEmojisByUnified);
|
|
16869
16807
|
});
|
|
16870
16808
|
function activeVariationFromUnified(unified) {
|
|
16871
16809
|
var _unified$split = unified.split('-'),
|
|
16872
|
-
|
|
16873
|
-
|
|
16810
|
+
suspectedSkinTone = _unified$split[1];
|
|
16874
16811
|
return skinToneVariations.includes(suspectedSkinTone) ? suspectedSkinTone : null;
|
|
16875
16812
|
}
|
|
16876
16813
|
|
|
@@ -16882,11 +16819,9 @@ var SEARCH_RESULTS_ONE_RESULT_FOUND = '1 result' + SEARCH_RESULTS_SUFFIX;
|
|
|
16882
16819
|
var SEARCH_RESULTS_MULTIPLE_RESULTS_FOUND = '%n results' + SEARCH_RESULTS_SUFFIX;
|
|
16883
16820
|
function mergeConfig(userConfig) {
|
|
16884
16821
|
var _userConfig$previewCo, _config$customEmojis;
|
|
16885
|
-
|
|
16886
16822
|
if (userConfig === void 0) {
|
|
16887
16823
|
userConfig = {};
|
|
16888
16824
|
}
|
|
16889
|
-
|
|
16890
16825
|
var base = basePickerConfig();
|
|
16891
16826
|
var previewConfig = Object.assign(base.previewConfig, (_userConfig$previewCo = userConfig.previewConfig) != null ? _userConfig$previewCo : {});
|
|
16892
16827
|
var config = Object.assign(base, userConfig);
|
|
@@ -16936,8 +16871,7 @@ var _excluded = ["children"];
|
|
|
16936
16871
|
var ConfigContext = /*#__PURE__*/React.createContext( /*#__PURE__*/basePickerConfig());
|
|
16937
16872
|
function PickerConfigProvider(_ref) {
|
|
16938
16873
|
var children = _ref.children,
|
|
16939
|
-
|
|
16940
|
-
|
|
16874
|
+
config = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
16941
16875
|
var mergedConfig = useSetConfig(config);
|
|
16942
16876
|
return React.createElement(ConfigContext.Provider, {
|
|
16943
16877
|
value: mergedConfig
|
|
@@ -16945,21 +16879,18 @@ function PickerConfigProvider(_ref) {
|
|
|
16945
16879
|
}
|
|
16946
16880
|
function useSetConfig(config) {
|
|
16947
16881
|
var _config$customEmojis2;
|
|
16948
|
-
|
|
16949
16882
|
var _React$useState = React.useState(function () {
|
|
16950
|
-
|
|
16951
|
-
|
|
16952
|
-
|
|
16953
|
-
|
|
16954
|
-
|
|
16883
|
+
return mergeConfig(config);
|
|
16884
|
+
}),
|
|
16885
|
+
mergedConfig = _React$useState[0],
|
|
16886
|
+
setMergedConfig = _React$useState[1];
|
|
16955
16887
|
React.useEffect(function () {
|
|
16956
16888
|
var _config$customEmojis, _mergedConfig$customE;
|
|
16957
|
-
|
|
16958
16889
|
if (((_config$customEmojis = config.customEmojis) == null ? void 0 : _config$customEmojis.length) !== ((_mergedConfig$customE = mergedConfig.customEmojis) == null ? void 0 : _mergedConfig$customE.length)) {
|
|
16959
16890
|
setMergedConfig(mergeConfig(config));
|
|
16960
|
-
}
|
|
16891
|
+
}
|
|
16892
|
+
// not gonna...
|
|
16961
16893
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16962
|
-
|
|
16963
16894
|
}, [(_config$customEmojis2 = config.customEmojis) == null ? void 0 : _config$customEmojis2.length]);
|
|
16964
16895
|
return mergedConfig;
|
|
16965
16896
|
}
|
|
@@ -16981,98 +16912,82 @@ function useDefineMutableConfig(config) {
|
|
|
16981
16912
|
}, [config.onEmojiClick]);
|
|
16982
16913
|
return MutableConfigRef;
|
|
16983
16914
|
}
|
|
16984
|
-
|
|
16985
16915
|
function emptyFunc() {}
|
|
16986
16916
|
|
|
16987
16917
|
function useSearchPlaceHolderConfig() {
|
|
16988
16918
|
var _find;
|
|
16989
|
-
|
|
16990
16919
|
var _usePickerConfig = usePickerConfig(),
|
|
16991
|
-
|
|
16992
|
-
|
|
16993
|
-
|
|
16920
|
+
searchPlaceHolder = _usePickerConfig.searchPlaceHolder,
|
|
16921
|
+
searchPlaceholder = _usePickerConfig.searchPlaceholder;
|
|
16994
16922
|
return (_find = [searchPlaceHolder, searchPlaceholder].find(function (p) {
|
|
16995
16923
|
return p !== DEFAULT_SEARCH_PLACEHOLDER;
|
|
16996
16924
|
})) != null ? _find : DEFAULT_SEARCH_PLACEHOLDER;
|
|
16997
16925
|
}
|
|
16998
16926
|
function useDefaultSkinToneConfig() {
|
|
16999
16927
|
var _usePickerConfig2 = usePickerConfig(),
|
|
17000
|
-
|
|
17001
|
-
|
|
16928
|
+
defaultSkinTone = _usePickerConfig2.defaultSkinTone;
|
|
17002
16929
|
return defaultSkinTone;
|
|
17003
16930
|
}
|
|
17004
16931
|
function useSkinTonesDisabledConfig() {
|
|
17005
16932
|
var _usePickerConfig3 = usePickerConfig(),
|
|
17006
|
-
|
|
17007
|
-
|
|
16933
|
+
skinTonesDisabled = _usePickerConfig3.skinTonesDisabled;
|
|
17008
16934
|
return skinTonesDisabled;
|
|
17009
16935
|
}
|
|
17010
16936
|
function useEmojiStyleConfig() {
|
|
17011
16937
|
var _usePickerConfig4 = usePickerConfig(),
|
|
17012
|
-
|
|
17013
|
-
|
|
16938
|
+
emojiStyle = _usePickerConfig4.emojiStyle;
|
|
17014
16939
|
return emojiStyle;
|
|
17015
16940
|
}
|
|
17016
16941
|
function useAutoFocusSearchConfig() {
|
|
17017
16942
|
var _usePickerConfig5 = usePickerConfig(),
|
|
17018
|
-
|
|
17019
|
-
|
|
16943
|
+
autoFocusSearch = _usePickerConfig5.autoFocusSearch;
|
|
17020
16944
|
return autoFocusSearch;
|
|
17021
16945
|
}
|
|
17022
16946
|
function useCategoriesConfig() {
|
|
17023
16947
|
var _usePickerConfig6 = usePickerConfig(),
|
|
17024
|
-
|
|
17025
|
-
|
|
16948
|
+
categories = _usePickerConfig6.categories;
|
|
17026
16949
|
return categories;
|
|
17027
16950
|
}
|
|
17028
16951
|
function useCustomEmojisConfig() {
|
|
17029
16952
|
var _usePickerConfig7 = usePickerConfig(),
|
|
17030
|
-
|
|
17031
|
-
|
|
16953
|
+
customEmojis = _usePickerConfig7.customEmojis;
|
|
17032
16954
|
return customEmojis;
|
|
17033
16955
|
}
|
|
17034
16956
|
function useOnEmojiClickConfig() {
|
|
17035
16957
|
var _useMutableConfig = useMutableConfig(),
|
|
17036
|
-
|
|
17037
|
-
|
|
16958
|
+
current = _useMutableConfig.current;
|
|
17038
16959
|
return current.onEmojiClick || function () {};
|
|
17039
16960
|
}
|
|
17040
16961
|
function usePreviewConfig() {
|
|
17041
16962
|
var _usePickerConfig8 = usePickerConfig(),
|
|
17042
|
-
|
|
17043
|
-
|
|
16963
|
+
previewConfig = _usePickerConfig8.previewConfig;
|
|
17044
16964
|
return previewConfig;
|
|
17045
16965
|
}
|
|
17046
16966
|
function useThemeConfig() {
|
|
17047
16967
|
var _usePickerConfig9 = usePickerConfig(),
|
|
17048
|
-
|
|
17049
|
-
|
|
16968
|
+
theme = _usePickerConfig9.theme;
|
|
17050
16969
|
return theme;
|
|
17051
16970
|
}
|
|
17052
16971
|
function useSuggestedEmojisModeConfig() {
|
|
17053
16972
|
var _usePickerConfig10 = usePickerConfig(),
|
|
17054
|
-
|
|
17055
|
-
|
|
16973
|
+
suggestedEmojisMode = _usePickerConfig10.suggestedEmojisMode;
|
|
17056
16974
|
return suggestedEmojisMode;
|
|
17057
16975
|
}
|
|
17058
16976
|
function useLazyLoadEmojisConfig() {
|
|
17059
16977
|
var _usePickerConfig11 = usePickerConfig(),
|
|
17060
|
-
|
|
17061
|
-
|
|
16978
|
+
lazyLoadEmojis = _usePickerConfig11.lazyLoadEmojis;
|
|
17062
16979
|
return lazyLoadEmojis;
|
|
17063
16980
|
}
|
|
17064
16981
|
function useClassNameConfig() {
|
|
17065
16982
|
var _usePickerConfig12 = usePickerConfig(),
|
|
17066
|
-
|
|
17067
|
-
|
|
16983
|
+
className = _usePickerConfig12.className;
|
|
17068
16984
|
return className;
|
|
17069
16985
|
}
|
|
17070
16986
|
function useStyleConfig() {
|
|
17071
16987
|
var _usePickerConfig13 = usePickerConfig(),
|
|
17072
|
-
|
|
17073
|
-
|
|
17074
|
-
|
|
17075
|
-
|
|
16988
|
+
height = _usePickerConfig13.height,
|
|
16989
|
+
width = _usePickerConfig13.width,
|
|
16990
|
+
style = _usePickerConfig13.style;
|
|
17076
16991
|
return _extends({
|
|
17077
16992
|
height: getDimension(height),
|
|
17078
16993
|
width: getDimension(width)
|
|
@@ -17080,47 +16995,38 @@ function useStyleConfig() {
|
|
|
17080
16995
|
}
|
|
17081
16996
|
function useEmojiVersionConfig() {
|
|
17082
16997
|
var _usePickerConfig14 = usePickerConfig(),
|
|
17083
|
-
|
|
17084
|
-
|
|
16998
|
+
emojiVersion = _usePickerConfig14.emojiVersion;
|
|
17085
16999
|
return emojiVersion;
|
|
17086
17000
|
}
|
|
17087
17001
|
function useSearchDisabledConfig() {
|
|
17088
17002
|
var _usePickerConfig15 = usePickerConfig(),
|
|
17089
|
-
|
|
17090
|
-
|
|
17003
|
+
searchDisabled = _usePickerConfig15.searchDisabled;
|
|
17091
17004
|
return searchDisabled;
|
|
17092
17005
|
}
|
|
17093
17006
|
function useSkinTonePickerLocationConfig() {
|
|
17094
17007
|
var _usePickerConfig16 = usePickerConfig(),
|
|
17095
|
-
|
|
17096
|
-
|
|
17008
|
+
skinTonePickerLocation = _usePickerConfig16.skinTonePickerLocation;
|
|
17097
17009
|
return skinTonePickerLocation;
|
|
17098
17010
|
}
|
|
17099
17011
|
function useUnicodeToHide() {
|
|
17100
17012
|
var _usePickerConfig17 = usePickerConfig(),
|
|
17101
|
-
|
|
17102
|
-
|
|
17013
|
+
unicodeToHide = _usePickerConfig17.unicodeToHide;
|
|
17103
17014
|
return unicodeToHide;
|
|
17104
17015
|
}
|
|
17105
17016
|
function useGetEmojiUrlConfig() {
|
|
17106
17017
|
var _usePickerConfig18 = usePickerConfig(),
|
|
17107
|
-
|
|
17108
|
-
|
|
17018
|
+
getEmojiUrl = _usePickerConfig18.getEmojiUrl;
|
|
17109
17019
|
return getEmojiUrl;
|
|
17110
17020
|
}
|
|
17111
|
-
|
|
17112
17021
|
function getDimension(dimensionConfig) {
|
|
17113
17022
|
return typeof dimensionConfig === 'number' ? dimensionConfig + "px" : dimensionConfig;
|
|
17114
17023
|
}
|
|
17115
|
-
|
|
17116
17024
|
function useSearchResultsConfig(searchResultsCount) {
|
|
17117
17025
|
var hasResults = searchResultsCount > 0;
|
|
17118
17026
|
var isPlural = searchResultsCount > 1;
|
|
17119
|
-
|
|
17120
17027
|
if (hasResults) {
|
|
17121
17028
|
return isPlural ? SEARCH_RESULTS_MULTIPLE_RESULTS_FOUND.replace('%n', searchResultsCount.toString()) : SEARCH_RESULTS_ONE_RESULT_FOUND;
|
|
17122
17029
|
}
|
|
17123
|
-
|
|
17124
17030
|
return SEARCH_RESULTS_NO_RESULTS_FOUND;
|
|
17125
17031
|
}
|
|
17126
17032
|
|
|
@@ -17128,28 +17034,22 @@ function useDebouncedState(initialValue, delay) {
|
|
|
17128
17034
|
if (delay === void 0) {
|
|
17129
17035
|
delay = 0;
|
|
17130
17036
|
}
|
|
17131
|
-
|
|
17132
17037
|
var _useState = React.useState(initialValue),
|
|
17133
|
-
|
|
17134
|
-
|
|
17135
|
-
|
|
17038
|
+
state = _useState[0],
|
|
17039
|
+
setState = _useState[1];
|
|
17136
17040
|
var timer = React.useRef(null);
|
|
17137
|
-
|
|
17138
17041
|
function debouncedSetState(value) {
|
|
17139
17042
|
return new Promise(function (resolve) {
|
|
17140
17043
|
var _window;
|
|
17141
|
-
|
|
17142
17044
|
if (timer.current) {
|
|
17143
17045
|
clearTimeout(timer.current);
|
|
17144
17046
|
}
|
|
17145
|
-
|
|
17146
17047
|
timer.current = (_window = window) == null ? void 0 : _window.setTimeout(function () {
|
|
17147
17048
|
setState(value);
|
|
17148
17049
|
resolve(value);
|
|
17149
17050
|
}, delay);
|
|
17150
17051
|
});
|
|
17151
17052
|
}
|
|
17152
|
-
|
|
17153
17053
|
return [state, debouncedSetState];
|
|
17154
17054
|
}
|
|
17155
17055
|
|
|
@@ -17165,16 +17065,13 @@ function useDisallowedEmojis() {
|
|
|
17165
17065
|
var emojiVersionConfig = useEmojiVersionConfig();
|
|
17166
17066
|
return React.useMemo(function () {
|
|
17167
17067
|
var emojiVersion = parseFloat("" + emojiVersionConfig);
|
|
17168
|
-
|
|
17169
17068
|
if (!emojiVersionConfig || Number.isNaN(emojiVersion)) {
|
|
17170
17069
|
return DisallowedEmojisRef.current;
|
|
17171
17070
|
}
|
|
17172
|
-
|
|
17173
17071
|
return allEmojis.reduce(function (disallowedEmojis, emoji) {
|
|
17174
17072
|
if (addedInNewerVersion(emoji, emojiVersion)) {
|
|
17175
17073
|
disallowedEmojis[emojiUnified(emoji)] = true;
|
|
17176
17074
|
}
|
|
17177
|
-
|
|
17178
17075
|
return disallowedEmojis;
|
|
17179
17076
|
}, DisallowedEmojisRef.current);
|
|
17180
17077
|
}, [emojiVersionConfig]);
|
|
@@ -17187,7 +17084,6 @@ function useIsEmojiDisallowed() {
|
|
|
17187
17084
|
return Boolean(disallowedEmojis[unified] || isUnicodeHidden(unified));
|
|
17188
17085
|
};
|
|
17189
17086
|
}
|
|
17190
|
-
|
|
17191
17087
|
function addedInNewerVersion(emoji, supportedLevel) {
|
|
17192
17088
|
return addedIn(emoji) > supportedLevel;
|
|
17193
17089
|
}
|
|
@@ -17201,8 +17097,8 @@ function useMarkInitialLoad(dispatch) {
|
|
|
17201
17097
|
function PickerContextProvider(_ref) {
|
|
17202
17098
|
var children = _ref.children;
|
|
17203
17099
|
var disallowedEmojis = useDisallowedEmojis();
|
|
17204
|
-
var defaultSkinTone = useDefaultSkinToneConfig();
|
|
17205
|
-
|
|
17100
|
+
var defaultSkinTone = useDefaultSkinToneConfig();
|
|
17101
|
+
// Initialize the filter with the inititial dictionary
|
|
17206
17102
|
var filterRef = React.useRef(alphaNumericEmojiIndex);
|
|
17207
17103
|
var disallowClickRef = React.useRef(false);
|
|
17208
17104
|
var disallowMouseRef = React.useRef(false);
|
|
@@ -17214,11 +17110,9 @@ function PickerContextProvider(_ref) {
|
|
|
17214
17110
|
var activeCategoryState = React.useState(null);
|
|
17215
17111
|
var emojisThatFailedToLoadState = React.useState(new Set());
|
|
17216
17112
|
var emojiVariationPickerState = React.useState(null);
|
|
17217
|
-
|
|
17218
17113
|
var _useState = React.useState(false),
|
|
17219
|
-
|
|
17220
|
-
|
|
17221
|
-
|
|
17114
|
+
isPastInitialLoad = _useState[0],
|
|
17115
|
+
setIsPastInitialLoad = _useState[1];
|
|
17222
17116
|
useMarkInitialLoad(setIsPastInitialLoad);
|
|
17223
17117
|
return React.createElement(PickerContext.Provider, {
|
|
17224
17118
|
value: {
|
|
@@ -17265,64 +17159,54 @@ var PickerContext = /*#__PURE__*/React.createContext({
|
|
|
17265
17159
|
});
|
|
17266
17160
|
function useFilterRef() {
|
|
17267
17161
|
var _React$useContext = React.useContext(PickerContext),
|
|
17268
|
-
|
|
17269
|
-
|
|
17162
|
+
filterRef = _React$useContext.filterRef;
|
|
17270
17163
|
return filterRef;
|
|
17271
17164
|
}
|
|
17272
17165
|
function useDisallowClickRef() {
|
|
17273
17166
|
var _React$useContext2 = React.useContext(PickerContext),
|
|
17274
|
-
|
|
17275
|
-
|
|
17167
|
+
disallowClickRef = _React$useContext2.disallowClickRef;
|
|
17276
17168
|
return disallowClickRef;
|
|
17277
17169
|
}
|
|
17278
17170
|
function useDisallowMouseRef() {
|
|
17279
17171
|
var _React$useContext3 = React.useContext(PickerContext),
|
|
17280
|
-
|
|
17281
|
-
|
|
17172
|
+
disallowMouseRef = _React$useContext3.disallowMouseRef;
|
|
17282
17173
|
return disallowMouseRef;
|
|
17283
17174
|
}
|
|
17284
17175
|
function useSearchTermState() {
|
|
17285
17176
|
var _React$useContext4 = React.useContext(PickerContext),
|
|
17286
|
-
|
|
17287
|
-
|
|
17177
|
+
searchTerm = _React$useContext4.searchTerm;
|
|
17288
17178
|
return searchTerm;
|
|
17289
17179
|
}
|
|
17290
17180
|
function useActiveSkinToneState() {
|
|
17291
17181
|
var _React$useContext5 = React.useContext(PickerContext),
|
|
17292
|
-
|
|
17293
|
-
|
|
17182
|
+
activeSkinTone = _React$useContext5.activeSkinTone;
|
|
17294
17183
|
return activeSkinTone;
|
|
17295
17184
|
}
|
|
17296
17185
|
function useEmojisThatFailedToLoadState() {
|
|
17297
17186
|
var _React$useContext6 = React.useContext(PickerContext),
|
|
17298
|
-
|
|
17299
|
-
|
|
17187
|
+
emojisThatFailedToLoadState = _React$useContext6.emojisThatFailedToLoadState;
|
|
17300
17188
|
return emojisThatFailedToLoadState;
|
|
17301
17189
|
}
|
|
17302
17190
|
function useIsPastInitialLoad() {
|
|
17303
17191
|
var _React$useContext7 = React.useContext(PickerContext),
|
|
17304
|
-
|
|
17305
|
-
|
|
17192
|
+
isPastInitialLoad = _React$useContext7.isPastInitialLoad;
|
|
17306
17193
|
return isPastInitialLoad;
|
|
17307
17194
|
}
|
|
17308
17195
|
function useEmojiVariationPickerState() {
|
|
17309
17196
|
var _React$useContext8 = React.useContext(PickerContext),
|
|
17310
|
-
|
|
17311
|
-
|
|
17197
|
+
emojiVariationPickerState = _React$useContext8.emojiVariationPickerState;
|
|
17312
17198
|
return emojiVariationPickerState;
|
|
17313
17199
|
}
|
|
17314
17200
|
function useSkinToneFanOpenState() {
|
|
17315
17201
|
var _React$useContext9 = React.useContext(PickerContext),
|
|
17316
|
-
|
|
17317
|
-
|
|
17202
|
+
skinToneFanOpenState = _React$useContext9.skinToneFanOpenState;
|
|
17318
17203
|
return skinToneFanOpenState;
|
|
17319
17204
|
}
|
|
17320
17205
|
function useUpdateSuggested() {
|
|
17321
17206
|
var _React$useContext11 = React.useContext(PickerContext),
|
|
17322
|
-
|
|
17323
|
-
|
|
17207
|
+
suggestedUpdateState = _React$useContext11.suggestedUpdateState;
|
|
17324
17208
|
var suggestedUpdated = suggestedUpdateState[0],
|
|
17325
|
-
|
|
17209
|
+
setsuggestedUpdate = suggestedUpdateState[1];
|
|
17326
17210
|
return [suggestedUpdated, function updateSuggested() {
|
|
17327
17211
|
setsuggestedUpdate(Date.now());
|
|
17328
17212
|
}];
|
|
@@ -17355,13 +17239,11 @@ function useOnMouseMove() {
|
|
|
17355
17239
|
bodyRef == null ? void 0 : bodyRef.addEventListener('mousemove', onMouseMove, {
|
|
17356
17240
|
passive: true
|
|
17357
17241
|
});
|
|
17358
|
-
|
|
17359
17242
|
function onMouseMove() {
|
|
17360
17243
|
if (isMouseDisallowed()) {
|
|
17361
17244
|
allowMouseMove();
|
|
17362
17245
|
}
|
|
17363
17246
|
}
|
|
17364
|
-
|
|
17365
17247
|
return function () {
|
|
17366
17248
|
bodyRef == null ? void 0 : bodyRef.removeEventListener('mousemove', onMouseMove);
|
|
17367
17249
|
};
|
|
@@ -17372,7 +17254,6 @@ function elementCountInRow(parent, element) {
|
|
|
17372
17254
|
if (!parent || !element) {
|
|
17373
17255
|
return 0;
|
|
17374
17256
|
}
|
|
17375
|
-
|
|
17376
17257
|
var parentWidth = parent.getBoundingClientRect().width;
|
|
17377
17258
|
var elementWidth = element.getBoundingClientRect().width;
|
|
17378
17259
|
return Math.floor(parentWidth / elementWidth);
|
|
@@ -17381,7 +17262,6 @@ function elementIndexInRow(parent, element) {
|
|
|
17381
17262
|
if (!parent || !element) {
|
|
17382
17263
|
return 0;
|
|
17383
17264
|
}
|
|
17384
|
-
|
|
17385
17265
|
var elementWidth = element.getBoundingClientRect().width;
|
|
17386
17266
|
var elementLeft = element.getBoundingClientRect().left;
|
|
17387
17267
|
var parentLeft = parent.getBoundingClientRect().left;
|
|
@@ -17391,7 +17271,6 @@ function rowNumber(parent, element) {
|
|
|
17391
17271
|
if (!parent || !element) {
|
|
17392
17272
|
return 0;
|
|
17393
17273
|
}
|
|
17394
|
-
|
|
17395
17274
|
var elementHeight = element.getBoundingClientRect().height;
|
|
17396
17275
|
var elementTop = element.getBoundingClientRect().top;
|
|
17397
17276
|
var parentTop = parent.getBoundingClientRect().top;
|
|
@@ -17401,14 +17280,12 @@ function hasNextRow(parent, element) {
|
|
|
17401
17280
|
if (!parent || !element) {
|
|
17402
17281
|
return false;
|
|
17403
17282
|
}
|
|
17404
|
-
|
|
17405
17283
|
var elementHeight = element.getBoundingClientRect().height;
|
|
17406
17284
|
var elementTop = element.getBoundingClientRect().top;
|
|
17407
17285
|
var parentTop = parent.getBoundingClientRect().top;
|
|
17408
17286
|
var parentHeight = parent.getBoundingClientRect().height;
|
|
17409
17287
|
return Math.round(elementTop - parentTop + elementHeight) < parentHeight;
|
|
17410
17288
|
}
|
|
17411
|
-
|
|
17412
17289
|
function getRowElements(elements, row, elementsInRow) {
|
|
17413
17290
|
if (row === -1) {
|
|
17414
17291
|
var lastRow = Math.floor((elements.length - 1) / elementsInRow);
|
|
@@ -17416,40 +17293,34 @@ function getRowElements(elements, row, elementsInRow) {
|
|
|
17416
17293
|
var lastElementIndex = elements.length - 1;
|
|
17417
17294
|
return elements.slice(firstElementIndex, lastElementIndex + 1);
|
|
17418
17295
|
}
|
|
17419
|
-
|
|
17420
17296
|
return elements.slice(row * elementsInRow, (row + 1) * elementsInRow);
|
|
17421
17297
|
}
|
|
17422
|
-
|
|
17423
17298
|
function getNextRowElements(allElements, currentRow, elementsInRow) {
|
|
17424
17299
|
var nextRow = currentRow + 1;
|
|
17425
|
-
|
|
17426
17300
|
if (nextRow * elementsInRow > allElements.length) {
|
|
17427
17301
|
return [];
|
|
17428
17302
|
}
|
|
17429
|
-
|
|
17430
17303
|
return getRowElements(allElements, nextRow, elementsInRow);
|
|
17431
17304
|
}
|
|
17432
|
-
|
|
17433
17305
|
function getElementInRow(elements, row, elementsInRow, indexInRow) {
|
|
17434
|
-
var rowElements = getRowElements(elements, row, elementsInRow);
|
|
17435
|
-
|
|
17306
|
+
var rowElements = getRowElements(elements, row, elementsInRow);
|
|
17307
|
+
// get element, default to last
|
|
17436
17308
|
return rowElements[indexInRow] || rowElements[rowElements.length - 1] || null;
|
|
17437
17309
|
}
|
|
17438
17310
|
function getElementInNextRow(allElements, currentRow, elementsInRow, index) {
|
|
17439
|
-
var nextRowElements = getNextRowElements(allElements, currentRow, elementsInRow);
|
|
17440
|
-
|
|
17311
|
+
var nextRowElements = getNextRowElements(allElements, currentRow, elementsInRow);
|
|
17312
|
+
// return item in index, or last item in row
|
|
17441
17313
|
return nextRowElements[index] || nextRowElements[nextRowElements.length - 1] || null;
|
|
17442
17314
|
}
|
|
17443
17315
|
function getElementInPrevRow(allElements, currentRow, elementsInRow, index) {
|
|
17444
|
-
var prevRowElements = getRowElements(allElements, currentRow - 1, elementsInRow);
|
|
17445
|
-
|
|
17316
|
+
var prevRowElements = getRowElements(allElements, currentRow - 1, elementsInRow);
|
|
17317
|
+
// default to last
|
|
17446
17318
|
return prevRowElements[index] || prevRowElements[prevRowElements.length - 1] || null;
|
|
17447
17319
|
}
|
|
17448
17320
|
function firstVisibleElementInContainer(parent, elements) {
|
|
17449
17321
|
if (!parent || !elements.length) {
|
|
17450
17322
|
return null;
|
|
17451
17323
|
}
|
|
17452
|
-
|
|
17453
17324
|
var parentTop = parent.getBoundingClientRect().top;
|
|
17454
17325
|
var parentBottom = parent.getBoundingClientRect().bottom;
|
|
17455
17326
|
var visibleElements = elements.find(function (element) {
|
|
@@ -17467,53 +17338,43 @@ var EmojiButtonSelector = "button" + /*#__PURE__*/asSelectors(ClassNames.emoji);
|
|
|
17467
17338
|
var VisibleEmojiSelector = /*#__PURE__*/[EmojiButtonSelector, asSelectors(ClassNames.visible), ":not(" + asSelectors(ClassNames.hidden) + ")"].join('');
|
|
17468
17339
|
function buttonFromTarget(emojiElement) {
|
|
17469
17340
|
var _emojiElement$closest;
|
|
17470
|
-
|
|
17471
17341
|
return (_emojiElement$closest = emojiElement == null ? void 0 : emojiElement.closest(EmojiButtonSelector)) != null ? _emojiElement$closest : null;
|
|
17472
17342
|
}
|
|
17473
17343
|
function emojiFromElement(element) {
|
|
17474
17344
|
var originalUnified = originalUnifiedFromEmojiElement(element);
|
|
17475
17345
|
var unified = unifiedFromEmojiElement(element);
|
|
17476
|
-
|
|
17477
17346
|
if (!originalUnified) {
|
|
17478
17347
|
return [];
|
|
17479
17348
|
}
|
|
17480
|
-
|
|
17481
17349
|
var emoji = emojiByUnified(unified != null ? unified : originalUnified);
|
|
17482
|
-
|
|
17483
17350
|
if (!emoji) {
|
|
17484
17351
|
return [];
|
|
17485
17352
|
}
|
|
17486
|
-
|
|
17487
17353
|
return [emoji, unified];
|
|
17488
17354
|
}
|
|
17489
17355
|
function isEmojiElement(element) {
|
|
17490
17356
|
var _element$parentElemen;
|
|
17491
|
-
|
|
17492
17357
|
return Boolean((element == null ? void 0 : element.matches(EmojiButtonSelector)) || (element == null ? void 0 : (_element$parentElemen = element.parentElement) == null ? void 0 : _element$parentElemen.matches(EmojiButtonSelector)));
|
|
17493
17358
|
}
|
|
17494
17359
|
function elementHeight(element) {
|
|
17495
17360
|
var _element$clientHeight;
|
|
17496
|
-
|
|
17497
17361
|
return (_element$clientHeight = element == null ? void 0 : element.clientHeight) != null ? _element$clientHeight : 0;
|
|
17498
17362
|
}
|
|
17499
17363
|
function emojiTrueOffsetTop(element) {
|
|
17500
17364
|
if (!element) {
|
|
17501
17365
|
return 0;
|
|
17502
17366
|
}
|
|
17503
|
-
|
|
17504
17367
|
var button = buttonFromTarget(element);
|
|
17505
|
-
var category = closestCategory(button);
|
|
17506
|
-
|
|
17368
|
+
var category = closestCategory(button);
|
|
17369
|
+
// compensate for the label height
|
|
17507
17370
|
var labelHeight = categoryLabelHeight(category);
|
|
17508
17371
|
return elementOffsetTop(button) + elementOffsetTop(category) + labelHeight;
|
|
17509
17372
|
}
|
|
17510
17373
|
function categoryLabelHeight(category) {
|
|
17511
17374
|
var _category$clientHeigh, _categoryWithoutLabel;
|
|
17512
|
-
|
|
17513
17375
|
if (!category) {
|
|
17514
17376
|
return 0;
|
|
17515
17377
|
}
|
|
17516
|
-
|
|
17517
17378
|
var categoryWithoutLabel = category.querySelector(asSelectors(ClassNames.categoryContent));
|
|
17518
17379
|
return ((_category$clientHeigh = category == null ? void 0 : category.clientHeight) != null ? _category$clientHeigh : 0) - ((_categoryWithoutLabel = categoryWithoutLabel == null ? void 0 : categoryWithoutLabel.clientHeight) != null ? _categoryWithoutLabel : 0);
|
|
17519
17380
|
}
|
|
@@ -17521,7 +17382,6 @@ function isEmojiBehindLabel(emoji) {
|
|
|
17521
17382
|
if (!emoji) {
|
|
17522
17383
|
return false;
|
|
17523
17384
|
}
|
|
17524
|
-
|
|
17525
17385
|
return emojiDistanceFromScrollTop(emoji) < categoryLabelHeight(closestCategory(emoji));
|
|
17526
17386
|
}
|
|
17527
17387
|
function queryScrollBody(root) {
|
|
@@ -17530,20 +17390,16 @@ function queryScrollBody(root) {
|
|
|
17530
17390
|
}
|
|
17531
17391
|
function emojiDistanceFromScrollTop(emoji) {
|
|
17532
17392
|
var _closestScrollBody$sc, _closestScrollBody;
|
|
17533
|
-
|
|
17534
17393
|
if (!emoji) {
|
|
17535
17394
|
return 0;
|
|
17536
17395
|
}
|
|
17537
|
-
|
|
17538
17396
|
return emojiTrueOffsetTop(emoji) - ((_closestScrollBody$sc = (_closestScrollBody = closestScrollBody(emoji)) == null ? void 0 : _closestScrollBody.scrollTop) != null ? _closestScrollBody$sc : 0);
|
|
17539
17397
|
}
|
|
17540
17398
|
function closestScrollBody(element) {
|
|
17541
17399
|
var _element$closest;
|
|
17542
|
-
|
|
17543
17400
|
if (!element) {
|
|
17544
17401
|
return null;
|
|
17545
17402
|
}
|
|
17546
|
-
|
|
17547
17403
|
return (_element$closest = element.closest(asSelectors(ClassNames.scrollBody))) != null ? _element$closest : null;
|
|
17548
17404
|
}
|
|
17549
17405
|
function emojiTruOffsetLeft(element) {
|
|
@@ -17551,46 +17407,33 @@ function emojiTruOffsetLeft(element) {
|
|
|
17551
17407
|
var category = closestCategory(button);
|
|
17552
17408
|
return elementOffsetLeft(button) + elementOffsetLeft(category);
|
|
17553
17409
|
}
|
|
17554
|
-
|
|
17555
17410
|
function elementOffsetTop(element) {
|
|
17556
17411
|
var _element$offsetTop;
|
|
17557
|
-
|
|
17558
17412
|
return (_element$offsetTop = element == null ? void 0 : element.offsetTop) != null ? _element$offsetTop : 0;
|
|
17559
17413
|
}
|
|
17560
|
-
|
|
17561
17414
|
function elementOffsetLeft(element) {
|
|
17562
17415
|
var _element$offsetLeft;
|
|
17563
|
-
|
|
17564
17416
|
return (_element$offsetLeft = element == null ? void 0 : element.offsetLeft) != null ? _element$offsetLeft : 0;
|
|
17565
17417
|
}
|
|
17566
|
-
|
|
17567
17418
|
function unifiedFromEmojiElement(emoji) {
|
|
17568
17419
|
var _elementDataSetKey;
|
|
17569
|
-
|
|
17570
17420
|
return (_elementDataSetKey = elementDataSetKey(buttonFromTarget(emoji), 'unified')) != null ? _elementDataSetKey : null;
|
|
17571
17421
|
}
|
|
17572
17422
|
function originalUnifiedFromEmojiElement(emoji) {
|
|
17573
17423
|
var unified = unifiedFromEmojiElement(emoji);
|
|
17574
|
-
|
|
17575
17424
|
if (unified) {
|
|
17576
17425
|
return unifiedWithoutSkinTone(unified);
|
|
17577
17426
|
}
|
|
17578
|
-
|
|
17579
17427
|
return null;
|
|
17580
17428
|
}
|
|
17581
|
-
|
|
17582
17429
|
function elementDataSetKey(element, key) {
|
|
17583
17430
|
var _elementDataSet$key;
|
|
17584
|
-
|
|
17585
17431
|
return (_elementDataSet$key = elementDataSet(element)[key]) != null ? _elementDataSet$key : null;
|
|
17586
17432
|
}
|
|
17587
|
-
|
|
17588
17433
|
function elementDataSet(element) {
|
|
17589
17434
|
var _element$dataset;
|
|
17590
|
-
|
|
17591
17435
|
return (_element$dataset = element == null ? void 0 : element.dataset) != null ? _element$dataset : {};
|
|
17592
17436
|
}
|
|
17593
|
-
|
|
17594
17437
|
function isVisibleEmoji(element) {
|
|
17595
17438
|
return element.classList.contains(ClassNames.visible);
|
|
17596
17439
|
}
|
|
@@ -17602,110 +17445,86 @@ function allVisibleEmojis(parent) {
|
|
|
17602
17445
|
if (!parent) {
|
|
17603
17446
|
return [];
|
|
17604
17447
|
}
|
|
17605
|
-
|
|
17606
17448
|
return Array.from(parent.querySelectorAll(VisibleEmojiSelector));
|
|
17607
17449
|
}
|
|
17608
17450
|
function lastVisibleEmoji(element) {
|
|
17609
17451
|
if (!element) return null;
|
|
17610
17452
|
var allEmojis = allVisibleEmojis(element);
|
|
17611
|
-
|
|
17612
17453
|
var _allEmojis$slice = allEmojis.slice(-1),
|
|
17613
|
-
|
|
17614
|
-
|
|
17454
|
+
last = _allEmojis$slice[0];
|
|
17615
17455
|
if (!last) {
|
|
17616
17456
|
return null;
|
|
17617
17457
|
}
|
|
17618
|
-
|
|
17619
17458
|
if (!isVisibleEmoji(last)) {
|
|
17620
17459
|
return prevVisibleEmoji(last);
|
|
17621
17460
|
}
|
|
17622
|
-
|
|
17623
17461
|
return last;
|
|
17624
17462
|
}
|
|
17625
17463
|
function nextVisibleEmoji(element) {
|
|
17626
17464
|
var next = element.nextElementSibling;
|
|
17627
|
-
|
|
17628
17465
|
if (!next) {
|
|
17629
17466
|
return firstVisibleEmoji(nextCategory(element));
|
|
17630
17467
|
}
|
|
17631
|
-
|
|
17632
17468
|
if (!isVisibleEmoji(next)) {
|
|
17633
17469
|
return nextVisibleEmoji(next);
|
|
17634
17470
|
}
|
|
17635
|
-
|
|
17636
17471
|
return next;
|
|
17637
17472
|
}
|
|
17638
17473
|
function prevVisibleEmoji(element) {
|
|
17639
17474
|
var prev = element.previousElementSibling;
|
|
17640
|
-
|
|
17641
17475
|
if (!prev) {
|
|
17642
17476
|
return lastVisibleEmoji(prevCategory(element));
|
|
17643
17477
|
}
|
|
17644
|
-
|
|
17645
17478
|
if (!isVisibleEmoji(prev)) {
|
|
17646
17479
|
return prevVisibleEmoji(prev);
|
|
17647
17480
|
}
|
|
17648
|
-
|
|
17649
17481
|
return prev;
|
|
17650
17482
|
}
|
|
17651
17483
|
function firstVisibleEmoji(parent) {
|
|
17652
17484
|
if (!parent) {
|
|
17653
17485
|
return null;
|
|
17654
17486
|
}
|
|
17655
|
-
|
|
17656
17487
|
var allEmojis = allVisibleEmojis(parent);
|
|
17657
17488
|
return firstVisibleElementInContainer(parent, allEmojis);
|
|
17658
17489
|
}
|
|
17659
17490
|
function prevCategory(element) {
|
|
17660
17491
|
var category = closestCategory(element);
|
|
17661
|
-
|
|
17662
17492
|
if (!category) {
|
|
17663
17493
|
return null;
|
|
17664
17494
|
}
|
|
17665
|
-
|
|
17666
17495
|
var prev = category.previousElementSibling;
|
|
17667
|
-
|
|
17668
17496
|
if (!prev) {
|
|
17669
17497
|
return null;
|
|
17670
17498
|
}
|
|
17671
|
-
|
|
17672
17499
|
if (isHidden(prev)) {
|
|
17673
17500
|
return prevCategory(prev);
|
|
17674
17501
|
}
|
|
17675
|
-
|
|
17676
17502
|
return prev;
|
|
17677
17503
|
}
|
|
17678
17504
|
function nextCategory(element) {
|
|
17679
17505
|
var category = closestCategory(element);
|
|
17680
|
-
|
|
17681
17506
|
if (!category) {
|
|
17682
17507
|
return null;
|
|
17683
17508
|
}
|
|
17684
|
-
|
|
17685
17509
|
var next = category.nextElementSibling;
|
|
17686
|
-
|
|
17687
17510
|
if (!next) {
|
|
17688
17511
|
return null;
|
|
17689
17512
|
}
|
|
17690
|
-
|
|
17691
17513
|
if (isHidden(next)) {
|
|
17692
17514
|
return nextCategory(next);
|
|
17693
17515
|
}
|
|
17694
|
-
|
|
17695
17516
|
return next;
|
|
17696
17517
|
}
|
|
17697
17518
|
function closestCategory(element) {
|
|
17698
17519
|
if (!element) {
|
|
17699
17520
|
return null;
|
|
17700
17521
|
}
|
|
17701
|
-
|
|
17702
17522
|
return element.closest(asSelectors(ClassNames.category));
|
|
17703
17523
|
}
|
|
17704
17524
|
function closestCategoryContent(element) {
|
|
17705
17525
|
if (!element) {
|
|
17706
17526
|
return null;
|
|
17707
17527
|
}
|
|
17708
|
-
|
|
17709
17528
|
return element.closest(asSelectors(ClassNames.categoryContent));
|
|
17710
17529
|
}
|
|
17711
17530
|
|
|
@@ -17719,19 +17538,15 @@ var SUGGESTED_LS_KEY = 'epr_suggested';
|
|
|
17719
17538
|
function getSuggested(mode) {
|
|
17720
17539
|
try {
|
|
17721
17540
|
var _window, _window$localStorage$, _window2;
|
|
17722
|
-
|
|
17723
17541
|
if (!((_window = window) != null && _window.localStorage)) {
|
|
17724
17542
|
return [];
|
|
17725
17543
|
}
|
|
17726
|
-
|
|
17727
17544
|
var recent = JSON.parse((_window$localStorage$ = (_window2 = window) == null ? void 0 : _window2.localStorage.getItem(SUGGESTED_LS_KEY)) != null ? _window$localStorage$ : '[]');
|
|
17728
|
-
|
|
17729
17545
|
if (mode === exports.SuggestionMode.FREQUENT) {
|
|
17730
17546
|
return recent.sort(function (a, b) {
|
|
17731
17547
|
return b.count - a.count;
|
|
17732
17548
|
});
|
|
17733
17549
|
}
|
|
17734
|
-
|
|
17735
17550
|
return recent;
|
|
17736
17551
|
} catch (_unused) {
|
|
17737
17552
|
return [];
|
|
@@ -17746,7 +17561,6 @@ function setSuggested(emoji, skinTone) {
|
|
|
17746
17561
|
return u === unified;
|
|
17747
17562
|
});
|
|
17748
17563
|
var nextList;
|
|
17749
|
-
|
|
17750
17564
|
if (existing) {
|
|
17751
17565
|
nextList = [existing].concat(recent.filter(function (i) {
|
|
17752
17566
|
return i !== existing;
|
|
@@ -17759,15 +17573,14 @@ function setSuggested(emoji, skinTone) {
|
|
|
17759
17573
|
};
|
|
17760
17574
|
nextList = [existing].concat(recent);
|
|
17761
17575
|
}
|
|
17762
|
-
|
|
17763
17576
|
existing.count++;
|
|
17764
17577
|
nextList.length = Math.min(nextList.length, 14);
|
|
17765
|
-
|
|
17766
17578
|
try {
|
|
17767
17579
|
var _window3;
|
|
17768
|
-
|
|
17769
|
-
|
|
17770
|
-
} catch (_unused2) {
|
|
17580
|
+
(_window3 = window) == null ? void 0 : _window3.localStorage.setItem(SUGGESTED_LS_KEY, JSON.stringify(nextList));
|
|
17581
|
+
// Prevents the change from being seen immediately.
|
|
17582
|
+
} catch (_unused2) {
|
|
17583
|
+
// ignore
|
|
17771
17584
|
}
|
|
17772
17585
|
}
|
|
17773
17586
|
|
|
@@ -17780,18 +17593,15 @@ function isCustomEmoji(emoji) {
|
|
|
17780
17593
|
|
|
17781
17594
|
function useCloseAllOpenToggles() {
|
|
17782
17595
|
var _useEmojiVariationPic = useEmojiVariationPickerState(),
|
|
17783
|
-
|
|
17784
|
-
|
|
17785
|
-
|
|
17596
|
+
variationPicker = _useEmojiVariationPic[0],
|
|
17597
|
+
setVariationPicker = _useEmojiVariationPic[1];
|
|
17786
17598
|
var _useSkinToneFanOpenSt = useSkinToneFanOpenState(),
|
|
17787
|
-
|
|
17788
|
-
|
|
17789
|
-
|
|
17599
|
+
skinToneFanOpen = _useSkinToneFanOpenSt[0],
|
|
17600
|
+
setSkinToneFanOpen = _useSkinToneFanOpenSt[1];
|
|
17790
17601
|
var closeAllOpenToggles = React.useCallback(function () {
|
|
17791
17602
|
if (variationPicker) {
|
|
17792
17603
|
setVariationPicker(null);
|
|
17793
17604
|
}
|
|
17794
|
-
|
|
17795
17605
|
if (skinToneFanOpen) {
|
|
17796
17606
|
setSkinToneFanOpen(false);
|
|
17797
17607
|
}
|
|
@@ -17800,11 +17610,9 @@ function useCloseAllOpenToggles() {
|
|
|
17800
17610
|
}
|
|
17801
17611
|
function useHasOpenToggles() {
|
|
17802
17612
|
var _useEmojiVariationPic2 = useEmojiVariationPickerState(),
|
|
17803
|
-
|
|
17804
|
-
|
|
17613
|
+
variationPicker = _useEmojiVariationPic2[0];
|
|
17805
17614
|
var _useSkinToneFanOpenSt2 = useSkinToneFanOpenState(),
|
|
17806
|
-
|
|
17807
|
-
|
|
17615
|
+
skinToneFanOpen = _useSkinToneFanOpenSt2[0];
|
|
17808
17616
|
return function hasOpenToggles() {
|
|
17809
17617
|
return !!variationPicker || skinToneFanOpen;
|
|
17810
17618
|
};
|
|
@@ -17812,14 +17620,11 @@ function useHasOpenToggles() {
|
|
|
17812
17620
|
|
|
17813
17621
|
function useSetVariationPicker() {
|
|
17814
17622
|
var setAnchoredEmojiRef = useSetAnchoredEmojiRef();
|
|
17815
|
-
|
|
17816
17623
|
var _useEmojiVariationPic = useEmojiVariationPickerState(),
|
|
17817
|
-
|
|
17818
|
-
|
|
17624
|
+
setEmojiVariationPicker = _useEmojiVariationPic[1];
|
|
17819
17625
|
return function setVariationPicker(element) {
|
|
17820
17626
|
var _emojiFromElement = emojiFromElement(element),
|
|
17821
|
-
|
|
17822
|
-
|
|
17627
|
+
emoji = _emojiFromElement[0];
|
|
17823
17628
|
if (emoji) {
|
|
17824
17629
|
setAnchoredEmojiRef(element);
|
|
17825
17630
|
setEmojiVariationPicker(emoji);
|
|
@@ -17831,37 +17636,27 @@ function useMouseDownHandlers(BodyRef) {
|
|
|
17831
17636
|
var mouseDownTimerRef = React.useRef();
|
|
17832
17637
|
var setVariationPicker = useSetVariationPicker();
|
|
17833
17638
|
var disallowClickRef = useDisallowClickRef();
|
|
17834
|
-
|
|
17835
17639
|
var _useEmojiVariationPic = useEmojiVariationPickerState(),
|
|
17836
|
-
|
|
17837
|
-
|
|
17640
|
+
setEmojiVariationPicker = _useEmojiVariationPic[1];
|
|
17838
17641
|
var closeAllOpenToggles = useCloseAllOpenToggles();
|
|
17839
|
-
|
|
17840
17642
|
var _useActiveSkinToneSta = useActiveSkinToneState(),
|
|
17841
|
-
|
|
17842
|
-
|
|
17643
|
+
activeSkinTone = _useActiveSkinToneSta[0];
|
|
17843
17644
|
var onEmojiClick = useOnEmojiClickConfig();
|
|
17844
|
-
|
|
17845
17645
|
var _useUpdateSuggested = useUpdateSuggested(),
|
|
17846
|
-
|
|
17847
|
-
|
|
17646
|
+
updateSuggested = _useUpdateSuggested[1];
|
|
17848
17647
|
var getEmojiUrl = useGetEmojiUrlConfig();
|
|
17849
17648
|
var activeEmojiStyle = useEmojiStyleConfig();
|
|
17850
17649
|
var onClick = React.useCallback(function onClick(event) {
|
|
17851
17650
|
if (disallowClickRef.current) {
|
|
17852
17651
|
return;
|
|
17853
17652
|
}
|
|
17854
|
-
|
|
17855
17653
|
closeAllOpenToggles();
|
|
17856
|
-
|
|
17857
17654
|
var _emojiFromEvent = emojiFromEvent(event),
|
|
17858
|
-
|
|
17859
|
-
|
|
17860
|
-
|
|
17655
|
+
emoji = _emojiFromEvent[0],
|
|
17656
|
+
unified = _emojiFromEvent[1];
|
|
17861
17657
|
if (!emoji || !unified) {
|
|
17862
17658
|
return;
|
|
17863
17659
|
}
|
|
17864
|
-
|
|
17865
17660
|
var skinToneToUse = activeVariationFromUnified(unified) || activeSkinTone;
|
|
17866
17661
|
updateSuggested();
|
|
17867
17662
|
setSuggested(emoji, skinToneToUse);
|
|
@@ -17869,18 +17664,14 @@ function useMouseDownHandlers(BodyRef) {
|
|
|
17869
17664
|
}, [activeSkinTone, closeAllOpenToggles, disallowClickRef, onEmojiClick, updateSuggested, getEmojiUrl, activeEmojiStyle]);
|
|
17870
17665
|
var onMouseDown = React.useCallback(function onMouseDown(event) {
|
|
17871
17666
|
var _window;
|
|
17872
|
-
|
|
17873
17667
|
if (mouseDownTimerRef.current) {
|
|
17874
17668
|
clearTimeout(mouseDownTimerRef.current);
|
|
17875
17669
|
}
|
|
17876
|
-
|
|
17877
17670
|
var _emojiFromEvent2 = emojiFromEvent(event),
|
|
17878
|
-
|
|
17879
|
-
|
|
17671
|
+
emoji = _emojiFromEvent2[0];
|
|
17880
17672
|
if (!emoji || !emojiHasVariations(emoji)) {
|
|
17881
17673
|
return;
|
|
17882
17674
|
}
|
|
17883
|
-
|
|
17884
17675
|
mouseDownTimerRef.current = (_window = window) == null ? void 0 : _window.setTimeout(function () {
|
|
17885
17676
|
disallowClickRef.current = true;
|
|
17886
17677
|
mouseDownTimerRef.current = undefined;
|
|
@@ -17908,7 +17699,6 @@ function useMouseDownHandlers(BodyRef) {
|
|
|
17908
17699
|
if (!BodyRef.current) {
|
|
17909
17700
|
return;
|
|
17910
17701
|
}
|
|
17911
|
-
|
|
17912
17702
|
var bodyRef = BodyRef.current;
|
|
17913
17703
|
bodyRef.addEventListener('click', onClick, {
|
|
17914
17704
|
passive: true
|
|
@@ -17926,23 +17716,17 @@ function useMouseDownHandlers(BodyRef) {
|
|
|
17926
17716
|
};
|
|
17927
17717
|
}, [BodyRef, onClick, onMouseDown, onMouseUp]);
|
|
17928
17718
|
}
|
|
17929
|
-
|
|
17930
17719
|
function emojiFromEvent(event) {
|
|
17931
17720
|
var target = event == null ? void 0 : event.target;
|
|
17932
|
-
|
|
17933
17721
|
if (!isEmojiElement(target)) {
|
|
17934
17722
|
return [];
|
|
17935
17723
|
}
|
|
17936
|
-
|
|
17937
17724
|
return emojiFromElement(target);
|
|
17938
17725
|
}
|
|
17939
|
-
|
|
17940
17726
|
function emojiClickOutput(emoji, activeSkinTone, activeEmojiStyle, getEmojiUrl) {
|
|
17941
17727
|
var names = emojiNames(emoji);
|
|
17942
|
-
|
|
17943
17728
|
if (isCustomEmoji(emoji)) {
|
|
17944
17729
|
var _unified = emojiUnified(emoji);
|
|
17945
|
-
|
|
17946
17730
|
return {
|
|
17947
17731
|
activeSkinTone: activeSkinTone,
|
|
17948
17732
|
emoji: _unified,
|
|
@@ -17956,7 +17740,6 @@ function emojiClickOutput(emoji, activeSkinTone, activeEmojiStyle, getEmojiUrl)
|
|
|
17956
17740
|
unifiedWithoutSkinTone: _unified
|
|
17957
17741
|
};
|
|
17958
17742
|
}
|
|
17959
|
-
|
|
17960
17743
|
var unified = emojiUnified(emoji, activeSkinTone);
|
|
17961
17744
|
return {
|
|
17962
17745
|
activeSkinTone: activeSkinTone,
|
|
@@ -17965,7 +17748,6 @@ function emojiClickOutput(emoji, activeSkinTone, activeEmojiStyle, getEmojiUrl)
|
|
|
17965
17748
|
if (emojiStyle === void 0) {
|
|
17966
17749
|
emojiStyle = activeEmojiStyle != null ? activeEmojiStyle : exports.EmojiStyle.APPLE;
|
|
17967
17750
|
}
|
|
17968
|
-
|
|
17969
17751
|
return getEmojiUrl(unified, emojiStyle);
|
|
17970
17752
|
},
|
|
17971
17753
|
imageUrl: getEmojiUrl(unified, activeEmojiStyle != null ? activeEmojiStyle : exports.EmojiStyle.APPLE),
|
|
@@ -17980,19 +17762,15 @@ function useOnScroll(BodyRef) {
|
|
|
17980
17762
|
var closeAllOpenToggles = useCloseAllOpenToggles();
|
|
17981
17763
|
React.useEffect(function () {
|
|
17982
17764
|
var bodyRef = BodyRef.current;
|
|
17983
|
-
|
|
17984
17765
|
if (!bodyRef) {
|
|
17985
17766
|
return;
|
|
17986
17767
|
}
|
|
17987
|
-
|
|
17988
17768
|
bodyRef.addEventListener('scroll', onScroll, {
|
|
17989
17769
|
passive: true
|
|
17990
17770
|
});
|
|
17991
|
-
|
|
17992
17771
|
function onScroll() {
|
|
17993
17772
|
closeAllOpenToggles();
|
|
17994
17773
|
}
|
|
17995
|
-
|
|
17996
17774
|
return function () {
|
|
17997
17775
|
bodyRef == null ? void 0 : bodyRef.removeEventListener('scroll', onScroll);
|
|
17998
17776
|
};
|
|
@@ -18003,24 +17781,19 @@ function scrollTo(root, top) {
|
|
|
18003
17781
|
if (top === void 0) {
|
|
18004
17782
|
top = 0;
|
|
18005
17783
|
}
|
|
18006
|
-
|
|
18007
17784
|
var $eprBody = queryScrollBody(root);
|
|
18008
|
-
|
|
18009
17785
|
if (!$eprBody) {
|
|
18010
17786
|
return;
|
|
18011
17787
|
}
|
|
18012
|
-
|
|
18013
17788
|
requestAnimationFrame(function () {
|
|
18014
17789
|
$eprBody.scrollTop = top + 1;
|
|
18015
17790
|
});
|
|
18016
17791
|
}
|
|
18017
17792
|
function scrollBy(root, by) {
|
|
18018
17793
|
var $eprBody = queryScrollBody(root);
|
|
18019
|
-
|
|
18020
17794
|
if (!$eprBody) {
|
|
18021
17795
|
return;
|
|
18022
17796
|
}
|
|
18023
|
-
|
|
18024
17797
|
requestAnimationFrame(function () {
|
|
18025
17798
|
$eprBody.scrollTop = $eprBody.scrollTop + by;
|
|
18026
17799
|
});
|
|
@@ -18039,11 +17812,9 @@ function scrollEmojiAboveLabel(emoji) {
|
|
|
18039
17812
|
if (!emoji || !isEmojiBehindLabel(emoji)) {
|
|
18040
17813
|
return;
|
|
18041
17814
|
}
|
|
18042
|
-
|
|
18043
17815
|
if (emoji.closest(asSelectors(ClassNames.variationPicker))) {
|
|
18044
17816
|
return;
|
|
18045
17817
|
}
|
|
18046
|
-
|
|
18047
17818
|
var scrollBody = closestScrollBody(emoji);
|
|
18048
17819
|
var by = emojiDistanceFromScrollTop(emoji);
|
|
18049
17820
|
scrollBy(scrollBody, -(categoryLabelHeight(closestCategory(emoji)) - by));
|
|
@@ -18061,7 +17832,6 @@ function useFocusSkinTonePicker() {
|
|
|
18061
17832
|
if (!SkinTonePickerRef.current) {
|
|
18062
17833
|
return;
|
|
18063
17834
|
}
|
|
18064
|
-
|
|
18065
17835
|
focusFirstElementChild(SkinTonePickerRef.current);
|
|
18066
17836
|
}, [SkinTonePickerRef]);
|
|
18067
17837
|
}
|
|
@@ -18071,7 +17841,6 @@ function useFocusCategoryNavigation() {
|
|
|
18071
17841
|
if (!CategoryNavigationRef.current) {
|
|
18072
17842
|
return;
|
|
18073
17843
|
}
|
|
18074
|
-
|
|
18075
17844
|
focusFirstElementChild(CategoryNavigationRef.current);
|
|
18076
17845
|
}, [CategoryNavigationRef]);
|
|
18077
17846
|
}
|
|
@@ -18082,11 +17851,9 @@ function useSetFilterRef() {
|
|
|
18082
17851
|
if (typeof setter === 'function') {
|
|
18083
17852
|
return setFilter(setter(filterRef.current));
|
|
18084
17853
|
}
|
|
18085
|
-
|
|
18086
17854
|
filterRef.current = setter;
|
|
18087
17855
|
};
|
|
18088
17856
|
}
|
|
18089
|
-
|
|
18090
17857
|
function useClearSearch() {
|
|
18091
17858
|
var applySearch = useApplySearch();
|
|
18092
17859
|
var SearchInputRef = useSearchInputRef();
|
|
@@ -18095,7 +17862,6 @@ function useClearSearch() {
|
|
|
18095
17862
|
if (SearchInputRef.current) {
|
|
18096
17863
|
SearchInputRef.current.value = '';
|
|
18097
17864
|
}
|
|
18098
|
-
|
|
18099
17865
|
applySearch('');
|
|
18100
17866
|
focusSearchInput();
|
|
18101
17867
|
};
|
|
@@ -18117,10 +17883,8 @@ function useFilter() {
|
|
|
18117
17883
|
var filterRef = useFilterRef();
|
|
18118
17884
|
var setFilterRef = useSetFilterRef();
|
|
18119
17885
|
var applySearch = useApplySearch();
|
|
18120
|
-
|
|
18121
17886
|
var _useSearchTermState = useSearchTermState(),
|
|
18122
|
-
|
|
18123
|
-
|
|
17887
|
+
searchTerm = _useSearchTermState[0];
|
|
18124
17888
|
var statusSearchResults = getStatusSearchResults(filterRef.current, searchTerm);
|
|
18125
17889
|
return {
|
|
18126
17890
|
onChange: onChange,
|
|
@@ -18128,36 +17892,28 @@ function useFilter() {
|
|
|
18128
17892
|
SearchInputRef: SearchInputRef,
|
|
18129
17893
|
statusSearchResults: statusSearchResults
|
|
18130
17894
|
};
|
|
18131
|
-
|
|
18132
17895
|
function onChange(inputValue) {
|
|
18133
17896
|
var filter = filterRef.current;
|
|
18134
17897
|
var nextValue = inputValue.toLowerCase();
|
|
18135
|
-
|
|
18136
17898
|
if (filter != null && filter[nextValue] || nextValue.length <= 1) {
|
|
18137
17899
|
return applySearch(nextValue);
|
|
18138
17900
|
}
|
|
18139
|
-
|
|
18140
17901
|
var longestMatch = findLongestMatch(nextValue, filter);
|
|
18141
|
-
|
|
18142
17902
|
if (!longestMatch) {
|
|
18143
17903
|
// Can we even get here?
|
|
18144
17904
|
// If so, we need to search among all emojis
|
|
18145
17905
|
return applySearch(nextValue);
|
|
18146
17906
|
}
|
|
18147
|
-
|
|
18148
17907
|
setFilterRef(function (current) {
|
|
18149
17908
|
var _Object$assign;
|
|
18150
|
-
|
|
18151
17909
|
return Object.assign(current, (_Object$assign = {}, _Object$assign[nextValue] = filterEmojiObjectByKeyword(longestMatch, nextValue), _Object$assign));
|
|
18152
17910
|
});
|
|
18153
17911
|
applySearch(nextValue);
|
|
18154
17912
|
}
|
|
18155
17913
|
}
|
|
18156
|
-
|
|
18157
17914
|
function useApplySearch() {
|
|
18158
17915
|
var _useSearchTermState2 = useSearchTermState(),
|
|
18159
|
-
|
|
18160
|
-
|
|
17916
|
+
setSearchTerm = _useSearchTermState2[1];
|
|
18161
17917
|
var PickerMainRef = usePickerMainRef();
|
|
18162
17918
|
return function applySearch(searchTerm) {
|
|
18163
17919
|
requestAnimationFrame(function () {
|
|
@@ -18167,92 +17923,71 @@ function useApplySearch() {
|
|
|
18167
17923
|
});
|
|
18168
17924
|
};
|
|
18169
17925
|
}
|
|
18170
|
-
|
|
18171
17926
|
function filterEmojiObjectByKeyword(emojis, keyword) {
|
|
18172
17927
|
var filtered = {};
|
|
18173
|
-
|
|
18174
17928
|
for (var unified in emojis) {
|
|
18175
17929
|
var emoji = emojis[unified];
|
|
18176
|
-
|
|
18177
17930
|
if (hasMatch(emoji, keyword)) {
|
|
18178
17931
|
filtered[unified] = emoji;
|
|
18179
17932
|
}
|
|
18180
17933
|
}
|
|
18181
|
-
|
|
18182
17934
|
return filtered;
|
|
18183
17935
|
}
|
|
18184
|
-
|
|
18185
17936
|
function hasMatch(emoji, keyword) {
|
|
18186
17937
|
return emojiNames(emoji).some(function (name) {
|
|
18187
17938
|
return name.includes(keyword);
|
|
18188
17939
|
});
|
|
18189
17940
|
}
|
|
18190
|
-
|
|
18191
17941
|
function useIsEmojiFiltered() {
|
|
18192
17942
|
var _useFilterRef = useFilterRef(),
|
|
18193
|
-
|
|
18194
|
-
|
|
17943
|
+
filter = _useFilterRef.current;
|
|
18195
17944
|
var _useSearchTermState3 = useSearchTermState(),
|
|
18196
|
-
|
|
18197
|
-
|
|
17945
|
+
searchTerm = _useSearchTermState3[0];
|
|
18198
17946
|
return function (unified) {
|
|
18199
17947
|
return isEmojiFilteredBySearchTerm(unified, filter, searchTerm);
|
|
18200
17948
|
};
|
|
18201
17949
|
}
|
|
18202
|
-
|
|
18203
17950
|
function isEmojiFilteredBySearchTerm(unified, filter, searchTerm) {
|
|
18204
17951
|
var _filter$searchTerm;
|
|
18205
|
-
|
|
18206
17952
|
if (!filter || !searchTerm) {
|
|
18207
17953
|
return false;
|
|
18208
17954
|
}
|
|
18209
|
-
|
|
18210
17955
|
return !((_filter$searchTerm = filter[searchTerm]) != null && _filter$searchTerm[unified]);
|
|
18211
17956
|
}
|
|
18212
|
-
|
|
18213
17957
|
function findLongestMatch(keyword, dict) {
|
|
18214
17958
|
if (!dict) {
|
|
18215
17959
|
return null;
|
|
18216
17960
|
}
|
|
18217
|
-
|
|
18218
17961
|
if (dict[keyword]) {
|
|
18219
17962
|
return dict[keyword];
|
|
18220
17963
|
}
|
|
18221
|
-
|
|
18222
17964
|
var longestMatchingKey = Object.keys(dict).sort(function (a, b) {
|
|
18223
17965
|
return b.length - a.length;
|
|
18224
17966
|
}).find(function (key) {
|
|
18225
17967
|
return keyword.includes(key);
|
|
18226
17968
|
});
|
|
18227
|
-
|
|
18228
17969
|
if (longestMatchingKey) {
|
|
18229
17970
|
return dict[longestMatchingKey];
|
|
18230
17971
|
}
|
|
18231
|
-
|
|
18232
17972
|
return null;
|
|
18233
17973
|
}
|
|
18234
|
-
|
|
18235
17974
|
function getNormalizedSearchTerm(str) {
|
|
18236
17975
|
if (!str || typeof str !== 'string') {
|
|
18237
17976
|
return '';
|
|
18238
17977
|
}
|
|
18239
|
-
|
|
18240
17978
|
return str.trim().toLowerCase();
|
|
18241
17979
|
}
|
|
18242
|
-
|
|
18243
17980
|
function getStatusSearchResults(filterState, searchTerm) {
|
|
18244
17981
|
var _Object$entries;
|
|
18245
|
-
|
|
18246
17982
|
if (!(filterState != null && filterState[searchTerm])) return '';
|
|
18247
|
-
var searchResultsCount = ((_Object$entries = Object.entries(filterState == null ? void 0 : filterState[searchTerm])) == null ? void 0 : _Object$entries.length) || 0;
|
|
18248
|
-
|
|
17983
|
+
var searchResultsCount = ((_Object$entries = Object.entries(filterState == null ? void 0 : filterState[searchTerm])) == null ? void 0 : _Object$entries.length) || 0;
|
|
17984
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
18249
17985
|
return useSearchResultsConfig(searchResultsCount);
|
|
18250
17986
|
}
|
|
18251
17987
|
|
|
18252
17988
|
function useIsEmojiHidden() {
|
|
18253
17989
|
var _useEmojisThatFailedT = useEmojisThatFailedToLoadState(),
|
|
18254
|
-
|
|
18255
|
-
|
|
17990
|
+
emojisThatFailedToLoad = _useEmojisThatFailedT[0];
|
|
18256
17991
|
var isEmojiFiltered = useIsEmojiFiltered();
|
|
18257
17992
|
return function (emoji) {
|
|
18258
17993
|
var unified = emojiUnified(emoji);
|
|
@@ -18270,21 +18005,29 @@ function Button(props) {
|
|
|
18270
18005
|
return React.createElement("button", Object.assign({
|
|
18271
18006
|
type: "button"
|
|
18272
18007
|
}, props, {
|
|
18273
|
-
className: flairup.cx(
|
|
18008
|
+
className: flairup.cx(styles.button, props.className)
|
|
18274
18009
|
}), props.children);
|
|
18275
18010
|
}
|
|
18011
|
+
var styles = /*#__PURE__*/stylesheet.create({
|
|
18012
|
+
button: {
|
|
18013
|
+
'.': 'epr-btn',
|
|
18014
|
+
cursor: 'pointer',
|
|
18015
|
+
border: '0',
|
|
18016
|
+
background: 'none',
|
|
18017
|
+
outline: 'none'
|
|
18018
|
+
}
|
|
18019
|
+
});
|
|
18276
18020
|
|
|
18277
18021
|
function ClickableEmojiButton(_ref) {
|
|
18278
18022
|
var _cx;
|
|
18279
|
-
|
|
18280
18023
|
var emojiNames = _ref.emojiNames,
|
|
18281
|
-
|
|
18282
|
-
|
|
18283
|
-
|
|
18284
|
-
|
|
18285
|
-
|
|
18286
|
-
|
|
18287
|
-
|
|
18024
|
+
unified = _ref.unified,
|
|
18025
|
+
hidden = _ref.hidden,
|
|
18026
|
+
hiddenOnSearch = _ref.hiddenOnSearch,
|
|
18027
|
+
_ref$showVariations = _ref.showVariations,
|
|
18028
|
+
showVariations = _ref$showVariations === void 0 ? true : _ref$showVariations,
|
|
18029
|
+
hasVariations = _ref.hasVariations,
|
|
18030
|
+
children = _ref.children;
|
|
18288
18031
|
return React.createElement(Button, {
|
|
18289
18032
|
className: flairup.cx(ClassNames.emoji, hidden && commonStyles.hidden, hiddenOnSearch && commonStyles.hiddenOnSearch, (_cx = {}, _cx[ClassNames.visible] = !hidden && !hiddenOnSearch, _cx[ClassNames.emojiHasVariations] = hasVariations && showVariations, _cx)),
|
|
18290
18033
|
"data-unified": unified,
|
|
@@ -18295,11 +18038,11 @@ function ClickableEmojiButton(_ref) {
|
|
|
18295
18038
|
|
|
18296
18039
|
function EmojiImg(_ref) {
|
|
18297
18040
|
var emojiName = _ref.emojiName,
|
|
18298
|
-
|
|
18299
|
-
|
|
18300
|
-
|
|
18301
|
-
|
|
18302
|
-
|
|
18041
|
+
style = _ref.style,
|
|
18042
|
+
_ref$lazyLoad = _ref.lazyLoad,
|
|
18043
|
+
lazyLoad = _ref$lazyLoad === void 0 ? false : _ref$lazyLoad,
|
|
18044
|
+
imgUrl = _ref.imgUrl,
|
|
18045
|
+
onError = _ref.onError;
|
|
18303
18046
|
return React.createElement("img", {
|
|
18304
18047
|
src: imgUrl,
|
|
18305
18048
|
alt: emojiName,
|
|
@@ -18312,7 +18055,7 @@ function EmojiImg(_ref) {
|
|
|
18312
18055
|
|
|
18313
18056
|
function NativeEmoji(_ref) {
|
|
18314
18057
|
var unified = _ref.unified,
|
|
18315
|
-
|
|
18058
|
+
style = _ref.style;
|
|
18316
18059
|
return React.createElement("span", {
|
|
18317
18060
|
className: flairup.cx(ClassNames.external, 'epr-emoji-native'),
|
|
18318
18061
|
"data-unified": unified,
|
|
@@ -18322,28 +18065,22 @@ function NativeEmoji(_ref) {
|
|
|
18322
18065
|
|
|
18323
18066
|
function ViewOnlyEmoji(_ref) {
|
|
18324
18067
|
var emoji = _ref.emoji,
|
|
18325
|
-
|
|
18326
|
-
|
|
18327
|
-
|
|
18328
|
-
|
|
18329
|
-
|
|
18330
|
-
|
|
18331
|
-
|
|
18068
|
+
unified = _ref.unified,
|
|
18069
|
+
emojiStyle = _ref.emojiStyle,
|
|
18070
|
+
size = _ref.size,
|
|
18071
|
+
lazyLoad = _ref.lazyLoad,
|
|
18072
|
+
_ref$getEmojiUrl = _ref.getEmojiUrl,
|
|
18073
|
+
getEmojiUrl = _ref$getEmojiUrl === void 0 ? emojiUrlByUnified : _ref$getEmojiUrl;
|
|
18332
18074
|
var _useEmojisThatFailedT = useEmojisThatFailedToLoadState(),
|
|
18333
|
-
|
|
18334
|
-
|
|
18075
|
+
setEmojisThatFailedToLoad = _useEmojisThatFailedT[1];
|
|
18335
18076
|
var style = {};
|
|
18336
|
-
|
|
18337
18077
|
if (size) {
|
|
18338
18078
|
style.width = style.height = style.fontSize = size + "px";
|
|
18339
18079
|
}
|
|
18340
|
-
|
|
18341
18080
|
var emojiToRender = emoji ? emoji : emojiByUnified(unified);
|
|
18342
|
-
|
|
18343
18081
|
if (!emojiToRender) {
|
|
18344
18082
|
return null;
|
|
18345
18083
|
}
|
|
18346
|
-
|
|
18347
18084
|
if (isCustomEmoji(emojiToRender)) {
|
|
18348
18085
|
return React.createElement(EmojiImg, {
|
|
18349
18086
|
style: style,
|
|
@@ -18354,7 +18091,6 @@ function ViewOnlyEmoji(_ref) {
|
|
|
18354
18091
|
onError: onError
|
|
18355
18092
|
});
|
|
18356
18093
|
}
|
|
18357
|
-
|
|
18358
18094
|
return React.createElement(React.Fragment, null, emojiStyle === exports.EmojiStyle.NATIVE ? React.createElement(NativeEmoji, {
|
|
18359
18095
|
unified: unified,
|
|
18360
18096
|
style: style
|
|
@@ -18366,7 +18102,6 @@ function ViewOnlyEmoji(_ref) {
|
|
|
18366
18102
|
imgUrl: getEmojiUrl(unified, emojiStyle),
|
|
18367
18103
|
onError: onError
|
|
18368
18104
|
}));
|
|
18369
|
-
|
|
18370
18105
|
function onError() {
|
|
18371
18106
|
setEmojisThatFailedToLoad(function (prev) {
|
|
18372
18107
|
return new Set(prev).add(unified);
|
|
@@ -18376,15 +18111,15 @@ function ViewOnlyEmoji(_ref) {
|
|
|
18376
18111
|
|
|
18377
18112
|
function ClickableEmoji(_ref) {
|
|
18378
18113
|
var emoji = _ref.emoji,
|
|
18379
|
-
|
|
18380
|
-
|
|
18381
|
-
|
|
18382
|
-
|
|
18383
|
-
|
|
18384
|
-
|
|
18385
|
-
|
|
18386
|
-
|
|
18387
|
-
|
|
18114
|
+
unified = _ref.unified,
|
|
18115
|
+
hidden = _ref.hidden,
|
|
18116
|
+
hiddenOnSearch = _ref.hiddenOnSearch,
|
|
18117
|
+
emojiStyle = _ref.emojiStyle,
|
|
18118
|
+
_ref$showVariations = _ref.showVariations,
|
|
18119
|
+
showVariations = _ref$showVariations === void 0 ? true : _ref$showVariations,
|
|
18120
|
+
size = _ref.size,
|
|
18121
|
+
lazyLoad = _ref.lazyLoad,
|
|
18122
|
+
getEmojiUrl = _ref.getEmojiUrl;
|
|
18388
18123
|
var hasVariations = emojiHasVariations(emoji);
|
|
18389
18124
|
return React.createElement(ClickableEmojiButton, {
|
|
18390
18125
|
hasVariations: hasVariations,
|
|
@@ -18405,22 +18140,22 @@ function ClickableEmoji(_ref) {
|
|
|
18405
18140
|
|
|
18406
18141
|
function EmojiCategory(_ref) {
|
|
18407
18142
|
var categoryConfig = _ref.categoryConfig,
|
|
18408
|
-
|
|
18409
|
-
|
|
18410
|
-
|
|
18143
|
+
children = _ref.children,
|
|
18144
|
+
hidden = _ref.hidden,
|
|
18145
|
+
hiddenOnSearch = _ref.hiddenOnSearch;
|
|
18411
18146
|
var category = categoryFromCategoryConfig(categoryConfig);
|
|
18412
18147
|
var categoryName = categoryNameFromCategoryConfig(categoryConfig);
|
|
18413
18148
|
return React.createElement("li", {
|
|
18414
|
-
className: flairup.cx(styles.category, hidden && commonStyles.hidden, hiddenOnSearch && commonStyles.hiddenOnSearch),
|
|
18149
|
+
className: flairup.cx(styles$1.category, hidden && commonStyles.hidden, hiddenOnSearch && commonStyles.hiddenOnSearch),
|
|
18415
18150
|
"data-name": category,
|
|
18416
18151
|
"aria-label": categoryName
|
|
18417
18152
|
}, React.createElement("h2", {
|
|
18418
|
-
className: flairup.cx(styles.label)
|
|
18153
|
+
className: flairup.cx(styles$1.label)
|
|
18419
18154
|
}, categoryName), React.createElement("div", {
|
|
18420
|
-
className: flairup.cx(styles.categoryContent)
|
|
18155
|
+
className: flairup.cx(styles$1.categoryContent)
|
|
18421
18156
|
}, children));
|
|
18422
18157
|
}
|
|
18423
|
-
var styles = /*#__PURE__*/stylesheet.create({
|
|
18158
|
+
var styles$1 = /*#__PURE__*/stylesheet.create({
|
|
18424
18159
|
category: {
|
|
18425
18160
|
'.': ClassNames.category,
|
|
18426
18161
|
':not(:has(.epr-visible))': {
|
|
@@ -18459,17 +18194,15 @@ var styles = /*#__PURE__*/stylesheet.create({
|
|
|
18459
18194
|
|
|
18460
18195
|
function Suggested(_ref) {
|
|
18461
18196
|
var categoryConfig = _ref.categoryConfig;
|
|
18462
|
-
|
|
18463
18197
|
var _useUpdateSuggested = useUpdateSuggested(),
|
|
18464
|
-
|
|
18465
|
-
|
|
18198
|
+
suggestedUpdated = _useUpdateSuggested[0];
|
|
18466
18199
|
var suggestedEmojisModeConfig = useSuggestedEmojisModeConfig();
|
|
18467
18200
|
var getEmojiUrl = useGetEmojiUrlConfig();
|
|
18468
18201
|
var suggested = React.useMemo(function () {
|
|
18469
18202
|
var _getSuggested;
|
|
18470
|
-
|
|
18471
18203
|
return (_getSuggested = getSuggested(suggestedEmojisModeConfig)) != null ? _getSuggested : [];
|
|
18472
|
-
},
|
|
18204
|
+
},
|
|
18205
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18473
18206
|
[suggestedUpdated, suggestedEmojisModeConfig]);
|
|
18474
18207
|
var emojiStyle = useEmojiStyleConfig();
|
|
18475
18208
|
return React.createElement(EmojiCategory, {
|
|
@@ -18478,11 +18211,9 @@ function Suggested(_ref) {
|
|
|
18478
18211
|
hidden: suggested.length === 0
|
|
18479
18212
|
}, suggested.map(function (suggestedItem) {
|
|
18480
18213
|
var emoji = emojiByUnified(suggestedItem.original);
|
|
18481
|
-
|
|
18482
18214
|
if (!emoji) {
|
|
18483
18215
|
return null;
|
|
18484
18216
|
}
|
|
18485
|
-
|
|
18486
18217
|
return React.createElement(ClickableEmoji, {
|
|
18487
18218
|
showVariations: false,
|
|
18488
18219
|
unified: suggestedItem.unified,
|
|
@@ -18498,17 +18229,15 @@ function EmojiList() {
|
|
|
18498
18229
|
var categories = useCategoriesConfig();
|
|
18499
18230
|
var renderdCategoriesCountRef = React.useRef(0);
|
|
18500
18231
|
return React.createElement("ul", {
|
|
18501
|
-
className: flairup.cx(styles$
|
|
18232
|
+
className: flairup.cx(styles$2.emojiList)
|
|
18502
18233
|
}, categories.map(function (categoryConfig) {
|
|
18503
18234
|
var category = categoryFromCategoryConfig(categoryConfig);
|
|
18504
|
-
|
|
18505
18235
|
if (category === exports.Categories.SUGGESTED) {
|
|
18506
18236
|
return React.createElement(Suggested, {
|
|
18507
18237
|
key: category,
|
|
18508
18238
|
categoryConfig: categoryConfig
|
|
18509
18239
|
});
|
|
18510
18240
|
}
|
|
18511
|
-
|
|
18512
18241
|
return React.createElement(RenderCategory, {
|
|
18513
18242
|
key: category,
|
|
18514
18243
|
category: category,
|
|
@@ -18517,49 +18246,39 @@ function EmojiList() {
|
|
|
18517
18246
|
});
|
|
18518
18247
|
}));
|
|
18519
18248
|
}
|
|
18520
|
-
|
|
18521
18249
|
function RenderCategory(_ref) {
|
|
18522
18250
|
var category = _ref.category,
|
|
18523
|
-
|
|
18524
|
-
|
|
18251
|
+
categoryConfig = _ref.categoryConfig,
|
|
18252
|
+
renderdCategoriesCountRef = _ref.renderdCategoriesCountRef;
|
|
18525
18253
|
var isEmojiHidden = useIsEmojiHidden();
|
|
18526
18254
|
var lazyLoadEmojis = useLazyLoadEmojisConfig();
|
|
18527
18255
|
var emojiStyle = useEmojiStyleConfig();
|
|
18528
18256
|
var isPastInitialLoad = useIsPastInitialLoad();
|
|
18529
|
-
|
|
18530
18257
|
var _useActiveSkinToneSta = useActiveSkinToneState(),
|
|
18531
|
-
|
|
18532
|
-
|
|
18258
|
+
activeSkinTone = _useActiveSkinToneSta[0];
|
|
18533
18259
|
var isEmojiDisallowed = useIsEmojiDisallowed();
|
|
18534
18260
|
var getEmojiUrl = useGetEmojiUrlConfig();
|
|
18535
|
-
var showVariations = !useSkinTonesDisabledConfig();
|
|
18261
|
+
var showVariations = !useSkinTonesDisabledConfig();
|
|
18262
|
+
// Small trick to defer the rendering of all emoji categories until the first category is visible
|
|
18536
18263
|
// This way the user gets to actually see something and not wait for the whole picker to render.
|
|
18537
|
-
|
|
18538
18264
|
var emojisToPush = !isPastInitialLoad && renderdCategoriesCountRef.current > 0 ? [] : emojisByCategory(category);
|
|
18539
|
-
|
|
18540
18265
|
if (emojisToPush.length > 0) {
|
|
18541
18266
|
renderdCategoriesCountRef.current++;
|
|
18542
18267
|
}
|
|
18543
|
-
|
|
18544
18268
|
var hiddenCounter = 0;
|
|
18545
18269
|
var emojis = emojisToPush.map(function (emoji) {
|
|
18546
18270
|
var unified = emojiUnified(emoji, activeSkinTone);
|
|
18547
|
-
|
|
18548
18271
|
var _isEmojiHidden = isEmojiHidden(emoji),
|
|
18549
|
-
|
|
18550
|
-
|
|
18551
|
-
|
|
18552
|
-
|
|
18272
|
+
failedToLoad = _isEmojiHidden.failedToLoad,
|
|
18273
|
+
filteredOut = _isEmojiHidden.filteredOut,
|
|
18274
|
+
hidden = _isEmojiHidden.hidden;
|
|
18553
18275
|
var isDisallowed = isEmojiDisallowed(emoji);
|
|
18554
|
-
|
|
18555
18276
|
if (hidden || isDisallowed) {
|
|
18556
18277
|
hiddenCounter++;
|
|
18557
18278
|
}
|
|
18558
|
-
|
|
18559
18279
|
if (isDisallowed) {
|
|
18560
18280
|
return null;
|
|
18561
18281
|
}
|
|
18562
|
-
|
|
18563
18282
|
return React.createElement(ClickableEmoji, {
|
|
18564
18283
|
showVariations: showVariations,
|
|
18565
18284
|
key: unified,
|
|
@@ -18579,8 +18298,7 @@ function RenderCategory(_ref) {
|
|
|
18579
18298
|
hidden: hiddenCounter === emojis.length
|
|
18580
18299
|
}, emojis);
|
|
18581
18300
|
}
|
|
18582
|
-
|
|
18583
|
-
var styles$1 = /*#__PURE__*/stylesheet.create({
|
|
18301
|
+
var styles$2 = /*#__PURE__*/stylesheet.create({
|
|
18584
18302
|
emojiList: {
|
|
18585
18303
|
'.': ClassNames.emojiList,
|
|
18586
18304
|
listStyle: 'none',
|
|
@@ -18606,13 +18324,10 @@ function focusNextVisibleEmoji(element) {
|
|
|
18606
18324
|
if (!element) {
|
|
18607
18325
|
return;
|
|
18608
18326
|
}
|
|
18609
|
-
|
|
18610
18327
|
var next = nextVisibleEmoji(element);
|
|
18611
|
-
|
|
18612
18328
|
if (!next) {
|
|
18613
18329
|
return focusFirstVisibleEmoji(nextCategory(element));
|
|
18614
18330
|
}
|
|
18615
|
-
|
|
18616
18331
|
focusElement(next);
|
|
18617
18332
|
scrollEmojiAboveLabel(next);
|
|
18618
18333
|
}
|
|
@@ -18620,13 +18335,10 @@ function focusPrevVisibleEmoji(element) {
|
|
|
18620
18335
|
if (!element) {
|
|
18621
18336
|
return;
|
|
18622
18337
|
}
|
|
18623
|
-
|
|
18624
18338
|
var prev = prevVisibleEmoji(element);
|
|
18625
|
-
|
|
18626
18339
|
if (!prev) {
|
|
18627
18340
|
return focusLastVisibleEmoji(prevCategory(element));
|
|
18628
18341
|
}
|
|
18629
|
-
|
|
18630
18342
|
focusElement(prev);
|
|
18631
18343
|
scrollEmojiAboveLabel(prev);
|
|
18632
18344
|
}
|
|
@@ -18634,13 +18346,10 @@ function focusVisibleEmojiOneRowUp(element, exitUp) {
|
|
|
18634
18346
|
if (!element) {
|
|
18635
18347
|
return;
|
|
18636
18348
|
}
|
|
18637
|
-
|
|
18638
18349
|
var prev = visibleEmojiOneRowUp(element);
|
|
18639
|
-
|
|
18640
18350
|
if (!prev) {
|
|
18641
18351
|
return exitUp();
|
|
18642
18352
|
}
|
|
18643
|
-
|
|
18644
18353
|
focusElement(prev);
|
|
18645
18354
|
scrollEmojiAboveLabel(prev);
|
|
18646
18355
|
}
|
|
@@ -18648,81 +18357,63 @@ function focusVisibleEmojiOneRowDown(element) {
|
|
|
18648
18357
|
if (!element) {
|
|
18649
18358
|
return;
|
|
18650
18359
|
}
|
|
18651
|
-
|
|
18652
18360
|
var next = visibleEmojiOneRowDown(element);
|
|
18653
18361
|
return focusElement(next);
|
|
18654
18362
|
}
|
|
18655
|
-
|
|
18656
18363
|
function visibleEmojiOneRowUp(element) {
|
|
18657
18364
|
if (!element) {
|
|
18658
18365
|
return null;
|
|
18659
18366
|
}
|
|
18660
|
-
|
|
18661
18367
|
var categoryContent = closestCategoryContent(element);
|
|
18662
18368
|
var category = closestCategory(categoryContent);
|
|
18663
18369
|
var indexInRow = elementIndexInRow(categoryContent, element);
|
|
18664
18370
|
var row = rowNumber(categoryContent, element);
|
|
18665
18371
|
var countInRow = elementCountInRow(categoryContent, element);
|
|
18666
|
-
|
|
18667
18372
|
if (row === 0) {
|
|
18668
18373
|
var prevVisibleCategory = prevCategory(category);
|
|
18669
|
-
|
|
18670
18374
|
if (!prevVisibleCategory) {
|
|
18671
18375
|
return null;
|
|
18672
18376
|
}
|
|
18673
|
-
|
|
18674
|
-
|
|
18377
|
+
return getElementInRow(allVisibleEmojis(prevVisibleCategory), -1,
|
|
18378
|
+
// last row
|
|
18675
18379
|
countInRow, indexInRow);
|
|
18676
18380
|
}
|
|
18677
|
-
|
|
18678
18381
|
return getElementInPrevRow(allVisibleEmojis(categoryContent), row, countInRow, indexInRow);
|
|
18679
18382
|
}
|
|
18680
|
-
|
|
18681
18383
|
function visibleEmojiOneRowDown(element) {
|
|
18682
18384
|
if (!element) {
|
|
18683
18385
|
return null;
|
|
18684
18386
|
}
|
|
18685
|
-
|
|
18686
18387
|
var categoryContent = closestCategoryContent(element);
|
|
18687
18388
|
var category = closestCategory(categoryContent);
|
|
18688
18389
|
var indexInRow = elementIndexInRow(categoryContent, element);
|
|
18689
18390
|
var row = rowNumber(categoryContent, element);
|
|
18690
18391
|
var countInRow = elementCountInRow(categoryContent, element);
|
|
18691
|
-
|
|
18692
18392
|
if (!hasNextRow(categoryContent, element)) {
|
|
18693
18393
|
var nextVisibleCategory = nextCategory(category);
|
|
18694
|
-
|
|
18695
18394
|
if (!nextVisibleCategory) {
|
|
18696
18395
|
return null;
|
|
18697
18396
|
}
|
|
18698
|
-
|
|
18699
18397
|
return getElementInRow(allVisibleEmojis(nextVisibleCategory), 0, countInRow, indexInRow);
|
|
18700
18398
|
}
|
|
18701
|
-
|
|
18702
18399
|
var itemInNextRow = getElementInNextRow(allVisibleEmojis(categoryContent), row, countInRow, indexInRow);
|
|
18703
18400
|
return itemInNextRow;
|
|
18704
18401
|
}
|
|
18705
18402
|
|
|
18706
18403
|
var Direction;
|
|
18707
|
-
|
|
18708
18404
|
(function (Direction) {
|
|
18709
18405
|
Direction[Direction["Up"] = 0] = "Up";
|
|
18710
18406
|
Direction[Direction["Down"] = 1] = "Down";
|
|
18711
18407
|
})(Direction || (Direction = {}));
|
|
18712
|
-
|
|
18713
18408
|
function EmojiVariationPicker() {
|
|
18714
18409
|
var AnchoredEmojiRef = useAnchoredEmojiRef();
|
|
18715
18410
|
var VariationPickerRef = useVariationPickerRef();
|
|
18716
|
-
|
|
18717
18411
|
var _useEmojiVariationPic = useEmojiVariationPickerState(),
|
|
18718
|
-
|
|
18719
|
-
|
|
18412
|
+
emoji = _useEmojiVariationPic[0];
|
|
18720
18413
|
var emojiStyle = useEmojiStyleConfig();
|
|
18721
|
-
|
|
18722
18414
|
var _useVariationPickerTo = useVariationPickerTop(VariationPickerRef),
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
|
|
18415
|
+
getTop = _useVariationPickerTo.getTop,
|
|
18416
|
+
getMenuDirection = _useVariationPickerTo.getMenuDirection;
|
|
18726
18417
|
var setAnchoredEmojiRef = useSetAnchoredEmojiRef();
|
|
18727
18418
|
var getPointerStyle = usePointerStyle(VariationPickerRef);
|
|
18728
18419
|
var getEmojiUrl = useGetEmojiUrlConfig();
|
|
@@ -18732,18 +18423,15 @@ function EmojiVariationPicker() {
|
|
|
18732
18423
|
if (!visible) {
|
|
18733
18424
|
return;
|
|
18734
18425
|
}
|
|
18735
|
-
|
|
18736
18426
|
focusFirstVisibleEmoji(VariationPickerRef.current);
|
|
18737
18427
|
}, [VariationPickerRef, visible, AnchoredEmojiRef]);
|
|
18738
18428
|
var top, pointerStyle;
|
|
18739
|
-
|
|
18740
18429
|
if (!visible && AnchoredEmojiRef.current) {
|
|
18741
18430
|
setAnchoredEmojiRef(null);
|
|
18742
18431
|
} else {
|
|
18743
18432
|
top = getTop();
|
|
18744
18433
|
pointerStyle = getPointerStyle();
|
|
18745
18434
|
}
|
|
18746
|
-
|
|
18747
18435
|
return React.createElement("div", {
|
|
18748
18436
|
ref: VariationPickerRef,
|
|
18749
18437
|
className: flairup.cx(ClassNames.variationPicker, {
|
|
@@ -18767,32 +18455,25 @@ function EmojiVariationPicker() {
|
|
|
18767
18455
|
style: pointerStyle
|
|
18768
18456
|
}));
|
|
18769
18457
|
}
|
|
18770
|
-
|
|
18771
18458
|
function usePointerStyle(VariationPickerRef) {
|
|
18772
18459
|
var AnchoredEmojiRef = useAnchoredEmojiRef();
|
|
18773
18460
|
return function getPointerStyle() {
|
|
18774
18461
|
var style = {};
|
|
18775
|
-
|
|
18776
18462
|
if (!VariationPickerRef.current) {
|
|
18777
18463
|
return style;
|
|
18778
18464
|
}
|
|
18779
|
-
|
|
18780
18465
|
if (AnchoredEmojiRef.current) {
|
|
18781
18466
|
var button = buttonFromTarget(AnchoredEmojiRef.current);
|
|
18782
18467
|
var offsetLeft = emojiTruOffsetLeft(button);
|
|
18783
|
-
|
|
18784
18468
|
if (!button) {
|
|
18785
18469
|
return style;
|
|
18786
|
-
}
|
|
18787
|
-
|
|
18788
|
-
|
|
18470
|
+
}
|
|
18471
|
+
// half of the button
|
|
18789
18472
|
style.left = offsetLeft + (button == null ? void 0 : button.clientWidth) / 2;
|
|
18790
18473
|
}
|
|
18791
|
-
|
|
18792
18474
|
return style;
|
|
18793
18475
|
};
|
|
18794
18476
|
}
|
|
18795
|
-
|
|
18796
18477
|
function useVariationPickerTop(VariationPickerRef) {
|
|
18797
18478
|
var AnchoredEmojiRef = useAnchoredEmojiRef();
|
|
18798
18479
|
var BodyRef = useBodyRef();
|
|
@@ -18801,36 +18482,28 @@ function useVariationPickerTop(VariationPickerRef) {
|
|
|
18801
18482
|
getMenuDirection: getMenuDirection,
|
|
18802
18483
|
getTop: getTop
|
|
18803
18484
|
};
|
|
18804
|
-
|
|
18805
18485
|
function getMenuDirection() {
|
|
18806
18486
|
return direction;
|
|
18807
18487
|
}
|
|
18808
|
-
|
|
18809
18488
|
function getTop() {
|
|
18810
18489
|
direction = Direction.Up;
|
|
18811
18490
|
var emojiOffsetTop = 0;
|
|
18812
|
-
|
|
18813
18491
|
if (!VariationPickerRef.current) {
|
|
18814
18492
|
return 0;
|
|
18815
18493
|
}
|
|
18816
|
-
|
|
18817
18494
|
var height = elementHeight(VariationPickerRef.current);
|
|
18818
|
-
|
|
18819
18495
|
if (AnchoredEmojiRef.current) {
|
|
18820
18496
|
var _bodyRef$scrollTop;
|
|
18821
|
-
|
|
18822
18497
|
var bodyRef = BodyRef.current;
|
|
18823
18498
|
var button = buttonFromTarget(AnchoredEmojiRef.current);
|
|
18824
18499
|
var buttonHeight = elementHeight(button);
|
|
18825
18500
|
emojiOffsetTop = emojiTrueOffsetTop(button);
|
|
18826
18501
|
var scrollTop = (_bodyRef$scrollTop = bodyRef == null ? void 0 : bodyRef.scrollTop) != null ? _bodyRef$scrollTop : 0;
|
|
18827
|
-
|
|
18828
18502
|
if (scrollTop > emojiOffsetTop - height) {
|
|
18829
18503
|
direction = Direction.Down;
|
|
18830
18504
|
emojiOffsetTop += buttonHeight + height;
|
|
18831
18505
|
}
|
|
18832
18506
|
}
|
|
18833
|
-
|
|
18834
18507
|
return emojiOffsetTop - height;
|
|
18835
18508
|
}
|
|
18836
18509
|
}
|
|
@@ -18841,11 +18514,11 @@ function Body() {
|
|
|
18841
18514
|
useMouseDownHandlers(BodyRef);
|
|
18842
18515
|
useOnMouseMove();
|
|
18843
18516
|
return React.createElement("div", {
|
|
18844
|
-
className: flairup.cx(styles$
|
|
18517
|
+
className: flairup.cx(styles$3.body),
|
|
18845
18518
|
ref: BodyRef
|
|
18846
18519
|
}, React.createElement(EmojiVariationPicker, null), React.createElement(EmojiList, null));
|
|
18847
18520
|
}
|
|
18848
|
-
var styles$
|
|
18521
|
+
var styles$3 = /*#__PURE__*/stylesheet.create({
|
|
18849
18522
|
body: {
|
|
18850
18523
|
'.': ClassNames.scrollBody,
|
|
18851
18524
|
flex: '1',
|
|
@@ -18863,7 +18536,6 @@ function useEmojiPreviewEvents(allow, setPreviewEmoji) {
|
|
|
18863
18536
|
if (!allow) {
|
|
18864
18537
|
return;
|
|
18865
18538
|
}
|
|
18866
|
-
|
|
18867
18539
|
var bodyRef = BodyRef.current;
|
|
18868
18540
|
bodyRef == null ? void 0 : bodyRef.addEventListener('keydown', onEscape, {
|
|
18869
18541
|
passive: true
|
|
@@ -18874,57 +18546,44 @@ function useEmojiPreviewEvents(allow, setPreviewEmoji) {
|
|
|
18874
18546
|
passive: true
|
|
18875
18547
|
});
|
|
18876
18548
|
bodyRef == null ? void 0 : bodyRef.addEventListener('blur', onLeave, true);
|
|
18877
|
-
|
|
18878
18549
|
function onEnter(e) {
|
|
18879
18550
|
var button = buttonFromTarget(e.target);
|
|
18880
|
-
|
|
18881
18551
|
if (!button) {
|
|
18882
18552
|
return onLeave();
|
|
18883
18553
|
}
|
|
18884
|
-
|
|
18885
18554
|
var unified = unifiedFromEmojiElement(button);
|
|
18886
18555
|
var originalUnified = originalUnifiedFromEmojiElement(button);
|
|
18887
|
-
|
|
18888
18556
|
if (!unified || !originalUnified) {
|
|
18889
18557
|
return onLeave();
|
|
18890
18558
|
}
|
|
18891
|
-
|
|
18892
18559
|
setPreviewEmoji({
|
|
18893
18560
|
unified: unified,
|
|
18894
18561
|
originalUnified: originalUnified
|
|
18895
18562
|
});
|
|
18896
18563
|
}
|
|
18897
|
-
|
|
18898
18564
|
function onLeave(e) {
|
|
18899
18565
|
if (e) {
|
|
18900
18566
|
var relatedTarget = e.relatedTarget;
|
|
18901
|
-
|
|
18902
18567
|
if (!buttonFromTarget(relatedTarget)) {
|
|
18903
18568
|
return setPreviewEmoji(null);
|
|
18904
18569
|
}
|
|
18905
18570
|
}
|
|
18906
|
-
|
|
18907
18571
|
setPreviewEmoji(null);
|
|
18908
18572
|
}
|
|
18909
|
-
|
|
18910
18573
|
function onEscape(e) {
|
|
18911
18574
|
if (e.key === 'Escape') {
|
|
18912
18575
|
setPreviewEmoji(null);
|
|
18913
18576
|
}
|
|
18914
18577
|
}
|
|
18915
|
-
|
|
18916
18578
|
function onMouseOver(e) {
|
|
18917
18579
|
if (isMouseDisallowed()) {
|
|
18918
18580
|
return;
|
|
18919
18581
|
}
|
|
18920
|
-
|
|
18921
18582
|
var button = buttonFromTarget(e.target);
|
|
18922
|
-
|
|
18923
18583
|
if (button) {
|
|
18924
18584
|
focusElement(button);
|
|
18925
18585
|
}
|
|
18926
18586
|
}
|
|
18927
|
-
|
|
18928
18587
|
return function () {
|
|
18929
18588
|
bodyRef == null ? void 0 : bodyRef.removeEventListener('mouseover', onMouseOver);
|
|
18930
18589
|
bodyRef == null ? void 0 : bodyRef.removeEventListener('mouseout', onLeave);
|
|
@@ -18946,25 +18605,23 @@ function useIsSkinToneInPreview() {
|
|
|
18946
18605
|
|
|
18947
18606
|
var _stylesheet$create;
|
|
18948
18607
|
var FlexDirection;
|
|
18949
|
-
|
|
18950
18608
|
(function (FlexDirection) {
|
|
18951
18609
|
FlexDirection["ROW"] = "FlexRow";
|
|
18952
18610
|
FlexDirection["COLUMN"] = "FlexColumn";
|
|
18953
18611
|
})(FlexDirection || (FlexDirection = {}));
|
|
18954
|
-
|
|
18955
18612
|
function Flex(_ref) {
|
|
18956
18613
|
var children = _ref.children,
|
|
18957
|
-
|
|
18958
|
-
|
|
18959
|
-
|
|
18960
|
-
|
|
18961
|
-
|
|
18614
|
+
className = _ref.className,
|
|
18615
|
+
_ref$style = _ref.style,
|
|
18616
|
+
style = _ref$style === void 0 ? {} : _ref$style,
|
|
18617
|
+
_ref$direction = _ref.direction,
|
|
18618
|
+
direction = _ref$direction === void 0 ? FlexDirection.ROW : _ref$direction;
|
|
18962
18619
|
return React.createElement("div", {
|
|
18963
18620
|
style: _extends({}, style),
|
|
18964
|
-
className: flairup.cx(styles$
|
|
18621
|
+
className: flairup.cx(styles$4.flex, className, styles$4[direction])
|
|
18965
18622
|
}, children);
|
|
18966
18623
|
}
|
|
18967
|
-
var styles$
|
|
18624
|
+
var styles$4 = /*#__PURE__*/stylesheet.create((_stylesheet$create = {
|
|
18968
18625
|
flex: {
|
|
18969
18626
|
display: 'flex'
|
|
18970
18627
|
}
|
|
@@ -18976,8 +18633,8 @@ var styles$3 = /*#__PURE__*/stylesheet.create((_stylesheet$create = {
|
|
|
18976
18633
|
|
|
18977
18634
|
function Space(_ref) {
|
|
18978
18635
|
var className = _ref.className,
|
|
18979
|
-
|
|
18980
|
-
|
|
18636
|
+
_ref$style = _ref.style,
|
|
18637
|
+
style = _ref$style === void 0 ? {} : _ref$style;
|
|
18981
18638
|
return React.createElement("div", {
|
|
18982
18639
|
style: _extends({
|
|
18983
18640
|
flex: 1
|
|
@@ -18988,8 +18645,8 @@ function Space(_ref) {
|
|
|
18988
18645
|
|
|
18989
18646
|
function Absolute(_ref) {
|
|
18990
18647
|
var children = _ref.children,
|
|
18991
|
-
|
|
18992
|
-
|
|
18648
|
+
className = _ref.className,
|
|
18649
|
+
style = _ref.style;
|
|
18993
18650
|
return React.createElement("div", {
|
|
18994
18651
|
style: _extends({}, style, {
|
|
18995
18652
|
position: 'absolute'
|
|
@@ -19000,8 +18657,8 @@ function Absolute(_ref) {
|
|
|
19000
18657
|
|
|
19001
18658
|
function Relative(_ref) {
|
|
19002
18659
|
var children = _ref.children,
|
|
19003
|
-
|
|
19004
|
-
|
|
18660
|
+
className = _ref.className,
|
|
18661
|
+
style = _ref.style;
|
|
19005
18662
|
return React.createElement("div", {
|
|
19006
18663
|
style: _extends({}, style, {
|
|
19007
18664
|
position: 'relative'
|
|
@@ -19027,27 +18684,21 @@ function SkinTonePickerMenu() {
|
|
|
19027
18684
|
}
|
|
19028
18685
|
function SkinTonePicker(_ref) {
|
|
19029
18686
|
var _cx;
|
|
19030
|
-
|
|
19031
18687
|
var _ref$direction = _ref.direction,
|
|
19032
|
-
|
|
18688
|
+
direction = _ref$direction === void 0 ? SkinTonePickerDirection.HORIZONTAL : _ref$direction;
|
|
19033
18689
|
var SkinTonePickerRef = useSkinTonePickerRef();
|
|
19034
18690
|
var isDisabled = useSkinTonesDisabledConfig();
|
|
19035
|
-
|
|
19036
18691
|
var _useSkinToneFanOpenSt = useSkinToneFanOpenState(),
|
|
19037
|
-
|
|
19038
|
-
|
|
19039
|
-
|
|
18692
|
+
isOpen = _useSkinToneFanOpenSt[0],
|
|
18693
|
+
setIsOpen = _useSkinToneFanOpenSt[1];
|
|
19040
18694
|
var _useActiveSkinToneSta = useActiveSkinToneState(),
|
|
19041
|
-
|
|
19042
|
-
|
|
19043
|
-
|
|
18695
|
+
activeSkinTone = _useActiveSkinToneSta[0],
|
|
18696
|
+
setActiveSkinTone = _useActiveSkinToneSta[1];
|
|
19044
18697
|
var closeAllOpenToggles = useCloseAllOpenToggles();
|
|
19045
18698
|
var focusSearchInput = useFocusSearchInput();
|
|
19046
|
-
|
|
19047
18699
|
if (isDisabled) {
|
|
19048
18700
|
return null;
|
|
19049
18701
|
}
|
|
19050
|
-
|
|
19051
18702
|
var fullWidth = ITEM_SIZE * skinToneVariations.length + "px";
|
|
19052
18703
|
var expandedSize = isOpen ? fullWidth : ITEM_SIZE + 'px';
|
|
19053
18704
|
var vertical = direction === SkinTonePickerDirection.VERTICAL;
|
|
@@ -19064,7 +18715,6 @@ function SkinTonePicker(_ref) {
|
|
|
19064
18715
|
ref: SkinTonePickerRef
|
|
19065
18716
|
}, skinToneVariations.map(function (skinToneVariation, i) {
|
|
19066
18717
|
var _cx2;
|
|
19067
|
-
|
|
19068
18718
|
var active = skinToneVariation === activeSkinTone;
|
|
19069
18719
|
return React.createElement(Button, {
|
|
19070
18720
|
style: {
|
|
@@ -19077,7 +18727,6 @@ function SkinTonePicker(_ref) {
|
|
|
19077
18727
|
} else {
|
|
19078
18728
|
setIsOpen(true);
|
|
19079
18729
|
}
|
|
19080
|
-
|
|
19081
18730
|
closeAllOpenToggles();
|
|
19082
18731
|
},
|
|
19083
18732
|
key: skinToneVariation,
|
|
@@ -19089,7 +18738,6 @@ function SkinTonePicker(_ref) {
|
|
|
19089
18738
|
})));
|
|
19090
18739
|
}
|
|
19091
18740
|
var SkinTonePickerDirection;
|
|
19092
|
-
|
|
19093
18741
|
(function (SkinTonePickerDirection) {
|
|
19094
18742
|
SkinTonePickerDirection["VERTICAL"] = "epr-vertical";
|
|
19095
18743
|
SkinTonePickerDirection["HORIZONTAL"] = "epr-horizontal";
|
|
@@ -19098,42 +18746,32 @@ var SkinTonePickerDirection;
|
|
|
19098
18746
|
function Preview() {
|
|
19099
18747
|
var previewConfig = usePreviewConfig();
|
|
19100
18748
|
var isSkinToneInPreview = useIsSkinToneInPreview();
|
|
19101
|
-
|
|
19102
18749
|
if (!previewConfig.showPreview) {
|
|
19103
18750
|
return null;
|
|
19104
18751
|
}
|
|
19105
|
-
|
|
19106
18752
|
return React.createElement(Flex, {
|
|
19107
|
-
className: flairup.cx(styles$
|
|
18753
|
+
className: flairup.cx(styles$5.preview)
|
|
19108
18754
|
}, React.createElement(PreviewBody, null), React.createElement(Space, null), isSkinToneInPreview ? React.createElement(SkinTonePickerMenu, null) : null);
|
|
19109
18755
|
}
|
|
19110
18756
|
function PreviewBody() {
|
|
19111
18757
|
var _previewEmoji$unified;
|
|
19112
|
-
|
|
19113
18758
|
var previewConfig = usePreviewConfig();
|
|
19114
|
-
|
|
19115
18759
|
var _useState = React.useState(null),
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
|
|
18760
|
+
previewEmoji = _useState[0],
|
|
18761
|
+
setPreviewEmoji = _useState[1];
|
|
19119
18762
|
var emojiStyle = useEmojiStyleConfig();
|
|
19120
|
-
|
|
19121
18763
|
var _useEmojiVariationPic = useEmojiVariationPickerState(),
|
|
19122
|
-
|
|
19123
|
-
|
|
18764
|
+
variationPickerEmoji = _useEmojiVariationPic[0];
|
|
19124
18765
|
var getEmojiUrl = useGetEmojiUrlConfig();
|
|
19125
18766
|
useEmojiPreviewEvents(previewConfig.showPreview, setPreviewEmoji);
|
|
19126
18767
|
var emoji = emojiByUnified((_previewEmoji$unified = previewEmoji == null ? void 0 : previewEmoji.unified) != null ? _previewEmoji$unified : previewEmoji == null ? void 0 : previewEmoji.originalUnified);
|
|
19127
18768
|
var show = emoji != null && previewEmoji != null;
|
|
19128
18769
|
return React.createElement(PreviewContent, null);
|
|
19129
|
-
|
|
19130
18770
|
function PreviewContent() {
|
|
19131
18771
|
var defaultEmoji = variationPickerEmoji != null ? variationPickerEmoji : emojiByUnified(previewConfig.defaultEmoji);
|
|
19132
|
-
|
|
19133
18772
|
if (!defaultEmoji) {
|
|
19134
18773
|
return null;
|
|
19135
18774
|
}
|
|
19136
|
-
|
|
19137
18775
|
var defaultText = variationPickerEmoji ? emojiName(variationPickerEmoji) : previewConfig.defaultCaption;
|
|
19138
18776
|
return React.createElement(React.Fragment, null, React.createElement("div", null, show ? React.createElement(ViewOnlyEmoji, {
|
|
19139
18777
|
unified: previewEmoji == null ? void 0 : previewEmoji.unified,
|
|
@@ -19148,13 +18786,13 @@ function PreviewBody() {
|
|
|
19148
18786
|
size: 45,
|
|
19149
18787
|
getEmojiUrl: getEmojiUrl
|
|
19150
18788
|
}) : null), show ? React.createElement("div", {
|
|
19151
|
-
className: flairup.cx(styles$
|
|
18789
|
+
className: flairup.cx(styles$5.label)
|
|
19152
18790
|
}, emojiName(emoji)) : React.createElement("div", {
|
|
19153
|
-
className: flairup.cx(styles$
|
|
18791
|
+
className: flairup.cx(styles$5.label)
|
|
19154
18792
|
}, defaultText));
|
|
19155
18793
|
}
|
|
19156
18794
|
}
|
|
19157
|
-
var styles$
|
|
18795
|
+
var styles$5 = /*#__PURE__*/stylesheet.create({
|
|
19158
18796
|
preview: {
|
|
19159
18797
|
alignItems: 'center',
|
|
19160
18798
|
borderTop: '1px solid var(--epr-preview-border-color)',
|
|
@@ -19173,7 +18811,6 @@ var styles$4 = /*#__PURE__*/stylesheet.create({
|
|
|
19173
18811
|
|
|
19174
18812
|
function categoryNameFromDom($category) {
|
|
19175
18813
|
var _$category$getAttribu;
|
|
19176
|
-
|
|
19177
18814
|
return (_$category$getAttribu = $category == null ? void 0 : $category.getAttribute('data-name')) != null ? _$category$getAttribu : null;
|
|
19178
18815
|
}
|
|
19179
18816
|
|
|
@@ -19186,27 +18823,20 @@ function useActiveCategoryScrollDetection(setActiveCategory) {
|
|
|
19186
18823
|
if (!bodyRef) {
|
|
19187
18824
|
return;
|
|
19188
18825
|
}
|
|
19189
|
-
|
|
19190
18826
|
for (var _iterator = _createForOfIteratorHelperLoose(entries), _step; !(_step = _iterator()).done;) {
|
|
19191
18827
|
var entry = _step.value;
|
|
19192
|
-
|
|
19193
18828
|
var _id = categoryNameFromDom(entry.target);
|
|
19194
|
-
|
|
19195
18829
|
visibleCategories.set(_id, entry.intersectionRatio);
|
|
19196
18830
|
}
|
|
19197
|
-
|
|
19198
18831
|
var ratios = Array.from(visibleCategories);
|
|
19199
18832
|
var lastCategory = ratios[ratios.length - 1];
|
|
19200
|
-
|
|
19201
18833
|
if (lastCategory[1] == 1) {
|
|
19202
18834
|
return setActiveCategory(lastCategory[0]);
|
|
19203
18835
|
}
|
|
19204
|
-
|
|
19205
18836
|
for (var _i = 0, _ratios = ratios; _i < _ratios.length; _i++) {
|
|
19206
18837
|
var _ratios$_i = _ratios[_i],
|
|
19207
|
-
|
|
19208
|
-
|
|
19209
|
-
|
|
18838
|
+
id = _ratios$_i[0],
|
|
18839
|
+
ratio = _ratios$_i[1];
|
|
19210
18840
|
if (ratio) {
|
|
19211
18841
|
setActiveCategory(id);
|
|
19212
18842
|
break;
|
|
@@ -19223,8 +18853,7 @@ function useActiveCategoryScrollDetection(setActiveCategory) {
|
|
|
19223
18853
|
|
|
19224
18854
|
function useIsSearchMode() {
|
|
19225
18855
|
var _useSearchTermState = useSearchTermState(),
|
|
19226
|
-
|
|
19227
|
-
|
|
18856
|
+
searchTerm = _useSearchTermState[0];
|
|
19228
18857
|
return !!searchTerm;
|
|
19229
18858
|
}
|
|
19230
18859
|
|
|
@@ -19233,17 +18862,13 @@ function useScrollCategoryIntoView() {
|
|
|
19233
18862
|
var PickerMainRef = usePickerMainRef();
|
|
19234
18863
|
return function scrollCategoryIntoView(category) {
|
|
19235
18864
|
var _BodyRef$current;
|
|
19236
|
-
|
|
19237
18865
|
if (!BodyRef.current) {
|
|
19238
18866
|
return;
|
|
19239
18867
|
}
|
|
19240
|
-
|
|
19241
18868
|
var $category = (_BodyRef$current = BodyRef.current) == null ? void 0 : _BodyRef$current.querySelector("[data-name=\"" + category + "\"]");
|
|
19242
|
-
|
|
19243
18869
|
if (!$category) {
|
|
19244
18870
|
return;
|
|
19245
18871
|
}
|
|
19246
|
-
|
|
19247
18872
|
var offsetTop = $category.offsetTop || 0;
|
|
19248
18873
|
scrollTo(PickerMainRef.current, offsetTop);
|
|
19249
18874
|
};
|
|
@@ -19251,19 +18876,16 @@ function useScrollCategoryIntoView() {
|
|
|
19251
18876
|
|
|
19252
18877
|
function useShouldHideCustomEmojis() {
|
|
19253
18878
|
var customCategoryConfig = useCustomEmojisConfig();
|
|
19254
|
-
|
|
19255
18879
|
if (!customCategoryConfig) {
|
|
19256
18880
|
return false;
|
|
19257
18881
|
}
|
|
19258
|
-
|
|
19259
18882
|
return customCategoryConfig.length === 0;
|
|
19260
18883
|
}
|
|
19261
18884
|
|
|
19262
18885
|
function CategoryNavigation() {
|
|
19263
18886
|
var _useState = React.useState(null),
|
|
19264
|
-
|
|
19265
|
-
|
|
19266
|
-
|
|
18887
|
+
activeCategory = _useState[0],
|
|
18888
|
+
setActiveCategory = _useState[1];
|
|
19267
18889
|
var scrollCategoryIntoView = useScrollCategoryIntoView();
|
|
19268
18890
|
useActiveCategoryScrollDetection(setActiveCategory);
|
|
19269
18891
|
var isSearchMode = useIsSearchMode();
|
|
@@ -19271,24 +18893,21 @@ function CategoryNavigation() {
|
|
|
19271
18893
|
var CategoryNavigationRef = useCategoryNavigationRef();
|
|
19272
18894
|
var hideCustomCategory = useShouldHideCustomEmojis();
|
|
19273
18895
|
return React.createElement("div", {
|
|
19274
|
-
className:
|
|
18896
|
+
className: flairup.cx(styles$6.nav),
|
|
19275
18897
|
role: "tablist",
|
|
19276
18898
|
"aria-label": "Category navigation",
|
|
19277
18899
|
id: "epr-category-nav-id",
|
|
19278
18900
|
ref: CategoryNavigationRef
|
|
19279
18901
|
}, categoriesConfig.map(function (categoryConfig) {
|
|
19280
18902
|
var _cx;
|
|
19281
|
-
|
|
19282
18903
|
var category = categoryFromCategoryConfig(categoryConfig);
|
|
19283
18904
|
var isActiveCategory = category === activeCategory;
|
|
19284
|
-
|
|
19285
18905
|
if (isCustomCategory(categoryConfig) && hideCustomCategory) {
|
|
19286
18906
|
return null;
|
|
19287
18907
|
}
|
|
19288
|
-
|
|
19289
18908
|
return React.createElement(Button, {
|
|
19290
18909
|
tabIndex: isSearchMode || isActiveCategory ? -1 : 0,
|
|
19291
|
-
className: flairup.cx(
|
|
18910
|
+
className: flairup.cx(styles$6.catBtn, "epr-icn-" + category, (_cx = {}, _cx[ClassNames.active] = isActiveCategory, _cx)),
|
|
19292
18911
|
key: category,
|
|
19293
18912
|
onClick: function onClick() {
|
|
19294
18913
|
setActiveCategory(category);
|
|
@@ -19301,21 +18920,62 @@ function CategoryNavigation() {
|
|
|
19301
18920
|
});
|
|
19302
18921
|
}));
|
|
19303
18922
|
}
|
|
18923
|
+
var styles$6 = /*#__PURE__*/stylesheet.create({
|
|
18924
|
+
nav: {
|
|
18925
|
+
'.': 'epr-category-nav',
|
|
18926
|
+
display: 'flex',
|
|
18927
|
+
flexDirection: 'row',
|
|
18928
|
+
justifyContent: 'space-around',
|
|
18929
|
+
padding: 'var(--epr-header-padding)'
|
|
18930
|
+
},
|
|
18931
|
+
'.epr-search-active': {
|
|
18932
|
+
nav: {
|
|
18933
|
+
opacity: '0.3',
|
|
18934
|
+
cursor: 'default',
|
|
18935
|
+
pointerEvents: 'none'
|
|
18936
|
+
}
|
|
18937
|
+
},
|
|
18938
|
+
'.epr-main:has(input:not(:placeholder-shown))': {
|
|
18939
|
+
nav: {
|
|
18940
|
+
opacity: '0.3',
|
|
18941
|
+
cursor: 'default',
|
|
18942
|
+
pointerEvents: 'none'
|
|
18943
|
+
}
|
|
18944
|
+
},
|
|
18945
|
+
catBtn: {
|
|
18946
|
+
'.': 'epr-cat-btn',
|
|
18947
|
+
display: 'inline-block',
|
|
18948
|
+
transition: 'opacity 0.2s ease-in-out',
|
|
18949
|
+
position: 'relative',
|
|
18950
|
+
height: 'var(--epr-category-navigation-button-size)',
|
|
18951
|
+
width: 'var(--epr-category-navigation-button-size)',
|
|
18952
|
+
backgroundSize: 'calc(var(--epr-category-navigation-button-size) * 10)',
|
|
18953
|
+
outline: 'none',
|
|
18954
|
+
backgroundPosition: '0 0',
|
|
18955
|
+
':focus:before': {
|
|
18956
|
+
content: '',
|
|
18957
|
+
position: 'absolute',
|
|
18958
|
+
top: '-2px',
|
|
18959
|
+
left: '-2px',
|
|
18960
|
+
right: '-2px',
|
|
18961
|
+
bottom: '-2px',
|
|
18962
|
+
border: '2px solid var(--epr-category-icon-active-color)',
|
|
18963
|
+
borderRadius: '50%'
|
|
18964
|
+
}
|
|
18965
|
+
}
|
|
18966
|
+
});
|
|
19304
18967
|
|
|
19305
18968
|
var SCOPE = /*#__PURE__*/asSelectors(ClassNames.emojiPicker) + " " + /*#__PURE__*/asSelectors(ClassNames.emojiList);
|
|
19306
18969
|
var EMOJI_BUTTON = /*#__PURE__*/['button', asSelectors(ClassNames.emoji)].join('');
|
|
19307
18970
|
var CATEGORY = /*#__PURE__*/asSelectors(ClassNames.category);
|
|
19308
18971
|
function CssSearch(_ref) {
|
|
19309
18972
|
var value = _ref.value;
|
|
19310
|
-
|
|
19311
18973
|
if (!value) {
|
|
19312
18974
|
return null;
|
|
19313
18975
|
}
|
|
19314
|
-
|
|
19315
18976
|
var q = genQuery(value);
|
|
19316
18977
|
return React.createElement("style", null, "\n " + SCOPE + " " + EMOJI_BUTTON + " {\n display: none;\n }\n\n\n " + SCOPE + " " + q + " {\n display: flex;\n }\n\n " + SCOPE + " " + CATEGORY + ":not(:has(" + q + ")) {\n display: none;\n }\n ");
|
|
19317
18978
|
}
|
|
19318
|
-
|
|
19319
18979
|
function genQuery(value) {
|
|
19320
18980
|
return [EMOJI_BUTTON, '[data-full-name*="', getNormalizedSearchTerm(value), '"]'].join('');
|
|
19321
18981
|
}
|
|
@@ -19323,16 +18983,14 @@ function genQuery(value) {
|
|
|
19323
18983
|
function SearchContainer() {
|
|
19324
18984
|
var searchDisabled = useSearchDisabledConfig();
|
|
19325
18985
|
var isSkinToneInSearch = useIsSkinToneInSearch();
|
|
19326
|
-
|
|
19327
18986
|
if (searchDisabled) {
|
|
19328
18987
|
return null;
|
|
19329
18988
|
}
|
|
19330
|
-
|
|
19331
18989
|
return React.createElement(Flex, {
|
|
19332
|
-
className: flairup.cx(styles$
|
|
18990
|
+
className: flairup.cx(styles$7.overlay)
|
|
19333
18991
|
}, React.createElement(Search, null), isSkinToneInSearch ? React.createElement(SkinTonePicker, null) : null);
|
|
19334
18992
|
}
|
|
19335
|
-
var styles$
|
|
18993
|
+
var styles$7 = /*#__PURE__*/stylesheet.create({
|
|
19336
18994
|
overlay: {
|
|
19337
18995
|
padding: 'var(--epr-header-padding)',
|
|
19338
18996
|
zIndex: 'var(--epr-header-overlay-z-index)'
|
|
@@ -19340,20 +18998,17 @@ var styles$5 = /*#__PURE__*/stylesheet.create({
|
|
|
19340
18998
|
});
|
|
19341
18999
|
function Search() {
|
|
19342
19000
|
var _useState = React.useState(0),
|
|
19343
|
-
|
|
19344
|
-
|
|
19345
|
-
|
|
19001
|
+
inc = _useState[0],
|
|
19002
|
+
setInc = _useState[1];
|
|
19346
19003
|
var closeAllOpenToggles = useCloseAllOpenToggles();
|
|
19347
19004
|
var SearchInputRef = useSearchInputRef();
|
|
19348
19005
|
var clearSearch = useClearSearch();
|
|
19349
19006
|
var placeholder = useSearchPlaceHolderConfig();
|
|
19350
19007
|
var autoFocus = useAutoFocusSearchConfig();
|
|
19351
|
-
|
|
19352
19008
|
var _useFilter = useFilter(),
|
|
19353
|
-
|
|
19354
|
-
|
|
19355
|
-
|
|
19356
|
-
|
|
19009
|
+
statusSearchResults = _useFilter.statusSearchResults,
|
|
19010
|
+
searchTerm = _useFilter.searchTerm,
|
|
19011
|
+
_onChange = _useFilter.onChange;
|
|
19357
19012
|
var input = SearchInputRef == null ? void 0 : SearchInputRef.current;
|
|
19358
19013
|
var value = input == null ? void 0 : input.value;
|
|
19359
19014
|
return React.createElement(Relative, {
|
|
@@ -19373,7 +19028,6 @@ function Search() {
|
|
|
19373
19028
|
setInc(inc + 1);
|
|
19374
19029
|
setTimeout(function () {
|
|
19375
19030
|
var _event$target$value, _event$target;
|
|
19376
|
-
|
|
19377
19031
|
_onChange((_event$target$value = event == null ? void 0 : (_event$target = event.target) == null ? void 0 : _event$target.value) != null ? _event$target$value : value);
|
|
19378
19032
|
});
|
|
19379
19033
|
},
|
|
@@ -19407,7 +19061,6 @@ function getActiveElement() {
|
|
|
19407
19061
|
}
|
|
19408
19062
|
|
|
19409
19063
|
var KeyboardEvents;
|
|
19410
|
-
|
|
19411
19064
|
(function (KeyboardEvents) {
|
|
19412
19065
|
KeyboardEvents["ArrowDown"] = "ArrowDown";
|
|
19413
19066
|
KeyboardEvents["ArrowUp"] = "ArrowUp";
|
|
@@ -19417,7 +19070,6 @@ var KeyboardEvents;
|
|
|
19417
19070
|
KeyboardEvents["Enter"] = "Enter";
|
|
19418
19071
|
KeyboardEvents["Space"] = " ";
|
|
19419
19072
|
})(KeyboardEvents || (KeyboardEvents = {}));
|
|
19420
|
-
|
|
19421
19073
|
function useKeyboardNavigation() {
|
|
19422
19074
|
usePickerMainKeyboardEvents();
|
|
19423
19075
|
useSearchInputKeyboardEvents();
|
|
@@ -19425,7 +19077,6 @@ function useKeyboardNavigation() {
|
|
|
19425
19077
|
useCategoryNavigationKeyboardEvents();
|
|
19426
19078
|
useBodyKeyboardEvents();
|
|
19427
19079
|
}
|
|
19428
|
-
|
|
19429
19080
|
function usePickerMainKeyboardEvents() {
|
|
19430
19081
|
var PickerMainRef = usePickerMainRef();
|
|
19431
19082
|
var clearSearch = useClearSearch();
|
|
@@ -19439,17 +19090,14 @@ function usePickerMainKeyboardEvents() {
|
|
|
19439
19090
|
return function onKeyDown(event) {
|
|
19440
19091
|
var key = event.key;
|
|
19441
19092
|
disallowMouseMove();
|
|
19442
|
-
|
|
19443
19093
|
switch (key) {
|
|
19444
19094
|
// eslint-disable-next-line no-fallthrough
|
|
19445
19095
|
case KeyboardEvents.Escape:
|
|
19446
19096
|
event.preventDefault();
|
|
19447
|
-
|
|
19448
19097
|
if (hasOpenToggles()) {
|
|
19449
19098
|
closeAllOpenToggles();
|
|
19450
19099
|
return;
|
|
19451
19100
|
}
|
|
19452
|
-
|
|
19453
19101
|
clearSearch();
|
|
19454
19102
|
scrollTo(0);
|
|
19455
19103
|
focusSearchInput();
|
|
@@ -19459,49 +19107,40 @@ function usePickerMainKeyboardEvents() {
|
|
|
19459
19107
|
}, [scrollTo, clearSearch, closeAllOpenToggles, focusSearchInput, hasOpenToggles, disallowMouseMove]);
|
|
19460
19108
|
React.useEffect(function () {
|
|
19461
19109
|
var current = PickerMainRef.current;
|
|
19462
|
-
|
|
19463
19110
|
if (!current) {
|
|
19464
19111
|
return;
|
|
19465
19112
|
}
|
|
19466
|
-
|
|
19467
19113
|
current.addEventListener('keydown', onKeyDown);
|
|
19468
19114
|
return function () {
|
|
19469
19115
|
current.removeEventListener('keydown', onKeyDown);
|
|
19470
19116
|
};
|
|
19471
19117
|
}, [PickerMainRef, SearchInputRef, scrollTo, onKeyDown]);
|
|
19472
19118
|
}
|
|
19473
|
-
|
|
19474
19119
|
function useSearchInputKeyboardEvents() {
|
|
19475
19120
|
var focusSkinTonePicker = useFocusSkinTonePicker();
|
|
19476
19121
|
var PickerMainRef = usePickerMainRef();
|
|
19477
19122
|
var BodyRef = useBodyRef();
|
|
19478
19123
|
var SearchInputRef = useSearchInputRef();
|
|
19479
|
-
|
|
19480
19124
|
var _useSkinToneFanOpenSt = useSkinToneFanOpenState(),
|
|
19481
|
-
|
|
19482
|
-
|
|
19125
|
+
setSkinToneFanOpenState = _useSkinToneFanOpenSt[1];
|
|
19483
19126
|
var goDownFromSearchInput = useGoDownFromSearchInput();
|
|
19484
19127
|
var isSkinToneInSearch = useIsSkinToneInSearch();
|
|
19485
19128
|
var onKeyDown = React.useMemo(function () {
|
|
19486
19129
|
return function onKeyDown(event) {
|
|
19487
19130
|
var key = event.key;
|
|
19488
|
-
|
|
19489
19131
|
switch (key) {
|
|
19490
19132
|
case KeyboardEvents.ArrowRight:
|
|
19491
19133
|
if (!isSkinToneInSearch) {
|
|
19492
19134
|
return;
|
|
19493
19135
|
}
|
|
19494
|
-
|
|
19495
19136
|
event.preventDefault();
|
|
19496
19137
|
setSkinToneFanOpenState(true);
|
|
19497
19138
|
focusSkinTonePicker();
|
|
19498
19139
|
break;
|
|
19499
|
-
|
|
19500
19140
|
case KeyboardEvents.ArrowDown:
|
|
19501
19141
|
event.preventDefault();
|
|
19502
19142
|
goDownFromSearchInput();
|
|
19503
19143
|
break;
|
|
19504
|
-
|
|
19505
19144
|
case KeyboardEvents.Enter:
|
|
19506
19145
|
event.preventDefault();
|
|
19507
19146
|
focusAndClickFirstVisibleEmoji(BodyRef.current);
|
|
@@ -19511,96 +19150,75 @@ function useSearchInputKeyboardEvents() {
|
|
|
19511
19150
|
}, [focusSkinTonePicker, goDownFromSearchInput, setSkinToneFanOpenState, BodyRef, isSkinToneInSearch]);
|
|
19512
19151
|
React.useEffect(function () {
|
|
19513
19152
|
var current = SearchInputRef.current;
|
|
19514
|
-
|
|
19515
19153
|
if (!current) {
|
|
19516
19154
|
return;
|
|
19517
19155
|
}
|
|
19518
|
-
|
|
19519
19156
|
current.addEventListener('keydown', onKeyDown);
|
|
19520
19157
|
return function () {
|
|
19521
19158
|
current.removeEventListener('keydown', onKeyDown);
|
|
19522
19159
|
};
|
|
19523
19160
|
}, [PickerMainRef, SearchInputRef, onKeyDown]);
|
|
19524
19161
|
}
|
|
19525
|
-
|
|
19526
19162
|
function useSkinTonePickerKeyboardEvents() {
|
|
19527
19163
|
var SkinTonePickerRef = useSkinTonePickerRef();
|
|
19528
19164
|
var focusSearchInput = useFocusSearchInput();
|
|
19529
19165
|
var SearchInputRef = useSearchInputRef();
|
|
19530
19166
|
var goDownFromSearchInput = useGoDownFromSearchInput();
|
|
19531
|
-
|
|
19532
19167
|
var _useSkinToneFanOpenSt2 = useSkinToneFanOpenState(),
|
|
19533
|
-
|
|
19534
|
-
|
|
19535
|
-
|
|
19168
|
+
isOpen = _useSkinToneFanOpenSt2[0],
|
|
19169
|
+
setIsOpen = _useSkinToneFanOpenSt2[1];
|
|
19536
19170
|
var isSkinToneInPreview = useIsSkinToneInPreview();
|
|
19537
19171
|
var isSkinToneInSearch = useIsSkinToneInSearch();
|
|
19538
19172
|
var onType = useOnType();
|
|
19539
19173
|
var onKeyDown = React.useMemo(function () {
|
|
19540
|
-
return (
|
|
19174
|
+
return (
|
|
19175
|
+
// eslint-disable-next-line complexity
|
|
19541
19176
|
function onKeyDown(event) {
|
|
19542
19177
|
var key = event.key;
|
|
19543
|
-
|
|
19544
19178
|
if (isSkinToneInSearch) {
|
|
19545
19179
|
switch (key) {
|
|
19546
19180
|
case KeyboardEvents.ArrowLeft:
|
|
19547
19181
|
event.preventDefault();
|
|
19548
|
-
|
|
19549
19182
|
if (!isOpen) {
|
|
19550
19183
|
return focusSearchInput();
|
|
19551
19184
|
}
|
|
19552
|
-
|
|
19553
19185
|
focusNextSkinTone(focusSearchInput);
|
|
19554
19186
|
break;
|
|
19555
|
-
|
|
19556
19187
|
case KeyboardEvents.ArrowRight:
|
|
19557
19188
|
event.preventDefault();
|
|
19558
|
-
|
|
19559
19189
|
if (!isOpen) {
|
|
19560
19190
|
return focusSearchInput();
|
|
19561
19191
|
}
|
|
19562
|
-
|
|
19563
19192
|
focusPrevSkinTone();
|
|
19564
19193
|
break;
|
|
19565
|
-
|
|
19566
19194
|
case KeyboardEvents.ArrowDown:
|
|
19567
19195
|
event.preventDefault();
|
|
19568
|
-
|
|
19569
19196
|
if (isOpen) {
|
|
19570
19197
|
setIsOpen(false);
|
|
19571
19198
|
}
|
|
19572
|
-
|
|
19573
19199
|
goDownFromSearchInput();
|
|
19574
19200
|
break;
|
|
19575
|
-
|
|
19576
19201
|
default:
|
|
19577
19202
|
onType(event);
|
|
19578
19203
|
break;
|
|
19579
19204
|
}
|
|
19580
19205
|
}
|
|
19581
|
-
|
|
19582
19206
|
if (isSkinToneInPreview) {
|
|
19583
19207
|
switch (key) {
|
|
19584
19208
|
case KeyboardEvents.ArrowUp:
|
|
19585
19209
|
event.preventDefault();
|
|
19586
|
-
|
|
19587
19210
|
if (!isOpen) {
|
|
19588
19211
|
return focusSearchInput();
|
|
19589
19212
|
}
|
|
19590
|
-
|
|
19591
19213
|
focusNextSkinTone(focusSearchInput);
|
|
19592
19214
|
break;
|
|
19593
|
-
|
|
19594
19215
|
case KeyboardEvents.ArrowDown:
|
|
19595
19216
|
event.preventDefault();
|
|
19596
|
-
|
|
19597
19217
|
if (!isOpen) {
|
|
19598
19218
|
return focusSearchInput();
|
|
19599
19219
|
}
|
|
19600
|
-
|
|
19601
19220
|
focusPrevSkinTone();
|
|
19602
19221
|
break;
|
|
19603
|
-
|
|
19604
19222
|
default:
|
|
19605
19223
|
onType(event);
|
|
19606
19224
|
break;
|
|
@@ -19611,18 +19229,15 @@ function useSkinTonePickerKeyboardEvents() {
|
|
|
19611
19229
|
}, [isOpen, focusSearchInput, setIsOpen, goDownFromSearchInput, onType, isSkinToneInPreview, isSkinToneInSearch]);
|
|
19612
19230
|
React.useEffect(function () {
|
|
19613
19231
|
var current = SkinTonePickerRef.current;
|
|
19614
|
-
|
|
19615
19232
|
if (!current) {
|
|
19616
19233
|
return;
|
|
19617
19234
|
}
|
|
19618
|
-
|
|
19619
19235
|
current.addEventListener('keydown', onKeyDown);
|
|
19620
19236
|
return function () {
|
|
19621
19237
|
current.removeEventListener('keydown', onKeyDown);
|
|
19622
19238
|
};
|
|
19623
19239
|
}, [SkinTonePickerRef, SearchInputRef, isOpen, onKeyDown]);
|
|
19624
19240
|
}
|
|
19625
|
-
|
|
19626
19241
|
function useCategoryNavigationKeyboardEvents() {
|
|
19627
19242
|
var focusSearchInput = useFocusSearchInput();
|
|
19628
19243
|
var CategoryNavigationRef = useCategoryNavigationRef();
|
|
@@ -19631,28 +19246,23 @@ function useCategoryNavigationKeyboardEvents() {
|
|
|
19631
19246
|
var onKeyDown = React.useMemo(function () {
|
|
19632
19247
|
return function onKeyDown(event) {
|
|
19633
19248
|
var key = event.key;
|
|
19634
|
-
|
|
19635
19249
|
switch (key) {
|
|
19636
19250
|
case KeyboardEvents.ArrowUp:
|
|
19637
19251
|
event.preventDefault();
|
|
19638
19252
|
focusSearchInput();
|
|
19639
19253
|
break;
|
|
19640
|
-
|
|
19641
19254
|
case KeyboardEvents.ArrowRight:
|
|
19642
19255
|
event.preventDefault();
|
|
19643
19256
|
focusNextElementSibling(getActiveElement());
|
|
19644
19257
|
break;
|
|
19645
|
-
|
|
19646
19258
|
case KeyboardEvents.ArrowLeft:
|
|
19647
19259
|
event.preventDefault();
|
|
19648
19260
|
focusPrevElementSibling(getActiveElement());
|
|
19649
19261
|
break;
|
|
19650
|
-
|
|
19651
19262
|
case KeyboardEvents.ArrowDown:
|
|
19652
19263
|
event.preventDefault();
|
|
19653
19264
|
focusFirstVisibleEmoji(BodyRef.current);
|
|
19654
19265
|
break;
|
|
19655
|
-
|
|
19656
19266
|
default:
|
|
19657
19267
|
onType(event);
|
|
19658
19268
|
break;
|
|
@@ -19661,18 +19271,15 @@ function useCategoryNavigationKeyboardEvents() {
|
|
|
19661
19271
|
}, [BodyRef, focusSearchInput, onType]);
|
|
19662
19272
|
React.useEffect(function () {
|
|
19663
19273
|
var current = CategoryNavigationRef.current;
|
|
19664
|
-
|
|
19665
19274
|
if (!current) {
|
|
19666
19275
|
return;
|
|
19667
19276
|
}
|
|
19668
|
-
|
|
19669
19277
|
current.addEventListener('keydown', onKeyDown);
|
|
19670
19278
|
return function () {
|
|
19671
19279
|
current.removeEventListener('keydown', onKeyDown);
|
|
19672
19280
|
};
|
|
19673
19281
|
}, [CategoryNavigationRef, BodyRef, onKeyDown]);
|
|
19674
19282
|
}
|
|
19675
|
-
|
|
19676
19283
|
function useBodyKeyboardEvents() {
|
|
19677
19284
|
var BodyRef = useBodyRef();
|
|
19678
19285
|
var goUpFromBody = useGoUpFromBody();
|
|
@@ -19681,49 +19288,40 @@ function useBodyKeyboardEvents() {
|
|
|
19681
19288
|
var closeAllOpenToggles = useCloseAllOpenToggles();
|
|
19682
19289
|
var onType = useOnType();
|
|
19683
19290
|
var onKeyDown = React.useMemo(function () {
|
|
19684
|
-
return (
|
|
19291
|
+
return (
|
|
19292
|
+
// eslint-disable-next-line complexity
|
|
19685
19293
|
function onKeyDown(event) {
|
|
19686
19294
|
var key = event.key;
|
|
19687
19295
|
var activeElement = buttonFromTarget(getActiveElement());
|
|
19688
|
-
|
|
19689
19296
|
switch (key) {
|
|
19690
19297
|
case KeyboardEvents.ArrowRight:
|
|
19691
19298
|
event.preventDefault();
|
|
19692
19299
|
focusNextVisibleEmoji(activeElement);
|
|
19693
19300
|
break;
|
|
19694
|
-
|
|
19695
19301
|
case KeyboardEvents.ArrowLeft:
|
|
19696
19302
|
event.preventDefault();
|
|
19697
19303
|
focusPrevVisibleEmoji(activeElement);
|
|
19698
19304
|
break;
|
|
19699
|
-
|
|
19700
19305
|
case KeyboardEvents.ArrowDown:
|
|
19701
19306
|
event.preventDefault();
|
|
19702
|
-
|
|
19703
19307
|
if (hasOpenToggles()) {
|
|
19704
19308
|
closeAllOpenToggles();
|
|
19705
19309
|
break;
|
|
19706
19310
|
}
|
|
19707
|
-
|
|
19708
19311
|
focusVisibleEmojiOneRowDown(activeElement);
|
|
19709
19312
|
break;
|
|
19710
|
-
|
|
19711
19313
|
case KeyboardEvents.ArrowUp:
|
|
19712
19314
|
event.preventDefault();
|
|
19713
|
-
|
|
19714
19315
|
if (hasOpenToggles()) {
|
|
19715
19316
|
closeAllOpenToggles();
|
|
19716
19317
|
break;
|
|
19717
19318
|
}
|
|
19718
|
-
|
|
19719
19319
|
focusVisibleEmojiOneRowUp(activeElement, goUpFromBody);
|
|
19720
19320
|
break;
|
|
19721
|
-
|
|
19722
19321
|
case KeyboardEvents.Space:
|
|
19723
19322
|
event.preventDefault();
|
|
19724
19323
|
setVariationPicker(event.target);
|
|
19725
19324
|
break;
|
|
19726
|
-
|
|
19727
19325
|
default:
|
|
19728
19326
|
onType(event);
|
|
19729
19327
|
break;
|
|
@@ -19733,18 +19331,15 @@ function useBodyKeyboardEvents() {
|
|
|
19733
19331
|
}, [goUpFromBody, onType, setVariationPicker, hasOpenToggles, closeAllOpenToggles]);
|
|
19734
19332
|
React.useEffect(function () {
|
|
19735
19333
|
var current = BodyRef.current;
|
|
19736
|
-
|
|
19737
19334
|
if (!current) {
|
|
19738
19335
|
return;
|
|
19739
19336
|
}
|
|
19740
|
-
|
|
19741
19337
|
current.addEventListener('keydown', onKeyDown);
|
|
19742
19338
|
return function () {
|
|
19743
19339
|
current.removeEventListener('keydown', onKeyDown);
|
|
19744
19340
|
};
|
|
19745
19341
|
}, [BodyRef, onKeyDown]);
|
|
19746
19342
|
}
|
|
19747
|
-
|
|
19748
19343
|
function useGoDownFromSearchInput() {
|
|
19749
19344
|
var focusCategoryNavigation = useFocusCategoryNavigation();
|
|
19750
19345
|
var isSearchMode = useIsSearchMode();
|
|
@@ -19753,11 +19348,9 @@ function useGoDownFromSearchInput() {
|
|
|
19753
19348
|
if (isSearchMode) {
|
|
19754
19349
|
return focusFirstVisibleEmoji(BodyRef.current);
|
|
19755
19350
|
}
|
|
19756
|
-
|
|
19757
19351
|
return focusCategoryNavigation();
|
|
19758
19352
|
}, [BodyRef, focusCategoryNavigation, isSearchMode]);
|
|
19759
19353
|
}
|
|
19760
|
-
|
|
19761
19354
|
function useGoUpFromBody() {
|
|
19762
19355
|
var focusSearchInput = useFocusSearchInput();
|
|
19763
19356
|
var focusCategoryNavigation = useFocusCategoryNavigation();
|
|
@@ -19766,35 +19359,26 @@ function useGoUpFromBody() {
|
|
|
19766
19359
|
if (isSearchMode) {
|
|
19767
19360
|
return focusSearchInput();
|
|
19768
19361
|
}
|
|
19769
|
-
|
|
19770
19362
|
return focusCategoryNavigation();
|
|
19771
19363
|
}, [focusSearchInput, isSearchMode, focusCategoryNavigation]);
|
|
19772
19364
|
}
|
|
19773
|
-
|
|
19774
19365
|
function focusNextSkinTone(exitLeft) {
|
|
19775
19366
|
var currentSkinTone = getActiveElement();
|
|
19776
|
-
|
|
19777
19367
|
if (!currentSkinTone) {
|
|
19778
19368
|
return;
|
|
19779
19369
|
}
|
|
19780
|
-
|
|
19781
19370
|
if (!hasNextElementSibling(currentSkinTone)) {
|
|
19782
19371
|
exitLeft();
|
|
19783
19372
|
}
|
|
19784
|
-
|
|
19785
19373
|
focusNextElementSibling(currentSkinTone);
|
|
19786
19374
|
}
|
|
19787
|
-
|
|
19788
19375
|
function focusPrevSkinTone() {
|
|
19789
19376
|
var currentSkinTone = getActiveElement();
|
|
19790
|
-
|
|
19791
19377
|
if (!currentSkinTone) {
|
|
19792
19378
|
return;
|
|
19793
19379
|
}
|
|
19794
|
-
|
|
19795
19380
|
focusPrevElementSibling(currentSkinTone);
|
|
19796
19381
|
}
|
|
19797
|
-
|
|
19798
19382
|
function useOnType() {
|
|
19799
19383
|
var appendSearch = useAppendSearch();
|
|
19800
19384
|
var focusSearchInput = useFocusSearchInput();
|
|
@@ -19802,11 +19386,9 @@ function useOnType() {
|
|
|
19802
19386
|
var closeAllOpenToggles = useCloseAllOpenToggles();
|
|
19803
19387
|
return function onType(event) {
|
|
19804
19388
|
var key = event.key;
|
|
19805
|
-
|
|
19806
19389
|
if (hasModifier(event) || searchDisabled) {
|
|
19807
19390
|
return;
|
|
19808
19391
|
}
|
|
19809
|
-
|
|
19810
19392
|
if (key.match(/(^[a-zA-Z0-9]$){1}/)) {
|
|
19811
19393
|
event.preventDefault();
|
|
19812
19394
|
closeAllOpenToggles();
|
|
@@ -19815,11 +19397,10 @@ function useOnType() {
|
|
|
19815
19397
|
}
|
|
19816
19398
|
};
|
|
19817
19399
|
}
|
|
19818
|
-
|
|
19819
19400
|
function hasModifier(event) {
|
|
19820
19401
|
var metaKey = event.metaKey,
|
|
19821
|
-
|
|
19822
|
-
|
|
19402
|
+
ctrlKey = event.ctrlKey,
|
|
19403
|
+
altKey = event.altKey;
|
|
19823
19404
|
return metaKey || ctrlKey || altKey;
|
|
19824
19405
|
}
|
|
19825
19406
|
|
|
@@ -19827,17 +19408,13 @@ function preloadEmoji(getEmojiUrl, emoji, emojiStyle) {
|
|
|
19827
19408
|
if (!emoji) {
|
|
19828
19409
|
return;
|
|
19829
19410
|
}
|
|
19830
|
-
|
|
19831
19411
|
if (emojiStyle === exports.EmojiStyle.NATIVE) {
|
|
19832
19412
|
return;
|
|
19833
19413
|
}
|
|
19834
|
-
|
|
19835
19414
|
var unified = emojiUnified(emoji);
|
|
19836
|
-
|
|
19837
19415
|
if (preloadedEmojs.has(unified)) {
|
|
19838
19416
|
return;
|
|
19839
19417
|
}
|
|
19840
|
-
|
|
19841
19418
|
emojiVariations(emoji).forEach(function (variation) {
|
|
19842
19419
|
var emojiUrl = getEmojiUrl(variation, emojiStyle);
|
|
19843
19420
|
preloadImage(emojiUrl);
|
|
@@ -19845,7 +19422,6 @@ function preloadEmoji(getEmojiUrl, emoji, emojiStyle) {
|
|
|
19845
19422
|
preloadedEmojs.add(unified);
|
|
19846
19423
|
}
|
|
19847
19424
|
var preloadedEmojs = /*#__PURE__*/new Set();
|
|
19848
|
-
|
|
19849
19425
|
function preloadImage(url) {
|
|
19850
19426
|
var image = new Image();
|
|
19851
19427
|
image.src = url;
|
|
@@ -19859,27 +19435,21 @@ function useOnFocus() {
|
|
|
19859
19435
|
if (emojiStyle === exports.EmojiStyle.NATIVE) {
|
|
19860
19436
|
return;
|
|
19861
19437
|
}
|
|
19862
|
-
|
|
19863
19438
|
var bodyRef = BodyRef.current;
|
|
19864
19439
|
bodyRef == null ? void 0 : bodyRef.addEventListener('focusin', onFocus);
|
|
19865
19440
|
return function () {
|
|
19866
19441
|
bodyRef == null ? void 0 : bodyRef.removeEventListener('focusin', onFocus);
|
|
19867
19442
|
};
|
|
19868
|
-
|
|
19869
19443
|
function onFocus(event) {
|
|
19870
19444
|
var button = buttonFromTarget(event.target);
|
|
19871
|
-
|
|
19872
19445
|
if (!button) {
|
|
19873
19446
|
return;
|
|
19874
19447
|
}
|
|
19875
|
-
|
|
19876
19448
|
var _emojiFromElement = emojiFromElement(button),
|
|
19877
|
-
|
|
19878
|
-
|
|
19449
|
+
emoji = _emojiFromElement[0];
|
|
19879
19450
|
if (!emoji) {
|
|
19880
19451
|
return;
|
|
19881
19452
|
}
|
|
19882
|
-
|
|
19883
19453
|
if (emojiHasVariations(emoji)) {
|
|
19884
19454
|
preloadEmoji(getEmojiUrl, emoji, emojiStyle);
|
|
19885
19455
|
}
|
|
@@ -19891,10 +19461,8 @@ function PickerMain(_ref) {
|
|
|
19891
19461
|
var children = _ref.children;
|
|
19892
19462
|
return React.createElement(PickerContextProvider, null, React.createElement(PickerRootElement, null, children));
|
|
19893
19463
|
}
|
|
19894
|
-
|
|
19895
19464
|
function PickerRootElement(_ref2) {
|
|
19896
19465
|
var _cx;
|
|
19897
|
-
|
|
19898
19466
|
var children = _ref2.children;
|
|
19899
19467
|
var theme = useThemeConfig();
|
|
19900
19468
|
var searchModeActive = useIsSearchMode();
|
|
@@ -19904,12 +19472,11 @@ function PickerRootElement(_ref2) {
|
|
|
19904
19472
|
useKeyboardNavigation();
|
|
19905
19473
|
useOnFocus();
|
|
19906
19474
|
return React.createElement("aside", {
|
|
19907
|
-
className: flairup.cx(styles$
|
|
19475
|
+
className: flairup.cx(styles$8.main, styles$8.baseVariables, theme === exports.Theme.DARK && styles$8.darkTheme, theme === exports.Theme.AUTO && styles$8.autoThemeDark, (_cx = {}, _cx[ClassNames.searchActive] = searchModeActive, _cx), className),
|
|
19908
19476
|
ref: PickerMainRef,
|
|
19909
19477
|
style: style
|
|
19910
19478
|
}, children);
|
|
19911
19479
|
}
|
|
19912
|
-
|
|
19913
19480
|
var DarkTheme = {
|
|
19914
19481
|
'--epr-emoji-variation-picker-bg-color': 'var(--epr-dark-emoji-variation-picker-bg-color)',
|
|
19915
19482
|
'--epr-highlight-color': 'var(--epr-dark-highlight-color)',
|
|
@@ -19925,7 +19492,7 @@ var DarkTheme = {
|
|
|
19925
19492
|
'--epr-category-icon-active-color': 'var(--epr-dark-category-icon-active-color)',
|
|
19926
19493
|
'--epr-skin-tone-picker-menu-color': 'var(--epr-dark-skin-tone-picker-menu-color)'
|
|
19927
19494
|
};
|
|
19928
|
-
var styles$
|
|
19495
|
+
var styles$8 = /*#__PURE__*/stylesheet.create({
|
|
19929
19496
|
main: {
|
|
19930
19497
|
'.': ['epr-main', ClassNames.emojiPicker],
|
|
19931
19498
|
position: 'relative',
|
|
@@ -19951,15 +19518,12 @@ var styles$6 = /*#__PURE__*/stylesheet.create({
|
|
|
19951
19518
|
'--epr-skin-tone-picker-menu-color': '#ffffff95',
|
|
19952
19519
|
'--epr-horizontal-padding': '10px',
|
|
19953
19520
|
'--epr-picker-border-radius': '8px',
|
|
19954
|
-
|
|
19955
19521
|
/* Header */
|
|
19956
19522
|
'--epr-search-border-color': 'var(--epr-highlight-color)',
|
|
19957
19523
|
'--epr-header-padding': '15px var(--epr-horizontal-padding)',
|
|
19958
|
-
|
|
19959
19524
|
/* Skin Tone Picker */
|
|
19960
19525
|
'--epr-active-skin-tone-indicator-border-color': 'var(--epr-highlight-color)',
|
|
19961
19526
|
'--epr-active-skin-hover-color': 'var(--epr-hover-bg-color)',
|
|
19962
|
-
|
|
19963
19527
|
/* Search */
|
|
19964
19528
|
'--epr-search-input-bg-color-active': 'var(--epr-search-input-bg-color)',
|
|
19965
19529
|
'--epr-search-input-padding': '0 30px',
|
|
@@ -19968,30 +19532,24 @@ var styles$6 = /*#__PURE__*/stylesheet.create({
|
|
|
19968
19532
|
'--epr-search-input-text-color': 'var(--epr-text-color)',
|
|
19969
19533
|
'--epr-search-input-placeholder-color': 'var(--epr-text-color)',
|
|
19970
19534
|
'--epr-search-bar-inner-padding': 'var(--epr-horizontal-padding)',
|
|
19971
|
-
|
|
19972
19535
|
/* Category Navigation */
|
|
19973
19536
|
'--epr-category-navigation-button-size': '30px',
|
|
19974
|
-
|
|
19975
19537
|
/* Variation Picker */
|
|
19976
19538
|
'--epr-emoji-variation-picker-height': '45px',
|
|
19977
19539
|
'--epr-emoji-variation-picker-bg-color': 'var(--epr-bg-color)',
|
|
19978
|
-
|
|
19979
19540
|
/* Preview */
|
|
19980
19541
|
'--epr-preview-height': '70px',
|
|
19981
19542
|
'--epr-preview-text-size': '14px',
|
|
19982
19543
|
'--epr-preview-text-padding': '0 var(--epr-horizontal-padding)',
|
|
19983
19544
|
'--epr-preview-border-color': 'var(--epr-picker-border-color)',
|
|
19984
19545
|
'--epr-preview-text-color': 'var(--epr-text-color)',
|
|
19985
|
-
|
|
19986
19546
|
/* Category */
|
|
19987
19547
|
'--epr-category-padding': '0 var(--epr-horizontal-padding)',
|
|
19988
|
-
|
|
19989
19548
|
/* Category Label */
|
|
19990
19549
|
'--epr-category-label-bg-color': '#ffffffe6',
|
|
19991
19550
|
'--epr-category-label-text-color': 'var(--epr-text-color)',
|
|
19992
19551
|
'--epr-category-label-padding': '0 var(--epr-horizontal-padding)',
|
|
19993
19552
|
'--epr-category-label-height': '40px',
|
|
19994
|
-
|
|
19995
19553
|
/* Emoji */
|
|
19996
19554
|
'--epr-emoji-size': '30px',
|
|
19997
19555
|
'--epr-emoji-padding': '5px',
|
|
@@ -19999,14 +19557,12 @@ var styles$6 = /*#__PURE__*/stylesheet.create({
|
|
|
19999
19557
|
'--epr-emoji-hover-color': 'var(--epr-hover-bg-color)',
|
|
20000
19558
|
'--epr-emoji-variation-indicator-color': 'var(--epr-picker-border-color)',
|
|
20001
19559
|
'--epr-emoji-variation-indicator-color-hover': 'var(--epr-text-color)',
|
|
20002
|
-
|
|
20003
19560
|
/* Z-Index */
|
|
20004
19561
|
'--epr-header-overlay-z-index': '3',
|
|
20005
19562
|
'--epr-emoji-variations-indictator-z-index': '1',
|
|
20006
19563
|
'--epr-category-label-z-index': '2',
|
|
20007
19564
|
'--epr-skin-variation-picker-z-index': '5',
|
|
20008
19565
|
'--epr-preview-z-index': '6',
|
|
20009
|
-
|
|
20010
19566
|
/* Dark Theme Variables */
|
|
20011
19567
|
'--epr-dark': '#000',
|
|
20012
19568
|
'--epr-dark-emoji-variation-picker-bg-color': 'var(--epr-dark)',
|
|
@@ -20038,12 +19594,10 @@ var styles$6 = /*#__PURE__*/stylesheet.create({
|
|
|
20038
19594
|
|
|
20039
19595
|
function EmojiPicker(props) {
|
|
20040
19596
|
return React.createElement(ElementRefContextProvider, null, React.createElement(PickerConfigProvider, Object.assign({}, props), React.createElement(PickerMain, null, React.createElement(Header, null), React.createElement(Body, null), React.createElement(Preview, null))));
|
|
20041
|
-
}
|
|
20042
|
-
|
|
20043
|
-
|
|
19597
|
+
}
|
|
19598
|
+
// eslint-disable-next-line complexity
|
|
20044
19599
|
var EmojiPickerReact = /*#__PURE__*/React.memo(EmojiPicker, function (prev, next) {
|
|
20045
19600
|
var _prev$customEmojis, _next$customEmojis;
|
|
20046
|
-
|
|
20047
19601
|
var prevCustomEmojis = (_prev$customEmojis = prev.customEmojis) != null ? _prev$customEmojis : [];
|
|
20048
19602
|
var nextCustomEmojis = (_next$customEmojis = next.customEmojis) != null ? _next$customEmojis : [];
|
|
20049
19603
|
return prev.emojiVersion === next.emojiVersion && prev.searchPlaceHolder === next.searchPlaceHolder && prev.searchPlaceholder === next.searchPlaceholder && prev.defaultSkinTone === next.defaultSkinTone && prev.skinTonesDisabled === next.skinTonesDisabled && prev.autoFocusSearch === next.autoFocusSearch && prev.emojiStyle === next.emojiStyle && prev.theme === next.theme && prev.suggestedEmojisMode === next.suggestedEmojisMode && prev.lazyLoadEmojis === next.lazyLoadEmojis && prev.className === next.className && prev.height === next.height && prev.width === next.width && prev.style === next.style && prev.searchDisabled === next.searchDisabled && prev.skinTonePickerLocation === next.skinTonePickerLocation && prevCustomEmojis.length === nextCustomEmojis.length;
|
|
@@ -20051,56 +19605,46 @@ var EmojiPickerReact = /*#__PURE__*/React.memo(EmojiPicker, function (prev, next
|
|
|
20051
19605
|
|
|
20052
19606
|
var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
20053
19607
|
_inheritsLoose(ErrorBoundary, _React$Component);
|
|
20054
|
-
|
|
20055
19608
|
function ErrorBoundary(props) {
|
|
20056
19609
|
var _this;
|
|
20057
|
-
|
|
20058
19610
|
_this = _React$Component.call(this, props) || this;
|
|
20059
19611
|
_this.state = {
|
|
20060
19612
|
hasError: false
|
|
20061
19613
|
};
|
|
20062
19614
|
return _this;
|
|
20063
19615
|
}
|
|
20064
|
-
|
|
20065
19616
|
ErrorBoundary.getDerivedStateFromError = function getDerivedStateFromError() {
|
|
20066
19617
|
return {
|
|
20067
19618
|
hasError: true
|
|
20068
19619
|
};
|
|
20069
19620
|
};
|
|
20070
|
-
|
|
20071
19621
|
var _proto = ErrorBoundary.prototype;
|
|
20072
|
-
|
|
20073
19622
|
_proto.componentDidCatch = function componentDidCatch(error, errorInfo) {
|
|
20074
19623
|
// eslint-disable-next-line no-console
|
|
20075
19624
|
console.error('Emoji Picker React failed to render:', error, errorInfo);
|
|
20076
19625
|
};
|
|
20077
|
-
|
|
20078
19626
|
_proto.render = function render() {
|
|
20079
19627
|
if (this.state.hasError) {
|
|
20080
19628
|
return null;
|
|
20081
19629
|
}
|
|
20082
|
-
|
|
20083
19630
|
return this.props.children;
|
|
20084
19631
|
};
|
|
20085
|
-
|
|
20086
19632
|
return ErrorBoundary;
|
|
20087
19633
|
}(React.Component);
|
|
20088
19634
|
|
|
20089
19635
|
function ExportedEmoji(_ref) {
|
|
20090
19636
|
var unified = _ref.unified,
|
|
20091
|
-
|
|
20092
|
-
|
|
20093
|
-
|
|
20094
|
-
|
|
20095
|
-
|
|
20096
|
-
|
|
20097
|
-
|
|
20098
|
-
|
|
20099
|
-
|
|
19637
|
+
_ref$size = _ref.size,
|
|
19638
|
+
size = _ref$size === void 0 ? 32 : _ref$size,
|
|
19639
|
+
_ref$emojiStyle = _ref.emojiStyle,
|
|
19640
|
+
emojiStyle = _ref$emojiStyle === void 0 ? exports.EmojiStyle.APPLE : _ref$emojiStyle,
|
|
19641
|
+
_ref$lazyLoad = _ref.lazyLoad,
|
|
19642
|
+
lazyLoad = _ref$lazyLoad === void 0 ? false : _ref$lazyLoad,
|
|
19643
|
+
getEmojiUrl = _ref.getEmojiUrl,
|
|
19644
|
+
emojiUrl = _ref.emojiUrl;
|
|
20100
19645
|
if (!unified && !emojiUrl && !getEmojiUrl) {
|
|
20101
19646
|
return null;
|
|
20102
19647
|
}
|
|
20103
|
-
|
|
20104
19648
|
return React.createElement(ViewOnlyEmoji, {
|
|
20105
19649
|
unified: unified,
|
|
20106
19650
|
size: size,
|