emoji-picker-react 5.0.1 → 5.0.2
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/data/index.js +1 -1
- package/dist/data-core/prepare.d.ts +6 -0
- package/dist/esm/chunks/{chunk-F2KS7DCA.mjs → chunk-56D5WCOZ.mjs} +26 -32
- package/dist/esm/chunks/{chunk-L5W4PFRJ.mjs → chunk-IODYR4CR.mjs} +1 -1
- package/dist/esm/chunks/{chunk-ACXAQEKG.mjs → chunk-RU7G34WK.mjs} +10 -3
- package/dist/esm/data.mjs +2 -2
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/primitives/index.mjs +2 -2
- package/dist/hooks/preloadEmoji.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/primitives/index.js +1 -1
- package/llms-full.txt +3 -0
- package/package.json +2 -2
- package/src/components/context/PickerDataContext.tsx +2 -1
- package/src/components/header/SkinTonePicker/BtnSkinToneVariation.tsx +7 -6
- package/src/config/config.ts +6 -3
- package/src/data-core/pickerData.ts +7 -9
- package/src/data-core/prepare.ts +12 -4
- package/src/data-core/search.ts +10 -2
- package/src/dataUtils/suggestedEmojis.ts +25 -39
- package/src/hooks/preloadEmoji.ts +12 -6
- package/src/hooks/useDisallowedEmojis.ts +6 -1
- package/src/hooks/useEmojiVirtualization.tsx +11 -1
|
@@ -19,5 +19,11 @@ export declare function __getPrepareCount(): number;
|
|
|
19
19
|
export declare function __resetPrepareCount(): void;
|
|
20
20
|
export declare function __clearCoreCacheForTest(): void;
|
|
21
21
|
export declare function normalizeUnified(input: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Datasets disagree on where U+FE0F (emoji presentation) appears in an ID:
|
|
24
|
+
* `2764` and `2764-fe0f` are the same heart. IDs are also indexed under
|
|
25
|
+
* this form, so either spelling finds the dataset's own record.
|
|
26
|
+
*/
|
|
27
|
+
export declare function withoutFe0f(unified: string): string;
|
|
22
28
|
export declare function normalizeQuery(input: string): string;
|
|
23
29
|
export declare function getPreparedCore(emojiData?: EmojiData): PreparedCore;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EMPTY_EMOJI_DATA, defaultEmojiDataOrEmpty, getPreparedCore, getRegisteredDefaultEmojiData, init_defaultEmojiData, loadDefaultEmojiData, normalizeQuery, parseNativeEmoji, searchEmojis } from "./chunk-
|
|
1
|
+
import { EMPTY_EMOJI_DATA, defaultEmojiDataOrEmpty, getPreparedCore, getRegisteredDefaultEmojiData, init_defaultEmojiData, loadDefaultEmojiData, normalizeQuery, parseNativeEmoji, searchEmojis, withoutFe0f } from "./chunk-RU7G34WK.mjs";
|
|
2
2
|
|
|
3
3
|
// src/primitives/Root.tsx
|
|
4
4
|
import * as React29 from "react";
|
|
@@ -1617,7 +1617,7 @@ function getBaseConfigByCategory(category, modifier = {}) {
|
|
|
1617
1617
|
}
|
|
1618
1618
|
|
|
1619
1619
|
// src/config/config.ts
|
|
1620
|
-
var KNOWN_FAILING_EMOJIS = [ "2640
|
|
1620
|
+
var KNOWN_FAILING_EMOJIS = [ "2640", "2642", "2695" ], DEFAULT_SEARCH_PLACEHOLDER = "Search", DEFAULT_PICKER_WIDTH = 350, DEFAULT_PICKER_HEIGHT = 450, DEFAULT_SEARCH_CLEAR_BUTTON_LABEL = "Clear", DEFAULT_LABELS = {
|
|
1621
1621
|
searchPlaceholder: DEFAULT_SEARCH_PLACEHOLDER,
|
|
1622
1622
|
searchLabel: "Type to search for an emoji",
|
|
1623
1623
|
searchClear: DEFAULT_SEARCH_CLEAR_BUTTON_LABEL,
|
|
@@ -1667,7 +1667,7 @@ function mergeConfig(rawUserConfig = {}) {
|
|
|
1667
1667
|
suggestionMode: config.suggestedEmojisMode
|
|
1668
1668
|
}, userConfig.emojiData, userConfig.customEmojis);
|
|
1669
1669
|
config.hiddenEmojis.forEach((emoji => {
|
|
1670
|
-
const id = String(emoji).trim().toLowerCase();
|
|
1670
|
+
const id = withoutFe0f(String(emoji).trim().toLowerCase());
|
|
1671
1671
|
id && config.unicodeToHide.add(id);
|
|
1672
1672
|
}));
|
|
1673
1673
|
const skinTonePickerLocation = resolveSkinTonePickerLocation(config.skinTonePickerLocation, config.searchDisabled, previewConfig.showPreview);
|
|
@@ -2325,9 +2325,9 @@ function getPickerDataSnapshot(genericEmojiData, customEmojis) {
|
|
|
2325
2325
|
emojis: nextEmojis
|
|
2326
2326
|
}, customGroups = customLayer.groups, allEmojis = Object.values(nextEmojis).concat(Object.values(customGroups)).flat(), allEmojisByUnified2 = /* @__PURE__ */ Object.create(null);
|
|
2327
2327
|
allEmojis.forEach((emoji => {
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
allEmojisByUnified2[
|
|
2328
|
+
[ emoji.u, ...emoji.v || [] ].forEach((id => {
|
|
2329
|
+
var _a;
|
|
2330
|
+
allEmojisByUnified2[id] = emoji, allEmojisByUnified2[_a = withoutFe0f(id)] || (allEmojisByUnified2[_a] = emoji);
|
|
2331
2331
|
}));
|
|
2332
2332
|
}));
|
|
2333
2333
|
const snapshot = {
|
|
@@ -2378,20 +2378,12 @@ function resolveSuggestedRenderIds(entries, lookup) {
|
|
|
2378
2378
|
}
|
|
2379
2379
|
|
|
2380
2380
|
function resolveEntryId(id, lookup) {
|
|
2381
|
-
if (id)
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
function nativeToUnifiedCandidates(native) {
|
|
2388
|
-
const codePoints = Array.from(native).map((char => char.codePointAt(0).toString(16).padStart(4, "0"))), exact = codePoints.join("-"), bare = codePoints.filter((codePoint => "fe0f" !== codePoint)), withPresentation = [ bare[0], "fe0f", ...bare.slice(1) ];
|
|
2389
|
-
return [ exact, bare.join("-"), withPresentation.join("-") ];
|
|
2390
|
-
}
|
|
2391
|
-
|
|
2392
|
-
function isKnownRenderId(id, lookup) {
|
|
2393
|
-
const record = lookup(id);
|
|
2394
|
-
return !!record && (record.u === id || (record.v ?? []).includes(id));
|
|
2381
|
+
if (!id) return;
|
|
2382
|
+
let unified = id, record = lookup(id);
|
|
2383
|
+
if (!record && /[^\0-\x7f]/.test(id) && (unified = Array.from(id).map((char => char.codePointAt(0).toString(16).padStart(4, "0"))).join("-"),
|
|
2384
|
+
record = lookup(unified)), !record) return;
|
|
2385
|
+
const known = [ record.u, ...record.v ?? [] ];
|
|
2386
|
+
return known.includes(unified) ? unified : known.find((each => withoutFe0f(each) === withoutFe0f(unified)));
|
|
2395
2387
|
}
|
|
2396
2388
|
|
|
2397
2389
|
// src/hooks/useDataIdentityStabilityWarning.ts
|
|
@@ -2450,7 +2442,7 @@ function PickerDataProvider({children}) {
|
|
|
2450
2442
|
const {customEmojis, emojiData: genericEmojiData} = usePickerConfig();
|
|
2451
2443
|
useDataIdentityStabilityWarning(genericEmojiData, customEmojis);
|
|
2452
2444
|
const data = React10.useMemo((() => getPickerDataSnapshot(genericEmojiData, customEmojis)), [ genericEmojiData, customEmojis ]), emojiByUnified2 = React10.useCallback((unified => {
|
|
2453
|
-
if (unified) return data.allEmojisByUnified[unified] ?? data.allEmojisByUnified[unifiedWithoutSkinTone(unified)];
|
|
2445
|
+
if (unified) return data.allEmojisByUnified[unified] ?? data.allEmojisByUnified[withoutFe0f(unified)] ?? data.allEmojisByUnified[unifiedWithoutSkinTone(unified)];
|
|
2454
2446
|
}), [ data.allEmojisByUnified ]), allCustomEmojis = React10.useMemo((() => [ ...data.emojiData.emojis?.custom ?? [], ...Object.values(data.customGroups).flat() ]), [ data.emojiData, data.customGroups ]), queryFilterDict = React10.useCallback((query => {
|
|
2455
2447
|
const normalized = normalizeQuery(query), dict = /* @__PURE__ */ Object.create(null);
|
|
2456
2448
|
if (!normalized) return dict;
|
|
@@ -4158,10 +4150,11 @@ function hasModifier(event) {
|
|
|
4158
4150
|
import { useEffect as useEffect14 } from "react";
|
|
4159
4151
|
|
|
4160
4152
|
// src/hooks/preloadEmoji.ts
|
|
4161
|
-
function preloadEmoji(getEmojiUrl, emoji, emojiStyle) {
|
|
4153
|
+
function preloadEmoji(getEmojiUrl, emoji, emojiStyle, rendered) {
|
|
4162
4154
|
if (!emoji) return;
|
|
4163
|
-
const unified = emojiUnified(emoji);
|
|
4164
|
-
preloadedEmojs.has(unified) ||
|
|
4155
|
+
const unified = emojiUnified(emoji), key = rendered ? rendered + "/only" : unified;
|
|
4156
|
+
preloadedEmojs.has(unified) || preloadedEmojs.has(key) || (preloadedEmojs.add(key),
|
|
4157
|
+
(rendered ? [ rendered ] : emojiVariations(emoji).concat(unified)).forEach((variation => {
|
|
4165
4158
|
preloadImage(getEmojiUrl(variation, emojiStyle));
|
|
4166
4159
|
})));
|
|
4167
4160
|
}
|
|
@@ -4735,7 +4728,7 @@ import { useCallback as useCallback10 } from "react";
|
|
|
4735
4728
|
function useIsEmojiDisallowed() {
|
|
4736
4729
|
const configured = parseFloat(useEmojiVersionConfig() || ""), nativeSupport = useNativeEmojiSupport(), cap = Number.isNaN(configured) ? 1 / 0 : configured, unicodeToHide = useUnicodeToHide(), [activeSkinTone] = useActiveSkinToneState();
|
|
4737
4730
|
return useCallback10((function isEmojiDisallowed(emoji, renderedUnified = emojiUnified(emoji, activeSkinTone)) {
|
|
4738
|
-
if (unicodeToHide.has(unifiedWithoutSkinTone(emojiUnified(emoji)))) return !0;
|
|
4731
|
+
if (unicodeToHide.has(withoutFe0f(unifiedWithoutSkinTone(emojiUnified(emoji))))) return !0;
|
|
4739
4732
|
if (isCustomEmoji(emoji)) return !1;
|
|
4740
4733
|
const version = addedIn(emoji);
|
|
4741
4734
|
return version > cap || !isNativeEmojiSupported(nativeSupport, renderedUnified, version);
|
|
@@ -5556,23 +5549,24 @@ var SKIN_TONE_LABEL_KEYS = {
|
|
|
5556
5549
|
":focus": {
|
|
5557
5550
|
boxShadow: "0 0 0 3px var(--epr-focus-bg-color)"
|
|
5558
5551
|
},
|
|
5552
|
+
// Swatch colors are themeable; the fallbacks are the defaults.
|
|
5559
5553
|
"&.epr-tone-neutral": {
|
|
5560
|
-
backgroundColor: "#ffd225"
|
|
5554
|
+
backgroundColor: "var(--epr-skin-tone-neutral-color, #ffd225)"
|
|
5561
5555
|
},
|
|
5562
5556
|
"&.epr-tone-1f3fb": {
|
|
5563
|
-
backgroundColor: "#ffdfbd"
|
|
5557
|
+
backgroundColor: "var(--epr-skin-tone-light-color, #ffdfbd)"
|
|
5564
5558
|
},
|
|
5565
5559
|
"&.epr-tone-1f3fc": {
|
|
5566
|
-
backgroundColor: "#e9c197"
|
|
5560
|
+
backgroundColor: "var(--epr-skin-tone-medium-light-color, #e9c197)"
|
|
5567
5561
|
},
|
|
5568
5562
|
"&.epr-tone-1f3fd": {
|
|
5569
|
-
backgroundColor: "#c88e62"
|
|
5563
|
+
backgroundColor: "var(--epr-skin-tone-medium-color, #c88e62)"
|
|
5570
5564
|
},
|
|
5571
5565
|
"&.epr-tone-1f3fe": {
|
|
5572
|
-
backgroundColor: "#a86637"
|
|
5566
|
+
backgroundColor: "var(--epr-skin-tone-medium-dark-color, #a86637)"
|
|
5573
5567
|
},
|
|
5574
5568
|
"&.epr-tone-1f3ff": {
|
|
5575
|
-
backgroundColor: "#60463a"
|
|
5569
|
+
backgroundColor: "var(--epr-skin-tone-dark-color, #60463a)"
|
|
5576
5570
|
}
|
|
5577
5571
|
}
|
|
5578
5572
|
}))();
|
|
@@ -6435,7 +6429,7 @@ function useEmojiVirtualization({categoryEmojis, topOffset, onHeightReady, scrol
|
|
|
6435
6429
|
})), accumulator;
|
|
6436
6430
|
}), []) : [];
|
|
6437
6431
|
return useEffect26((() => requestNativeProbe(probe2))), useEffect26((() => {
|
|
6438
|
-
preloads.forEach((emoji => preloadEmoji(getEmojiUrl, emoji, emojiStyle)));
|
|
6432
|
+
preloads.forEach((emoji => preloadEmoji(getEmojiUrl, emoji, emojiStyle, emojiUnified(emoji, activeSkinTone))));
|
|
6439
6433
|
})), {
|
|
6440
6434
|
virtualizedCounter: emojisToPush.length - emojis.length,
|
|
6441
6435
|
emojis,
|
|
@@ -46,6 +46,10 @@ function normalizeUnified(input) {
|
|
|
46
46
|
return input.trim().toLowerCase();
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
function withoutFe0f(unified) {
|
|
50
|
+
return unified.replace(/-fe0f/g, "");
|
|
51
|
+
}
|
|
52
|
+
|
|
49
53
|
function normalizeQuery(input) {
|
|
50
54
|
return input && "string" == typeof input ? input.trim().toLowerCase() : "";
|
|
51
55
|
}
|
|
@@ -68,7 +72,8 @@ function appendEntry(byUnified, byCharMutable, records, entry) {
|
|
|
68
72
|
addedIn
|
|
69
73
|
});
|
|
70
74
|
records.push(info), byUnified.set(unified, info);
|
|
71
|
-
for (const
|
|
75
|
+
for (const id of [ unified, ...info.variations ]) byUnified.has(id) || byUnified.set(id, info),
|
|
76
|
+
byUnified.has(withoutFe0f(id)) || byUnified.set(withoutFe0f(id), info);
|
|
72
77
|
indexCharBucket(byCharMutable, names, info);
|
|
73
78
|
}
|
|
74
79
|
|
|
@@ -123,7 +128,9 @@ function smallestCandidateBucket(core, normalized) {
|
|
|
123
128
|
function getEmojiByUnified(unified, options) {
|
|
124
129
|
if (!unified || "string" != typeof unified) return;
|
|
125
130
|
const normalized = normalizeUnified(unified);
|
|
126
|
-
|
|
131
|
+
if (!normalized) return;
|
|
132
|
+
const core = getPreparedCore(options?.emojiData);
|
|
133
|
+
return core.byUnified.get(normalized) ?? core.byUnified.get(withoutFe0f(normalized));
|
|
127
134
|
}
|
|
128
135
|
|
|
129
136
|
function searchEmojis(query, options) {
|
|
@@ -146,4 +153,4 @@ function searchEmojis(query, options) {
|
|
|
146
153
|
return memoizeQuery(core, normalized, matches), Object.freeze([ ...matches ]);
|
|
147
154
|
}
|
|
148
155
|
|
|
149
|
-
export { registerDefaultEmojiData, getRegisteredDefaultEmojiData, EMPTY_EMOJI_DATA, defaultEmojiDataOrEmpty, loadDefaultEmojiData, init_defaultEmojiData, parseNativeEmoji, normalizeQuery, getPreparedCore, getEmojiByUnified, searchEmojis };
|
|
156
|
+
export { registerDefaultEmojiData, getRegisteredDefaultEmojiData, EMPTY_EMOJI_DATA, defaultEmojiDataOrEmpty, loadDefaultEmojiData, init_defaultEmojiData, parseNativeEmoji, withoutFe0f, normalizeQuery, getPreparedCore, getEmojiByUnified, searchEmojis };
|
package/dist/esm/data.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { require_registerDefaultEmojiData } from "./chunks/chunk-
|
|
1
|
+
import { require_registerDefaultEmojiData } from "./chunks/chunk-IODYR4CR.mjs";
|
|
2
2
|
|
|
3
|
-
import { getEmojiByUnified, searchEmojis } from "./chunks/chunk-
|
|
3
|
+
import { getEmojiByUnified, searchEmojis } from "./chunks/chunk-RU7G34WK.mjs";
|
|
4
4
|
|
|
5
5
|
import "./chunks/chunk-7ZGTUZFB.mjs";
|
|
6
6
|
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Categories, CategoryNav, DEFAULT_PICKER_HEIGHT, DEFAULT_PICKER_WIDTH, DefaultPickerConfiguration, EmojiStyle, Empty, List, LoadError, Loading, MutableConfigProvider, Panel, Preview, Reactions, Relative, Root, Search, SkinTone, SkinTonePickerLocation, SkinTones, SuggestionMode, Theme, ViewOnlyEmoji, Viewport, commonInteractionStyles, compareConfig, cx, defaultPickerTokens, emojiByUnified, isPickerBehaviorProp, resolveEmojiStyle, resolveSkinTonePickerLocation, stylesheet, useDefaultAppearance, useDefineMutableConfig, usePreviewConfig, useSearchDisabledConfig, useSkinTonePickerLocationConfig, useSkinTonesDisabledConfig, validColumns } from "./chunks/chunk-
|
|
2
|
+
import { Categories, CategoryNav, DEFAULT_PICKER_HEIGHT, DEFAULT_PICKER_WIDTH, DefaultPickerConfiguration, EmojiStyle, Empty, List, LoadError, Loading, MutableConfigProvider, Panel, Preview, Reactions, Relative, Root, Search, SkinTone, SkinTonePickerLocation, SkinTones, SuggestionMode, Theme, ViewOnlyEmoji, Viewport, commonInteractionStyles, compareConfig, cx, defaultPickerTokens, emojiByUnified, isPickerBehaviorProp, resolveEmojiStyle, resolveSkinTonePickerLocation, stylesheet, useDefaultAppearance, useDefineMutableConfig, usePreviewConfig, useSearchDisabledConfig, useSkinTonePickerLocationConfig, useSkinTonesDisabledConfig, validColumns } from "./chunks/chunk-56D5WCOZ.mjs";
|
|
3
3
|
|
|
4
|
-
import { require_registerDefaultEmojiData } from "./chunks/chunk-
|
|
4
|
+
import { require_registerDefaultEmojiData } from "./chunks/chunk-IODYR4CR.mjs";
|
|
5
5
|
|
|
6
|
-
import "./chunks/chunk-
|
|
6
|
+
import "./chunks/chunk-RU7G34WK.mjs";
|
|
7
7
|
|
|
8
8
|
import "./chunks/chunk-7ZGTUZFB.mjs";
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Categories, CategoryNav, EmojiStyle, Empty, List, LoadError, Loading, Panel, Preview, Reactions, Root, Search, SearchInput, SkinTone, SkinTonePickerLocation, SkinTones, SuggestionMode, Theme, Viewport, darkPickerTokens, defaultPickerTokens, lightPickerTokens, structuralPickerTokens, useActiveEmoji, useCategoryNavigation, useEmojiDataState, usePickerMode, useSearchActions, useSearchState, useSkinTone } from "../chunks/chunk-
|
|
2
|
+
import { Categories, CategoryNav, EmojiStyle, Empty, List, LoadError, Loading, Panel, Preview, Reactions, Root, Search, SearchInput, SkinTone, SkinTonePickerLocation, SkinTones, SuggestionMode, Theme, Viewport, darkPickerTokens, defaultPickerTokens, lightPickerTokens, structuralPickerTokens, useActiveEmoji, useCategoryNavigation, useEmojiDataState, usePickerMode, useSearchActions, useSearchState, useSkinTone } from "../chunks/chunk-56D5WCOZ.mjs";
|
|
3
3
|
|
|
4
|
-
import "../chunks/chunk-
|
|
4
|
+
import "../chunks/chunk-RU7G34WK.mjs";
|
|
5
5
|
|
|
6
6
|
import "../chunks/chunk-LO4TPPLH.mjs";
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GetEmojiUrl } from '../components/emoji/BaseEmojiProps';
|
|
2
2
|
import { DataEmoji } from '../dataUtils/DataTypes';
|
|
3
3
|
import { EmojiStyleValue } from '../types/exposedTypes';
|
|
4
|
-
export declare function preloadEmoji(getEmojiUrl: GetEmojiUrl, emoji: undefined | DataEmoji, emojiStyle: EmojiStyleValue): void;
|
|
4
|
+
export declare function preloadEmoji(getEmojiUrl: GetEmojiUrl, emoji: undefined | DataEmoji, emojiStyle: EmojiStyleValue, rendered?: string): void;
|
|
5
5
|
export declare const preloadedEmojs: Set<string>;
|