emoji-picker-react 4.17.4 → 4.18.0
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 +51 -6
- package/dist/components/Layout/Flex.d.ts +1 -1
- package/dist/components/body/EmojiCategory.d.ts +1 -1
- package/dist/components/context/ElementRefContext.d.ts +1 -1
- package/dist/components/emoji/ClickableEmojiButton.d.ts +1 -1
- package/dist/components/emoji/Emoji.d.ts +1 -1
- package/dist/components/emoji/EmojiImg.d.ts +1 -1
- package/dist/components/emoji/ExportedEmoji.d.ts +1 -1
- package/dist/components/emoji/NativeEmoji.d.ts +1 -1
- package/dist/components/emoji/ViewOnlyEmoji.d.ts +1 -1
- package/dist/components/header/SkinTonePicker/BtnSkinToneVariation.d.ts +1 -1
- package/dist/components/header/SkinTonePicker/SkinTonePicker.d.ts +1 -1
- package/dist/components/navigation/CategoryButton.d.ts +3 -2
- package/dist/config/config.d.ts +2 -1
- package/dist/config/useConfig.d.ts +1 -0
- package/dist/data/groups.js +1 -1
- package/dist/data/groups.ts +1 -1
- package/dist/data/skinToneVariations.js +2 -2
- package/dist/data/skinToneVariations.ts +10 -12
- package/dist/emoji-picker-react.cjs.development.js +110 -93
- 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 +110 -93
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/dist/hooks/useActiveCategoryScrollDetection.d.ts +1 -1
- package/dist/hooks/useEmojiVirtualization.d.ts +1 -1
- package/dist/hooks/useFilter.d.ts +4 -0
- package/dist/index.d.ts +2 -1
- package/dist/typeRefinements/typeRefinements.d.ts +1 -1
- package/dist/types/exposedTypes.d.ts +3 -0
- package/dist/virtualization/virtualizationHelpers.d.ts +1 -1
- package/package.json +18 -10
- package/src/DomUtils/classNames.ts +2 -2
- package/src/DomUtils/detectEmojyPartiallyBelowFold.ts +1 -1
- package/src/DomUtils/elementPositionInRow.ts +3 -3
- package/src/DomUtils/focusElement.ts +0 -1
- package/src/DomUtils/keyboardNavigation.ts +2 -2
- package/src/DomUtils/scrollTo.ts +2 -2
- package/src/DomUtils/selectors.ts +18 -17
- package/src/Stylesheet/stylesheet.tsx +22 -22
- package/src/components/Layout/Flex.tsx +6 -6
- package/src/components/Layout/Space.tsx +0 -1
- package/src/components/Reactions/BtnPlus.tsx +8 -8
- package/src/components/Reactions/DEFAULT_REACTIONS.ts +1 -1
- package/src/components/Reactions/Reactions.tsx +1 -0
- package/src/components/atoms/Button.tsx +6 -7
- package/src/components/body/Body.tsx +3 -3
- package/src/components/body/EmojiCategory.tsx +8 -8
- package/src/components/body/EmojiList.tsx +9 -9
- package/src/components/body/EmojiVariationPicker.tsx +22 -23
- package/src/components/body/MeasureEmoji.tsx +10 -11
- package/src/components/context/ElementRefContext.tsx +5 -6
- package/src/components/context/PickerConfigContext.tsx +5 -6
- package/src/components/context/PickerContext.tsx +8 -8
- package/src/components/context/PickerDataContext.tsx +2 -2
- package/src/components/emoji/ClickableEmojiButton.tsx +15 -14
- package/src/components/emoji/Emoji.tsx +1 -1
- package/src/components/emoji/EmojiImg.tsx +10 -5
- package/src/components/emoji/ExportedEmoji.tsx +1 -1
- package/src/components/emoji/NativeEmoji.tsx +4 -4
- package/src/components/emoji/ViewOnlyEmoji.tsx +2 -3
- package/src/components/emoji/emojiStyles.ts +3 -3
- package/src/components/footer/Preview.tsx +10 -10
- package/src/components/header/Search/BtnClearSearch.tsx +13 -13
- package/src/components/header/Search/IcnSearch.tsx +3 -3
- package/src/components/header/Search/Search.tsx +18 -18
- package/src/components/header/SkinTonePicker/BtnSkinToneVariation.tsx +15 -14
- package/src/components/header/SkinTonePicker/SkinTonePicker.tsx +15 -15
- package/src/components/main/PickerMain.tsx +16 -16
- package/src/components/navigation/CategoryButton.tsx +41 -26
- package/src/components/navigation/CategoryNavigation.tsx +14 -8
- package/src/config/config.ts +3 -0
- package/src/config/mutableConfig.ts +2 -2
- package/src/config/useConfig.ts +15 -10
- package/src/data/groups.ts +1 -1
- package/src/data/skinToneVariations.ts +10 -12
- package/src/dataUtils/DataTypes.ts +1 -1
- package/src/dataUtils/alphaNumericEmojiIndex.ts +1 -1
- package/src/dataUtils/parseNativeEmoji.ts +1 -1
- package/src/dataUtils/suggested.ts +3 -3
- package/src/hooks/preloadEmoji.ts +3 -3
- package/src/hooks/useActiveCategoryScrollDetection.ts +9 -7
- package/src/hooks/useCloseAllOpenToggles.ts +2 -2
- package/src/hooks/useDebouncedState.ts +2 -2
- package/src/hooks/useDisallowMouseMove.ts +1 -1
- package/src/hooks/useDisallowedEmojis.ts +2 -2
- package/src/hooks/useEmojiPreviewEvents.ts +8 -8
- package/src/hooks/useEmojiVirtualization.tsx +9 -9
- package/src/hooks/useFilter.ts +19 -19
- package/src/hooks/useFocus.ts +1 -1
- package/src/hooks/useHideEmojisByUniocode.ts +4 -4
- package/src/hooks/useInitialLoad.ts +1 -1
- package/src/hooks/useIsEmojiHidden.ts +1 -1
- package/src/hooks/useKeyboardNavigation.ts +18 -18
- package/src/hooks/useMouseDownHandlers.ts +18 -18
- package/src/hooks/useOnScroll.ts +1 -1
- package/src/hooks/useScrollCategoryIntoView.ts +2 -2
- package/src/index.tsx +5 -2
- package/src/typeRefinements/typeRefinements.ts +2 -2
- package/src/types/exposedTypes.ts +11 -6
- package/src/virtualization/virtualizationHelpers.ts +2 -2
package/README.md
CHANGED
|
@@ -98,12 +98,13 @@ The following is a complete list of all props accepted by `EmojiPicker`.
|
|
|
98
98
|
|
|
99
99
|
### 🦄 Customization & Advanced
|
|
100
100
|
|
|
101
|
-
| Prop | Type | Default | Description
|
|
102
|
-
| --------------- | ------------------------------------------------ | ----------------------- |
|
|
103
|
-
| `customEmojis` | `CustomEmoji[]` | `[]` | Array of custom image-based emojis to inject.
|
|
104
|
-
| `hiddenEmojis` | `string[]` | `[]` | Array of unified IDs (e.g., `'1f921'`) to hide from the picker.
|
|
105
|
-
| `previewConfig` | `PreviewConfig` | `{ showPreview: true }` |
|
|
106
|
-
| `getEmojiUrl` | `(unified: string, style: EmojiStyle) => string` | - | Function to override the default CDN URL for emoji images.
|
|
101
|
+
| Prop | Type | Default | Description |
|
|
102
|
+
| --------------- | ------------------------------------------------ | ----------------------- | ------------------------------------------------------------------------ |
|
|
103
|
+
| `customEmojis` | `CustomEmoji[]` | `[]` | Array of custom image-based emojis to inject. |
|
|
104
|
+
| `hiddenEmojis` | `string[]` | `[]` | Array of unified IDs (e.g., `'1f921'`) to hide from the picker. |
|
|
105
|
+
| `previewConfig` | `PreviewConfig` | `{ showPreview: true }` | Configuration for the bottom preview bar. |
|
|
106
|
+
| `getEmojiUrl` | `(unified: string, style: EmojiStyle) => string` | - | Function to override the default CDN URL for emoji images. |
|
|
107
|
+
| `categoryIcons` | `CategoryIcons` | `{}` | Map `Categories` enum values to custom React nodes for navigation icons. |
|
|
107
108
|
|
|
108
109
|
### ❤️ Reactions Picker Mode
|
|
109
110
|
|
|
@@ -152,6 +153,50 @@ Control the footer preview area using `previewConfig`:
|
|
|
152
153
|
}
|
|
153
154
|
```
|
|
154
155
|
|
|
156
|
+
### Custom Category Icons
|
|
157
|
+
|
|
158
|
+
You can customize the navigation icons using one of two methods.
|
|
159
|
+
|
|
160
|
+
**Method 1: The `categoryIcons` prop**
|
|
161
|
+
|
|
162
|
+
Map `Categories` enum values to valid React nodes:
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import EmojiPicker, { Categories } from 'emoji-picker-react';
|
|
166
|
+
|
|
167
|
+
<EmojiPicker
|
|
168
|
+
categoryIcons={{
|
|
169
|
+
[Categories.SUGGESTED]: <img src="recent.png" alt="Recent" />,
|
|
170
|
+
[Categories.SMILEYS_PEOPLE]: <MyCustomFaceIcon />,
|
|
171
|
+
}}
|
|
172
|
+
/>;
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Method 2: The `categories` configuration array**
|
|
176
|
+
|
|
177
|
+
Define the icon directly within the category configuration object:
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import EmojiPicker, { Categories } from 'emoji-picker-react';
|
|
181
|
+
|
|
182
|
+
<EmojiPicker
|
|
183
|
+
categories={[
|
|
184
|
+
{
|
|
185
|
+
category: Categories.SUGGESTED,
|
|
186
|
+
name: 'Recently Used',
|
|
187
|
+
icon: <img src="recent.png" alt="Recent" />,
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
category: Categories.SMILEYS_PEOPLE,
|
|
191
|
+
name: 'Smileys & People',
|
|
192
|
+
icon: <MyCustomFaceIcon />,
|
|
193
|
+
},
|
|
194
|
+
]}
|
|
195
|
+
/>;
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
> **Note:** If both methods are used for the same category, the icon from the `categories` configuration takes precedence over the `categoryIcons` prop.
|
|
199
|
+
|
|
155
200
|
---
|
|
156
201
|
|
|
157
202
|
## 🌍 Internationalization (i18n)
|
|
@@ -9,5 +9,5 @@ declare type Props = Readonly<{
|
|
|
9
9
|
style?: React.CSSProperties;
|
|
10
10
|
direction?: FlexDirection;
|
|
11
11
|
}>;
|
|
12
|
-
export default function Flex({ children, className, style, direction }: Props): JSX.Element;
|
|
12
|
+
export default function Flex({ children, className, style, direction, }: Props): JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -7,5 +7,5 @@ declare type Props = Readonly<{
|
|
|
7
7
|
hiddenOnSearch?: boolean;
|
|
8
8
|
height?: number;
|
|
9
9
|
}>;
|
|
10
|
-
export declare function EmojiCategory({ categoryConfig, children, hidden, hiddenOnSearch, height }: Props): JSX.Element;
|
|
10
|
+
export declare function EmojiCategory({ categoryConfig, children, hidden, hiddenOnSearch, height, }: Props): JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { NullableElement } from '../../DomUtils/selectors';
|
|
3
|
-
export declare function ElementRefContextProvider({ children }: {
|
|
3
|
+
export declare function ElementRefContextProvider({ children, }: {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
}): JSX.Element;
|
|
6
6
|
export declare type ElementRef<E extends HTMLElement = HTMLElement> = React.MutableRefObject<E | null>;
|
|
@@ -11,5 +11,5 @@ declare type ClickableEmojiButtonProps = Readonly<{
|
|
|
11
11
|
className?: string;
|
|
12
12
|
style?: React.CSSProperties;
|
|
13
13
|
}>;
|
|
14
|
-
export declare function ClickableEmojiButton({ emojiNames, unified, hidden, hiddenOnSearch, showVariations, hasVariations, children, className, noBackground, style }: ClickableEmojiButtonProps): JSX.Element;
|
|
14
|
+
export declare function ClickableEmojiButton({ emojiNames, unified, hidden, hiddenOnSearch, showVariations, hasVariations, children, className, noBackground, style, }: ClickableEmojiButtonProps): JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -10,5 +10,5 @@ declare type ClickableEmojiProps = Readonly<BaseEmojiProps & {
|
|
|
10
10
|
noBackground?: boolean;
|
|
11
11
|
style?: React.CSSProperties;
|
|
12
12
|
}>;
|
|
13
|
-
export declare function ClickableEmoji({ emoji, unified, hidden, hiddenOnSearch, emojiStyle, showVariations, size, lazyLoad, getEmojiUrl, className, noBackground, style }: ClickableEmojiProps): JSX.Element;
|
|
13
|
+
export declare function ClickableEmoji({ emoji, unified, hidden, hiddenOnSearch, emojiStyle, showVariations, size, lazyLoad, getEmojiUrl, className, noBackground, style, }: ClickableEmojiProps): JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { EmojiStyle } from '../../types/exposedTypes';
|
|
3
|
-
export declare function EmojiImg({ emojiName, style, lazyLoad, imgUrl, onError, className }: {
|
|
3
|
+
export declare function EmojiImg({ emojiName, style, lazyLoad, imgUrl, onError, className, }: {
|
|
4
4
|
emojiName: string;
|
|
5
5
|
emojiStyle: EmojiStyle;
|
|
6
6
|
style: React.CSSProperties;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { EmojiStyle } from '../../types/exposedTypes';
|
|
3
3
|
import { GetEmojiUrl } from './BaseEmojiProps';
|
|
4
|
-
export declare function ExportedEmoji({ unified, size, emojiStyle, lazyLoad, getEmojiUrl, emojiUrl }: {
|
|
4
|
+
export declare function ExportedEmoji({ unified, size, emojiStyle, lazyLoad, getEmojiUrl, emojiUrl, }: {
|
|
5
5
|
unified: string;
|
|
6
6
|
emojiStyle?: EmojiStyle;
|
|
7
7
|
size?: number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { BaseEmojiProps } from './BaseEmojiProps';
|
|
3
|
-
export declare function ViewOnlyEmoji({ emoji, unified, emojiStyle, size, lazyLoad, getEmojiUrl, className }: BaseEmojiProps): JSX.Element | null;
|
|
3
|
+
export declare function ViewOnlyEmoji({ emoji, unified, emojiStyle, size, lazyLoad, getEmojiUrl, className, }: BaseEmojiProps): JSX.Element | null;
|
|
@@ -7,5 +7,5 @@ declare type Props = {
|
|
|
7
7
|
skinToneVariation: SkinTones;
|
|
8
8
|
style?: React.CSSProperties;
|
|
9
9
|
};
|
|
10
|
-
export declare function BtnSkinToneVariation({ isOpen, onClick, isActive, skinToneVariation, style }: Props): JSX.Element;
|
|
10
|
+
export declare function BtnSkinToneVariation({ isOpen, onClick, isActive, skinToneVariation, style, }: Props): JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -3,7 +3,7 @@ declare type Props = {
|
|
|
3
3
|
direction?: SkinTonePickerDirection;
|
|
4
4
|
};
|
|
5
5
|
export declare function SkinTonePickerMenu(): JSX.Element;
|
|
6
|
-
export declare function SkinTonePicker({ direction }: Props): JSX.Element | null;
|
|
6
|
+
export declare function SkinTonePicker({ direction, }: Props): JSX.Element | null;
|
|
7
7
|
export declare enum SkinTonePickerDirection {
|
|
8
8
|
VERTICAL = "epr-vertical",
|
|
9
9
|
HORIZONTAL = "epr-horizontal"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { CategoryConfig } from '../../types/exposedTypes';
|
|
3
3
|
declare type Props = {
|
|
4
4
|
isActiveCategory: boolean;
|
|
@@ -6,6 +6,7 @@ declare type Props = {
|
|
|
6
6
|
allowNavigation: boolean;
|
|
7
7
|
onClick: () => void;
|
|
8
8
|
categoryConfig: CategoryConfig;
|
|
9
|
+
customIcon?: React.ReactNode;
|
|
9
10
|
};
|
|
10
|
-
export declare function CategoryButton({ isActiveCategory, category, allowNavigation, categoryConfig, onClick }: Props): JSX.Element;
|
|
11
|
+
export declare function CategoryButton({ isActiveCategory, category, allowNavigation, categoryConfig, onClick, customIcon, }: Props): JSX.Element;
|
|
11
12
|
export {};
|
package/dist/config/config.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GetEmojiUrl } from '../components/emoji/BaseEmojiProps';
|
|
3
|
-
import { EmojiClickData, EmojiData, EmojiStyle, SkinTonePickerLocation, SkinTones, SuggestionMode, Theme } from '../types/exposedTypes';
|
|
3
|
+
import { CategoryIcons, EmojiClickData, EmojiData, EmojiStyle, SkinTonePickerLocation, SkinTones, SuggestionMode, Theme } from '../types/exposedTypes';
|
|
4
4
|
import { CategoriesConfig } from './categoryConfig';
|
|
5
5
|
import { CustomEmoji } from './customEmojiConfig';
|
|
6
6
|
export declare const DEFAULT_SEARCH_PLACEHOLDER = "Search";
|
|
@@ -40,6 +40,7 @@ export declare type PickerConfigInternal = {
|
|
|
40
40
|
allowExpandReactions: boolean;
|
|
41
41
|
hiddenEmojis: string[];
|
|
42
42
|
emojiData?: EmojiData;
|
|
43
|
+
categoryIcons: CategoryIcons;
|
|
43
44
|
};
|
|
44
45
|
export declare type PreviewConfig = {
|
|
45
46
|
defaultEmoji: string;
|
|
@@ -15,6 +15,7 @@ export declare function useSkinTonesDisabledConfig(): boolean;
|
|
|
15
15
|
export declare function useEmojiStyleConfig(): EmojiStyle;
|
|
16
16
|
export declare function useAutoFocusSearchConfig(): boolean;
|
|
17
17
|
export declare function useCategoriesConfig(): CategoriesConfig;
|
|
18
|
+
export declare function useCategoryIconsConfig(): Partial<Record<import("./categoryConfig").Categories, React.ReactNode>>;
|
|
18
19
|
export declare function useCustomEmojisConfig(): CustomEmoji[];
|
|
19
20
|
export declare function useOpenConfig(): boolean;
|
|
20
21
|
export declare function useOnEmojiClickConfig(mouseEventSource: MOUSE_EVENT_SOURCE): (emoji: EmojiClickData, event: MouseEvent) => void;
|
package/dist/data/groups.js
CHANGED
package/dist/data/groups.ts
CHANGED
|
@@ -5,13 +5,13 @@ const skinToneVariations = [
|
|
|
5
5
|
SkinTones.MEDIUM_LIGHT,
|
|
6
6
|
SkinTones.MEDIUM,
|
|
7
7
|
SkinTones.MEDIUM_DARK,
|
|
8
|
-
SkinTones.DARK
|
|
8
|
+
SkinTones.DARK,
|
|
9
9
|
];
|
|
10
10
|
export const skinTonesNamed = Object.entries(SkinTones).reduce((acc, [key, value]) => {
|
|
11
11
|
acc[value] = key;
|
|
12
12
|
return acc;
|
|
13
13
|
}, {});
|
|
14
14
|
export const skinTonesMapped = skinToneVariations.reduce((mapped, skinTone) => Object.assign(mapped, {
|
|
15
|
-
[skinTone]: skinTone
|
|
15
|
+
[skinTone]: skinTone,
|
|
16
16
|
}), {});
|
|
17
17
|
export default skinToneVariations;
|
|
@@ -6,7 +6,7 @@ const skinToneVariations = [
|
|
|
6
6
|
SkinTones.MEDIUM_LIGHT,
|
|
7
7
|
SkinTones.MEDIUM,
|
|
8
8
|
SkinTones.MEDIUM_DARK,
|
|
9
|
-
SkinTones.DARK
|
|
9
|
+
SkinTones.DARK,
|
|
10
10
|
];
|
|
11
11
|
|
|
12
12
|
export const skinTonesNamed = Object.entries(SkinTones).reduce(
|
|
@@ -14,18 +14,16 @@ export const skinTonesNamed = Object.entries(SkinTones).reduce(
|
|
|
14
14
|
acc[value] = key;
|
|
15
15
|
return acc;
|
|
16
16
|
},
|
|
17
|
-
{} as Record<string, string
|
|
17
|
+
{} as Record<string, string>,
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
export const skinTonesMapped: Record<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{}
|
|
29
|
-
);
|
|
20
|
+
export const skinTonesMapped: Record<string, string> =
|
|
21
|
+
skinToneVariations.reduce(
|
|
22
|
+
(mapped, skinTone) =>
|
|
23
|
+
Object.assign(mapped, {
|
|
24
|
+
[skinTone]: skinTone,
|
|
25
|
+
}),
|
|
26
|
+
{},
|
|
27
|
+
);
|
|
30
28
|
|
|
31
29
|
export default skinToneVariations;
|