emoji-picker-react 4.16.1 → 4.17.1

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.
Files changed (217) hide show
  1. package/README.md +166 -314
  2. package/dist/components/body/EmojiCategory.d.ts +1 -1
  3. package/dist/components/context/PickerDataContext.d.ts +16 -0
  4. package/dist/components/navigation/CategoryButton.d.ts +1 -1
  5. package/dist/config/categoryConfig.d.ts +2 -6
  6. package/dist/config/config.d.ts +2 -1
  7. package/dist/data/emojis-bn.d.ts +3 -0
  8. package/dist/data/emojis-bn.js +2 -0
  9. package/dist/data/emojis-bn.json +1 -0
  10. package/dist/data/emojis-bn.ts +3 -0
  11. package/dist/data/emojis-da.d.ts +3 -0
  12. package/dist/data/emojis-da.js +2 -0
  13. package/dist/data/emojis-da.json +1 -0
  14. package/dist/data/emojis-da.ts +3 -0
  15. package/dist/data/emojis-de.d.ts +3 -0
  16. package/dist/data/emojis-de.js +2 -0
  17. package/dist/data/emojis-de.json +1 -0
  18. package/dist/data/emojis-de.ts +3 -0
  19. package/dist/data/emojis-en-gb.d.ts +3 -0
  20. package/dist/data/emojis-en-gb.js +2 -0
  21. package/dist/data/emojis-en-gb.json +1 -0
  22. package/dist/data/emojis-en-gb.ts +3 -0
  23. package/dist/data/emojis-en.d.ts +3 -0
  24. package/dist/data/emojis-en.js +2 -0
  25. package/dist/data/emojis-en.json +1 -0
  26. package/dist/data/emojis-en.ts +3 -0
  27. package/dist/data/emojis-es-mx.d.ts +3 -0
  28. package/dist/data/emojis-es-mx.js +2 -0
  29. package/dist/data/emojis-es-mx.json +1 -0
  30. package/dist/data/emojis-es-mx.ts +3 -0
  31. package/dist/data/emojis-es.d.ts +3 -0
  32. package/dist/data/emojis-es.js +2 -0
  33. package/dist/data/emojis-es.json +1 -0
  34. package/dist/data/emojis-es.ts +3 -0
  35. package/dist/data/emojis-et.d.ts +3 -0
  36. package/dist/data/emojis-et.js +2 -0
  37. package/dist/data/emojis-et.json +1 -0
  38. package/dist/data/emojis-et.ts +3 -0
  39. package/dist/data/emojis-fi.d.ts +3 -0
  40. package/dist/data/emojis-fi.js +2 -0
  41. package/dist/data/emojis-fi.json +1 -0
  42. package/dist/data/emojis-fi.ts +3 -0
  43. package/dist/data/emojis-fr.d.ts +3 -0
  44. package/dist/data/emojis-fr.js +2 -0
  45. package/dist/data/emojis-fr.json +1 -0
  46. package/dist/data/emojis-fr.ts +3 -0
  47. package/dist/data/emojis-hi.d.ts +3 -0
  48. package/dist/data/emojis-hi.js +2 -0
  49. package/dist/data/emojis-hi.json +1 -0
  50. package/dist/data/emojis-hi.ts +3 -0
  51. package/dist/data/emojis-hu.d.ts +3 -0
  52. package/dist/data/emojis-hu.js +2 -0
  53. package/dist/data/emojis-hu.json +1 -0
  54. package/dist/data/emojis-hu.ts +3 -0
  55. package/dist/data/emojis-it.d.ts +3 -0
  56. package/dist/data/emojis-it.js +2 -0
  57. package/dist/data/emojis-it.json +1 -0
  58. package/dist/data/emojis-it.ts +3 -0
  59. package/dist/data/emojis-ja.d.ts +3 -0
  60. package/dist/data/emojis-ja.js +2 -0
  61. package/dist/data/emojis-ja.json +1 -0
  62. package/dist/data/emojis-ja.ts +3 -0
  63. package/dist/data/emojis-ko.d.ts +3 -0
  64. package/dist/data/emojis-ko.js +2 -0
  65. package/dist/data/emojis-ko.json +1 -0
  66. package/dist/data/emojis-ko.ts +3 -0
  67. package/dist/data/emojis-lt.d.ts +3 -0
  68. package/dist/data/emojis-lt.js +2 -0
  69. package/dist/data/emojis-lt.json +1 -0
  70. package/dist/data/emojis-lt.ts +3 -0
  71. package/dist/data/emojis-ms.d.ts +3 -0
  72. package/dist/data/emojis-ms.js +2 -0
  73. package/dist/data/emojis-ms.json +1 -0
  74. package/dist/data/emojis-ms.ts +3 -0
  75. package/dist/data/emojis-nb.d.ts +3 -0
  76. package/dist/data/emojis-nb.js +2 -0
  77. package/dist/data/emojis-nb.json +1 -0
  78. package/dist/data/emojis-nb.ts +3 -0
  79. package/dist/data/emojis-nl.d.ts +3 -0
  80. package/dist/data/emojis-nl.js +2 -0
  81. package/dist/data/emojis-nl.json +1 -0
  82. package/dist/data/emojis-nl.ts +3 -0
  83. package/dist/data/emojis-pl.d.ts +3 -0
  84. package/dist/data/emojis-pl.js +2 -0
  85. package/dist/data/emojis-pl.json +1 -0
  86. package/dist/data/emojis-pl.ts +3 -0
  87. package/dist/data/emojis-pt.d.ts +3 -0
  88. package/dist/data/emojis-pt.js +2 -0
  89. package/dist/data/emojis-pt.json +1 -0
  90. package/dist/data/emojis-pt.ts +3 -0
  91. package/dist/data/emojis-ru.d.ts +3 -0
  92. package/dist/data/emojis-ru.js +2 -0
  93. package/dist/data/emojis-ru.json +1 -0
  94. package/dist/data/emojis-ru.ts +3 -0
  95. package/dist/data/emojis-sv.d.ts +3 -0
  96. package/dist/data/emojis-sv.js +2 -0
  97. package/dist/data/emojis-sv.json +1 -0
  98. package/dist/data/emojis-sv.ts +3 -0
  99. package/dist/data/emojis-th.d.ts +3 -0
  100. package/dist/data/emojis-th.js +2 -0
  101. package/dist/data/emojis-th.json +1 -0
  102. package/dist/data/emojis-th.ts +3 -0
  103. package/dist/data/emojis-uk.d.ts +3 -0
  104. package/dist/data/emojis-uk.js +2 -0
  105. package/dist/data/emojis-uk.json +1 -0
  106. package/dist/data/emojis-uk.ts +3 -0
  107. package/dist/data/emojis-zh-hant.d.ts +3 -0
  108. package/dist/data/emojis-zh-hant.js +2 -0
  109. package/dist/data/emojis-zh-hant.json +1 -0
  110. package/dist/data/emojis-zh-hant.ts +3 -0
  111. package/dist/data/emojis-zh.d.ts +3 -0
  112. package/dist/data/emojis-zh.js +2 -0
  113. package/dist/data/emojis-zh.json +1 -0
  114. package/dist/data/emojis-zh.ts +3 -0
  115. package/dist/data/emojis.d.ts +102 -50
  116. package/dist/data/emojis.js +1 -0
  117. package/dist/data/emojis.json +1 -0
  118. package/dist/data/emojis.ts +1 -0
  119. package/dist/data/groups.d.ts +2 -2
  120. package/dist/data/groups.js +11 -0
  121. package/dist/data/groups.ts +12 -0
  122. package/dist/data/skinToneVariations.d.ts +5 -5
  123. package/dist/data/skinToneVariations.js +17 -0
  124. package/dist/data/skinToneVariations.ts +31 -0
  125. package/dist/dataUtils/DataTypes.d.ts +2 -2
  126. package/dist/dataUtils/emojiUtils.d.ts +12 -0
  127. package/dist/emoji-picker-react.cjs.development.js +20120 -17359
  128. package/dist/emoji-picker-react.cjs.development.js.map +1 -1
  129. package/dist/emoji-picker-react.cjs.production.min.js +1 -1
  130. package/dist/emoji-picker-react.cjs.production.min.js.map +1 -1
  131. package/dist/emoji-picker-react.esm.js +20121 -17360
  132. package/dist/emoji-picker-react.esm.js.map +1 -1
  133. package/dist/typeRefinements/typeRefinements.d.ts +2 -1
  134. package/dist/types/exposedTypes.d.ts +64 -50
  135. package/dist/types/exposedTypes.js +46 -0
  136. package/package.json +9 -5
  137. package/src/EmojiPickerReact.tsx +4 -1
  138. package/src/components/Reactions/Reactions.tsx +28 -20
  139. package/src/components/body/EmojiCategory.tsx +1 -1
  140. package/src/components/body/EmojiList.tsx +3 -5
  141. package/src/components/context/PickerConfigContext.tsx +2 -1
  142. package/src/components/context/PickerContext.tsx +7 -2
  143. package/src/components/context/PickerDataContext.tsx +157 -0
  144. package/src/components/emoji/ClickableEmojiButton.tsx +1 -3
  145. package/src/components/emoji/ViewOnlyEmoji.tsx +4 -5
  146. package/src/components/footer/Preview.tsx +6 -6
  147. package/src/components/navigation/CategoryButton.tsx +2 -4
  148. package/src/config/categoryConfig.ts +47 -30
  149. package/src/config/compareConfig.ts +3 -2
  150. package/src/config/config.ts +31 -15
  151. package/src/data/emojis-bn.json +1 -0
  152. package/src/data/emojis-bn.ts +3 -0
  153. package/src/data/emojis-da.json +1 -0
  154. package/src/data/emojis-da.ts +3 -0
  155. package/src/data/emojis-de.json +1 -0
  156. package/src/data/emojis-de.ts +3 -0
  157. package/src/data/emojis-en-gb.json +1 -0
  158. package/src/data/emojis-en-gb.ts +3 -0
  159. package/src/data/emojis-en.json +1 -0
  160. package/src/data/emojis-en.ts +3 -0
  161. package/src/data/emojis-es-mx.json +1 -0
  162. package/src/data/emojis-es-mx.ts +3 -0
  163. package/src/data/emojis-es.json +1 -0
  164. package/src/data/emojis-es.ts +3 -0
  165. package/src/data/emojis-et.json +1 -0
  166. package/src/data/emojis-et.ts +3 -0
  167. package/src/data/emojis-fi.json +1 -0
  168. package/src/data/emojis-fi.ts +3 -0
  169. package/src/data/emojis-fr.json +1 -0
  170. package/src/data/emojis-fr.ts +3 -0
  171. package/src/data/emojis-hi.json +1 -0
  172. package/src/data/emojis-hi.ts +3 -0
  173. package/src/data/emojis-hu.json +1 -0
  174. package/src/data/emojis-hu.ts +3 -0
  175. package/src/data/emojis-it.json +1 -0
  176. package/src/data/emojis-it.ts +3 -0
  177. package/src/data/emojis-ja.json +1 -0
  178. package/src/data/emojis-ja.ts +3 -0
  179. package/src/data/emojis-ko.json +1 -0
  180. package/src/data/emojis-ko.ts +3 -0
  181. package/src/data/emojis-lt.json +1 -0
  182. package/src/data/emojis-lt.ts +3 -0
  183. package/src/data/emojis-ms.json +1 -0
  184. package/src/data/emojis-ms.ts +3 -0
  185. package/src/data/emojis-nb.json +1 -0
  186. package/src/data/emojis-nb.ts +3 -0
  187. package/src/data/emojis-nl.json +1 -0
  188. package/src/data/emojis-nl.ts +3 -0
  189. package/src/data/emojis-pl.json +1 -0
  190. package/src/data/emojis-pl.ts +3 -0
  191. package/src/data/emojis-pt.json +1 -0
  192. package/src/data/emojis-pt.ts +3 -0
  193. package/src/data/emojis-ru.json +1 -0
  194. package/src/data/emojis-ru.ts +3 -0
  195. package/src/data/emojis-sv.json +1 -0
  196. package/src/data/emojis-sv.ts +3 -0
  197. package/src/data/emojis-th.json +1 -0
  198. package/src/data/emojis-th.ts +3 -0
  199. package/src/data/emojis-uk.json +1 -0
  200. package/src/data/emojis-uk.ts +3 -0
  201. package/src/data/emojis-zh-hant.json +1 -0
  202. package/src/data/emojis-zh-hant.ts +3 -0
  203. package/src/data/emojis-zh.json +1 -0
  204. package/src/data/emojis-zh.ts +3 -0
  205. package/src/data/emojis.json +1 -1
  206. package/src/data/emojis.ts +1 -1
  207. package/src/dataUtils/DataTypes.ts +2 -2
  208. package/src/dataUtils/alphaNumericEmojiIndex.ts +1 -8
  209. package/src/dataUtils/emojiSelectors.ts +24 -25
  210. package/src/dataUtils/emojiUtils.ts +74 -0
  211. package/src/hooks/preloadEmoji.ts +1 -1
  212. package/src/hooks/useDisallowedEmojis.ts +4 -3
  213. package/src/hooks/useEmojiVirtualization.tsx +2 -3
  214. package/src/hooks/useFilter.ts +1 -1
  215. package/src/hooks/useIsEmojiHidden.ts +1 -1
  216. package/src/typeRefinements/typeRefinements.ts +2 -5
  217. package/src/types/exposedTypes.ts +17 -0
