emoji-picker-react 4.1.1 → 4.3.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 +33 -25
- package/dist/components/emoji/Emoji.d.ts +4 -2
- package/dist/components/emoji/ExportedEmoji.d.ts +3 -1
- package/dist/config/cdnUrls.d.ts +1 -1
- package/dist/config/config.d.ts +5 -2
- package/dist/config/useConfig.d.ts +4 -3
- package/dist/dataUtils/emojiSelectors.d.ts +1 -2
- package/dist/emoji-picker-react.cjs.development.js +289 -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 +289 -258
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/dist/hooks/preloadEmoji.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/body/EmojiList.tsx +3 -0
- package/src/components/body/EmojiVariationPicker.tsx +13 -8
- package/src/components/body/Suggested.tsx +5 -2
- package/src/components/emoji/Emoji.tsx +17 -8
- package/src/components/emoji/ExportedEmoji.tsx +5 -2
- package/src/components/footer/Preview.tsx +9 -2
- package/src/components/main/PickerMain.tsx +3 -3
- package/src/config/cdnUrls.ts +1 -1
- package/src/config/config.ts +15 -9
- package/src/config/useConfig.ts +21 -4
- package/src/dataUtils/emojiSelectors.ts +3 -10
- package/src/hooks/preloadEmoji.ts +5 -7
- package/src/hooks/useMouseDownHandlers.ts +19 -13
- package/src/hooks/useOnFocus.ts +4 -3
package/README.md
CHANGED
|
@@ -43,21 +43,22 @@ function App() {
|
|
|
43
43
|
|
|
44
44
|
The following props are accepted by them picker:
|
|
45
45
|
|
|
46
|
-
| Prop | Type
|
|
47
|
-
| ------------------- |
|
|
48
|
-
| onEmojiClick | function
|
|
49
|
-
| autoFocusSearch | boolean
|
|
50
|
-
| Theme | string
|
|
51
|
-
| emojiStyle | string
|
|
52
|
-
| defaultSkinTone | string
|
|
53
|
-
| lazyLoadEmojis | boolean
|
|
54
|
-
| previewConfig | object
|
|
55
|
-
| searchPlaceholder | string
|
|
56
|
-
| suggestedEmojisMode | string
|
|
57
|
-
| skinTonesDisabled | boolean
|
|
58
|
-
| `width` | number
|
|
59
|
-
| emojiVersion | `string`
|
|
60
|
-
| `height` | number
|
|
46
|
+
| Prop | Type | Default | Description |
|
|
47
|
+
| ------------------- | ----------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
48
|
+
| onEmojiClick | function | | Callback function that is called when an emoji is clicked. The function receives the emoji object as a parameter. |
|
|
49
|
+
| autoFocusSearch | boolean | `true` | Controls the auto focus of the search input. |
|
|
50
|
+
| Theme | string | `light` | Controls the theme of the picker. Possible values are `light`, `dark` and `auto`. |
|
|
51
|
+
| emojiStyle | string | `apple` | Controls the emoji style. Possible values are `google`, `apple`, `facebook`, `twitter` and `native`. |
|
|
52
|
+
| defaultSkinTone | string | `neutral` | Controls the default skin tone. |
|
|
53
|
+
| lazyLoadEmojis | boolean | `false` | Controls whether the emojis are loaded lazily or not. |
|
|
54
|
+
| previewConfig | object | `{}` | Controls the preview of the emoji. See below for more information. |
|
|
55
|
+
| searchPlaceholder | string | `Search` | Controls the placeholder of the search input. |
|
|
56
|
+
| suggestedEmojisMode | string | `frequent` | Controls the suggested emojis mode. Possible values are `frequent` and `recent`. |
|
|
57
|
+
| skinTonesDisabled | boolean | `false` | Controls whether the skin tones are disabled or not. |
|
|
58
|
+
| `width` | `number`/`string` | `350` | Controls the width of the picker. You can provide a number that will be treated as pixel size, or your any accepted css width as string. |
|
|
59
|
+
| emojiVersion | `string` | - | Allows displaying emojis up to a certain version for compatibility. |
|
|
60
|
+
| `height` | `number`/`string` | `450` | Controls the height of the picker. You can provide a number that will be treated as pixel size, or your any accepted css height as string. |
|
|
61
|
+
| getEmojiUrl | `Function` | - | Allows to customize the emoji url and provide your own image host. |
|
|
61
62
|
|
|
62
63
|
## Full details
|
|
63
64
|
|
|
@@ -140,12 +141,12 @@ import { SkinTones } from 'emoji-picker-react';
|
|
|
140
141
|
[
|
|
141
142
|
{
|
|
142
143
|
category: 'suggested',
|
|
143
|
-
name: 'Recently Used'
|
|
144
|
+
name: 'Recently Used'
|
|
144
145
|
},
|
|
145
146
|
{
|
|
146
147
|
category: 'smileys_people',
|
|
147
|
-
name: 'Faces...'
|
|
148
|
-
}
|
|
148
|
+
name: 'Faces...'
|
|
149
|
+
}
|
|
149
150
|
];
|
|
150
151
|
```
|
|
151
152
|
|
|
@@ -164,16 +165,22 @@ import { SkinTones } from 'emoji-picker-react';
|
|
|
164
165
|
- `"4.0"`
|
|
165
166
|
- `"5.0"`
|
|
166
167
|
|
|
168
|
+
* `getEmojiUrl`: `(unified: string, emojiStyle: EmojiStyle) => string` - Allows to customize the emoji url and provide your own image host. The function receives the emoji unified and the emoji style as parameters. The function should return the url of the emoji image.
|
|
169
|
+
|
|
167
170
|
# Customization
|
|
168
171
|
|
|
169
172
|
## Custom Picker Width and Height
|
|
170
173
|
|
|
171
|
-
To customize the dimensions of the picker, use the `height` and `width` props
|
|
174
|
+
To customize the dimensions of the picker, use the `height` and `width` props. You can pass in a number that will be treated as pixel size, or your any accepted css width/height as string.
|
|
172
175
|
|
|
173
176
|
```jsx
|
|
174
177
|
<EmojiPicker height={500} width={400} />
|
|
175
178
|
```
|
|
176
179
|
|
|
180
|
+
```jsx
|
|
181
|
+
<EmojiPicker height="100%" width="15em" />
|
|
182
|
+
```
|
|
183
|
+
|
|
177
184
|
## CSS Variables
|
|
178
185
|
|
|
179
186
|
The picker can be customized via css variables. The root selector for the picker is `.EmojiPickerReact`, when overriding, make sure to provide a more specific selector.
|
|
@@ -195,12 +202,13 @@ The picker exports an `Emoji` component. The emoji component is the same used wi
|
|
|
195
202
|
|
|
196
203
|
## Props
|
|
197
204
|
|
|
198
|
-
| Name
|
|
199
|
-
|
|
|
200
|
-
| `unified`
|
|
201
|
-
| `size`
|
|
202
|
-
| `emojiStyle`
|
|
203
|
-
| `lazyLoad`
|
|
205
|
+
| Name | Type | Default | Description |
|
|
206
|
+
| ------------- | ------------ | ------------------ | ------------------------------------------------------------------------------------------- |
|
|
207
|
+
| `unified` | string | "" | The unified code of the emoji. |
|
|
208
|
+
| `size` | number | 32 | The size of the emoji. |
|
|
209
|
+
| `emojiStyle` | `EmojiStyle` | `EmojiStyle.APPLE` | The emoji style to use. Can be either `apple`, `google`, `facebook`, `twitter` or `native`. |
|
|
210
|
+
| `lazyLoad` | boolean | `false` | Whether to lazy load the emoji. image |
|
|
211
|
+
| `getEmojiUrl` | Function | - | Allows to customize the emoji url and provide your own image host. |
|
|
204
212
|
|
|
205
213
|
```js
|
|
206
214
|
import { Emoji, EmojiStyle } from 'emoji-picker-react';
|
|
@@ -14,7 +14,9 @@ declare type BaseProps = {
|
|
|
14
14
|
unified: string;
|
|
15
15
|
size?: number;
|
|
16
16
|
lazyLoad?: boolean;
|
|
17
|
+
getEmojiUrl?: GetEmojiUrl;
|
|
17
18
|
};
|
|
18
|
-
export declare function ClickableEmoji({ emoji, unified, hidden, hiddenOnSearch, emojiStyle, showVariations, size, lazyLoad }: ClickableEmojiProps): JSX.Element;
|
|
19
|
-
export declare function ViewOnlyEmoji({ emoji, unified, emojiStyle, size, lazyLoad }: BaseProps): JSX.Element;
|
|
19
|
+
export declare function ClickableEmoji({ emoji, unified, hidden, hiddenOnSearch, emojiStyle, showVariations, size, lazyLoad, getEmojiUrl, }: ClickableEmojiProps): JSX.Element;
|
|
20
|
+
export declare function ViewOnlyEmoji({ emoji, unified, emojiStyle, size, lazyLoad, getEmojiUrl, }: BaseProps): JSX.Element;
|
|
21
|
+
export declare type GetEmojiUrl = (unified: string, style: EmojiStyle) => string;
|
|
20
22
|
export {};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { EmojiStyle } from '../../types/exposedTypes';
|
|
3
|
-
|
|
3
|
+
import { GetEmojiUrl } from './Emoji';
|
|
4
|
+
export declare function ExportedEmoji({ unified, size, emojiStyle, lazyLoad, getEmojiUrl, }: {
|
|
4
5
|
unified: string;
|
|
5
6
|
emojiStyle?: EmojiStyle;
|
|
6
7
|
size?: number;
|
|
7
8
|
lazyLoad?: boolean;
|
|
9
|
+
getEmojiUrl?: GetEmojiUrl;
|
|
8
10
|
}): JSX.Element | null;
|
package/dist/config/cdnUrls.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { EmojiStyle } from
|
|
1
|
+
import { EmojiStyle } from '../types/exposedTypes';
|
|
2
2
|
export declare function cdnUrl(emojiStyle: EmojiStyle): string;
|
package/dist/config/config.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GetEmojiUrl } from '../components/emoji/Emoji';
|
|
1
2
|
import { EmojiClickData, EmojiStyle, SkinTones, SuggestionMode, Theme } from '../types/exposedTypes';
|
|
2
3
|
import { CategoriesConfig } from './categoryConfig';
|
|
3
4
|
export declare function mergeConfig(userConfig?: PickerConfig): PickerConfigInternal;
|
|
@@ -15,8 +16,9 @@ export declare type PickerConfigInternal = {
|
|
|
15
16
|
suggestedEmojisMode: SuggestionMode;
|
|
16
17
|
lazyLoadEmojis: boolean;
|
|
17
18
|
previewConfig: PreviewConfig;
|
|
18
|
-
height:
|
|
19
|
-
width:
|
|
19
|
+
height: PickerDimensions;
|
|
20
|
+
width: PickerDimensions;
|
|
21
|
+
getEmojiUrl: GetEmojiUrl;
|
|
20
22
|
};
|
|
21
23
|
export declare type PreviewConfig = {
|
|
22
24
|
defaultEmoji: string;
|
|
@@ -27,4 +29,5 @@ declare type ConfigExternal = {
|
|
|
27
29
|
previewConfig: Partial<PreviewConfig>;
|
|
28
30
|
} & Omit<PickerConfigInternal, 'previewConfig'>;
|
|
29
31
|
export declare type PickerConfig = Partial<ConfigExternal>;
|
|
32
|
+
export declare type PickerDimensions = string | number;
|
|
30
33
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EmojiClickData, EmojiStyle, SkinTones, SuggestionMode, Theme } from '../types/exposedTypes';
|
|
2
2
|
import { CategoriesConfig } from './categoryConfig';
|
|
3
|
-
import { PreviewConfig } from './config';
|
|
3
|
+
import { PickerDimensions, PreviewConfig } from './config';
|
|
4
4
|
export declare function useSearchPlaceHolderConfig(): string;
|
|
5
5
|
export declare function useDefaultSkinToneConfig(): SkinTones;
|
|
6
6
|
export declare function useSkinTonesDisabledConfig(): boolean;
|
|
@@ -13,7 +13,8 @@ export declare function useThemeConfig(): Theme;
|
|
|
13
13
|
export declare function useSuggestedEmojisModeConfig(): SuggestionMode;
|
|
14
14
|
export declare function useLazyLoadEmojisConfig(): boolean;
|
|
15
15
|
export declare function usePickerSizeConfig(): {
|
|
16
|
-
height:
|
|
17
|
-
width:
|
|
16
|
+
height: PickerDimensions;
|
|
17
|
+
width: PickerDimensions;
|
|
18
18
|
};
|
|
19
19
|
export declare function useEmojiVersionConfig(): string | null;
|
|
20
|
+
export declare function useGetEmojiUrlConfig(): (unified: string, style: EmojiStyle) => string;
|
|
@@ -5,10 +5,9 @@ export declare function emojiNames(emoji: DataEmoji): string[];
|
|
|
5
5
|
export declare function addedIn(emoji: DataEmoji): number;
|
|
6
6
|
export declare function emojiName(emoji: DataEmoji): string;
|
|
7
7
|
export declare function unifiedWithoutSkinTone(unified: string): string;
|
|
8
|
-
export declare function emojiUrl(emojiStyle: EmojiStyle, emoji: DataEmoji, skinTone?: string): string;
|
|
9
8
|
export declare function emojiUnified(emoji: DataEmoji, skinTone?: string): string;
|
|
10
9
|
export declare function emojisByCategory(category: Categories): DataEmojis;
|
|
11
|
-
export declare function emojiUrlByUnified(
|
|
10
|
+
export declare function emojiUrlByUnified(unified: string, emojiStyle: EmojiStyle): string;
|
|
12
11
|
export declare function emojiVariations(emoji: DataEmoji): string[];
|
|
13
12
|
export declare function emojiHasVariations(emoji: DataEmoji): boolean;
|
|
14
13
|
export declare function emojiVariationUnified(emoji: DataEmoji, skinTone?: string): string | undefined;
|