emoji-picker-react 4.13.2 → 4.14.0-rc.1
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/README.md +15 -15
- package/dist/DomUtils/elementPositionInRow.d.ts +1 -6
- package/dist/components/body/EmojiCategory.d.ts +2 -1
- package/dist/components/body/EmojiList.d.ts +3 -1
- package/dist/components/context/ElementRefContext.d.ts +1 -0
- package/dist/components/emoji/ClickableEmojiButton.d.ts +2 -1
- package/dist/components/emoji/Emoji.d.ts +3 -2
- package/dist/dataUtils/emojiSelectors.d.ts +1 -1
- package/dist/emoji-picker-react.cjs.development.js +540 -486
- 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 +541 -487
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/dist/hooks/useCategoryHeight.d.ts +5 -0
- package/dist/hooks/useOnScroll.d.ts +1 -1
- package/package.json +1 -1
- package/src/DomUtils/elementPositionInRow.ts +8 -131
- package/src/DomUtils/keyboardNavigation.ts +62 -48
- package/src/components/body/Body.tsx +2 -2
- package/src/components/body/EmojiCategory.tsx +7 -5
- package/src/components/body/EmojiList.tsx +126 -35
- package/src/components/context/ElementRefContext.tsx +8 -0
- package/src/components/emoji/ClickableEmojiButton.tsx +4 -1
- package/src/components/emoji/Emoji.tsx +4 -1
- package/src/components/header/Search/Search.tsx +1 -8
- package/src/components/main/PickerMain.tsx +8 -5
- package/src/dataUtils/emojiSelectors.ts +29 -3
- package/src/hooks/useCategoryHeight.ts +92 -0
- package/src/hooks/useOnScroll.ts +5 -1
- package/dist/components/body/Suggested.d.ts +0 -7
- package/dist/components/header/Search/CssSearch.d.ts +0 -4
- package/src/components/body/Suggested.tsx +0 -69
- package/src/components/header/Search/CssSearch.tsx +0 -45
|
@@ -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
|
|
17169
|
-
|
|
17170
|
-
|
|
17171
|
-
|
|
17172
|
-
|
|
17173
|
-
|
|
17174
|
-
}
|
|
17175
|
-
|
|
17176
|
-
|
|
17177
|
-
|
|
17178
|
-
|
|
17179
|
-
|
|
17180
|
-
|
|
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
|
|
17207
|
-
var
|
|
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
|
|
17215
|
-
var
|
|
17216
|
-
|
|
17217
|
-
|
|
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
|
-
|
|
17974
|
-
|
|
17975
|
-
|
|
17976
|
-
|
|
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
|
|
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
|
-
|
|
17994
|
-
|
|
17995
|
-
|
|
17996
|
-
|
|
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
|
|
18001
|
-
|
|
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() {
|
|
@@ -18713,7 +18810,7 @@ var styles = /*#__PURE__*/stylesheet.create({
|
|
|
18713
18810
|
borderColor: 'var(--epr-picker-border-color)',
|
|
18714
18811
|
backgroundColor: 'var(--epr-bg-color)',
|
|
18715
18812
|
overflow: 'hidden',
|
|
18716
|
-
transition: '
|
|
18813
|
+
transition: 'height 0.3s ease-in-out, background-color 0.1s ease-in-out',
|
|
18717
18814
|
'*': {
|
|
18718
18815
|
boxSizing: 'border-box',
|
|
18719
18816
|
fontFamily: 'sans-serif'
|
|
@@ -18833,65 +18930,6 @@ function elementCountInRow(parent, element) {
|
|
|
18833
18930
|
var elementWidth = element.getBoundingClientRect().width;
|
|
18834
18931
|
return Math.floor(parentWidth / elementWidth);
|
|
18835
18932
|
}
|
|
18836
|
-
function elementIndexInRow(parent, element) {
|
|
18837
|
-
if (!parent || !element) {
|
|
18838
|
-
return 0;
|
|
18839
|
-
}
|
|
18840
|
-
var elementWidth = element.getBoundingClientRect().width;
|
|
18841
|
-
var elementLeft = element.getBoundingClientRect().left;
|
|
18842
|
-
var parentLeft = parent.getBoundingClientRect().left;
|
|
18843
|
-
return Math.floor((elementLeft - parentLeft) / elementWidth);
|
|
18844
|
-
}
|
|
18845
|
-
function rowNumber(parent, element) {
|
|
18846
|
-
if (!parent || !element) {
|
|
18847
|
-
return 0;
|
|
18848
|
-
}
|
|
18849
|
-
var elementHeight = element.getBoundingClientRect().height;
|
|
18850
|
-
var elementTop = element.getBoundingClientRect().top;
|
|
18851
|
-
var parentTop = parent.getBoundingClientRect().top;
|
|
18852
|
-
return Math.round((elementTop - parentTop) / elementHeight);
|
|
18853
|
-
}
|
|
18854
|
-
function hasNextRow(parent, element) {
|
|
18855
|
-
if (!parent || !element) {
|
|
18856
|
-
return false;
|
|
18857
|
-
}
|
|
18858
|
-
var elementHeight = element.getBoundingClientRect().height;
|
|
18859
|
-
var elementTop = element.getBoundingClientRect().top;
|
|
18860
|
-
var parentTop = parent.getBoundingClientRect().top;
|
|
18861
|
-
var parentHeight = parent.getBoundingClientRect().height;
|
|
18862
|
-
return Math.round(elementTop - parentTop + elementHeight) < parentHeight;
|
|
18863
|
-
}
|
|
18864
|
-
function getRowElements(elements, row, elementsInRow) {
|
|
18865
|
-
if (row === -1) {
|
|
18866
|
-
var lastRow = Math.floor((elements.length - 1) / elementsInRow);
|
|
18867
|
-
var firstElementIndex = lastRow * elementsInRow;
|
|
18868
|
-
var lastElementIndex = elements.length - 1;
|
|
18869
|
-
return elements.slice(firstElementIndex, lastElementIndex + 1);
|
|
18870
|
-
}
|
|
18871
|
-
return elements.slice(row * elementsInRow, (row + 1) * elementsInRow);
|
|
18872
|
-
}
|
|
18873
|
-
function getNextRowElements(allElements, currentRow, elementsInRow) {
|
|
18874
|
-
var nextRow = currentRow + 1;
|
|
18875
|
-
if (nextRow * elementsInRow > allElements.length) {
|
|
18876
|
-
return [];
|
|
18877
|
-
}
|
|
18878
|
-
return getRowElements(allElements, nextRow, elementsInRow);
|
|
18879
|
-
}
|
|
18880
|
-
function getElementInRow(elements, row, elementsInRow, indexInRow) {
|
|
18881
|
-
var rowElements = getRowElements(elements, row, elementsInRow);
|
|
18882
|
-
// get element, default to last
|
|
18883
|
-
return rowElements[indexInRow] || rowElements[rowElements.length - 1] || null;
|
|
18884
|
-
}
|
|
18885
|
-
function getElementInNextRow(allElements, currentRow, elementsInRow, index) {
|
|
18886
|
-
var nextRowElements = getNextRowElements(allElements, currentRow, elementsInRow);
|
|
18887
|
-
// return item in index, or last item in row
|
|
18888
|
-
return nextRowElements[index] || nextRowElements[nextRowElements.length - 1] || null;
|
|
18889
|
-
}
|
|
18890
|
-
function getElementInPrevRow(allElements, currentRow, elementsInRow, index) {
|
|
18891
|
-
var prevRowElements = getRowElements(allElements, currentRow - 1, elementsInRow);
|
|
18892
|
-
// default to last
|
|
18893
|
-
return prevRowElements[index] || prevRowElements[prevRowElements.length - 1] || null;
|
|
18894
|
-
}
|
|
18895
18933
|
function firstVisibleElementInContainer(parent, elements, maxVisibilityDiffThreshold) {
|
|
18896
18934
|
if (maxVisibilityDiffThreshold === void 0) {
|
|
18897
18935
|
maxVisibilityDiffThreshold = 0;
|
|
@@ -18919,15 +18957,17 @@ function hasNextElementSibling(element) {
|
|
|
18919
18957
|
return !!element.nextElementSibling;
|
|
18920
18958
|
}
|
|
18921
18959
|
function getLabelHeight(parentNode) {
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
18960
|
+
if (!parentNode) {
|
|
18961
|
+
return DEFAULT_LABEL_HEIGHT;
|
|
18962
|
+
}
|
|
18963
|
+
var label = parentNode.querySelector(asSelectors(ClassNames.label));
|
|
18964
|
+
if (label) {
|
|
18925
18965
|
var height = label.getBoundingClientRect().height;
|
|
18926
|
-
// return height if label is not hidden
|
|
18927
18966
|
if (height > 0) {
|
|
18928
18967
|
return height;
|
|
18929
18968
|
}
|
|
18930
18969
|
}
|
|
18970
|
+
// fallback to default
|
|
18931
18971
|
return DEFAULT_LABEL_HEIGHT;
|
|
18932
18972
|
}
|
|
18933
18973
|
|
|
@@ -19143,56 +19183,6 @@ function parseNativeEmoji(unified) {
|
|
|
19143
19183
|
}).join('');
|
|
19144
19184
|
}
|
|
19145
19185
|
|
|
19146
|
-
var SUGGESTED_LS_KEY = 'epr_suggested';
|
|
19147
|
-
function getSuggested(mode) {
|
|
19148
|
-
try {
|
|
19149
|
-
var _window, _window$localStorage$, _window2;
|
|
19150
|
-
if (!((_window = window) != null && _window.localStorage)) {
|
|
19151
|
-
return [];
|
|
19152
|
-
}
|
|
19153
|
-
var recent = JSON.parse((_window$localStorage$ = (_window2 = window) == null ? void 0 : _window2.localStorage.getItem(SUGGESTED_LS_KEY)) != null ? _window$localStorage$ : '[]');
|
|
19154
|
-
if (mode === exports.SuggestionMode.FREQUENT) {
|
|
19155
|
-
return recent.sort(function (a, b) {
|
|
19156
|
-
return b.count - a.count;
|
|
19157
|
-
});
|
|
19158
|
-
}
|
|
19159
|
-
return recent;
|
|
19160
|
-
} catch (_unused) {
|
|
19161
|
-
return [];
|
|
19162
|
-
}
|
|
19163
|
-
}
|
|
19164
|
-
function setSuggested(emoji, skinTone) {
|
|
19165
|
-
var recent = getSuggested();
|
|
19166
|
-
var unified = emojiUnified(emoji, skinTone);
|
|
19167
|
-
var originalUnified = emojiUnified(emoji);
|
|
19168
|
-
var existing = recent.find(function (_ref) {
|
|
19169
|
-
var u = _ref.unified;
|
|
19170
|
-
return u === unified;
|
|
19171
|
-
});
|
|
19172
|
-
var nextList;
|
|
19173
|
-
if (existing) {
|
|
19174
|
-
nextList = [existing].concat(recent.filter(function (i) {
|
|
19175
|
-
return i !== existing;
|
|
19176
|
-
}));
|
|
19177
|
-
} else {
|
|
19178
|
-
existing = {
|
|
19179
|
-
unified: unified,
|
|
19180
|
-
original: originalUnified,
|
|
19181
|
-
count: 0
|
|
19182
|
-
};
|
|
19183
|
-
nextList = [existing].concat(recent);
|
|
19184
|
-
}
|
|
19185
|
-
existing.count++;
|
|
19186
|
-
nextList.length = Math.min(nextList.length, 14);
|
|
19187
|
-
try {
|
|
19188
|
-
var _window3;
|
|
19189
|
-
(_window3 = window) == null ? void 0 : _window3.localStorage.setItem(SUGGESTED_LS_KEY, JSON.stringify(nextList));
|
|
19190
|
-
// Prevents the change from being seen immediately.
|
|
19191
|
-
} catch (_unused2) {
|
|
19192
|
-
// ignore
|
|
19193
|
-
}
|
|
19194
|
-
}
|
|
19195
|
-
|
|
19196
19186
|
function isCustomCategory(category) {
|
|
19197
19187
|
return category.category === exports.Categories.CUSTOM;
|
|
19198
19188
|
}
|
|
@@ -19355,12 +19345,14 @@ function ClickableEmojiButton(_ref) {
|
|
|
19355
19345
|
children = _ref.children,
|
|
19356
19346
|
className = _ref.className,
|
|
19357
19347
|
_ref$noBackground = _ref.noBackground,
|
|
19358
|
-
noBackground = _ref$noBackground === void 0 ? false : _ref$noBackground
|
|
19348
|
+
noBackground = _ref$noBackground === void 0 ? false : _ref$noBackground,
|
|
19349
|
+
style = _ref.style;
|
|
19359
19350
|
return React.createElement(Button, {
|
|
19360
19351
|
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),
|
|
19361
19352
|
"data-unified": unified,
|
|
19362
19353
|
"aria-label": getAriaLabel(emojiNames),
|
|
19363
|
-
"data-full-name": emojiNames
|
|
19354
|
+
"data-full-name": emojiNames,
|
|
19355
|
+
style: style
|
|
19364
19356
|
}, children);
|
|
19365
19357
|
}
|
|
19366
19358
|
function getAriaLabel(emojiNames) {
|
|
@@ -19550,7 +19542,8 @@ function ClickableEmoji(_ref) {
|
|
|
19550
19542
|
getEmojiUrl = _ref.getEmojiUrl,
|
|
19551
19543
|
className = _ref.className,
|
|
19552
19544
|
_ref$noBackground = _ref.noBackground,
|
|
19553
|
-
noBackground = _ref$noBackground === void 0 ? false : _ref$noBackground
|
|
19545
|
+
noBackground = _ref$noBackground === void 0 ? false : _ref$noBackground,
|
|
19546
|
+
style = _ref.style;
|
|
19554
19547
|
var hasVariations = emojiHasVariations(emoji);
|
|
19555
19548
|
return React.createElement(ClickableEmojiButton, {
|
|
19556
19549
|
hasVariations: hasVariations,
|
|
@@ -19559,7 +19552,8 @@ function ClickableEmoji(_ref) {
|
|
|
19559
19552
|
hiddenOnSearch: hiddenOnSearch,
|
|
19560
19553
|
emojiNames: emojiNames(emoji),
|
|
19561
19554
|
unified: unified,
|
|
19562
|
-
noBackground: noBackground
|
|
19555
|
+
noBackground: noBackground,
|
|
19556
|
+
style: style
|
|
19563
19557
|
}, React.createElement(ViewOnlyEmoji, {
|
|
19564
19558
|
unified: unified,
|
|
19565
19559
|
emoji: emoji,
|
|
@@ -19689,6 +19683,9 @@ var styles$6 = /*#__PURE__*/stylesheet.create({
|
|
|
19689
19683
|
|
|
19690
19684
|
function useOnScroll(BodyRef) {
|
|
19691
19685
|
var closeAllOpenToggles = useCloseAllOpenToggles();
|
|
19686
|
+
var _useState = React.useState(0),
|
|
19687
|
+
scrollTop = _useState[0],
|
|
19688
|
+
setScrollTop = _useState[1];
|
|
19692
19689
|
React.useEffect(function () {
|
|
19693
19690
|
var bodyRef = BodyRef.current;
|
|
19694
19691
|
if (!bodyRef) {
|
|
@@ -19698,12 +19695,78 @@ function useOnScroll(BodyRef) {
|
|
|
19698
19695
|
passive: true
|
|
19699
19696
|
});
|
|
19700
19697
|
function onScroll() {
|
|
19698
|
+
var _bodyRef$scrollTop;
|
|
19699
|
+
setScrollTop((_bodyRef$scrollTop = bodyRef == null ? void 0 : bodyRef.scrollTop) != null ? _bodyRef$scrollTop : 0);
|
|
19701
19700
|
closeAllOpenToggles();
|
|
19702
19701
|
}
|
|
19703
19702
|
return function () {
|
|
19704
19703
|
bodyRef == null ? void 0 : bodyRef.removeEventListener('scroll', onScroll);
|
|
19705
19704
|
};
|
|
19706
19705
|
}, [BodyRef, closeAllOpenToggles]);
|
|
19706
|
+
return scrollTop;
|
|
19707
|
+
}
|
|
19708
|
+
|
|
19709
|
+
var EMOJI_SIZE_DEFAULT = 32;
|
|
19710
|
+
function useCategoryHeight(emojiCount) {
|
|
19711
|
+
var EmojiListRef = useEmojiListRef();
|
|
19712
|
+
var _useReactionsModeStat = useReactionsModeState(),
|
|
19713
|
+
isReactionsMode = _useReactionsModeStat[0];
|
|
19714
|
+
var PickerMainRef = usePickerMainRef();
|
|
19715
|
+
var emojiSizeRef = React.useRef();
|
|
19716
|
+
var _React$useState = React.useState(),
|
|
19717
|
+
dimensions = _React$useState[0],
|
|
19718
|
+
setDimensions = _React$useState[1];
|
|
19719
|
+
// Helper to compute and store dimensions based on current DOM
|
|
19720
|
+
var computeAndSetDimensions = React.useCallback(function () {
|
|
19721
|
+
var _ref;
|
|
19722
|
+
var listEl = EmojiListRef.current;
|
|
19723
|
+
if (!listEl) return;
|
|
19724
|
+
var emojiElement = listEl.querySelector(EmojiButtonSelector);
|
|
19725
|
+
var measured = emojiElement == null ? void 0 : emojiElement.clientHeight;
|
|
19726
|
+
var emojiSize = (_ref = measured != null ? measured : emojiSizeRef.current) != null ? _ref : EMOJI_SIZE_DEFAULT;
|
|
19727
|
+
emojiSizeRef.current = emojiSize;
|
|
19728
|
+
var pickerWidth = listEl.clientWidth;
|
|
19729
|
+
if (pickerWidth === 0 || emojiSize === 0) return;
|
|
19730
|
+
var emojisPerRow = Math.max(1, Math.floor(pickerWidth / emojiSize));
|
|
19731
|
+
var rowCount = Math.ceil(emojiCount / emojisPerRow);
|
|
19732
|
+
var categoryHeight = rowCount * emojiSize;
|
|
19733
|
+
setDimensions({
|
|
19734
|
+
categoryHeight: categoryHeight,
|
|
19735
|
+
emojisPerRow: emojisPerRow,
|
|
19736
|
+
emojiSize: emojiSize
|
|
19737
|
+
});
|
|
19738
|
+
}, [EmojiListRef, emojiCount]);
|
|
19739
|
+
// Recompute on data-count changes and when reactions mode toggles
|
|
19740
|
+
React.useEffect(function () {
|
|
19741
|
+
computeAndSetDimensions();
|
|
19742
|
+
}, [emojiCount, isReactionsMode, computeAndSetDimensions]);
|
|
19743
|
+
// Listen to transitionend on the picker root (where height transition occurs)
|
|
19744
|
+
React.useEffect(function () {
|
|
19745
|
+
var rootEl = PickerMainRef.current;
|
|
19746
|
+
if (!rootEl) return;
|
|
19747
|
+
var handler = function handler(e) {
|
|
19748
|
+
var te = e;
|
|
19749
|
+
var prop = te.propertyName;
|
|
19750
|
+
if (prop === 'width' || prop === 'max-width' || prop === 'min-width' || prop === 'height' || prop === 'max-height' || prop === 'min-height') {
|
|
19751
|
+
if (typeof queueMicrotask === 'function') {
|
|
19752
|
+
queueMicrotask(function () {
|
|
19753
|
+
return computeAndSetDimensions();
|
|
19754
|
+
});
|
|
19755
|
+
} else {
|
|
19756
|
+
requestAnimationFrame(function () {
|
|
19757
|
+
return computeAndSetDimensions();
|
|
19758
|
+
});
|
|
19759
|
+
}
|
|
19760
|
+
}
|
|
19761
|
+
};
|
|
19762
|
+
rootEl.addEventListener('transitionend', handler, {
|
|
19763
|
+
passive: true
|
|
19764
|
+
});
|
|
19765
|
+
return function () {
|
|
19766
|
+
rootEl.removeEventListener('transitionend', handler);
|
|
19767
|
+
};
|
|
19768
|
+
}, [PickerMainRef, computeAndSetDimensions]);
|
|
19769
|
+
return dimensions;
|
|
19707
19770
|
}
|
|
19708
19771
|
|
|
19709
19772
|
function useIsEmojiHidden() {
|
|
@@ -19726,7 +19789,8 @@ function EmojiCategory(_ref) {
|
|
|
19726
19789
|
var categoryConfig = _ref.categoryConfig,
|
|
19727
19790
|
children = _ref.children,
|
|
19728
19791
|
hidden = _ref.hidden,
|
|
19729
|
-
hiddenOnSearch = _ref.hiddenOnSearch
|
|
19792
|
+
hiddenOnSearch = _ref.hiddenOnSearch,
|
|
19793
|
+
height = _ref.height;
|
|
19730
19794
|
var category = categoryFromCategoryConfig(categoryConfig);
|
|
19731
19795
|
var categoryName = categoryNameFromCategoryConfig(categoryConfig);
|
|
19732
19796
|
return React.createElement("li", {
|
|
@@ -19736,15 +19800,16 @@ function EmojiCategory(_ref) {
|
|
|
19736
19800
|
}, React.createElement("h2", {
|
|
19737
19801
|
className: flairup.cx(styles$7.label)
|
|
19738
19802
|
}, categoryName), React.createElement("div", {
|
|
19739
|
-
className: flairup.cx(styles$7.categoryContent)
|
|
19803
|
+
className: flairup.cx(styles$7.categoryContent),
|
|
19804
|
+
style: {
|
|
19805
|
+
height: height
|
|
19806
|
+
}
|
|
19740
19807
|
}, children));
|
|
19741
19808
|
}
|
|
19742
19809
|
var styles$7 = /*#__PURE__*/stylesheet.create({
|
|
19743
19810
|
category: {
|
|
19744
19811
|
'.': ClassNames.category,
|
|
19745
|
-
|
|
19746
|
-
display: 'none'
|
|
19747
|
-
}
|
|
19812
|
+
position: 'relative'
|
|
19748
19813
|
},
|
|
19749
19814
|
categoryContent: {
|
|
19750
19815
|
'.': ClassNames.categoryContent,
|
|
@@ -19776,115 +19841,100 @@ var styles$7 = /*#__PURE__*/stylesheet.create({
|
|
|
19776
19841
|
}
|
|
19777
19842
|
});
|
|
19778
19843
|
|
|
19779
|
-
|
|
19780
|
-
|
|
19781
|
-
var _React$useState = React.useState(isEverMounted),
|
|
19782
|
-
isMounted = _React$useState[0],
|
|
19783
|
-
setIsMounted = _React$useState[1];
|
|
19784
|
-
React.useEffect(function () {
|
|
19785
|
-
setIsMounted(true);
|
|
19786
|
-
isEverMounted = true;
|
|
19787
|
-
}, []);
|
|
19788
|
-
return isMounted || isEverMounted;
|
|
19789
|
-
}
|
|
19790
|
-
|
|
19791
|
-
function Suggested(_ref) {
|
|
19792
|
-
var categoryConfig = _ref.categoryConfig;
|
|
19793
|
-
var _useUpdateSuggested = useUpdateSuggested(),
|
|
19794
|
-
suggestedUpdated = _useUpdateSuggested[0];
|
|
19795
|
-
var isMounted = useIsEverMounted();
|
|
19796
|
-
var suggestedEmojisModeConfig = useSuggestedEmojisModeConfig();
|
|
19797
|
-
var getEmojiUrl = useGetEmojiUrlConfig();
|
|
19798
|
-
var suggested = React.useMemo(function () {
|
|
19799
|
-
var _getSuggested;
|
|
19800
|
-
return (_getSuggested = getSuggested(suggestedEmojisModeConfig)) != null ? _getSuggested : [];
|
|
19801
|
-
},
|
|
19802
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19803
|
-
[suggestedUpdated, suggestedEmojisModeConfig]);
|
|
19804
|
-
var emojiStyle = useEmojiStyleConfig();
|
|
19805
|
-
var isEmojiDisallowed = useIsEmojiDisallowed();
|
|
19806
|
-
if (!isMounted) {
|
|
19807
|
-
return null;
|
|
19808
|
-
}
|
|
19809
|
-
return React.createElement(EmojiCategory, {
|
|
19810
|
-
categoryConfig: categoryConfig,
|
|
19811
|
-
hiddenOnSearch: true,
|
|
19812
|
-
hidden: suggested.length === 0
|
|
19813
|
-
}, suggested.map(function (suggestedItem) {
|
|
19814
|
-
var emoji = emojiByUnified(suggestedItem.original);
|
|
19815
|
-
if (!emoji) {
|
|
19816
|
-
return null;
|
|
19817
|
-
}
|
|
19818
|
-
if (isEmojiDisallowed(emoji)) {
|
|
19819
|
-
return null;
|
|
19820
|
-
}
|
|
19821
|
-
return React.createElement(ClickableEmoji, {
|
|
19822
|
-
showVariations: false,
|
|
19823
|
-
unified: suggestedItem.unified,
|
|
19824
|
-
emojiStyle: emojiStyle,
|
|
19825
|
-
emoji: emoji,
|
|
19826
|
-
key: suggestedItem.unified,
|
|
19827
|
-
getEmojiUrl: getEmojiUrl
|
|
19828
|
-
});
|
|
19829
|
-
}));
|
|
19830
|
-
}
|
|
19831
|
-
|
|
19832
|
-
function EmojiList() {
|
|
19844
|
+
function EmojiList(_ref) {
|
|
19845
|
+
var scrollTop = _ref.scrollTop;
|
|
19833
19846
|
var categories = useCategoriesConfig();
|
|
19834
|
-
var
|
|
19847
|
+
var _React$useState = React.useState({}),
|
|
19848
|
+
categoryHeights = _React$useState[0],
|
|
19849
|
+
setCategoryHeights = _React$useState[1];
|
|
19850
|
+
var EmojiListRef = useEmojiListRef();
|
|
19851
|
+
var getEmojisByCategory = useGetEmojisByCategory();
|
|
19852
|
+
var labelHeight = getLabelHeight(EmojiListRef.current);
|
|
19853
|
+
var topOffset = 0;
|
|
19835
19854
|
return React.createElement("ul", {
|
|
19836
|
-
className: flairup.cx(styles$8.emojiList)
|
|
19855
|
+
className: flairup.cx(styles$8.emojiList),
|
|
19856
|
+
ref: EmojiListRef
|
|
19837
19857
|
}, categories.map(function (categoryConfig) {
|
|
19838
19858
|
var category = categoryFromCategoryConfig(categoryConfig);
|
|
19839
|
-
|
|
19840
|
-
|
|
19841
|
-
|
|
19842
|
-
|
|
19843
|
-
});
|
|
19859
|
+
var currentOffset = topOffset;
|
|
19860
|
+
var categoryHeight = categoryHeights[category];
|
|
19861
|
+
if (categoryHeight) {
|
|
19862
|
+
topOffset += categoryHeight + labelHeight;
|
|
19844
19863
|
}
|
|
19845
19864
|
return React.createElement(React.Suspense, {
|
|
19846
19865
|
key: category
|
|
19847
19866
|
}, React.createElement(RenderCategory, {
|
|
19848
|
-
|
|
19867
|
+
categoryEmojis: getEmojisByCategory(category),
|
|
19849
19868
|
categoryConfig: categoryConfig,
|
|
19850
|
-
|
|
19869
|
+
topOffset: currentOffset,
|
|
19870
|
+
onHeightReady: function onHeightReady(height) {
|
|
19871
|
+
if (categoryHeights[category] !== height) {
|
|
19872
|
+
setCategoryHeights(function (prev) {
|
|
19873
|
+
var _extends2;
|
|
19874
|
+
return _extends({}, prev, (_extends2 = {}, _extends2[category] = height, _extends2));
|
|
19875
|
+
});
|
|
19876
|
+
}
|
|
19877
|
+
},
|
|
19878
|
+
scrollTop: scrollTop
|
|
19851
19879
|
}));
|
|
19852
19880
|
}));
|
|
19853
19881
|
}
|
|
19854
|
-
function RenderCategory(
|
|
19855
|
-
var
|
|
19856
|
-
categoryConfig =
|
|
19857
|
-
|
|
19882
|
+
function RenderCategory(_ref2) {
|
|
19883
|
+
var categoryEmojis = _ref2.categoryEmojis,
|
|
19884
|
+
categoryConfig = _ref2.categoryConfig,
|
|
19885
|
+
topOffset = _ref2.topOffset,
|
|
19886
|
+
onHeightReady = _ref2.onHeightReady,
|
|
19887
|
+
scrollTop = _ref2.scrollTop;
|
|
19858
19888
|
var isEmojiHidden = useIsEmojiHidden();
|
|
19859
19889
|
var lazyLoadEmojis = useLazyLoadEmojisConfig();
|
|
19860
19890
|
var emojiStyle = useEmojiStyleConfig();
|
|
19861
|
-
var isPastInitialLoad = useIsPastInitialLoad();
|
|
19862
19891
|
var _useActiveSkinToneSta = useActiveSkinToneState(),
|
|
19863
19892
|
activeSkinTone = _useActiveSkinToneSta[0];
|
|
19864
19893
|
var isEmojiDisallowed = useIsEmojiDisallowed();
|
|
19865
19894
|
var getEmojiUrl = useGetEmojiUrlConfig();
|
|
19866
19895
|
var showVariations = !useSkinTonesDisabledConfig();
|
|
19867
|
-
|
|
19868
|
-
// This way the user gets to actually see something and not wait for the whole picker to render.
|
|
19869
|
-
var emojisToPush = !isPastInitialLoad && renderdCategoriesCountRef.current > 0 ? [] : emojisByCategory(category);
|
|
19870
|
-
if (emojisToPush.length > 0) {
|
|
19871
|
-
renderdCategoriesCountRef.current++;
|
|
19872
|
-
}
|
|
19896
|
+
var BodyRef = useBodyRef();
|
|
19873
19897
|
var hiddenCounter = 0;
|
|
19874
|
-
var
|
|
19875
|
-
|
|
19898
|
+
var virtualizedCounter = 0;
|
|
19899
|
+
var emojisToPush = categoryEmojis.filter(function (emoji) {
|
|
19876
19900
|
var _isEmojiHidden = isEmojiHidden(emoji),
|
|
19877
19901
|
failedToLoad = _isEmojiHidden.failedToLoad,
|
|
19878
19902
|
filteredOut = _isEmojiHidden.filteredOut,
|
|
19879
19903
|
hidden = _isEmojiHidden.hidden;
|
|
19904
|
+
return !failedToLoad && !filteredOut && !hidden;
|
|
19905
|
+
});
|
|
19906
|
+
var dimensions = useCategoryHeight(emojisToPush.length);
|
|
19907
|
+
React.useEffect(function () {
|
|
19908
|
+
if (dimensions) {
|
|
19909
|
+
onHeightReady(dimensions.categoryHeight);
|
|
19910
|
+
}
|
|
19911
|
+
}, [dimensions, onHeightReady, emojisToPush.length]);
|
|
19912
|
+
var emojis = emojisToPush.reduce(function (accumulator, emoji, index) {
|
|
19913
|
+
var _BodyRef$current$clie, _BodyRef$current;
|
|
19914
|
+
var unified = emojiUnified(emoji, activeSkinTone);
|
|
19915
|
+
var _isEmojiHidden2 = isEmojiHidden(emoji),
|
|
19916
|
+
failedToLoad = _isEmojiHidden2.failedToLoad,
|
|
19917
|
+
filteredOut = _isEmojiHidden2.filteredOut,
|
|
19918
|
+
hidden = _isEmojiHidden2.hidden;
|
|
19880
19919
|
var isDisallowed = isEmojiDisallowed(emoji);
|
|
19881
19920
|
if (hidden || isDisallowed) {
|
|
19882
19921
|
hiddenCounter++;
|
|
19883
19922
|
}
|
|
19884
|
-
if (isDisallowed) {
|
|
19885
|
-
return
|
|
19923
|
+
if (isDisallowed || failedToLoad || filteredOut) {
|
|
19924
|
+
return accumulator;
|
|
19886
19925
|
}
|
|
19887
|
-
|
|
19926
|
+
var style = getEmojiPositionStyle(dimensions, index - hiddenCounter);
|
|
19927
|
+
if (shouldVirtualize({
|
|
19928
|
+
scrollTop: scrollTop,
|
|
19929
|
+
clientHeight: (_BodyRef$current$clie = (_BodyRef$current = BodyRef.current) == null ? void 0 : _BodyRef$current.clientHeight) != null ? _BodyRef$current$clie : 0,
|
|
19930
|
+
topOffset: topOffset,
|
|
19931
|
+
style: style,
|
|
19932
|
+
dimensions: dimensions
|
|
19933
|
+
})) {
|
|
19934
|
+
virtualizedCounter++;
|
|
19935
|
+
return accumulator;
|
|
19936
|
+
}
|
|
19937
|
+
accumulator.push(React.createElement(ClickableEmoji, {
|
|
19888
19938
|
showVariations: showVariations,
|
|
19889
19939
|
key: unified,
|
|
19890
19940
|
emoji: emoji,
|
|
@@ -19893,14 +19943,19 @@ function RenderCategory(_ref) {
|
|
|
19893
19943
|
hiddenOnSearch: filteredOut,
|
|
19894
19944
|
emojiStyle: emojiStyle,
|
|
19895
19945
|
lazyLoad: lazyLoadEmojis,
|
|
19896
|
-
getEmojiUrl: getEmojiUrl
|
|
19897
|
-
|
|
19898
|
-
|
|
19946
|
+
getEmojiUrl: getEmojiUrl,
|
|
19947
|
+
style: _extends({}, style, {
|
|
19948
|
+
position: 'absolute'
|
|
19949
|
+
})
|
|
19950
|
+
}));
|
|
19951
|
+
return accumulator;
|
|
19952
|
+
}, []);
|
|
19899
19953
|
return React.createElement(EmojiCategory, {
|
|
19900
19954
|
categoryConfig: categoryConfig,
|
|
19955
|
+
height: dimensions == null ? void 0 : dimensions.categoryHeight,
|
|
19901
19956
|
// Indicates that there are no visible emojis
|
|
19902
19957
|
// Hence, the category should be hidden
|
|
19903
|
-
hidden: hiddenCounter === emojis.length
|
|
19958
|
+
hidden: hiddenCounter === emojis.length && virtualizedCounter === 0
|
|
19904
19959
|
}, emojis);
|
|
19905
19960
|
}
|
|
19906
19961
|
var styles$8 = /*#__PURE__*/stylesheet.create({
|
|
@@ -19911,6 +19966,26 @@ var styles$8 = /*#__PURE__*/stylesheet.create({
|
|
|
19911
19966
|
padding: '0'
|
|
19912
19967
|
}
|
|
19913
19968
|
});
|
|
19969
|
+
function getEmojiPositionStyle(dimensions, index) {
|
|
19970
|
+
return dimensions ? {
|
|
19971
|
+
top: Math.floor(index / dimensions.emojisPerRow) * dimensions.emojiSize,
|
|
19972
|
+
left: index % dimensions.emojisPerRow * dimensions.emojiSize
|
|
19973
|
+
} : undefined;
|
|
19974
|
+
}
|
|
19975
|
+
function shouldVirtualize(_ref3) {
|
|
19976
|
+
var scrollTop = _ref3.scrollTop,
|
|
19977
|
+
clientHeight = _ref3.clientHeight,
|
|
19978
|
+
topOffset = _ref3.topOffset,
|
|
19979
|
+
style = _ref3.style,
|
|
19980
|
+
dimensions = _ref3.dimensions;
|
|
19981
|
+
if (!style || !dimensions) {
|
|
19982
|
+
return false;
|
|
19983
|
+
}
|
|
19984
|
+
var emojiTop = topOffset + style.top;
|
|
19985
|
+
var emojiBottom = emojiTop + dimensions.emojiSize;
|
|
19986
|
+
var isVisible = emojiBottom + dimensions.emojiSize * 2 >= scrollTop && emojiTop <= scrollTop + clientHeight + dimensions.emojiSize;
|
|
19987
|
+
return !isVisible;
|
|
19988
|
+
}
|
|
19914
19989
|
|
|
19915
19990
|
var SVGTriangle = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI2LjMuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI1MHB4IgoJIGhlaWdodD0iMTVweCIgdmlld0JveD0iMCAwIDUwIDE1IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA1MCAxNSIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnIGlkPSJMYXllcl8xIj4KPC9nPgo8ZyBpZD0iTGF5ZXJfMiI+Cgk8cGF0aCBmaWxsPSIjRkZGRkZGIiBzdHJva2U9IiNFOEU3RTciIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgZD0iTTEuODYtMC40M2w5LjgzLDExLjUzYzAuNTksMC42OSwxLjU2LDAuNjksMi4xNCwwbDkuODMtMTEuNTMiLz4KCTxwYXRoIGZpbGw9IiMwMTAyMDIiIHN0cm9rZT0iIzE1MTYxNyIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBkPSJNMjYuODYtMC40M2w5LjgzLDExLjUzYzAuNTksMC42OSwxLjU2LDAuNjksMi4xNCwwbDkuODMtMTEuNTMiLz4KPC9nPgo8L3N2Zz4=';
|
|
19916
19991
|
|
|
@@ -20078,13 +20153,15 @@ var styles$9 = /*#__PURE__*/stylesheet.create( /*#__PURE__*/_extends({
|
|
|
20078
20153
|
|
|
20079
20154
|
function Body() {
|
|
20080
20155
|
var BodyRef = useBodyRef();
|
|
20081
|
-
useOnScroll(BodyRef);
|
|
20156
|
+
var scrollTop = useOnScroll(BodyRef);
|
|
20082
20157
|
useMouseDownHandlers(BodyRef, MOUSE_EVENT_SOURCE.PICKER);
|
|
20083
20158
|
useOnMouseMove();
|
|
20084
20159
|
return React.createElement("div", {
|
|
20085
20160
|
className: flairup.cx(styles$a.body, commonInteractionStyles.hiddenOnReactions),
|
|
20086
20161
|
ref: BodyRef
|
|
20087
|
-
}, React.createElement(EmojiVariationPicker, null), React.createElement(EmojiList,
|
|
20162
|
+
}, React.createElement(EmojiVariationPicker, null), React.createElement(EmojiList, {
|
|
20163
|
+
scrollTop: scrollTop
|
|
20164
|
+
}));
|
|
20088
20165
|
}
|
|
20089
20166
|
var styles$a = /*#__PURE__*/stylesheet.create({
|
|
20090
20167
|
body: {
|
|
@@ -20789,21 +20866,6 @@ var styles$h = /*#__PURE__*/stylesheet.create( /*#__PURE__*/_extends({
|
|
|
20789
20866
|
backgroundPositionY: '-40px'
|
|
20790
20867
|
}), /*#__PURE__*/darkMode('btnClearSearch', HoverDark)));
|
|
20791
20868
|
|
|
20792
|
-
var SCOPE = /*#__PURE__*/asSelectors(ClassNames.emojiPicker) + " " + /*#__PURE__*/asSelectors(ClassNames.emojiList);
|
|
20793
|
-
var EMOJI_BUTTON = /*#__PURE__*/['button', asSelectors(ClassNames.emoji)].join('');
|
|
20794
|
-
var CATEGORY = /*#__PURE__*/asSelectors(ClassNames.category);
|
|
20795
|
-
function CssSearch(_ref) {
|
|
20796
|
-
var value = _ref.value;
|
|
20797
|
-
if (!value) {
|
|
20798
|
-
return null;
|
|
20799
|
-
}
|
|
20800
|
-
var q = genQuery(value);
|
|
20801
|
-
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 ");
|
|
20802
|
-
}
|
|
20803
|
-
function genQuery(value) {
|
|
20804
|
-
return [EMOJI_BUTTON, '[data-full-name*="', getNormalizedSearchTerm(value), '"]'].join('');
|
|
20805
|
-
}
|
|
20806
|
-
|
|
20807
20869
|
var SVGMagnifier = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI2LjMuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHdpZHRoPSIyMHB4IiBoZWlnaHQ9IjQwcHgiIHZpZXdCb3g9IjAgMCAyMCA0MCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMjAgNDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzg2ODY4NiIgZD0iTTEyLDguODFjMCwyLjA4LTEuNjgsMy43Ni0zLjc2LDMuNzZjLTIuMDgsMC0zLjc2LTEuNjgtMy43Ni0zLjc2CgljMC0yLjA4LDEuNjgtMy43NiwzLjc2LTMuNzZDMTAuMzIsNS4wNSwxMiw2LjczLDEyLDguODF6IE0xMS4yMywxMi43MmMtMC44MywwLjY0LTEuODcsMS4wMS0yLjk5LDEuMDFjLTIuNzIsMC00LjkyLTIuMi00LjkyLTQuOTIKCWMwLTIuNzIsMi4yLTQuOTIsNC45Mi00LjkyYzIuNzIsMCw0LjkyLDIuMiw0LjkyLDQuOTJjMCwxLjEzLTAuMzgsMi4xNi0xLjAxLDIuOTlsMy45NCwzLjkzYzAuMjUsMC4yNSwwLjI1LDAuNjYsMCwwLjkyCgljLTAuMjUsMC4yNS0wLjY2LDAuMjUtMC45MiwwTDExLjIzLDEyLjcyeiIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI0MwQzBCRiIgZD0iTTEyLDI4LjgxYzAsMi4wOC0xLjY4LDMuNzYtMy43NiwzLjc2Yy0yLjA4LDAtMy43Ni0xLjY4LTMuNzYtMy43NgoJYzAtMi4wOCwxLjY4LTMuNzYsMy43Ni0zLjc2QzEwLjMyLDI1LjA1LDEyLDI2LjczLDEyLDI4LjgxeiBNMTEuMjMsMzIuNzJjLTAuODMsMC42NC0xLjg3LDEuMDEtMi45OSwxLjAxCgljLTIuNzIsMC00LjkyLTIuMi00LjkyLTQuOTJjMC0yLjcyLDIuMi00LjkyLDQuOTItNC45MmMyLjcyLDAsNC45MiwyLjIsNC45Miw0LjkyYzAsMS4xMy0wLjM4LDIuMTYtMS4wMSwyLjk5bDMuOTQsMy45MwoJYzAuMjUsMC4yNSwwLjI1LDAuNjYsMCwwLjkyYy0wLjI1LDAuMjUtMC42NiwwLjI1LTAuOTIsMEwxMS4yMywzMi43MnoiLz4KPC9zdmc+';
|
|
20808
20870
|
|
|
20809
20871
|
function IcnSearch() {
|
|
@@ -20841,9 +20903,6 @@ function SearchContainer() {
|
|
|
20841
20903
|
}, React.createElement(Search, null), isSkinToneInSearch ? React.createElement(SkinTonePicker, null) : null);
|
|
20842
20904
|
}
|
|
20843
20905
|
function Search() {
|
|
20844
|
-
var _useState = React.useState(0),
|
|
20845
|
-
inc = _useState[0],
|
|
20846
|
-
setInc = _useState[1];
|
|
20847
20906
|
var closeAllOpenToggles = useCloseAllOpenToggles();
|
|
20848
20907
|
var SearchInputRef = useSearchInputRef();
|
|
20849
20908
|
var placeholder = useSearchPlaceHolderConfig();
|
|
@@ -20856,9 +20915,7 @@ function Search() {
|
|
|
20856
20915
|
var value = input == null ? void 0 : input.value;
|
|
20857
20916
|
return React.createElement(Relative, {
|
|
20858
20917
|
className: flairup.cx(styles$j.searchContainer)
|
|
20859
|
-
}, React.createElement(
|
|
20860
|
-
value: value
|
|
20861
|
-
}), React.createElement("input", {
|
|
20918
|
+
}, React.createElement("input", {
|
|
20862
20919
|
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
20863
20920
|
autoFocus: autoFocus,
|
|
20864
20921
|
"aria-label": 'Type to search for an emoji',
|
|
@@ -20868,11 +20925,8 @@ function Search() {
|
|
|
20868
20925
|
"aria-controls": "epr-search-id",
|
|
20869
20926
|
placeholder: placeholder,
|
|
20870
20927
|
onChange: function onChange(event) {
|
|
20871
|
-
|
|
20872
|
-
|
|
20873
|
-
var _event$target$value, _event$target;
|
|
20874
|
-
_onChange((_event$target$value = event == null ? void 0 : (_event$target = event.target) == null ? void 0 : _event$target.value) != null ? _event$target$value : value);
|
|
20875
|
-
});
|
|
20928
|
+
var _event$target$value, _event$target;
|
|
20929
|
+
_onChange((_event$target$value = event == null ? void 0 : (_event$target = event.target) == null ? void 0 : _event$target.value) != null ? _event$target$value : value);
|
|
20876
20930
|
},
|
|
20877
20931
|
ref: SearchInputRef
|
|
20878
20932
|
}), searchTerm ? React.createElement("div", {
|