emoji-picker-react 4.13.3 → 4.14.0

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.
Files changed (42) hide show
  1. package/dist/DomUtils/elementPositionInRow.d.ts +1 -6
  2. package/dist/components/body/EmojiCategory.d.ts +2 -1
  3. package/dist/components/body/EmojiList.d.ts +3 -1
  4. package/dist/components/context/ElementRefContext.d.ts +1 -0
  5. package/dist/components/emoji/ClickableEmojiButton.d.ts +2 -1
  6. package/dist/components/emoji/Emoji.d.ts +3 -2
  7. package/dist/dataUtils/emojiSelectors.d.ts +1 -1
  8. package/dist/emoji-picker-react.cjs.development.js +615 -544
  9. package/dist/emoji-picker-react.cjs.development.js.map +1 -1
  10. package/dist/emoji-picker-react.cjs.production.min.js +1 -1
  11. package/dist/emoji-picker-react.cjs.production.min.js.map +1 -1
  12. package/dist/emoji-picker-react.esm.js +616 -545
  13. package/dist/emoji-picker-react.esm.js.map +1 -1
  14. package/dist/hooks/preloadEmoji.d.ts +4 -0
  15. package/dist/hooks/useCategoryHeight.d.ts +5 -0
  16. package/dist/hooks/useEmojiVirtualization.d.ts +16 -0
  17. package/dist/hooks/useOnScroll.d.ts +1 -1
  18. package/dist/virtualization/virtualizationHelpers.d.ts +18 -0
  19. package/package.json +2 -1
  20. package/src/DomUtils/elementPositionInRow.ts +8 -131
  21. package/src/DomUtils/keyboardNavigation.ts +62 -48
  22. package/src/components/body/Body.tsx +2 -2
  23. package/src/components/body/EmojiCategory.tsx +7 -5
  24. package/src/components/body/EmojiList.tsx +43 -78
  25. package/src/components/context/ElementRefContext.tsx +8 -0
  26. package/src/components/emoji/ClickableEmojiButton.tsx +4 -1
  27. package/src/components/emoji/Emoji.tsx +4 -1
  28. package/src/components/header/Search/Search.tsx +0 -5
  29. package/src/components/main/PickerMain.tsx +8 -5
  30. package/src/dataUtils/emojiSelectors.ts +29 -3
  31. package/src/hooks/preloadEmoji.ts +49 -7
  32. package/src/hooks/useCategoryHeight.ts +92 -0
  33. package/src/hooks/useEmojiVirtualization.tsx +112 -0
  34. package/src/hooks/useFilter.ts +17 -24
  35. package/src/hooks/useOnScroll.ts +5 -1
  36. package/src/virtualization/virtualizationHelpers.ts +45 -0
  37. package/dist/components/body/Suggested.d.ts +0 -7
  38. package/dist/components/header/Search/CssSearch.d.ts +0 -4
  39. package/dist/globals/doesBrowserSupportCssHas.d.ts +0 -2
  40. package/src/components/body/Suggested.tsx +0 -69
  41. package/src/components/header/Search/CssSearch.tsx +0 -45
  42. package/src/globals/doesBrowserSupportCssHas.ts +0 -16
