emoji-picker-react 4.20.1 → 4.20.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/llms.txt CHANGED
@@ -105,9 +105,11 @@ const Picker = dynamic(() => import('emoji-picker-react'));
105
105
 
106
106
  ## Troubleshooting
107
107
 
108
- ### `global is not defined` (Vite)
108
+ ### `global is not defined` (Vite, versions before 4.20)
109
109
 
110
- Add this to your HTML:
110
+ Since 4.20 the picker is SSR-safe and no longer references the Node-style
111
+ `global`. If you see `global is not defined`, upgrade to the latest version.
112
+ On older versions only, the workaround was adding this to your HTML:
111
113
 
112
114
  ```html
113
115
  <script>
@@ -328,6 +330,7 @@ function App() {
328
330
  - `emojis-sv` (Swedish)
329
331
  - `emojis-th` (Thai)
330
332
  - `emojis-uk` (Ukrainian)
333
+ - `emojis-vi` (Vietnamese)
331
334
  - `emojis-zh-hant` (Traditional Chinese)
332
335
  - `emojis-zh` (Simplified Chinese)
333
336
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.20.1",
2
+ "version": "4.20.2",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -42,10 +42,11 @@
42
42
  "build:data": "npm run build:data:src && npm run build:data:dist",
43
43
  "storybook": "npm run build:data && storybook dev -p 6006",
44
44
  "build-storybook": "storybook build",
45
- "docs:llms": "node ./scripts/generateLlmsTxt.js"
45
+ "docs:llms": "node ./scripts/generateLlmsTxt.js",
46
+ "check:react-floor": "node ./scripts/checkReactApiFloor.js"
46
47
  },
47
48
  "peerDependencies": {
48
- "react": ">=16"
49
+ "react": ">=16.8"
49
50
  },
50
51
  "husky": {
51
52
  "hooks": {
@@ -63,11 +64,11 @@
63
64
  "size-limit": [
64
65
  {
65
66
  "path": "dist/emoji-picker-react.cjs.production.min.js",
66
- "limit": "10 KB"
67
+ "limit": "95 KB"
67
68
  },
68
69
  {
69
70
  "path": "dist/emoji-picker-react.esm.js",
70
- "limit": "10 KB"
71
+ "limit": "95 KB"
71
72
  }
72
73
  ],
73
74
  "devDependencies": {
@@ -118,6 +119,6 @@
118
119
  "vitest": "^2.0.5"
119
120
  },
120
121
  "dependencies": {
121
- "flairup": "1.1.1"
122
+ "flairup": "1.1.2"
122
123
  }
123
124
  }
@@ -40,22 +40,21 @@ export function EmojiList({ scrollTop }: { scrollTop: number }) {
40
40
  }
41
41
 
42
42
  return (
43
- <React.Suspense key={category}>
44
- <RenderCategory
45
- categoryEmojis={getEmojisByCategory(category)}
46
- categoryConfig={categoryConfig}
47
- topOffset={currentOffset}
48
- onHeightReady={(height) => {
49
- if (categoryHeights[category] !== height) {
50
- setCategoryHeights((prev) => ({
51
- ...prev,
52
- [category]: height,
53
- }));
54
- }
55
- }}
56
- scrollTop={scrollTop}
57
- />
58
- </React.Suspense>
43
+ <RenderCategory
44
+ key={category}
45
+ categoryEmojis={getEmojisByCategory(category)}
46
+ categoryConfig={categoryConfig}
47
+ topOffset={currentOffset}
48
+ onHeightReady={(height) => {
49
+ if (categoryHeights[category] !== height) {
50
+ setCategoryHeights((prev) => ({
51
+ ...prev,
52
+ [category]: height,
53
+ }));
54
+ }
55
+ }}
56
+ scrollTop={scrollTop}
57
+ />
59
58
  );
60
59
  })}
61
60
  </ul>
@@ -19,7 +19,7 @@ import {
19
19
  emojiHasVariations,
20
20
  emojiUnified,
21
21
  emojiVariations,
22
- } from '../../dataUtils/emojiSelectors';
22
+ } from '../../dataUtils/emojiUtils';
23
23
  import {
24
24
  useAnchoredEmojiRef,
25
25
  useBodyRef,
@@ -7,15 +7,13 @@ import {
7
7
  useGetEmojiUrlConfig,
8
8
  useLazyLoadEmojisConfig,
9
9
  } from '../../config/useConfig';
10
- import {
11
- useGetEmojisByCategory,
12
- emojiUnified,
13
- } from '../../dataUtils/emojiSelectors';
10
+ import { emojiUnified } from '../../dataUtils/emojiUtils';
14
11
  import { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect';
15
12
  import {
16
13
  useActiveSkinToneState,
17
14
  useEmojiSizeState,
18
15
  } from '../context/PickerContext';
16
+ import { useGetEmojisByCategory } from '../context/PickerDataContext';
19
17
  import { ClickableEmoji } from '../emoji/Emoji';
20
18
 
21
19
  export function MeasureEmoji() {
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  import { DataEmoji } from '../../dataUtils/DataTypes';
4
- import { emojiHasVariations, emojiNames } from '../../dataUtils/emojiSelectors';
4
+ import { emojiHasVariations, emojiNames } from '../../dataUtils/emojiUtils';
5
5
 
6
6
  import { BaseEmojiProps } from './BaseEmojiProps';
7
7
  import { ClickableEmojiButton } from './ClickableEmojiButton';
@@ -11,7 +11,7 @@ import {
11
11
  useGetEmojiUrlConfig,
12
12
  usePreviewConfig,
13
13
  } from '../../config/useConfig';
14
- import { emojiName, emojiUnified } from '../../dataUtils/emojiSelectors';
14
+ import { emojiName, emojiUnified } from '../../dataUtils/emojiUtils';
15
15
  import { useEmojiPreviewEvents } from '../../hooks/useEmojiPreviewEvents';
16
16
  import { useIsSkinToneInPreview } from '../../hooks/useShouldShowSkinTonePicker';
17
17
  import Flex from '../Layout/Flex';
@@ -1,20 +1,18 @@
1
- import React from 'react';
2
-
3
- import { useUpdateSuggested } from '../components/context/PickerContext';
1
+ // Pure data helpers plus the legacy global registry. This module intentionally
2
+ // imports no React components, hooks, or context providers so it can never
3
+ // form an import cycle with them. Context-aware lookups live in
4
+ // components/context/PickerDataContext instead.
4
5
  import { Categories } from '../config/categoryConfig';
5
6
  import { cdnUrl } from '../config/cdnUrls';
6
7
  import { CustomEmoji } from '../config/customEmojiConfig';
7
- import { useSuggestedEmojisModeConfig } from '../config/useConfig';
8
8
  import emojis from '../data/emojis';
9
9
  import skinToneVariations, {
10
10
  skinTonesMapped,
11
11
  } from '../data/skinToneVariations';
12
- import { useIsMounted } from '../hooks/useIsMounted';
13
12
  import { EmojiStyle, SkinTones } from '../types/exposedTypes';
14
13
 
15
14
  import { DataEmoji, DataEmojis, EmojiProperties, WithName } from './DataTypes';
16
15
  import { indexEmoji } from './alphaNumericEmojiIndex';
17
- import { getSuggested } from './suggested';
18
16
 
19
17
  export function emojiNames(emoji: WithName): string[] {
20
18
  return emoji[EmojiProperties.name] ?? [];
@@ -54,39 +52,6 @@ export function emojiUnified(emoji: DataEmoji, skinTone?: string): string {
54
52
  return emojiVariationUnified(emoji, skinTone) ?? unified;
55
53
  }
56
54
 
57
- export function useGetEmojisByCategory(): (Category: Categories) => DataEmojis {
58
- const suggestedEmojisModeConfig = useSuggestedEmojisModeConfig();
59
- const [suggestedUpdated] = useUpdateSuggested();
60
- // Suggestions come from localStorage, which doesn't exist during SSR.
61
- // Read them only after mount so the first client render matches the server.
62
- const isMounted = useIsMounted();
63
-
64
- const suggested = React.useMemo(
65
- () => {
66
- if (!isMounted) {
67
- return [] as DataEmojis;
68
- }
69
-
70
- const suggested = getSuggested(suggestedEmojisModeConfig) ?? [];
71
-
72
- return suggested
73
- .map((s) => emojiByUnified(s.unified))
74
- .filter(Boolean) as DataEmojis;
75
- },
76
- // eslint-disable-next-line react-hooks/exhaustive-deps
77
- [isMounted, suggestedUpdated, suggestedEmojisModeConfig],
78
- );
79
-
80
- return function getEmojisByCategory(category: Categories): DataEmojis {
81
- if (category === Categories.SUGGESTED) {
82
- return suggested;
83
- }
84
-
85
- // @ts-ignore
86
- return emojis.emojis[category] ?? [];
87
- };
88
- }
89
-
90
55
  // WARNING: DO NOT USE DIRECTLY
91
56
  export function emojiUrlByUnified(
92
57
  unified: string,
@@ -1,7 +1,7 @@
1
1
  import { SkinTones, SuggestionMode } from '../types/exposedTypes';
2
2
 
3
3
  import { DataEmoji } from './DataTypes';
4
- import { emojiUnified } from './emojiSelectors';
4
+ import { emojiUnified } from './emojiUtils';
5
5
 
6
6
  const SUGGESTED_LS_KEY = 'epr_suggested';
7
7
 
@@ -26,7 +26,7 @@ import {
26
26
  emojiHasVariations,
27
27
  emojiNames,
28
28
  emojiUnified,
29
- } from '../dataUtils/emojiSelectors';
29
+ } from '../dataUtils/emojiUtils';
30
30
  import { parseNativeEmoji } from '../dataUtils/parseNativeEmoji';
31
31
  import { setSuggested } from '../dataUtils/suggested';
32
32
  import { isCustomEmoji } from '../typeRefinements/typeRefinements';
@@ -3,7 +3,7 @@ import { useEffect } from 'react';
3
3
  import { buttonFromTarget, emojiFromElement } from '../DomUtils/selectors';
4
4
  import { useBodyRef } from '../components/context/ElementRefContext';
5
5
  import { useEmojiStyleConfig, useGetEmojiUrlConfig } from '../config/useConfig';
6
- import { emojiHasVariations } from '../dataUtils/emojiSelectors';
6
+ import { emojiHasVariations } from '../dataUtils/emojiUtils';
7
7
  import { EmojiStyle } from '../types/exposedTypes';
8
8
 
9
9
  import { preloadEmoji } from './preloadEmoji';