emoji-picker-react 4.20.1 → 4.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/Stylesheet/stylesheet.d.ts +1 -1
- package/dist/dataUtils/emojiSelectors.d.ts +0 -2
- package/dist/emoji-picker-react.cjs.development.js +117 -161
- 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 +82 -126
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/llms.txt +6 -3
- package/package.json +13 -6
- package/src/Stylesheet/stylesheet.tsx +1 -1
- package/src/components/Layout/Flex.tsx +1 -1
- package/src/components/Layout/Space.tsx +1 -1
- package/src/components/Reactions/BtnPlus.tsx +1 -1
- package/src/components/Reactions/Reactions.tsx +1 -1
- package/src/components/atoms/Button.tsx +1 -1
- package/src/components/body/Body.tsx +1 -1
- package/src/components/body/EmojiCategory.tsx +1 -1
- package/src/components/body/EmojiList.tsx +16 -17
- package/src/components/body/EmojiVariationPicker.tsx +2 -2
- package/src/components/body/MeasureEmoji.tsx +2 -4
- package/src/components/emoji/ClickableEmojiButton.tsx +1 -1
- package/src/components/emoji/Emoji.tsx +1 -1
- package/src/components/emoji/EmojiImg.tsx +1 -1
- package/src/components/emoji/NativeEmoji.tsx +1 -1
- package/src/components/footer/Preview.tsx +2 -2
- package/src/components/header/Header.tsx +1 -1
- package/src/components/header/Search/BtnClearSearch.tsx +1 -1
- package/src/components/header/Search/IcnSearch.tsx +1 -1
- package/src/components/header/Search/Search.tsx +1 -1
- package/src/components/header/SkinTonePicker/BtnSkinToneVariation.tsx +1 -1
- package/src/components/header/SkinTonePicker/SkinTonePicker.tsx +1 -1
- package/src/components/main/PickerMain.tsx +1 -1
- package/src/components/navigation/CategoryButton.tsx +1 -1
- package/src/components/navigation/CategoryNavigation.tsx +1 -1
- package/src/dataUtils/emojiSelectors.ts +4 -39
- package/src/dataUtils/suggested.ts +1 -1
- package/src/hooks/useMouseDownHandlers.ts +1 -1
- package/src/hooks/useOnFocus.ts +1 -1
package/llms.txt
CHANGED
|
@@ -64,7 +64,7 @@ See [PROPS.md](PROPS.md) for the complete props reference.
|
|
|
64
64
|
|
|
65
65
|
## Styling
|
|
66
66
|
|
|
67
|
-
No stylesheet import needed. All styles are scoped via [
|
|
67
|
+
No stylesheet import needed. All styles are scoped via [ShipStyles](https://github.com/ealush/shipstyles) — generated class names are hashed, so the picker's CSS won't leak into or clash with your app's styles.
|
|
68
68
|
|
|
69
69
|
Restyle the picker by overriding [CSS variables](CSS_VARIABLES.md) on `.EmojiPickerReact`:
|
|
70
70
|
|
|
@@ -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
|
-
|
|
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.
|
|
2
|
+
"version": "4.20.4",
|
|
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": "
|
|
67
|
+
"limit": "95 KB"
|
|
67
68
|
},
|
|
68
69
|
{
|
|
69
70
|
"path": "dist/emoji-picker-react.esm.js",
|
|
70
|
-
"limit": "
|
|
71
|
+
"limit": "95 KB"
|
|
71
72
|
}
|
|
72
73
|
],
|
|
73
74
|
"devDependencies": {
|
|
@@ -75,6 +76,10 @@
|
|
|
75
76
|
"@babel/preset-react": "^7.24.1",
|
|
76
77
|
"@babel/preset-typescript": "^7.24.1",
|
|
77
78
|
"@playwright/test": "^1.46.1",
|
|
79
|
+
"@semantic-release/changelog": "^7.0.0",
|
|
80
|
+
"@semantic-release/git": "^11.0.1",
|
|
81
|
+
"@semantic-release/github": "^12.0.9",
|
|
82
|
+
"@semantic-release/npm": "^13.1.5",
|
|
78
83
|
"@size-limit/preset-small-lib": "^8.0.1",
|
|
79
84
|
"@storybook/addon-essentials": "^8.6.15",
|
|
80
85
|
"@storybook/addon-info": "^5.3.21",
|
|
@@ -92,6 +97,7 @@
|
|
|
92
97
|
"@typescript-eslint/parser": "^5.36.2",
|
|
93
98
|
"autoprefixer": "^10.4.8",
|
|
94
99
|
"babel-loader": "^8.2.5",
|
|
100
|
+
"conventional-changelog-conventionalcommits": "^9.3.1",
|
|
95
101
|
"cssnano": "^5.1.13",
|
|
96
102
|
"emoji-datasource": "^16.0.0",
|
|
97
103
|
"emojibase-data": "^17.0.0",
|
|
@@ -109,6 +115,7 @@
|
|
|
109
115
|
"react-dom": "^18.2.0",
|
|
110
116
|
"react-is": "^18.2.0",
|
|
111
117
|
"rollup-plugin-svg": "^2.0.0",
|
|
118
|
+
"semantic-release": "^25.0.9",
|
|
112
119
|
"size-limit": "^8.0.1",
|
|
113
120
|
"storybook": "8.6.15",
|
|
114
121
|
"tiny-invariant": "^1.2.0",
|
|
@@ -118,6 +125,6 @@
|
|
|
118
125
|
"vitest": "^2.0.5"
|
|
119
126
|
},
|
|
120
127
|
"dependencies": {
|
|
121
|
-
"
|
|
128
|
+
"shipstyles": "1.0.0"
|
|
122
129
|
}
|
|
123
130
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cx } from 'flairup';
|
|
2
1
|
import * as React from 'react';
|
|
2
|
+
import { cx } from 'shipstyles';
|
|
3
3
|
|
|
4
4
|
import { ClassNames } from '../../DomUtils/classNames';
|
|
5
5
|
import { getLabelHeight } from '../../DomUtils/elementPositionInRow';
|
|
@@ -40,22 +40,21 @@ export function EmojiList({ scrollTop }: { scrollTop: number }) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
return (
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { cx } from 'flairup';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { useEffect } from 'react';
|
|
3
|
+
import { cx } from 'shipstyles';
|
|
4
4
|
|
|
5
5
|
import { ClassNames } from '../../DomUtils/classNames';
|
|
6
6
|
import { focusFirstVisibleEmoji } from '../../DomUtils/keyboardNavigation';
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
emojiHasVariations,
|
|
20
20
|
emojiUnified,
|
|
21
21
|
emojiVariations,
|
|
22
|
-
} from '../../dataUtils/
|
|
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/
|
|
4
|
+
import { emojiHasVariations, emojiNames } from '../../dataUtils/emojiUtils';
|
|
5
5
|
|
|
6
6
|
import { BaseEmojiProps } from './BaseEmojiProps';
|
|
7
7
|
import { ClickableEmojiButton } from './ClickableEmojiButton';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { cx } from 'flairup';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { useState } from 'react';
|
|
3
|
+
import { cx } from 'shipstyles';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
commonInteractionStyles,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useGetEmojiUrlConfig,
|
|
12
12
|
usePreviewConfig,
|
|
13
13
|
} from '../../config/useConfig';
|
|
14
|
-
import { emojiName, emojiUnified } from '../../dataUtils/
|
|
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,6 +1,6 @@
|
|
|
1
|
-
import { cx } from 'flairup';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { useState } from 'react';
|
|
3
|
+
import { cx } from 'shipstyles';
|
|
4
4
|
|
|
5
5
|
import { stylesheet } from '../../Stylesheet/stylesheet';
|
|
6
6
|
import { categoryFromCategoryConfig } from '../../config/categoryConfig';
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
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,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
emojiHasVariations,
|
|
27
27
|
emojiNames,
|
|
28
28
|
emojiUnified,
|
|
29
|
-
} from '../dataUtils/
|
|
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';
|
package/src/hooks/useOnFocus.ts
CHANGED
|
@@ -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/
|
|
6
|
+
import { emojiHasVariations } from '../dataUtils/emojiUtils';
|
|
7
7
|
import { EmojiStyle } from '../types/exposedTypes';
|
|
8
8
|
|
|
9
9
|
import { preloadEmoji } from './preloadEmoji';
|