package/README.md CHANGED
@@ -1,30 +1,36 @@
1
- # Emoji Picker React (v4) | [Live Demo](https://ealush.com/emoji-picker-react)
1
+ # 🥒 Emoji Picker React (v4)
2
2
 
3
- ![Picker](https://user-images.githubusercontent.com/11255103/192167134-8205eb89-a71d-4463-8f3a-940e844917d5.gif)
3
+ **The most popular, fully customizable emoji picker for React apps.**
4
4
 
5
- ## Usage as a Reactions Picker
5
+ **[🔴 Live Demo](https://ealush.com/emoji-picker-react)** | **[🐛 Report a Bug](https://github.com/ealush/emoji-picker-react/issues)**
6
6
 
7
- ![image](https://github.com/ealush/emoji-picker-react/assets/11255103/48901306-e7fd-49cd-8f1e-9b214083a61d)
7
+ ---
8
8
 
9
- ## ![reactions](https://github.com/ealush/emoji-picker-react/assets/11255103/c28cc954-dc1d-4d82-91a8-64a74cf1d598)
9
+ ## ✨ Features
10
10
 
11
- _If you enjoy using emoji-picker-react<br/>
12
- You should also consider trying:<br/>
13
- <img src="https://cdn.jsdelivr.net/gh/ealush/emoji-picker-react@custom_emojis_assets/vest.png" height="16"/> [Vest validation framework](https://vestjs.dev).<br/>_
11
+ - 🎨 **Fully Customizable**: Control styles via CSS variables.
12
+ - 🌗 **Dark Mode**: Native support for light, dark, and auto themes.
13
+ - 🖱️ **Interactivity**: Custom click handlers and reactions picker mode.
14
+ - 🌍 **Multi-Language**: Built-in support for dozens of languages.
15
+ - 🦄 **Custom Emojis**: seamless support for custom image-based emojis.
16
+ - 📦 **Zero-Config**: Works out of the box with sensible defaults.
17
+ - 📱 **Responsive**: Mobile-friendly design.
18
+ - 🍎 **Multiple Styles**: Support for Apple, Google, Facebook, Twitter, and Native system emojis.
14
19
 
15
20
  ---
16
21
 
17
- ## What to know before using
18
-
19
- - This package assumes it runs in the browser. I have taken many steps to prevent it from failing on the server, but still, it is recommended to only render the component on the client. See troubleshooting section for more information.
22
+ ## 🚀 Getting Started
20
23
 
21
- ## Installation
24
+ ### Installation
22
25
 
23
- ```
26
+ ```bash
24
27
  npm install emoji-picker-react
28
+
25
29
  ```
26
30
 
27
- ## Usage
31
+ ### Basic Usage
32
+
33
+ Render the component in your app. It works immediately with no required props.
28
34
 
29
35
  ```jsx
30
36
  import EmojiPicker from 'emoji-picker-react';
@@ -32,351 +38,197 @@ import EmojiPicker from 'emoji-picker-react';
32
38
  function App() {
33
39
  return (
34
40
  <div>
35
- <EmojiPicker />
41
+ <EmojiPicker onEmojiClick={(emojiObject) => console.log(emojiObject)} />
36
42
  </div>
37
43
  );
38
44
  }
39
45
  ```
40
46
 
41
- ## Shout Outs
42
-
43
- | Component Design 🎨 |
44
- | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
45
- | <a href="https://pavelbolo.com" target="_blank">![317751726_1277528579755086_5320360926126813336_n copy](https://user-images.githubusercontent.com/11255103/205937426-a570b4a1-7243-4d3e-a7e5-ea04b61d940a.png)</a> |
46
- | <a href="https://pavelbolo.com" target="_blank">Pavel Bolo</a> |
47
-
48
- ## Features
49
-
50
- - Custom click handler
51
- - Custom Emojis Support
52
- - Dark mode
53
- - Customizable styles via css variables
54
- - Default skin tone selection
55
- - Skin tone change
56
- - Different emoji sets (Google, Apple, Facebook, Twitter)
57
- - Native Emoji support
58
- - Emoji Component To Render Emojis in your app
59
- - Reactions Picker
60
-
61
- # Props
62
-
63
- The following props are accepted by the picker:
64
-
65
- | Prop | Type | Default | Description |
66
- | ---------------------- | ------------------------------------------------------ | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
67
- | open | boolean | `true` | Controls whether the picker is open or not. |
68
- | onEmojiClick | function | | Callback function that is called when an emoji is clicked. The function receives the emoji object as a parameter. |
69
- | autoFocusSearch | boolean | `true` | Controls the auto focus of the search input. |
70
- | theme | string | `light` | Controls the theme of the picker. Possible values are `light`, `dark` and `auto`. |
71
- | emojiStyle | string | `apple` | Controls the emoji style. Possible values are `google`, `apple`, `facebook`, `twitter` and `native`. |
72
- | defaultSkinTone | string | `neutral` | Controls the default skin tone. |
73
- | lazyLoadEmojis | boolean | `false` | Controls whether the emojis are loaded lazily or not. |
74
- | previewConfig | object | `{}` | Controls the preview of the emoji. See below for more information. |
75
- | searchPlaceholder | string | `Search` | Controls the placeholder of the search input. |
76
- | searchClearButtonLabel | string | 'Clear' | Controls the `aria-label` and `title` of the Clear button of the search input. |
77
- | suggestedEmojisMode | string | `frequent` | Controls the suggested emojis mode. Possible values are `frequent` and `recent`. |
78
- | skinTonesDisabled | boolean | `false` | Controls whether the skin tones are disabled or not. |
79
- | searchDisabled | boolean | `false` | Controls whether the search is disabled or not. When disabled, the skin tone picker will be shown in the preview component. |
80
- | skinTonePickerLocation | string | `SEARCH` | Controls the location of the skin tone picker. Possible values are `SEARCH` and `PREVIEW`. |
81
- | emojiVersion | string | - | Allows displaying emojis up to a certain version for compatibility. |
82
- | className | string | - | Adds a class name to the root element of the picker. |
83
- | 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. |
84
- | 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. |
85
- | style | React.CSSProperties | `{}` | Adds inline style to the root element of the picker. |
86
- | getEmojiUrl | Function | - | Allows to customize the emoji url and provide your own image host. |
87
- | categories | Array | - | Allows full config over ordering, naming and display of categories. |
88
- | customEmojis | Array<{names: string[], imgUrl: string, id: string}> | - | Allows adding custom emojis to the picker. |
89
- | hiddenEmojis | string[] | - | Controls the emojis that are hidden from the picker. |
90
- | reactionsDefaultOpen | boolean | `false` | Controls whether the reactions picker is on the initial mount instead of the main picker component. |
91
- | reactions | string[] | - | Controls the reactions to display in the reactions picker. Takes unified emoji ids |
92
- | onReactionClick | Function | - | Callback function that is called when a reaction is clicked. The function receives the emoji object as a parameter. If not passed, onEmojiClicked is used. |
93
- | allowExpandReactions | boolean | `true` | Controls whether the reactions picker can be expanded to the main picker. |
94
- | onSkinToneChange | Function | - | Callback function that is called when a skin tone is changed. The function receives new picked skin tone as a parameter. |
95
-
96
- ## Full details
97
-
98
- - `onEmojiClick`: `(emojiData: EmojiClickData, event: MouseEvent) => void` - Callback function when an emoji is clicked. The callback receives the event and the emoji data. The emoji data is comprised of the following properties:
99
-
100
- ```ts
101
- {
102
- activeSkinTone: SkinTones;
103
- unified: string;
104
- unifiedWithoutSkinTone: string;
105
- emoji: string; // the emoji character, for example: '😀'. Emoji ID in custom emojis
106
- isCustom: boolean; // whether the emoji is a custom emoji or not
107
- names: string[];
108
- imageUrl: string; // the url of the emoji image with the current emoji style applied
109
- getImageUrl: (emojiStyle: EmojiStyle) => string; // a function that receives an emoji style and returns the url of the emoji image with the provided style applied
110
- }
111
- ```
112
-
113
- - `theme`: `Theme` - The theme of the picker. Can be `light`, `dark` or auto. Default is `light`.
114
- The `Theme` enum can be imported from the package.
115
-
116
- ```ts
117
- import { Theme } from 'emoji-picker-react';
118
- ```
119
-
120
- - `emojiStyle`: `EmojiStyle` - The emoji style to use. Can be either `apple`, `google`, `facebook`, `twitter` or `native`. Default is `apple`.
121
- The `EmojiStyle` enum can be imported from the package.
122
-
123
- ```ts
124
- import { EmojiStyle } from 'emoji-picker-react';
125
- ```
126
-
127
- - `autoFocusSearch`: `boolean` - Whether to focus the search input on mount. Defaults to `true`.
128
-
129
- - `lazyLoadEmojis`: `boolean` - Whether to lazy load the emojis. Defaults to `false`.
130
-
131
- - `defaultSkinTone`: `SkinTones` - The default skin tone to use when an emoji is clicked. Defaults to `SkinTones.Neutral`. Possible skin tones are:
132
-
133
- - ✋ 'neutral'
134
- - ✋🏻 '1f3fb'
135
- - ✋🏼 '1f3fc'
136
- - ✋🏽 '1f3fd'
137
- - ✋🏾 '1f3fe'
138
- - ✋🏿 '1f3ff'
139
-
140
- The skin tones typescript enum can be imported directly from the package:
141
-
142
- ```ts
143
- import { SkinTones } from 'emoji-picker-react';
144
- ```
145
-
146
- - `onSkinToneChange`: `(skinTone: SkinTones) => void` - Callback function when a skin tone is changed.
147
-
148
- - `searchDisabled`: `boolean` - Whether to disable the search input. Defaults to `false`. When disabled, the skin tone picker will be shown in the preview component.
149
-
150
- - `skinTonesDisabled`: `boolean` - Whether to disable the skin tone selection. Defaults to `false`.
151
-
152
- - `skinTonePickerLocation`: `SkinTonePickerLocation` - The location of the skin tone picker. Can be either `SEARCH` or `PREVIEW`. Defaults to `SEARCH`. The `SkinTonePickerLocation` enum can be imported from the package.
153
-
154
- ```ts
155
- import { SkinTonePickerLocation } from 'emoji-picker-react';
156
- ```
157
-
158
- - `previewConfig`: `PreviewConfig` - Full control over the Preview component, either to show/hide it, change the default emoji or the default caption.
159
-
160
- ```ts
161
- {
162
- defaultEmoji: string; // defaults to: "1f60a"
163
- defaultCaption: string; // defaults to: "What's your mood?"
164
- showPreview: boolean; // defaults to: true
165
- }
166
- ```
167
-
168
- - `searchPlaceholder`: `string` - The placeholder text for the search input. Defaults to `Search`.
169
-
170
- - `searchClearButtonLabel`: `string` - The `aria-label` and `title` text for the search input clear button. Defaults to `Clear`.
171
-
172
- - categories: Allows full config over ordering, naming and display of categories.
173
- To only sort/omit categories, you can simply pass an array of category names to display:
174
-
175
- - 'suggested',
176
- - 'custom', - Hidden by default
177
- - 'smileys_people',
178
- - 'animals_nature',
179
- - 'food_drink',
180
- - 'travel_places',
181
- - 'activities',
182
- - 'objects',
183
- - 'symbols',
184
- - 'flags'
185
-
186
- For a more in-depth configuration, you can pass an array with category config:
187
-
188
- ```ts
189
- [
190
- {
191
- category: 'suggested',
192
- name: 'Recently Used'
193
- },
194
- {
195
- category: 'smileys_people',
196
- name: 'Faces...'
197
- }
198
- ];
199
- ```
200
-
201
- - `suggestedEmojisMode`: `SuggestedEmojisMode` - The mode to use for the suggested emojis. Can be either `recent` or `frequent`. Defaults to `recent`.
202
- The `SuggestionMode` enum can be imported from the package.
203
-
204
- ```ts
205
- import { SuggestionMode } from 'emoji-picker-react';
206
- ```
207
-
208
- - `emojiVersion`: `string` - Allows displaying emojis up to a certain version for compatibility. The passed version will be parsed as a float and each emoji will be tested against it. Common values are:
209
-
210
- - `"0.6"`
211
- - `"1.0"`
212
- - `"2.0"`
213
- - `"3.0"`
214
- - `"4.0"`
215
- - `"5.0"`
216
-
217
- - `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.
218
-
219
- ## customEmojis - Custom Emojis
220
-
221
- The customEmojis prop allows you to add custom emojis to the picker. The custom emojis prop takes an array of custom emojis, each custom emoji has three keys:
222
-
223
- - _id_: Unique identifier for each of the custom emojis
224
- - _names_: an array of string identifiers, will be used both for display, search and indexing.
225
- - _imgUrl_: URL for the emoji image
226
-
227
- ## hiddenEmojis - Excluding certain emojis
228
-
229
- The hiddenEmojis prop allows you to hide emojis from the picker. The hidden emojis prop takes an array of emoji unicode names to hide.
230
-
231
- For example:
47
+ ---
232
48
 
233
- ```js
234
- ['1f600', '1f601', '1f602']; // will remove: 😀, 😁, 😂
235
- ```
49
+ ## 📚 Props Reference
50
+
51
+ The following is a complete list of all props accepted by `EmojiPicker`.
52
+
53
+ ### 🎛️ General Configuration
54
+
55
+ | Prop | Type | Default | Description |
56
+ | ----------------- | ------------ | ------------------ | -------------------------------------------------------------------------------------------- |
57
+ | `open` | `boolean` | `true` | Controls the visibility of the picker. |
58
+ | `theme` | `Theme` | `Theme.LIGHT` | The visual theme. Options: `'light'`, `'dark'`, `'auto'`. |
59
+ | `emojiStyle` | `EmojiStyle` | `EmojiStyle.APPLE` | The emoji set to use. Options: `'apple'`, `'google'`, `'facebook'`, `'twitter'`, `'native'`. |
60
+ | `emojiVersion` | `string` | `null` | Limit emojis to a specific unicode version (e.g., `"14.0"`). |
61
+ | `lazyLoadEmojis` | `boolean` | `false` | If true, emoji images are loaded only when they scroll into view. |
62
+ | `autoFocusSearch` | `boolean` | `true` | Focuses the search input automatically when the picker mounts. |
63
+ | `emojiData` | `object` | `undefined` | Pass imported locale data here for internationalization. |
64
+
65
+ ### 📐 Dimensions & Styling
66
+
67
+ | Prop | Type | Default | Description |
68
+ | ----------- | --------------- | -------- | ------------------------------------------ |
69
+ | `width` | `string` | `number` | `350` |
70
+ | `height` | `string` | `number` | `450` |
71
+ | `style` | `CSSProperties` | `{}` | Inline styles applied to the root element. |
72
+ | `className` | `string` | `""` | CSS class applied to the root element. |
73
+
74
+ ### 🖱️ Events & Interaction
75
+
76
+ | Prop | Type | Description |
77
+ | ------------------ | -------------------------------------------------------- | -------------------------------------------------------------------- |
78
+ | `onEmojiClick` | `(emojiData: EmojiClickData, event: MouseEvent) => void` | Callback triggered when a user clicks an emoji. |
79
+ | `onReactionClick` | `(emojiData: EmojiClickData, event: MouseEvent) => void` | Callback triggered when a user clicks a reaction (in reaction mode). |
80
+ | `onSkinToneChange` | `(skinTone: SkinTones) => void` | Callback triggered when the user selects a new skin tone. |
81
+
82
+ ### 🔎 Search & Categories
83
+
84
+ | Prop | Type | Default | Description |
85
+ | ------------------------ | ------------------------ | ------------------------- | -------------------------------------------------------------------- |
86
+ | `searchDisabled` | `boolean` | `false` | If true, the search bar is completely removed. |
87
+ | `searchPlaceholder` | `string` | `"Search"` | Placeholder text for the search input. |
88
+ | `searchClearButtonLabel` | `string` | `"Clear"` | Aria label for the search clear button. |
89
+ | `categories` | `CategoryConfig[]` | _(All)_ | Array of category objects to customize order or visibility. |
90
+ | `suggestedEmojisMode` | `SuggestionMode` | `SuggestionMode.FREQUENT` | Logic for "Suggested" category. Options: `'recent'`, `'frequent'`. |
91
+ | `defaultSkinTone` | `SkinTones` | `SkinTones.NEUTRAL` | The initial skin tone. |
92
+ | `skinTonesDisabled` | `boolean` | `false` | If true, users cannot change the skin tone. |
93
+ | `skinTonePickerLocation` | `SkinTonePickerLocation` | `SEARCH` | Location of the skin tone trigger. Options: `'SEARCH'`, `'PREVIEW'`. |
94
+
95
+ ### 🦄 Customization & Advanced
96
+
97
+ | Prop | Type | Default | Description |
98
+ | --------------- | ------------------------------------------------ | ----------------------- | --------------------------------------------------------------- |
99
+ | `customEmojis` | `CustomEmoji[]` | `[]` | Array of custom image-based emojis to inject. |
100
+ | `hiddenEmojis` | `string[]` | `[]` | Array of unified IDs (e.g., `'1f921'`) to hide from the picker. |
101
+ | `previewConfig` | `PreviewConfig` | `{ showPreview: true }` | configuration for the bottom preview bar. |
102
+ | `getEmojiUrl` | `(unified: string, style: EmojiStyle) => string` | - | Function to override the default CDN URL for emoji images. |
103
+
104
+ ### ❤️ Reactions Picker Mode
105
+
106
+ | Prop | Type | Default | Description |
107
+ | ---------------------- | ---------- | --------------- | ------------------------------------------------------------------------ |
108
+ | `reactionsDefaultOpen` | `boolean` | `false` | If true, mounts in "Reactions" mode (single row) instead of full picker. |
109
+ | `reactions` | `string[]` | _(Default Set)_ | Array of unified IDs to display in the reactions bar. |
110
+ | `allowExpandReactions` | `boolean` | `true` | If true, shows a `+` button to switch from reactions to full picker. |
236
111
 
237
- ### Usage Example
112
+ ---
238
113
 
239
- ```jsx
240
- <Picker
241
- customEmojis={[
242
- {
243
- names: ['Alice', 'alice in wonderland'],
244
- imgUrl:
245
- 'https://cdn.jsdelivr.net/gh/ealush/emoji-picker-react@custom_emojis_assets/alice.png',
246
- id: 'alice'
247
- },
248
- {
249
- names: ['Dog'],
250
- imgUrl:
251
- 'https://cdn.jsdelivr.net/gh/ealush/emoji-picker-react@custom_emojis_assets/dog.png',
252
- id: 'dog'
253
- },
254
- {
255
- names: ['Hat'],
256
- imgUrl:
257
- 'https://cdn.jsdelivr.net/gh/ealush/emoji-picker-react@custom_emojis_assets/hat.png',
258
- id: 'hat'
259
- },
260
- {
261
- names: ['Vest'],
262
- imgUrl:
263
- 'https://cdn.jsdelivr.net/gh/ealush/emoji-picker-react@custom_emojis_assets/vest.png',
264
- id: 'vest'
265
- }
266
- ]}
267
- />
268
- ```
114
+ ## 🛠️ Detailed Configuration
269
115
 
270
- Here are some additional things to keep in mind about custom emojis:
116
+ ### CSS Variables
271
117
 
272
- - The custom emojis will be added to the Custom category.
273
- - The location or name of the Custom category can be controlled via the categories prop.
274
- - The custom emojis will be indexed by their id property. This means that you can search for custom emojis by their id or names.
118
+ Override default variables by targeting `.EmojiPickerReact`.
275
119
 
276
- ## Reactions Picker
120
+ ### CSS Variables
277
121
 
278
- ![image](https://github.com/ealush/emoji-picker-react/assets/11255103/48901306-e7fd-49cd-8f1e-9b214083a61d)
122
+ You can customize the picker by overriding CSS variables.
279
123
 
280
- ![reactions](https://github.com/ealush/emoji-picker-react/assets/11255103/c28cc954-dc1d-4d82-91a8-64a74cf1d598)
124
+ **[🎨 View Full List of CSS Variables](CSS_VARIABLES.md)**
281
125
 
282
- The picker can be used as a reactions picker. To use it as a reactions picker, you should set the reactionsDefaultOpen prop to true. This will cause the picker to the reactions picker on the initial mount instead of the main picker component.
126
+ ### Custom Emojis Data Structure
283
127
 
284
- To customize the reactions, you should pass an array of unified emoji ids to the reactions prop.
128
+ When passing `customEmojis`, use this format:
285
129
 
286
- The reactions picker uses the same event handlers, and the same css variables for customizations.
130
+ ```ts
131
+ {
132
+ id: string; // Unique ID
133
+ names: string[]; // Search keywords
134
+ imgUrl: string; // Image source
135
+ }
287
136
 
288
- ```jsx
289
- <Picker reactionsDefaultOpen={true} onReactionClick={handleReaction} />
290
137
  ```
291
138
 
292
- # Customization
139
+ ### Preview Config
293
140
 
294
- ## Custom Picker Width and Height
141
+ Control the footer preview area using `previewConfig`:
295
142
 
296
- 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.
297
-
298
- ```jsx
299
- <EmojiPicker height={500} width={400} />
300
- ```
301
-
302
- ```jsx
303
- <EmojiPicker height="100%" width="15em" />
143
+ ```ts
144
+ {
145
+ defaultEmoji: string; // Default: "1f60a"
146
+ defaultCaption: string; // Default: "What's your mood?"
147
+ showPreview: boolean; // Default: true
148
+ }
304
149
  ```
305
150
 
306
- ## CSS Variables
307
-
308
- 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.
309
-
310
- In dark mode, the specific selector is `.EmojiPickerReact.epr-dark-theme`.
311
-
312
- The list of possible variables is quite extensive, but the main ones you may want to override are:
313
-
314
- - `--epr-emoji-size`: The size of the emojis.
315
- - `--epr-emoji-gap`: The space between emojis.
316
-
317
- - `--epr-hover-bg-color` Hovered emoji background color.
318
- - `--epr-bg-color`: The background color of the picker. When changing it, you should also change `--epr-category-label-bg-color` as they are usually the same color.
319
- - `--epr-text-color`: The text color in the picker.
320
-
321
- # Rendering Output Emojis in Your App
322
-
323
- The picker exports an `Emoji` component. The emoji component is the same used within the picker, so it will render the same way as the emojis in the picker. You can choose to render emojis either as native, or as images.
151
+ ---
324
152
 
325
- ## Props
153
+ ## 🌍 Internationalization (i18n)
326
154
 
327
- | Name | Type | Default | Description |
328
- | ------------- | ------------ | ------------------ | ------------------------------------------------------------------------------------------- |
329
- | `unified` | string | "" | The unified code of the emoji. |
330
- | `size` | number | 32 | The size of the emoji. |
331
- | `emojiStyle` | `EmojiStyle` | `EmojiStyle.APPLE` | The emoji style to use. Can be either `apple`, `google`, `facebook`, `twitter` or `native`. |
332
- | `lazyLoad` | boolean | `false` | Whether to lazy load the emoji. image |
333
- | `emojiUrl` | string | - | The url of the emoji image to render. Useful for custom emojis. |
334
- | `getEmojiUrl` | Function | - | Allows to customize the emoji url and provide your own image host for dynamic resolution. |
155
+ Import the dictionary you need and pass it to the `emojiData` prop.
335
156
 
336
- ```js
337
- import { Emoji, EmojiStyle } from 'emoji-picker-react';
157
+ ```javascript
158
+ import EmojiPicker from 'emoji-picker-react';
159
+ import es from 'emoji-picker-react/dist/data/emojis-es'; // Spanish
338
160
 
339
- export function MyApp() {
340
- return (
341
- <p>
342
- My Favorite emoji is:
343
- <Emoji unified="1f423" size="25" />
344
- </p>
345
- );
161
+ function App() {
162
+ return <EmojiPicker emojiData={es} />;
346
163
  }
347
164
  ```
348
165
 
349
- # How to Contribute?
350
-
351
- Check out the [contributing documentation](https://github.com/ealush/emoji-picker-react/blob/master/CONTRIBUTING.md) to get information about contributing, reporting bugs, suggesting enhancements, and writing code changes to the project!
166
+ <details>
167
+ <summary><strong>View Supported Languages</strong></summary>
168
+
169
+ - `emojis-bn` (Bengali 🇧🇩)
170
+ - `emojis-da` (Danish 🇩🇰)
171
+ - `emojis-de` (German 🇩🇪)
172
+ - `emojis-en-gb` (English, GB 🇬🇧)
173
+ - `emojis-en` (English, US 🇺🇸)
174
+ - `emojis-es-mx` (Spanish, Mexico 🇲🇽)
175
+ - `emojis-es` (Spanish 🇪🇸)
176
+ - `emojis-et` (Estonian 🇪🇪)
177
+ - `emojis-fi` (Finnish 🇫🇮)
178
+ - `emojis-fr` (French 🇫🇷)
179
+ - `emojis-hi` (Hindi 🇮🇳)
180
+ - `emojis-hu` (Hungarian 🇭🇺)
181
+ - `emojis-it` (Italian 🇮🇹)
182
+ - `emojis-ja` (Japanese 🇯🇵)
183
+ - `emojis-ko` (Korean 🇰🇷)
184
+ - `emojis-lt` (Lithuanian 🇱🇹)
185
+ - `emojis-ms` (Malay 🇲🇾)
186
+ - `emojis-nb` (Norwegian Bokmål 🇳🇴)
187
+ - `emojis-nl` (Dutch 🇳🇱)
188
+ - `emojis-pl` (Polish 🇵🇱)
189
+ - `emojis-pt` (Portuguese 🇵🇹)
190
+ - `emojis-ru` (Russian 🇷🇺)
191
+ - `emojis-sv` (Swedish 🇸🇪)
192
+ - `emojis-th` (Thai 🇹🇭)
193
+ - `emojis-uk` (Ukrainian 🇺🇦)
194
+ - `emojis-zh-hant` (Traditional Chinese 🇹🇼)
195
+ - `emojis-zh` (Simplified Chinese 🇨🇳)
196
+
197
+ </details>
352
198
 
353
- # Troubleshooting
199
+ ---
354
200
 
355
- ## Error Boundary
201
+ ## ⚠️ Troubleshooting
356
202
 
357
- emoji-picker-react has a top-level error boundary, trying to catch rendering errors. It won't catch server side related errors, or event handlers errors. If an error is caught, the picker will not render, and a console error will be logged.
203
+ ### Server-Side Rendering (Next.js / Remix)
358
204
 
359
- ## Next.js
205
+ This package relies on the `window` object and must be rendered on the client.
360
206
 
361
- To avoid errors such as "document is not defined" on the server side, you should make sure the library is only imported on the client side. Here is how to do that:
207
+ **Next.js Example:**
362
208
 
363
209
  ```javascript
364
210
  import dynamic from 'next/dynamic';
365
211
 
366
- const Picker = dynamic(
367
- () => {
368
- return import('emoji-picker-react');
369
- },
370
- { ssr: false }
371
- );
212
+ const Picker = dynamic(() => import('emoji-picker-react'), { ssr: false });
372
213
  ```
373
214
 
374
- ## Vite
215
+ ### Vite
375
216
 
376
- For reference, if you only need to shim global, you can add
217
+ If you encounter `global is not defined`, add this to your HTML:
377
218
 
378
219
  ```html
379
220
  <script>
380
221
  window.global = window;
381
222
  </script>
382
223
  ```
224
+
225
+ ---
226
+
227
+ ## 🤝 Contributing
228
+
229
+ We welcome contributions! Please check out the [Contributing Guide](https://github.com/ealush/emoji-picker-react/blob/master/CONTRIBUTING.md) for how to run the project locally.
230
+
231
+ **Shout Outs:**
232
+ Design inspiration by [Pavel Bolo](https://pavelbolo.com).
233
+
234
+ _If you enjoy using `emoji-picker-react`, check out [Vest validation framework](https://vestjs.dev)._
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { CategoryConfig } from '../../config/categoryConfig';
2
+ import { CategoryConfig } from '../../types/exposedTypes';
3
3
  declare type Props = Readonly<{
4
4
  categoryConfig: CategoryConfig;
5
5
  children?: React.ReactNode;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { DataEmoji, DataEmojis } from '../../dataUtils/DataTypes';
3
+ import { Categories, EmojiData, SkinTones } from '../../types/exposedTypes';
4
+ export interface PickerDataContextValue {
5
+ emojiData: EmojiData;
6
+ allEmojis: DataEmojis;
7
+ allEmojisByUnified: Record<string, DataEmoji>;
8
+ searchIndex: Record<string, Record<string, DataEmoji>>;
9
+ emojiByUnified: (unified?: string) => DataEmoji | undefined;
10
+ activeVariationFromUnified: (unified: string) => SkinTones | null;
11
+ }
12
+ export declare function PickerDataProvider({ children, }: {
13
+ children: React.ReactNode;
14
+ }): JSX.Element;
15
+ export declare function usePickerDataContext(): PickerDataContextValue;
16
+ export declare function useGetEmojisByCategory(): (category: Categories) => DataEmojis;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { CategoryConfig } from '../../config/categoryConfig';
2
+ import { CategoryConfig } from '../../types/exposedTypes';
3
3
  declare type Props = {
4
4
  isActiveCategory: boolean;
5
5
  category: string;
@@ -1,4 +1,4 @@
1
- import { Categories, SuggestionMode } from '../types/exposedTypes';
1
+ import { Categories, CategoryConfig, EmojiData, SuggestionMode } from '../types/exposedTypes';
2
2
  export { Categories };
3
3
  export declare const SuggestedRecent: CategoryConfig;
4
4
  export declare type CustomCategoryConfig = {
@@ -9,12 +9,8 @@ export declare function baseCategoriesConfig(modifiers?: Record<Categories, Cate
9
9
  export declare function categoryFromCategoryConfig(category: CategoryConfig): Categories;
10
10
  export declare function categoryNameFromCategoryConfig(category: CategoryConfig): string;
11
11
  export declare type CategoriesConfig = CategoryConfig[];
12
- export declare type CategoryConfig = {
13
- category: Categories;
14
- name: string;
15
- };
16
12
  export declare type UserCategoryConfig = Array<Categories | CategoryConfig>;
17
- export declare function mergeCategoriesConfig(userCategoriesConfig?: UserCategoryConfig, modifiers?: CategoryConfigModifiers): CategoriesConfig;
13
+ export declare function mergeCategoriesConfig(userCategoriesConfig?: UserCategoryConfig, modifiers?: CategoryConfigModifiers, emojiData?: EmojiData): CategoriesConfig;
18
14
  declare type CategoryConfigModifiers = {
19
15
  suggestionMode?: SuggestionMode;
20
16
  };
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { GetEmojiUrl } from '../components/emoji/BaseEmojiProps';
3
- import { EmojiClickData, EmojiStyle, SkinTonePickerLocation, SkinTones, SuggestionMode, Theme } from '../types/exposedTypes';
3
+ import { 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";
@@ -39,6 +39,7 @@ export declare type PickerConfigInternal = {
39
39
  open: boolean;
40
40
  allowExpandReactions: boolean;
41
41
  hiddenEmojis: string[];
42
+ emojiData?: EmojiData;
42
43
  };
43
44
  export declare type PreviewConfig = {
44
45
  defaultEmoji: string;
@@ -0,0 +1,3 @@
1
+ import { EmojiData } from '../types/exposedTypes';
2
+ declare const data: EmojiData;
3
+ export default data;