@@ -197,6 +197,86 @@ function compareConfig(prev, next) {
197
197
  var DEFAULT_REACTIONS = ['1f44d', '2764-fe0f', '1f603', '1f622', '1f64f', '1f44e', '1f621' // 😡
198
198
  ];
199
199
 
200
+ var alphaNumericEmojiIndex = {};
201
+ setTimeout(function () {
202
+ allEmojis.reduce(function (searchIndex, emoji) {
203
+ indexEmoji(emoji);
204
+ return searchIndex;
205
+ }, alphaNumericEmojiIndex);
206
+ });
207
+ function indexEmoji(emoji) {
208
+ var joinedNameString = emojiNames(emoji).flat().join('').toLowerCase().replace(/[^a-zA-Z\d]/g, '').split('');
209
+ joinedNameString.forEach(function (_char) {
210
+ var _alphaNumericEmojiInd;
211
+ alphaNumericEmojiIndex[_char] = (_alphaNumericEmojiInd = alphaNumericEmojiIndex[_char]) != null ? _alphaNumericEmojiInd : {};
212
+ alphaNumericEmojiIndex[_char][emojiUnified(emoji)] = emoji;
213
+ });
214
+ }
215
+
216
+ function useDebouncedState(initialValue, delay) {
217
+ if (delay === void 0) {
218
+ delay = 0;
219
+ }
220
+ var _useState = React.useState(initialValue),
221
+ state = _useState[0],
222
+ setState = _useState[1];
223
+ var timer = React.useRef(null);
224
+ function debouncedSetState(value) {
225
+ return new Promise(function (resolve) {
226
+ var _window;
227
+ if (timer.current) {
228
+ clearTimeout(timer.current);
229
+ }
230
+ timer.current = (_window = window) == null ? void 0 : _window.setTimeout(function () {
231
+ setState(value);
232
+ resolve(value);
233
+ }, delay);
234
+ });
235
+ }
236
+ return [state, debouncedSetState];
237
+ }
238
+
239
+ function useIsUnicodeHidden() {
240
+ var unicodeToHide = useUnicodeToHide();
241
+ return function (emojiUnified) {
242
+ return unicodeToHide.has(emojiUnified);
243
+ };
244
+ }
245
+
246
+ function useDisallowedEmojis() {
247
+ var DisallowedEmojisRef = React.useRef({});
248
+ var emojiVersionConfig = useEmojiVersionConfig();
249
+ return React.useMemo(function () {
250
+ var emojiVersion = parseFloat("" + emojiVersionConfig);
251
+ if (!emojiVersionConfig || Number.isNaN(emojiVersion)) {
252
+ return DisallowedEmojisRef.current;
253
+ }
254
+ return allEmojis.reduce(function (disallowedEmojis, emoji) {
255
+ if (addedInNewerVersion(emoji, emojiVersion)) {
256
+ disallowedEmojis[emojiUnified(emoji)] = true;
257
+ }
258
+ return disallowedEmojis;
259
+ }, DisallowedEmojisRef.current);
260
+ }, [emojiVersionConfig]);
261
+ }
262
+ function useIsEmojiDisallowed() {
263
+ var disallowedEmojis = useDisallowedEmojis();
264
+ var isUnicodeHidden = useIsUnicodeHidden();
265
+ return function isEmojiDisallowed(emoji) {
266
+ var unified = unifiedWithoutSkinTone(emojiUnified(emoji));
267
+ return Boolean(disallowedEmojis[unified] || isUnicodeHidden(unified));
268
+ };
269
+ }
270
+ function addedInNewerVersion(emoji, supportedLevel) {
271
+ return addedIn(emoji) > supportedLevel;
272
+ }
273
+
274
+ function useMarkInitialLoad(dispatch) {
275
+ React.useEffect(function () {
276
+ dispatch(true);
277
+ }, [dispatch]);
278
+ }
279
+
200
280
  (function (SuggestionMode) {
201
281
  SuggestionMode["RECENT"] = "recent";
202
282
  SuggestionMode["FREQUENT"] = "frequent";
@@ -238,6 +318,128 @@ var DEFAULT_REACTIONS = ['1f44d', '2764-fe0f', '1f603', '1f622', '1f64f', '1f44e
238
318
  SkinTonePickerLocation["PREVIEW"] = "PREVIEW";
239
319
  })(exports.SkinTonePickerLocation || (exports.SkinTonePickerLocation = {}));
240
320
 
321
+ function PickerContextProvider(_ref) {
322
+ var children = _ref.children;
323
+ var disallowedEmojis = useDisallowedEmojis();
324
+ var defaultSkinTone = useDefaultSkinToneConfig();
325
+ var reactionsDefaultOpen = useReactionsOpenConfig();
326
+ // Initialize the filter with the inititial dictionary
327
+ var filterRef = React.useRef(alphaNumericEmojiIndex);
328
+ var disallowClickRef = React.useRef(false);
329
+ var disallowMouseRef = React.useRef(false);
330
+ var disallowedEmojisRef = React.useRef(disallowedEmojis);
331
+ var suggestedUpdateState = useDebouncedState(Date.now(), 200);
332
+ var searchTerm = useDebouncedState('', 100);
333
+ var skinToneFanOpenState = React.useState(false);
334
+ var activeSkinTone = React.useState(defaultSkinTone);
335
+ var activeCategoryState = React.useState(null);
336
+ var emojisThatFailedToLoadState = React.useState(new Set());
337
+ var emojiVariationPickerState = React.useState(null);
338
+ var reactionsModeState = React.useState(reactionsDefaultOpen);
339
+ var _useState = React.useState(false),
340
+ isPastInitialLoad = _useState[0],
341
+ setIsPastInitialLoad = _useState[1];
342
+ useMarkInitialLoad(setIsPastInitialLoad);
343
+ return React.createElement(PickerContext.Provider, {
344
+ value: {
345
+ activeCategoryState: activeCategoryState,
346
+ activeSkinTone: activeSkinTone,
347
+ disallowClickRef: disallowClickRef,
348
+ disallowMouseRef: disallowMouseRef,
349
+ disallowedEmojisRef: disallowedEmojisRef,
350
+ emojiVariationPickerState: emojiVariationPickerState,
351
+ emojisThatFailedToLoadState: emojisThatFailedToLoadState,
352
+ filterRef: filterRef,
353
+ isPastInitialLoad: isPastInitialLoad,
354
+ searchTerm: searchTerm,
355
+ skinToneFanOpenState: skinToneFanOpenState,
356
+ suggestedUpdateState: suggestedUpdateState,
357
+ reactionsModeState: reactionsModeState
358
+ }
359
+ }, children);
360
+ }
361
+ var PickerContext = /*#__PURE__*/React.createContext({
362
+ activeCategoryState: [null, function () {}],
363
+ activeSkinTone: [exports.SkinTones.NEUTRAL, function () {}],
364
+ disallowClickRef: {
365
+ current: false
366
+ },
367
+ disallowMouseRef: {
368
+ current: false
369
+ },
370
+ disallowedEmojisRef: {
371
+ current: {}
372
+ },
373
+ emojiVariationPickerState: [null, function () {}],
374
+ emojisThatFailedToLoadState: [/*#__PURE__*/new Set(), function () {}],
375
+ filterRef: {
376
+ current: {}
377
+ },
378
+ isPastInitialLoad: true,
379
+ searchTerm: ['', function () {
380
+ return new Promise(function () {
381
+ return undefined;
382
+ });
383
+ }],
384
+ skinToneFanOpenState: [false, function () {}],
385
+ suggestedUpdateState: [/*#__PURE__*/Date.now(), function () {}],
386
+ reactionsModeState: [false, function () {}]
387
+ });
388
+ function useFilterRef() {
389
+ var _React$useContext = React.useContext(PickerContext),
390
+ filterRef = _React$useContext.filterRef;
391
+ return filterRef;
392
+ }
393
+ function useDisallowClickRef() {
394
+ var _React$useContext2 = React.useContext(PickerContext),
395
+ disallowClickRef = _React$useContext2.disallowClickRef;
396
+ return disallowClickRef;
397
+ }
398
+ function useDisallowMouseRef() {
399
+ var _React$useContext3 = React.useContext(PickerContext),
400
+ disallowMouseRef = _React$useContext3.disallowMouseRef;
401
+ return disallowMouseRef;
402
+ }
403
+ function useReactionsModeState() {
404
+ var _React$useContext4 = React.useContext(PickerContext),
405
+ reactionsModeState = _React$useContext4.reactionsModeState;
406
+ return reactionsModeState;
407
+ }
408
+ function useSearchTermState() {
409
+ var _React$useContext5 = React.useContext(PickerContext),
410
+ searchTerm = _React$useContext5.searchTerm;
411
+ return searchTerm;
412
+ }
413
+ function useActiveSkinToneState() {
414
+ var _React$useContext6 = React.useContext(PickerContext),
415
+ activeSkinTone = _React$useContext6.activeSkinTone;
416
+ return activeSkinTone;
417
+ }
418
+ function useEmojisThatFailedToLoadState() {
419
+ var _React$useContext7 = React.useContext(PickerContext),
420
+ emojisThatFailedToLoadState = _React$useContext7.emojisThatFailedToLoadState;
421
+ return emojisThatFailedToLoadState;
422
+ }
423
+ function useEmojiVariationPickerState() {
424
+ var _React$useContext9 = React.useContext(PickerContext),
425
+ emojiVariationPickerState = _React$useContext9.emojiVariationPickerState;
426
+ return emojiVariationPickerState;
427
+ }
428
+ function useSkinToneFanOpenState() {
429
+ var _React$useContext10 = React.useContext(PickerContext),
430
+ skinToneFanOpenState = _React$useContext10.skinToneFanOpenState;
431
+ return skinToneFanOpenState;
432
+ }
433
+ function useUpdateSuggested() {
434
+ var _React$useContext12 = React.useContext(PickerContext),
435
+ suggestedUpdateState = _React$useContext12.suggestedUpdateState;
436
+ var suggestedUpdated = suggestedUpdateState[0],
437
+ setsuggestedUpdate = suggestedUpdateState[1];
438
+ return [suggestedUpdated, function updateSuggested() {
439
+ setsuggestedUpdate(Date.now());
440
+ }];
441
+ }
442
+
241
443
  var _configByCategory;
242
444
  var categoriesOrdered = [exports.Categories.SUGGESTED, exports.Categories.CUSTOM, exports.Categories.SMILEYS_PEOPLE, exports.Categories.ANIMALS_NATURE, exports.Categories.FOOD_DRINK, exports.Categories.TRAVEL_PLACES, exports.Categories.ACTIVITIES, exports.Categories.OBJECTS, exports.Categories.SYMBOLS, exports.Categories.FLAGS];
243
445
  var SuggestedRecent = {
@@ -17165,56 +17367,107 @@ var EmojiProperties;
17165
17367
  EmojiProperties["imgUrl"] = "imgUrl";
17166
17368
  })(EmojiProperties || (EmojiProperties = {}));
17167
17369
 
17168
- var alphaNumericEmojiIndex = {};
17169
- setTimeout(function () {
17170
- allEmojis.reduce(function (searchIndex, emoji) {
17171
- indexEmoji(emoji);
17172
- return searchIndex;
17173
- }, alphaNumericEmojiIndex);
17174
- });
17175
- function indexEmoji(emoji) {
17176
- var joinedNameString = emojiNames(emoji).flat().join('').toLowerCase().replace(/[^a-zA-Z\d]/g, '').split('');
17177
- joinedNameString.forEach(function (_char) {
17178
- var _alphaNumericEmojiInd;
17179
- alphaNumericEmojiIndex[_char] = (_alphaNumericEmojiInd = alphaNumericEmojiIndex[_char]) != null ? _alphaNumericEmojiInd : {};
17180
- alphaNumericEmojiIndex[_char][emojiUnified(emoji)] = emoji;
17181
- });
17182
- }
17183
-
17184
- function emojiNames(emoji) {
17185
- var _emoji$EmojiPropertie;
17186
- return (_emoji$EmojiPropertie = emoji[EmojiProperties.name]) != null ? _emoji$EmojiPropertie : [];
17187
- }
17188
- function addedIn(emoji) {
17189
- return parseFloat(emoji[EmojiProperties.added_in]);
17190
- }
17191
- function emojiName(emoji) {
17192
- if (!emoji) {
17193
- return '';
17194
- }
17195
- return emojiNames(emoji)[0];
17196
- }
17197
- function unifiedWithoutSkinTone(unified) {
17198
- var splat = unified.split('-');
17199
- var _splat$splice = splat.splice(1, 1),
17200
- skinTone = _splat$splice[0];
17201
- if (skinTonesMapped[skinTone]) {
17202
- return splat.join('-');
17370
+ var SUGGESTED_LS_KEY = 'epr_suggested';
17371
+ function getSuggested(mode) {
17372
+ try {
17373
+ var _window, _window$localStorage$, _window2;
17374
+ if (!((_window = window) != null && _window.localStorage)) {
17375
+ return [];
17376
+ }
17377
+ var recent = JSON.parse((_window$localStorage$ = (_window2 = window) == null ? void 0 : _window2.localStorage.getItem(SUGGESTED_LS_KEY)) != null ? _window$localStorage$ : '[]');
17378
+ if (mode === exports.SuggestionMode.FREQUENT) {
17379
+ return recent.sort(function (a, b) {
17380
+ return b.count - a.count;
17381
+ });
17382
+ }
17383
+ return recent;
17384
+ } catch (_unused) {
17385
+ return [];
17203
17386
  }
17204
- return unified;
17205
17387
  }
17206
- function emojiUnified(emoji, skinTone) {
17207
- var _emojiVariationUnifie;
17388
+ function setSuggested(emoji, skinTone) {
17389
+ var recent = getSuggested();
17390
+ var unified = emojiUnified(emoji, skinTone);
17391
+ var originalUnified = emojiUnified(emoji);
17392
+ var existing = recent.find(function (_ref) {
17393
+ var u = _ref.unified;
17394
+ return u === unified;
17395
+ });
17396
+ var nextList;
17397
+ if (existing) {
17398
+ nextList = [existing].concat(recent.filter(function (i) {
17399
+ return i !== existing;
17400
+ }));
17401
+ } else {
17402
+ existing = {
17403
+ unified: unified,
17404
+ original: originalUnified,
17405
+ count: 0
17406
+ };
17407
+ nextList = [existing].concat(recent);
17408
+ }
17409
+ existing.count++;
17410
+ nextList.length = Math.min(nextList.length, 14);
17411
+ try {
17412
+ var _window3;
17413
+ (_window3 = window) == null ? void 0 : _window3.localStorage.setItem(SUGGESTED_LS_KEY, JSON.stringify(nextList));
17414
+ // Prevents the change from being seen immediately.
17415
+ } catch (_unused2) {
17416
+ // ignore
17417
+ }
17418
+ }
17419
+
17420
+ function emojiNames(emoji) {
17421
+ var _emoji$EmojiPropertie;
17422
+ return (_emoji$EmojiPropertie = emoji[EmojiProperties.name]) != null ? _emoji$EmojiPropertie : [];
17423
+ }
17424
+ function addedIn(emoji) {
17425
+ return parseFloat(emoji[EmojiProperties.added_in]);
17426
+ }
17427
+ function emojiName(emoji) {
17428
+ if (!emoji) {
17429
+ return '';
17430
+ }
17431
+ return emojiNames(emoji)[0];
17432
+ }
17433
+ function unifiedWithoutSkinTone(unified) {
17434
+ var splat = unified.split('-');
17435
+ var _splat$splice = splat.splice(1, 1),
17436
+ skinTone = _splat$splice[0];
17437
+ if (skinTonesMapped[skinTone]) {
17438
+ return splat.join('-');
17439
+ }
17440
+ return unified;
17441
+ }
17442
+ function emojiUnified(emoji, skinTone) {
17443
+ var _emojiVariationUnifie;
17208
17444
  var unified = emoji[EmojiProperties.unified];
17209
17445
  if (!skinTone || !emojiHasVariations(emoji)) {
17210
17446
  return unified;
17211
17447
  }
17212
17448
  return (_emojiVariationUnifie = emojiVariationUnified(emoji, skinTone)) != null ? _emojiVariationUnifie : unified;
17213
17449
  }
17214
- function emojisByCategory(category) {
17215
- var _emojis$category;
17216
- // @ts-ignore
17217
- return (_emojis$category = emojis == null ? void 0 : emojis[category]) != null ? _emojis$category : [];
17450
+ function useGetEmojisByCategory() {
17451
+ var suggestedEmojisModeConfig = useSuggestedEmojisModeConfig();
17452
+ var _useUpdateSuggested = useUpdateSuggested(),
17453
+ suggestedUpdated = _useUpdateSuggested[0];
17454
+ var suggested = React__default.useMemo(function () {
17455
+ var _getSuggested;
17456
+ var suggested = (_getSuggested = getSuggested(suggestedEmojisModeConfig)) != null ? _getSuggested : [];
17457
+ return suggested.map(function (s) {
17458
+ return emojiByUnified(s.unified);
17459
+ }).filter(Boolean);
17460
+ },
17461
+ // eslint-disable-next-line react-hooks/exhaustive-deps
17462
+ [suggestedUpdated, suggestedEmojisModeConfig]);
17463
+ return function getEmojisByCategory(category) {
17464
+ var _emojis$category;
17465
+ if (category === exports.Categories.SUGGESTED) {
17466
+ return suggested;
17467
+ }
17468
+ // @ts-ignore
17469
+ return (_emojis$category = emojis[category]) != null ? _emojis$category : [];
17470
+ };
17218
17471
  }
17219
17472
  // WARNING: DO NOT USE DIRECTLY
17220
17473
  function emojiUrlByUnified(unified, emojiStyle) {
@@ -17375,197 +17628,6 @@ function usePickerConfig() {
17375
17628
  return React.useContext(ConfigContext);
17376
17629
  }
17377
17630
 
17378
- function useDebouncedState(initialValue, delay) {
17379
- if (delay === void 0) {
17380
- delay = 0;
17381
- }
17382
- var _useState = React.useState(initialValue),
17383
- state = _useState[0],
17384
- setState = _useState[1];
17385
- var timer = React.useRef(null);
17386
- function debouncedSetState(value) {
17387
- return new Promise(function (resolve) {
17388
- var _window;
17389
- if (timer.current) {
17390
- clearTimeout(timer.current);
17391
- }
17392
- timer.current = (_window = window) == null ? void 0 : _window.setTimeout(function () {
17393
- setState(value);
17394
- resolve(value);
17395
- }, delay);
17396
- });
17397
- }
17398
- return [state, debouncedSetState];
17399
- }
17400
-
17401
- function useIsUnicodeHidden() {
17402
- var unicodeToHide = useUnicodeToHide();
17403
- return function (emojiUnified) {
17404
- return unicodeToHide.has(emojiUnified);
17405
- };
17406
- }
17407
-
17408
- function useDisallowedEmojis() {
17409
- var DisallowedEmojisRef = React.useRef({});
17410
- var emojiVersionConfig = useEmojiVersionConfig();
17411
- return React.useMemo(function () {
17412
- var emojiVersion = parseFloat("" + emojiVersionConfig);
17413
- if (!emojiVersionConfig || Number.isNaN(emojiVersion)) {
17414
- return DisallowedEmojisRef.current;
17415
- }
17416
- return allEmojis.reduce(function (disallowedEmojis, emoji) {
17417
- if (addedInNewerVersion(emoji, emojiVersion)) {
17418
- disallowedEmojis[emojiUnified(emoji)] = true;
17419
- }
17420
- return disallowedEmojis;
17421
- }, DisallowedEmojisRef.current);
17422
- }, [emojiVersionConfig]);
17423
- }
17424
- function useIsEmojiDisallowed() {
17425
- var disallowedEmojis = useDisallowedEmojis();
17426
- var isUnicodeHidden = useIsUnicodeHidden();
17427
- return function isEmojiDisallowed(emoji) {
17428
- var unified = unifiedWithoutSkinTone(emojiUnified(emoji));
17429
- return Boolean(disallowedEmojis[unified] || isUnicodeHidden(unified));
17430
- };
17431
- }
17432
- function addedInNewerVersion(emoji, supportedLevel) {
17433
- return addedIn(emoji) > supportedLevel;
17434
- }
17435
-
17436
- function useMarkInitialLoad(dispatch) {
17437
- React.useEffect(function () {
17438
- dispatch(true);
17439
- }, [dispatch]);
17440
- }
17441
-
17442
- function PickerContextProvider(_ref) {
17443
- var children = _ref.children;
17444
- var disallowedEmojis = useDisallowedEmojis();
17445
- var defaultSkinTone = useDefaultSkinToneConfig();
17446
- var reactionsDefaultOpen = useReactionsOpenConfig();
17447
- // Initialize the filter with the inititial dictionary
17448
- var filterRef = React.useRef(alphaNumericEmojiIndex);
17449
- var disallowClickRef = React.useRef(false);
17450
- var disallowMouseRef = React.useRef(false);
17451
- var disallowedEmojisRef = React.useRef(disallowedEmojis);
17452
- var suggestedUpdateState = useDebouncedState(Date.now(), 200);
17453
- var searchTerm = useDebouncedState('', 100);
17454
- var skinToneFanOpenState = React.useState(false);
17455
- var activeSkinTone = React.useState(defaultSkinTone);
17456
- var activeCategoryState = React.useState(null);
17457
- var emojisThatFailedToLoadState = React.useState(new Set());
17458
- var emojiVariationPickerState = React.useState(null);
17459
- var reactionsModeState = React.useState(reactionsDefaultOpen);
17460
- var _useState = React.useState(false),
17461
- isPastInitialLoad = _useState[0],
17462
- setIsPastInitialLoad = _useState[1];
17463
- useMarkInitialLoad(setIsPastInitialLoad);
17464
- return React.createElement(PickerContext.Provider, {
17465
- value: {
17466
- activeCategoryState: activeCategoryState,
17467
- activeSkinTone: activeSkinTone,
17468
- disallowClickRef: disallowClickRef,
17469
- disallowMouseRef: disallowMouseRef,
17470
- disallowedEmojisRef: disallowedEmojisRef,
17471
- emojiVariationPickerState: emojiVariationPickerState,
17472
- emojisThatFailedToLoadState: emojisThatFailedToLoadState,
17473
- filterRef: filterRef,
17474
- isPastInitialLoad: isPastInitialLoad,
17475
- searchTerm: searchTerm,
17476
- skinToneFanOpenState: skinToneFanOpenState,
17477
- suggestedUpdateState: suggestedUpdateState,
17478
- reactionsModeState: reactionsModeState
17479
- }
17480
- }, children);
17481
- }
17482
- var PickerContext = /*#__PURE__*/React.createContext({
17483
- activeCategoryState: [null, function () {}],
17484
- activeSkinTone: [exports.SkinTones.NEUTRAL, function () {}],
17485
- disallowClickRef: {
17486
- current: false
17487
- },
17488
- disallowMouseRef: {
17489
- current: false
17490
- },
17491
- disallowedEmojisRef: {
17492
- current: {}
17493
- },
17494
- emojiVariationPickerState: [null, function () {}],
17495
- emojisThatFailedToLoadState: [/*#__PURE__*/new Set(), function () {}],
17496
- filterRef: {
17497
- current: {}
17498
- },
17499
- isPastInitialLoad: true,
17500
- searchTerm: ['', function () {
17501
- return new Promise(function () {
17502
- return undefined;
17503
- });
17504
- }],
17505
- skinToneFanOpenState: [false, function () {}],
17506
- suggestedUpdateState: [/*#__PURE__*/Date.now(), function () {}],
17507
- reactionsModeState: [false, function () {}]
17508
- });
17509
- function useFilterRef() {
17510
- var _React$useContext = React.useContext(PickerContext),
17511
- filterRef = _React$useContext.filterRef;
17512
- return filterRef;
17513
- }
17514
- function useDisallowClickRef() {
17515
- var _React$useContext2 = React.useContext(PickerContext),
17516
- disallowClickRef = _React$useContext2.disallowClickRef;
17517
- return disallowClickRef;
17518
- }
17519
- function useDisallowMouseRef() {
17520
- var _React$useContext3 = React.useContext(PickerContext),
17521
- disallowMouseRef = _React$useContext3.disallowMouseRef;
17522
- return disallowMouseRef;
17523
- }
17524
- function useReactionsModeState() {
17525
- var _React$useContext4 = React.useContext(PickerContext),
17526
- reactionsModeState = _React$useContext4.reactionsModeState;
17527
- return reactionsModeState;
17528
- }
17529
- function useSearchTermState() {
17530
- var _React$useContext5 = React.useContext(PickerContext),
17531
- searchTerm = _React$useContext5.searchTerm;
17532
- return searchTerm;
17533
- }
17534
- function useActiveSkinToneState() {
17535
- var _React$useContext6 = React.useContext(PickerContext),
17536
- activeSkinTone = _React$useContext6.activeSkinTone;
17537
- return activeSkinTone;
17538
- }
17539
- function useEmojisThatFailedToLoadState() {
17540
- var _React$useContext7 = React.useContext(PickerContext),
17541
- emojisThatFailedToLoadState = _React$useContext7.emojisThatFailedToLoadState;
17542
- return emojisThatFailedToLoadState;
17543
- }
17544
- function useIsPastInitialLoad() {
17545
- var _React$useContext8 = React.useContext(PickerContext),
17546
- isPastInitialLoad = _React$useContext8.isPastInitialLoad;
17547
- return isPastInitialLoad;
17548
- }
17549
- function useEmojiVariationPickerState() {
17550
- var _React$useContext9 = React.useContext(PickerContext),
17551
- emojiVariationPickerState = _React$useContext9.emojiVariationPickerState;
17552
- return emojiVariationPickerState;
17553
- }
17554
- function useSkinToneFanOpenState() {
17555
- var _React$useContext10 = React.useContext(PickerContext),
17556
- skinToneFanOpenState = _React$useContext10.skinToneFanOpenState;
17557
- return skinToneFanOpenState;
17558
- }
17559
- function useUpdateSuggested() {
17560
- var _React$useContext12 = React.useContext(PickerContext),
17561
- suggestedUpdateState = _React$useContext12.suggestedUpdateState;
17562
- var suggestedUpdated = suggestedUpdateState[0],
17563
- setsuggestedUpdate = suggestedUpdateState[1];
17564
- return [suggestedUpdated, function updateSuggested() {
17565
- setsuggestedUpdate(Date.now());
17566
- }];
17567
- }
17568
-
17569
17631
  var MutableConfigContext = /*#__PURE__*/React__default.createContext({});
17570
17632
  function useMutableConfig() {
17571
17633
  var mutableConfig = React__default.useContext(MutableConfigContext);
@@ -17800,6 +17862,7 @@ function ElementRefContextProvider(_ref) {
17800
17862
  var PickerMainRef = React.useRef(null);
17801
17863
  var AnchoredEmojiRef = React.useRef(null);
17802
17864
  var BodyRef = React.useRef(null);
17865
+ var EmojiListRef = React.useRef(null);
17803
17866
  var SearchInputRef = React.useRef(null);
17804
17867
  var SkinTonePickerRef = React.useRef(null);
17805
17868
  var CategoryNavigationRef = React.useRef(null);
@@ -17809,6 +17872,7 @@ function ElementRefContextProvider(_ref) {
17809
17872
  value: {
17810
17873
  AnchoredEmojiRef: AnchoredEmojiRef,
17811
17874
  BodyRef: BodyRef,
17875
+ EmojiListRef: EmojiListRef,
17812
17876
  CategoryNavigationRef: CategoryNavigationRef,
17813
17877
  PickerMainRef: PickerMainRef,
17814
17878
  SearchInputRef: SearchInputRef,
@@ -17822,6 +17886,7 @@ var ElementRefContext = /*#__PURE__*/React.createContext({
17822
17886
  AnchoredEmojiRef: /*#__PURE__*/React.createRef(),
17823
17887
  BodyRef: /*#__PURE__*/React.createRef(),
17824
17888
  CategoryNavigationRef: /*#__PURE__*/React.createRef(),
17889
+ EmojiListRef: /*#__PURE__*/React.createRef(),
17825
17890
  PickerMainRef: /*#__PURE__*/React.createRef(),
17826
17891
  SearchInputRef: /*#__PURE__*/React.createRef(),
17827
17892
  SkinTonePickerRef: /*#__PURE__*/React.createRef(),
@@ -17831,6 +17896,9 @@ var ElementRefContext = /*#__PURE__*/React.createContext({
17831
17896
  function useElementRef() {
17832
17897
  return React.useContext(ElementRefContext);
17833
17898
  }
17899
+ function useEmojiListRef() {
17900
+ return useElementRef()['EmojiListRef'];
17901
+ }
17834
17902
  function usePickerMainRef() {
17835
17903
  return useElementRef()['PickerMainRef'];
17836
17904
  }
@@ -17967,38 +18035,67 @@ function visibleEmojiOneRowUp(element) {
17967
18035
  }
17968
18036
  var categoryContent = closestCategoryContent(element);
17969
18037
  var category = closestCategory(categoryContent);
17970
- var indexInRow = elementIndexInRow(categoryContent, element);
17971
- var row = rowNumber(categoryContent, element);
17972
18038
  var countInRow = elementCountInRow(categoryContent, element);
17973
- if (row === 0) {
17974
- var prevVisibleCategory = prevCategory(category);
17975
- if (!prevVisibleCategory) {
17976
- return null;
18039
+ var emojisInCurrentCategory = allVisibleEmojis(category);
18040
+ var currentEmojiIndex = emojisInCurrentCategory.indexOf(element);
18041
+ var indexInRow = currentEmojiIndex % countInRow;
18042
+ if (currentEmojiIndex === -1) {
18043
+ return null;
18044
+ }
18045
+ if (emojisInCurrentCategory[currentEmojiIndex - countInRow]) {
18046
+ return emojisInCurrentCategory[currentEmojiIndex - countInRow];
18047
+ }
18048
+ var prevVisibleCategory = prevCategory(category);
18049
+ if (!prevVisibleCategory) {
18050
+ return null;
18051
+ }
18052
+ var allPrevEmojis = allVisibleEmojis(prevVisibleCategory);
18053
+ // if there is an emoji in the same index of `indexInRow` in the previous category, return it
18054
+ // for this we need to find the last emoji in the previous category that shares the same indexInRow
18055
+ // this is by using the % operator to find the last emoji that matches
18056
+ var lastIndexInRow = allPrevEmojis.length % countInRow - 1;
18057
+ if (indexInRow > lastIndexInRow) {
18058
+ return allPrevEmojis.at(-1);
18059
+ }
18060
+ // otherwise, return the last emoji that shares the same indexInRow
18061
+ for (var i = allPrevEmojis.length - 1; i >= 0; i--) {
18062
+ if (i % countInRow === indexInRow) {
18063
+ return allPrevEmojis[i];
17977
18064
  }
17978
- return getElementInRow(allVisibleEmojis(prevVisibleCategory), -1,
17979
- // last row
17980
- countInRow, indexInRow);
17981
18065
  }
17982
- return getElementInPrevRow(allVisibleEmojis(categoryContent), row, countInRow, indexInRow);
18066
+ return allPrevEmojis.at(-1);
17983
18067
  }
17984
18068
  function visibleEmojiOneRowDown(element) {
18069
+ var _emojisInNextCategory;
17985
18070
  if (!element) {
17986
18071
  return null;
17987
18072
  }
17988
18073
  var categoryContent = closestCategoryContent(element);
17989
18074
  var category = closestCategory(categoryContent);
17990
- var indexInRow = elementIndexInRow(categoryContent, element);
17991
- var row = rowNumber(categoryContent, element);
17992
18075
  var countInRow = elementCountInRow(categoryContent, element);
17993
- if (!hasNextRow(categoryContent, element)) {
17994
- var nextVisibleCategory = nextCategory(category);
17995
- if (!nextVisibleCategory) {
17996
- return null;
18076
+ var emojisInCurrentCategory = allVisibleEmojis(category);
18077
+ var currentEmojiIndex = emojisInCurrentCategory.indexOf(element);
18078
+ if (currentEmojiIndex === -1) {
18079
+ return null;
18080
+ }
18081
+ // the remainder until the end of the row
18082
+ var remainder = countInRow - currentEmojiIndex % countInRow - 1;
18083
+ var firstInNextRow = currentEmojiIndex + remainder + 1;
18084
+ if (emojisInCurrentCategory[firstInNextRow]) {
18085
+ // if we have a next row, search in the next row for the last available emoji
18086
+ for (var p = currentEmojiIndex + countInRow; p % countInRow >= 0; p--) {
18087
+ if (emojisInCurrentCategory[p]) {
18088
+ return emojisInCurrentCategory[p];
18089
+ }
17997
18090
  }
17998
- return getElementInRow(allVisibleEmojis(nextVisibleCategory), 0, countInRow, indexInRow);
17999
18091
  }
18000
- var itemInNextRow = getElementInNextRow(allVisibleEmojis(categoryContent), row, countInRow, indexInRow);
18001
- return itemInNextRow;
18092
+ var indexInRow = currentEmojiIndex % countInRow;
18093
+ var nextVisibleCategory = nextCategory(category);
18094
+ var emojisInNextCategory = allVisibleEmojis(nextVisibleCategory);
18095
+ if (emojisInNextCategory[indexInRow]) {
18096
+ return emojisInNextCategory[indexInRow];
18097
+ }
18098
+ return (_emojisInNextCategory = emojisInNextCategory.at(0)) != null ? _emojisInNextCategory : null;
18002
18099
  }
18003
18100
 
18004
18101
  function useCloseAllOpenToggles() {
@@ -18066,19 +18163,6 @@ function useOnMouseMove() {
18066
18163
  }, [BodyRef, allowMouseMove, isMouseDisallowed]);
18067
18164
  }
18068
18165
 
18069
- function doesBrowserSupportCssHas() {
18070
- // if env is not browser:
18071
- if (typeof window === 'undefined' || typeof window.CSS === 'undefined') {
18072
- return false;
18073
- }
18074
- try {
18075
- return CSS.supports('selector(:has(*))');
18076
- } catch (e) {
18077
- return false;
18078
- }
18079
- }
18080
- var browserSupportsCssHas = /*#__PURE__*/doesBrowserSupportCssHas();
18081
-
18082
18166
  function useFocusSearchInput() {
18083
18167
  var SearchInputRef = useSearchInputRef();
18084
18168
  return React.useCallback(function () {
@@ -18152,27 +18236,22 @@ function useFilter() {
18152
18236
  statusSearchResults: statusSearchResults
18153
18237
  };
18154
18238
  function onChange(inputValue) {
18155
- if (browserSupportsCssHas) {
18156
- return;
18239
+ var filter = filterRef.current;
18240
+ var nextValue = inputValue.toLowerCase();
18241
+ if (filter != null && filter[nextValue] || nextValue.length <= 1) {
18242
+ return applySearch(nextValue);
18157
18243
  }
18158
- setTimeout(function () {
18159
- var filter = filterRef.current;
18160
- var nextValue = inputValue.toLowerCase();
18161
- if (filter != null && filter[nextValue] || nextValue.length <= 1) {
18162
- return applySearch(nextValue);
18163
- }
18164
- var longestMatch = findLongestMatch(nextValue, filter);
18165
- if (!longestMatch) {
18166
- // Can we even get here?
18167
- // If so, we need to search among all emojis
18168
- return applySearch(nextValue);
18169
- }
18170
- setFilterRef(function (current) {
18171
- var _Object$assign;
18172
- return Object.assign(current, (_Object$assign = {}, _Object$assign[nextValue] = filterEmojiObjectByKeyword(longestMatch, nextValue), _Object$assign));
18173
- });
18174
- applySearch(nextValue);
18244
+ var longestMatch = findLongestMatch(nextValue, filter);
18245
+ if (!longestMatch) {
18246
+ // Can we even get here?
18247
+ // If so, we need to search among all emojis
18248
+ return applySearch(nextValue);
18249
+ }
18250
+ setFilterRef(function (current) {
18251
+ var _Object$assign;
18252
+ return Object.assign(current, (_Object$assign = {}, _Object$assign[nextValue] = filterEmojiObjectByKeyword(longestMatch, nextValue), _Object$assign));
18175
18253
  });
18254
+ applySearch(nextValue);
18176
18255
  }
18177
18256
  }
18178
18257
  function useApplySearch() {
@@ -18616,22 +18695,44 @@ function hasModifier(event) {
18616
18695
  return metaKey || ctrlKey || altKey;
18617
18696
  }
18618
18697
 
18619
- function preloadEmoji(getEmojiUrl, emoji, emojiStyle) {
18698
+ // eslint-disable-next-line max-params
18699
+ function preloaEmojidIfNeeded(emoji, emojiStyles, scrollTop, clientHeight, topOffset, style, dimensions, getEmojiUrl) {
18620
18700
  if (!emoji) {
18621
18701
  return;
18622
18702
  }
18623
- if (emojiStyle === exports.EmojiStyle.NATIVE) {
18703
+ if (emojiStyles === exports.EmojiStyle.NATIVE) {
18704
+ return;
18705
+ }
18706
+ var unified = emojiUnified(emoji);
18707
+ if (preloadedEmojs.has(unified)) {
18708
+ return;
18709
+ }
18710
+ // preload only if the emoji is a few rows below the viewport
18711
+ if (!style || !dimensions) {
18712
+ return;
18713
+ }
18714
+ setTimeout(function () {
18715
+ var emojiTop = topOffset + style.top;
18716
+ var viewportBottom = scrollTop + clientHeight;
18717
+ var isJustBelowViewport = emojiTop >= viewportBottom && emojiTop < viewportBottom + dimensions.emojiSize * 2;
18718
+ if (isJustBelowViewport) {
18719
+ preloadEmoji(getEmojiUrl, emoji, emojiStyles);
18720
+ }
18721
+ });
18722
+ }
18723
+ function preloadEmoji(getEmojiUrl, emoji, emojiStyle) {
18724
+ if (!emoji) {
18624
18725
  return;
18625
18726
  }
18626
18727
  var unified = emojiUnified(emoji);
18627
18728
  if (preloadedEmojs.has(unified)) {
18628
18729
  return;
18629
18730
  }
18630
- emojiVariations(emoji).forEach(function (variation) {
18731
+ preloadedEmojs.add(unified);
18732
+ emojiVariations(emoji).concat(unified).forEach(function (variation) {
18631
18733
  var emojiUrl = getEmojiUrl(variation, emojiStyle);
18632
18734
  preloadImage(emojiUrl);
18633
18735
  });
18634
- preloadedEmojs.add(unified);
18635
18736
  }
18636
18737
  var preloadedEmojs = /*#__PURE__*/new Set();
18637
18738
  function preloadImage(url) {
@@ -18731,7 +18832,7 @@ var styles = /*#__PURE__*/stylesheet.create({
18731
18832
  borderColor: 'var(--epr-picker-border-color)',
18732
18833
  backgroundColor: 'var(--epr-bg-color)',
18733
18834
  overflow: 'hidden',
18734
- transition: 'all 0.3s ease-in-out, background-color 0.1s ease-in-out',
18835
+ transition: 'height 0.3s ease-in-out, background-color 0.1s ease-in-out',
18735
18836
  '*': {
18736
18837
  boxSizing: 'border-box',
18737
18838
  fontFamily: 'sans-serif'
@@ -18851,65 +18952,6 @@ function elementCountInRow(parent, element) {
18851
18952
  var elementWidth = element.getBoundingClientRect().width;
18852
18953
  return Math.floor(parentWidth / elementWidth);
18853
18954
  }
18854
- function elementIndexInRow(parent, element) {
18855
- if (!parent || !element) {
18856
- return 0;
18857
- }
18858
- var elementWidth = element.getBoundingClientRect().width;
18859
- var elementLeft = element.getBoundingClientRect().left;
18860
- var parentLeft = parent.getBoundingClientRect().left;
18861
- return Math.floor((elementLeft - parentLeft) / elementWidth);
18862
- }
18863
- function rowNumber(parent, element) {
18864
- if (!parent || !element) {
18865
- return 0;
18866
- }
18867
- var elementHeight = element.getBoundingClientRect().height;
18868
- var elementTop = element.getBoundingClientRect().top;
18869
- var parentTop = parent.getBoundingClientRect().top;
18870
- return Math.round((elementTop - parentTop) / elementHeight);
18871
- }
18872
- function hasNextRow(parent, element) {
18873
- if (!parent || !element) {
18874
- return false;
18875
- }
18876
- var elementHeight = element.getBoundingClientRect().height;
18877
- var elementTop = element.getBoundingClientRect().top;
18878
- var parentTop = parent.getBoundingClientRect().top;
18879
- var parentHeight = parent.getBoundingClientRect().height;
18880
- return Math.round(elementTop - parentTop + elementHeight) < parentHeight;
18881
- }
18882
- function getRowElements(elements, row, elementsInRow) {
18883
- if (row === -1) {
18884
- var lastRow = Math.floor((elements.length - 1) / elementsInRow);
18885
- var firstElementIndex = lastRow * elementsInRow;
18886
- var lastElementIndex = elements.length - 1;
18887
- return elements.slice(firstElementIndex, lastElementIndex + 1);
18888
- }
18889
- return elements.slice(row * elementsInRow, (row + 1) * elementsInRow);
18890
- }
18891
- function getNextRowElements(allElements, currentRow, elementsInRow) {
18892
- var nextRow = currentRow + 1;
18893
- if (nextRow * elementsInRow > allElements.length) {
18894
- return [];
18895
- }
18896
- return getRowElements(allElements, nextRow, elementsInRow);
18897
- }
18898
- function getElementInRow(elements, row, elementsInRow, indexInRow) {
18899
- var rowElements = getRowElements(elements, row, elementsInRow);
18900
- // get element, default to last
18901
- return rowElements[indexInRow] || rowElements[rowElements.length - 1] || null;
18902
- }
18903
- function getElementInNextRow(allElements, currentRow, elementsInRow, index) {
18904
- var nextRowElements = getNextRowElements(allElements, currentRow, elementsInRow);
18905
- // return item in index, or last item in row
18906
- return nextRowElements[index] || nextRowElements[nextRowElements.length - 1] || null;
18907
- }
18908
- function getElementInPrevRow(allElements, currentRow, elementsInRow, index) {
18909
- var prevRowElements = getRowElements(allElements, currentRow - 1, elementsInRow);
18910
- // default to last
18911
- return prevRowElements[index] || prevRowElements[prevRowElements.length - 1] || null;
18912
- }
18913
18955
  function firstVisibleElementInContainer(parent, elements, maxVisibilityDiffThreshold) {
18914
18956
  if (maxVisibilityDiffThreshold === void 0) {
18915
18957
  maxVisibilityDiffThreshold = 0;
@@ -18937,15 +18979,17 @@ function hasNextElementSibling(element) {
18937
18979
  return !!element.nextElementSibling;
18938
18980
  }
18939
18981
  function getLabelHeight(parentNode) {
18940
- var labels = Array.from(parentNode.querySelectorAll(asSelectors(ClassNames.label)));
18941
- for (var _i = 0, _labels = labels; _i < _labels.length; _i++) {
18942
- var label = _labels[_i];
18982
+ if (!parentNode) {
18983
+ return DEFAULT_LABEL_HEIGHT;
18984
+ }
18985
+ var label = parentNode.querySelector(asSelectors(ClassNames.label));
18986
+ if (label) {
18943
18987
  var height = label.getBoundingClientRect().height;
18944
- // return height if label is not hidden
18945
18988
  if (height > 0) {
18946
18989
  return height;
18947
18990
  }
18948
18991
  }
18992
+ // fallback to default
18949
18993
  return DEFAULT_LABEL_HEIGHT;
18950
18994
  }
18951
18995
 
@@ -19161,56 +19205,6 @@ function parseNativeEmoji(unified) {
19161
19205
  }).join('');
19162
19206
  }
19163
19207
 
19164
- var SUGGESTED_LS_KEY = 'epr_suggested';
19165
- function getSuggested(mode) {
19166
- try {
19167
- var _window, _window$localStorage$, _window2;
19168
- if (!((_window = window) != null && _window.localStorage)) {
19169
- return [];
19170
- }
19171
- var recent = JSON.parse((_window$localStorage$ = (_window2 = window) == null ? void 0 : _window2.localStorage.getItem(SUGGESTED_LS_KEY)) != null ? _window$localStorage$ : '[]');
19172
- if (mode === exports.SuggestionMode.FREQUENT) {
19173
- return recent.sort(function (a, b) {
19174
- return b.count - a.count;
19175
- });
19176
- }
19177
- return recent;
19178
- } catch (_unused) {
19179
- return [];
19180
- }
19181
- }
19182
- function setSuggested(emoji, skinTone) {
19183
- var recent = getSuggested();
19184
- var unified = emojiUnified(emoji, skinTone);
19185
- var originalUnified = emojiUnified(emoji);
19186
- var existing = recent.find(function (_ref) {
19187
- var u = _ref.unified;
19188
- return u === unified;
19189
- });
19190
- var nextList;
19191
- if (existing) {
19192
- nextList = [existing].concat(recent.filter(function (i) {
19193
- return i !== existing;
19194
- }));
19195
- } else {
19196
- existing = {
19197
- unified: unified,
19198
- original: originalUnified,
19199
- count: 0
19200
- };
19201
- nextList = [existing].concat(recent);
19202
- }
19203
- existing.count++;
19204
- nextList.length = Math.min(nextList.length, 14);
19205
- try {
19206
- var _window3;
19207
- (_window3 = window) == null ? void 0 : _window3.localStorage.setItem(SUGGESTED_LS_KEY, JSON.stringify(nextList));
19208
- // Prevents the change from being seen immediately.
19209
- } catch (_unused2) {
19210
- // ignore
19211
- }
19212
- }
19213
-
19214
19208
  function isCustomCategory(category) {
19215
19209
  return category.category === exports.Categories.CUSTOM;
19216
19210
  }
@@ -19373,12 +19367,14 @@ function ClickableEmojiButton(_ref) {
19373
19367
  children = _ref.children,
19374
19368
  className = _ref.className,
19375
19369
  _ref$noBackground = _ref.noBackground,
19376
- noBackground = _ref$noBackground === void 0 ? false : _ref$noBackground;
19370
+ noBackground = _ref$noBackground === void 0 ? false : _ref$noBackground,
19371
+ style = _ref.style;
19377
19372
  return React.createElement(Button, {
19378
19373
  className: flairup.cx(styles$2.emoji, hidden && commonStyles.hidden, hiddenOnSearch && commonInteractionStyles.hiddenOnSearch, (_cx = {}, _cx[ClassNames.visible] = !hidden && !hiddenOnSearch, _cx), !!(hasVariations && showVariations) && styles$2.hasVariations, noBackground && styles$2.noBackground, className),
19379
19374
  "data-unified": unified,
19380
19375
  "aria-label": getAriaLabel(emojiNames),
19381
- "data-full-name": emojiNames
19376
+ "data-full-name": emojiNames,
19377
+ style: style
19382
19378
  }, children);
19383
19379
  }
19384
19380
  function getAriaLabel(emojiNames) {
@@ -19568,7 +19564,8 @@ function ClickableEmoji(_ref) {
19568
19564
  getEmojiUrl = _ref.getEmojiUrl,
19569
19565
  className = _ref.className,
19570
19566
  _ref$noBackground = _ref.noBackground,
19571
- noBackground = _ref$noBackground === void 0 ? false : _ref$noBackground;
19567
+ noBackground = _ref$noBackground === void 0 ? false : _ref$noBackground,
19568
+ style = _ref.style;
19572
19569
  var hasVariations = emojiHasVariations(emoji);
19573
19570
  return React.createElement(ClickableEmojiButton, {
19574
19571
  hasVariations: hasVariations,
@@ -19577,7 +19574,8 @@ function ClickableEmoji(_ref) {
19577
19574
  hiddenOnSearch: hiddenOnSearch,
19578
19575
  emojiNames: emojiNames(emoji),
19579
19576
  unified: unified,
19580
- noBackground: noBackground
19577
+ noBackground: noBackground,
19578
+ style: style
19581
19579
  }, React.createElement(ViewOnlyEmoji, {
19582
19580
  unified: unified,
19583
19581
  emoji: emoji,
@@ -19707,6 +19705,9 @@ var styles$6 = /*#__PURE__*/stylesheet.create({
19707
19705
 
19708
19706
  function useOnScroll(BodyRef) {
19709
19707
  var closeAllOpenToggles = useCloseAllOpenToggles();
19708
+ var _useState = React.useState(0),
19709
+ scrollTop = _useState[0],
19710
+ setScrollTop = _useState[1];
19710
19711
  React.useEffect(function () {
19711
19712
  var bodyRef = BodyRef.current;
19712
19713
  if (!bodyRef) {
@@ -19716,12 +19717,99 @@ function useOnScroll(BodyRef) {
19716
19717
  passive: true
19717
19718
  });
19718
19719
  function onScroll() {
19720
+ var _bodyRef$scrollTop;
19721
+ setScrollTop((_bodyRef$scrollTop = bodyRef == null ? void 0 : bodyRef.scrollTop) != null ? _bodyRef$scrollTop : 0);
19719
19722
  closeAllOpenToggles();
19720
19723
  }
19721
19724
  return function () {
19722
19725
  bodyRef == null ? void 0 : bodyRef.removeEventListener('scroll', onScroll);
19723
19726
  };
19724
19727
  }, [BodyRef, closeAllOpenToggles]);
19728
+ return scrollTop;
19729
+ }
19730
+
19731
+ function shouldVirtualize(_ref) {
19732
+ var scrollTop = _ref.scrollTop,
19733
+ clientHeight = _ref.clientHeight,
19734
+ topOffset = _ref.topOffset,
19735
+ style = _ref.style,
19736
+ dimensions = _ref.dimensions;
19737
+ if (!style || !dimensions) {
19738
+ return false;
19739
+ }
19740
+ var emojiTop = topOffset + style.top;
19741
+ var emojiBottom = emojiTop + dimensions.emojiSize;
19742
+ var isVisible = emojiBottom + dimensions.emojiSize * 2 >= scrollTop && emojiTop <= scrollTop + clientHeight + dimensions.emojiSize;
19743
+ return !isVisible;
19744
+ }
19745
+ function getEmojiPositionStyle(dimensions, index) {
19746
+ return dimensions ? {
19747
+ top: Math.floor(index / dimensions.emojisPerRow) * dimensions.emojiSize,
19748
+ left: index % dimensions.emojisPerRow * dimensions.emojiSize
19749
+ } : undefined;
19750
+ }
19751
+
19752
+ var EMOJI_SIZE_DEFAULT = 32;
19753
+ function useCategoryHeight(emojiCount) {
19754
+ var EmojiListRef = useEmojiListRef();
19755
+ var _useReactionsModeStat = useReactionsModeState(),
19756
+ isReactionsMode = _useReactionsModeStat[0];
19757
+ var PickerMainRef = usePickerMainRef();
19758
+ var emojiSizeRef = React.useRef();
19759
+ var _React$useState = React.useState(),
19760
+ dimensions = _React$useState[0],
19761
+ setDimensions = _React$useState[1];
19762
+ // Helper to compute and store dimensions based on current DOM
19763
+ var computeAndSetDimensions = React.useCallback(function () {
19764
+ var _ref;
19765
+ var listEl = EmojiListRef.current;
19766
+ if (!listEl) return;
19767
+ var emojiElement = listEl.querySelector(EmojiButtonSelector);
19768
+ var measured = emojiElement == null ? void 0 : emojiElement.clientHeight;
19769
+ var emojiSize = (_ref = measured != null ? measured : emojiSizeRef.current) != null ? _ref : EMOJI_SIZE_DEFAULT;
19770
+ emojiSizeRef.current = emojiSize;
19771
+ var pickerWidth = listEl.clientWidth;
19772
+ if (pickerWidth === 0 || emojiSize === 0) return;
19773
+ var emojisPerRow = Math.max(1, Math.floor(pickerWidth / emojiSize));
19774
+ var rowCount = Math.ceil(emojiCount / emojisPerRow);
19775
+ var categoryHeight = rowCount * emojiSize;
19776
+ setDimensions({
19777
+ categoryHeight: categoryHeight,
19778
+ emojisPerRow: emojisPerRow,
19779
+ emojiSize: emojiSize
19780
+ });
19781
+ }, [EmojiListRef, emojiCount]);
19782
+ // Recompute on data-count changes and when reactions mode toggles
19783
+ React.useEffect(function () {
19784
+ computeAndSetDimensions();
19785
+ }, [emojiCount, isReactionsMode, computeAndSetDimensions]);
19786
+ // Listen to transitionend on the picker root (where height transition occurs)
19787
+ React.useEffect(function () {
19788
+ var rootEl = PickerMainRef.current;
19789
+ if (!rootEl) return;
19790
+ var handler = function handler(e) {
19791
+ var te = e;
19792
+ var prop = te.propertyName;
19793
+ if (prop === 'width' || prop === 'max-width' || prop === 'min-width' || prop === 'height' || prop === 'max-height' || prop === 'min-height') {
19794
+ if (typeof queueMicrotask === 'function') {
19795
+ queueMicrotask(function () {
19796
+ return computeAndSetDimensions();
19797
+ });
19798
+ } else {
19799
+ requestAnimationFrame(function () {
19800
+ return computeAndSetDimensions();
19801
+ });
19802
+ }
19803
+ }
19804
+ };
19805
+ rootEl.addEventListener('transitionend', handler, {
19806
+ passive: true
19807
+ });
19808
+ return function () {
19809
+ rootEl.removeEventListener('transitionend', handler);
19810
+ };
19811
+ }, [PickerMainRef, computeAndSetDimensions]);
19812
+ return dimensions;
19725
19813
  }
19726
19814
 
19727
19815
  function useIsEmojiHidden() {
@@ -19740,11 +19828,78 @@ function useIsEmojiHidden() {
19740
19828
  };
19741
19829
  }
19742
19830
 
19831
+ function useEmojiVirtualization(_ref) {
19832
+ var categoryEmojis = _ref.categoryEmojis,
19833
+ topOffset = _ref.topOffset,
19834
+ onHeightReady = _ref.onHeightReady,
19835
+ scrollTop = _ref.scrollTop;
19836
+ var isEmojiHidden = useIsEmojiHidden();
19837
+ var lazyLoadEmojis = useLazyLoadEmojisConfig();
19838
+ var emojiStyle = useEmojiStyleConfig();
19839
+ var _useActiveSkinToneSta = useActiveSkinToneState(),
19840
+ activeSkinTone = _useActiveSkinToneSta[0];
19841
+ var isEmojiDisallowed = useIsEmojiDisallowed();
19842
+ var getEmojiUrl = useGetEmojiUrlConfig();
19843
+ var showVariations = !useSkinTonesDisabledConfig();
19844
+ var BodyRef = useBodyRef();
19845
+ var virtualizedCounter = 0;
19846
+ var emojisToPush = categoryEmojis.filter(function (emoji) {
19847
+ var isDisallowed = isEmojiDisallowed(emoji);
19848
+ var _isEmojiHidden = isEmojiHidden(emoji),
19849
+ failedToLoad = _isEmojiHidden.failedToLoad,
19850
+ filteredOut = _isEmojiHidden.filteredOut,
19851
+ hidden = _isEmojiHidden.hidden;
19852
+ return !failedToLoad && !filteredOut && !hidden && !isDisallowed;
19853
+ });
19854
+ var dimensions = useCategoryHeight(emojisToPush.length);
19855
+ React.useEffect(function () {
19856
+ if (dimensions) {
19857
+ onHeightReady(dimensions.categoryHeight);
19858
+ }
19859
+ }, [dimensions, onHeightReady, emojisToPush.length]);
19860
+ var emojis = emojisToPush.reduce(function (accumulator, emoji, index) {
19861
+ var _BodyRef$current$clie, _BodyRef$current;
19862
+ var unified = emojiUnified(emoji, activeSkinTone);
19863
+ var style = getEmojiPositionStyle(dimensions, index);
19864
+ if (dimensions && BodyRef.current && shouldVirtualize({
19865
+ scrollTop: scrollTop,
19866
+ clientHeight: (_BodyRef$current$clie = (_BodyRef$current = BodyRef.current) == null ? void 0 : _BodyRef$current.clientHeight) != null ? _BodyRef$current$clie : 0,
19867
+ topOffset: topOffset,
19868
+ style: style,
19869
+ dimensions: dimensions
19870
+ })) {
19871
+ var _BodyRef$current$clie2, _BodyRef$current2;
19872
+ virtualizedCounter++;
19873
+ preloaEmojidIfNeeded(emoji, emojiStyle, scrollTop, (_BodyRef$current$clie2 = (_BodyRef$current2 = BodyRef.current) == null ? void 0 : _BodyRef$current2.clientHeight) != null ? _BodyRef$current$clie2 : 0, topOffset, style, dimensions, getEmojiUrl);
19874
+ return accumulator;
19875
+ }
19876
+ accumulator.push(React.createElement(ClickableEmoji, {
19877
+ showVariations: showVariations,
19878
+ key: unified,
19879
+ emoji: emoji,
19880
+ unified: unified,
19881
+ emojiStyle: emojiStyle,
19882
+ lazyLoad: lazyLoadEmojis,
19883
+ getEmojiUrl: getEmojiUrl,
19884
+ style: _extends({}, style, {
19885
+ position: 'absolute'
19886
+ })
19887
+ }));
19888
+ return accumulator;
19889
+ }, []);
19890
+ return {
19891
+ virtualizedCounter: virtualizedCounter,
19892
+ emojis: emojis,
19893
+ dimensions: dimensions
19894
+ };
19895
+ }
19896
+
19743
19897
  function EmojiCategory(_ref) {
19744
19898
  var categoryConfig = _ref.categoryConfig,
19745
19899
  children = _ref.children,
19746
19900
  hidden = _ref.hidden,
19747
- hiddenOnSearch = _ref.hiddenOnSearch;
19901
+ hiddenOnSearch = _ref.hiddenOnSearch,
19902
+ height = _ref.height;
19748
19903
  var category = categoryFromCategoryConfig(categoryConfig);
19749
19904
  var categoryName = categoryNameFromCategoryConfig(categoryConfig);
19750
19905
  return React.createElement("li", {
@@ -19754,15 +19909,16 @@ function EmojiCategory(_ref) {
19754
19909
  }, React.createElement("h2", {
19755
19910
  className: flairup.cx(styles$7.label)
19756
19911
  }, categoryName), React.createElement("div", {
19757
- className: flairup.cx(styles$7.categoryContent)
19912
+ className: flairup.cx(styles$7.categoryContent),
19913
+ style: {
19914
+ height: height
19915
+ }
19758
19916
  }, children));
19759
19917
  }
19760
19918
  var styles$7 = /*#__PURE__*/stylesheet.create({
19761
19919
  category: {
19762
19920
  '.': ClassNames.category,
19763
- ':not(:has(.epr-visible))': {
19764
- display: 'none'
19765
- }
19921
+ position: 'relative'
19766
19922
  },
19767
19923
  categoryContent: {
19768
19924
  '.': ClassNames.categoryContent,
@@ -19794,131 +19950,65 @@ var styles$7 = /*#__PURE__*/stylesheet.create({
19794
19950
  }
19795
19951
  });
19796
19952
 
19797
- var isEverMounted = false;
19798
- function useIsEverMounted() {
19799
- var _React$useState = React.useState(isEverMounted),
19800
- isMounted = _React$useState[0],
19801
- setIsMounted = _React$useState[1];
19802
- React.useEffect(function () {
19803
- setIsMounted(true);
19804
- isEverMounted = true;
19805
- }, []);
19806
- return isMounted || isEverMounted;
19807
- }
19808
-
19809
- function Suggested(_ref) {
19810
- var categoryConfig = _ref.categoryConfig;
19811
- var _useUpdateSuggested = useUpdateSuggested(),
19812
- suggestedUpdated = _useUpdateSuggested[0];
19813
- var isMounted = useIsEverMounted();
19814
- var suggestedEmojisModeConfig = useSuggestedEmojisModeConfig();
19815
- var getEmojiUrl = useGetEmojiUrlConfig();
19816
- var suggested = React.useMemo(function () {
19817
- var _getSuggested;
19818
- return (_getSuggested = getSuggested(suggestedEmojisModeConfig)) != null ? _getSuggested : [];
19819
- },
19820
- // eslint-disable-next-line react-hooks/exhaustive-deps
19821
- [suggestedUpdated, suggestedEmojisModeConfig]);
19822
- var emojiStyle = useEmojiStyleConfig();
19823
- var isEmojiDisallowed = useIsEmojiDisallowed();
19824
- if (!isMounted) {
19825
- return null;
19826
- }
19827
- return React.createElement(EmojiCategory, {
19828
- categoryConfig: categoryConfig,
19829
- hiddenOnSearch: true,
19830
- hidden: suggested.length === 0
19831
- }, suggested.map(function (suggestedItem) {
19832
- var emoji = emojiByUnified(suggestedItem.original);
19833
- if (!emoji) {
19834
- return null;
19835
- }
19836
- if (isEmojiDisallowed(emoji)) {
19837
- return null;
19838
- }
19839
- return React.createElement(ClickableEmoji, {
19840
- showVariations: false,
19841
- unified: suggestedItem.unified,
19842
- emojiStyle: emojiStyle,
19843
- emoji: emoji,
19844
- key: suggestedItem.unified,
19845
- getEmojiUrl: getEmojiUrl
19846
- });
19847
- }));
19848
- }
19849
-
19850
- function EmojiList() {
19953
+ function EmojiList(_ref) {
19954
+ var scrollTop = _ref.scrollTop;
19851
19955
  var categories = useCategoriesConfig();
19852
- var renderdCategoriesCountRef = React.useRef(0);
19956
+ var _React$useState = React.useState({}),
19957
+ categoryHeights = _React$useState[0],
19958
+ setCategoryHeights = _React$useState[1];
19959
+ var EmojiListRef = useEmojiListRef();
19960
+ var getEmojisByCategory = useGetEmojisByCategory();
19961
+ var labelHeight = getLabelHeight(EmojiListRef.current);
19962
+ var topOffset = 0;
19853
19963
  return React.createElement("ul", {
19854
- className: flairup.cx(styles$8.emojiList)
19964
+ className: flairup.cx(styles$8.emojiList),
19965
+ ref: EmojiListRef
19855
19966
  }, categories.map(function (categoryConfig) {
19856
19967
  var category = categoryFromCategoryConfig(categoryConfig);
19857
- if (category === exports.Categories.SUGGESTED) {
19858
- return React.createElement(Suggested, {
19859
- key: category,
19860
- categoryConfig: categoryConfig
19861
- });
19968
+ var currentOffset = topOffset;
19969
+ var categoryHeight = categoryHeights[category];
19970
+ if (categoryHeight) {
19971
+ topOffset += categoryHeight + labelHeight;
19862
19972
  }
19863
19973
  return React.createElement(React.Suspense, {
19864
19974
  key: category
19865
19975
  }, React.createElement(RenderCategory, {
19866
- category: category,
19976
+ categoryEmojis: getEmojisByCategory(category),
19867
19977
  categoryConfig: categoryConfig,
19868
- renderdCategoriesCountRef: renderdCategoriesCountRef
19978
+ topOffset: currentOffset,
19979
+ onHeightReady: function onHeightReady(height) {
19980
+ if (categoryHeights[category] !== height) {
19981
+ setCategoryHeights(function (prev) {
19982
+ var _extends2;
19983
+ return _extends({}, prev, (_extends2 = {}, _extends2[category] = height, _extends2));
19984
+ });
19985
+ }
19986
+ },
19987
+ scrollTop: scrollTop
19869
19988
  }));
19870
19989
  }));
19871
19990
  }
19872
- function RenderCategory(_ref) {
19873
- var category = _ref.category,
19874
- categoryConfig = _ref.categoryConfig,
19875
- renderdCategoriesCountRef = _ref.renderdCategoriesCountRef;
19876
- var isEmojiHidden = useIsEmojiHidden();
19877
- var lazyLoadEmojis = useLazyLoadEmojisConfig();
19878
- var emojiStyle = useEmojiStyleConfig();
19879
- var isPastInitialLoad = useIsPastInitialLoad();
19880
- var _useActiveSkinToneSta = useActiveSkinToneState(),
19881
- activeSkinTone = _useActiveSkinToneSta[0];
19882
- var isEmojiDisallowed = useIsEmojiDisallowed();
19883
- var getEmojiUrl = useGetEmojiUrlConfig();
19884
- var showVariations = !useSkinTonesDisabledConfig();
19885
- // Small trick to defer the rendering of all emoji categories until the first category is visible
19886
- // This way the user gets to actually see something and not wait for the whole picker to render.
19887
- var emojisToPush = !isPastInitialLoad && renderdCategoriesCountRef.current > 0 ? [] : emojisByCategory(category);
19888
- if (emojisToPush.length > 0) {
19889
- renderdCategoriesCountRef.current++;
19890
- }
19891
- var hiddenCounter = 0;
19892
- var emojis = emojisToPush.map(function (emoji) {
19893
- var unified = emojiUnified(emoji, activeSkinTone);
19894
- var _isEmojiHidden = isEmojiHidden(emoji),
19895
- failedToLoad = _isEmojiHidden.failedToLoad,
19896
- filteredOut = _isEmojiHidden.filteredOut,
19897
- hidden = _isEmojiHidden.hidden;
19898
- var isDisallowed = isEmojiDisallowed(emoji);
19899
- if (hidden || isDisallowed) {
19900
- hiddenCounter++;
19901
- }
19902
- if (isDisallowed) {
19903
- return null;
19904
- }
19905
- return React.createElement(ClickableEmoji, {
19906
- showVariations: showVariations,
19907
- key: unified,
19908
- emoji: emoji,
19909
- unified: unified,
19910
- hidden: failedToLoad,
19911
- hiddenOnSearch: filteredOut,
19912
- emojiStyle: emojiStyle,
19913
- lazyLoad: lazyLoadEmojis,
19914
- getEmojiUrl: getEmojiUrl
19915
- });
19916
- });
19991
+ function RenderCategory(_ref2) {
19992
+ var categoryEmojis = _ref2.categoryEmojis,
19993
+ categoryConfig = _ref2.categoryConfig,
19994
+ topOffset = _ref2.topOffset,
19995
+ onHeightReady = _ref2.onHeightReady,
19996
+ scrollTop = _ref2.scrollTop;
19997
+ var _useEmojiVirtualizati = useEmojiVirtualization({
19998
+ categoryEmojis: categoryEmojis,
19999
+ topOffset: topOffset,
20000
+ onHeightReady: onHeightReady,
20001
+ scrollTop: scrollTop
20002
+ }),
20003
+ virtualizedCounter = _useEmojiVirtualizati.virtualizedCounter,
20004
+ emojis = _useEmojiVirtualizati.emojis,
20005
+ dimensions = _useEmojiVirtualizati.dimensions;
19917
20006
  return React.createElement(EmojiCategory, {
19918
20007
  categoryConfig: categoryConfig,
20008
+ height: dimensions == null ? void 0 : dimensions.categoryHeight,
19919
20009
  // Indicates that there are no visible emojis
19920
20010
  // Hence, the category should be hidden
19921
- hidden: hiddenCounter === emojis.length
20011
+ hidden: !emojis.length && virtualizedCounter === 0
19922
20012
  }, emojis);
19923
20013
  }
19924
20014
  var styles$8 = /*#__PURE__*/stylesheet.create({
@@ -20096,13 +20186,15 @@ var styles$9 = /*#__PURE__*/stylesheet.create( /*#__PURE__*/_extends({
20096
20186
 
20097
20187
  function Body() {
20098
20188
  var BodyRef = useBodyRef();
20099
- useOnScroll(BodyRef);
20189
+ var scrollTop = useOnScroll(BodyRef);
20100
20190
  useMouseDownHandlers(BodyRef, MOUSE_EVENT_SOURCE.PICKER);
20101
20191
  useOnMouseMove();
20102
20192
  return React.createElement("div", {
20103
20193
  className: flairup.cx(styles$a.body, commonInteractionStyles.hiddenOnReactions),
20104
20194
  ref: BodyRef
20105
- }, React.createElement(EmojiVariationPicker, null), React.createElement(EmojiList, null));
20195
+ }, React.createElement(EmojiVariationPicker, null), React.createElement(EmojiList, {
20196
+ scrollTop: scrollTop
20197
+ }));
20106
20198
  }
20107
20199
  var styles$a = /*#__PURE__*/stylesheet.create({
20108
20200
  body: {
@@ -20807,21 +20899,6 @@ var styles$h = /*#__PURE__*/stylesheet.create( /*#__PURE__*/_extends({
20807
20899
  backgroundPositionY: '-40px'
20808
20900
  }), /*#__PURE__*/darkMode('btnClearSearch', HoverDark)));
20809
20901
 
20810
- var SCOPE = /*#__PURE__*/asSelectors(ClassNames.emojiPicker) + " " + /*#__PURE__*/asSelectors(ClassNames.emojiList);
20811
- var EMOJI_BUTTON = /*#__PURE__*/['button', asSelectors(ClassNames.emoji)].join('');
20812
- var CATEGORY = /*#__PURE__*/asSelectors(ClassNames.category);
20813
- function CssSearch(_ref) {
20814
- var value = _ref.value;
20815
- if (!value) {
20816
- return null;
20817
- }
20818
- var q = genQuery(value);
20819
- 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 ");
20820
- }
20821
- function genQuery(value) {
20822
- return [EMOJI_BUTTON, '[data-full-name*="', getNormalizedSearchTerm(value), '"]'].join('');
20823
- }
20824
-
20825
20902
  var SVGMagnifier = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI2LjMuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjQwcHgiIHZpZXdCb3g9IjAgMCAyMCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMjAgNDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzg2ODY4NiIgZD0iTTEyLDguODFjMCwyLjA4LTEuNjgsMy43Ni0zLjc2LDMuNzZjLTIuMDgsMC0zLjc2LTEuNjgtMy43Ni0zLjc2CgljMC0yLjA4LDEuNjgtMy43NiwzLjc2LTMuNzZDMTAuMzIsNS4wNSwxMiw2LjczLDEyLDguODF6IE0xMS4yMywxMi43MmMtMC44MywwLjY0LTEuODcsMS4wMS0yLjk5LDEuMDFjLTIuNzIsMC00LjkyLTIuMi00LjkyLTQuOTIKCWMwLTIuNzIsMi4yLTQuOTIsNC45Mi00LjkyYzIuNzIsMCw0LjkyLDIuMiw0LjkyLDQuOTJjMCwxLjEzLTAuMzgsMi4xNi0xLjAxLDIuOTlsMy45NCwzLjkzYzAuMjUsMC4yNSwwLjI1LDAuNjYsMCwwLjkyCgljLTAuMjUsMC4yNS0wLjY2LDAuMjUtMC45MiwwTDExLjIzLDEyLjcyeiIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI0MwQzBCRiIgZD0iTTEyLDI4LjgxYzAsMi4wOC0xLjY4LDMuNzYtMy43NiwzLjc2Yy0yLjA4LDAtMy43Ni0xLjY4LTMuNzYtMy43NgoJYzAtMi4wOCwxLjY4LTMuNzYsMy43Ni0zLjc2QzEwLjMyLDI1LjA1LDEyLDI2LjczLDEyLDI4LjgxeiBNMTEuMjMsMzIuNzJjLTAuODMsMC42NC0xLjg3LDEuMDEtMi45OSwxLjAxCgljLTIuNzIsMC00LjkyLTIuMi00LjkyLTQuOTJjMC0yLjcyLDIuMi00LjkyLDQuOTItNC45MmMyLjcyLDAsNC45MiwyLjIsNC45Miw0LjkyYzAsMS4xMy0wLjM4LDIuMTYtMS4wMSwyLjk5bDMuOTQsMy45MwoJYzAuMjUsMC4yNSwwLjI1LDAuNjYsMCwwLjkyYy0wLjI1LDAuMjUtMC42NiwwLjI1LTAuOTIsMEwxMS4yMywzMi43MnoiLz4KPC9zdmc+';
20826
20903
 
20827
20904
  function IcnSearch() {
@@ -20859,9 +20936,6 @@ function SearchContainer() {
20859
20936
  }, React.createElement(Search, null), isSkinToneInSearch ? React.createElement(SkinTonePicker, null) : null);
20860
20937
  }
20861
20938
  function Search() {
20862
- var _useState = React.useState(0),
20863
- inc = _useState[0],
20864
- setInc = _useState[1];
20865
20939
  var closeAllOpenToggles = useCloseAllOpenToggles();
20866
20940
  var SearchInputRef = useSearchInputRef();
20867
20941
  var placeholder = useSearchPlaceHolderConfig();
@@ -20874,9 +20948,7 @@ function Search() {
20874
20948
  var value = input == null ? void 0 : input.value;
20875
20949
  return React.createElement(Relative, {
20876
20950
  className: flairup.cx(styles$j.searchContainer)
20877
- }, React.createElement(CssSearch, {
20878
- value: value
20879
- }), React.createElement("input", {
20951
+ }, React.createElement("input", {
20880
20952
  // eslint-disable-next-line jsx-a11y/no-autofocus
20881
20953
  autoFocus: autoFocus,
20882
20954
  "aria-label": 'Type to search for an emoji',
@@ -20887,7 +20959,6 @@ function Search() {
20887
20959
  placeholder: placeholder,
20888
20960
  onChange: function onChange(event) {
20889
20961
  var _event$target$value, _event$target;
20890
- setInc(inc + 1);
20891
20962
  _onChange((_event$target$value = event == null ? void 0 : (_event$target = event.target) == null ? void 0 : _event$target.value) != null ? _event$target$value : value);
20892
20963
  },
20893
20964
  ref: SearchInputRef