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