emoji-picker-react 4.9.4 → 4.10.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 CHANGED
@@ -85,6 +85,7 @@ The following props are accepted by them picker:
85
85
  | getEmojiUrl | `Function` | - | Allows to customize the emoji url and provide your own image host. |
86
86
  | categories | `Array` | - | Allows full config over ordering, naming and display of categories. |
87
87
  | customEmojis | `Array<{names: string[], imgUrl: string, id: string}>` | - | Allows adding custom emojis to the picker. |
88
+ | hiddenEmojis | `string[]` | - | Controls the emojis that are hidden from the picker. |
88
89
  | reactionsDefaultOpen | `boolean` | `false` | Controls whether the reactions picker is on the initial mount instead of the main picker component. |
89
90
  | reactions | string[] | - | Controls the reactions to display in the reactions picker. Takes unified emoji ids |
90
91
  | 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. |
@@ -212,13 +213,23 @@ import { SkinTones } from 'emoji-picker-react';
212
213
 
213
214
  - `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.
214
215
 
215
- ## Custom Emojis
216
+ ## customEmojis - Custom Emojis
216
217
 
217
218
  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:
218
219
 
219
- id: Unique identifier for each of the custom emojis
220
- names: an array of string identifiers, will be used both for display, search and indexing.
221
- imgUrl: URL for the emoji image
220
+ - _id_: Unique identifier for each of the custom emojis
221
+ - _names_: an array of string identifiers, will be used both for display, search and indexing.
222
+ - _imgUrl_: URL for the emoji image
223
+
224
+ ## hiddenEmojis - Excluding certain emojis
225
+
226
+ The hiddenEmojis prop allows you to hide emojis from the picker. The hidden emojis prop takes an array of emoji unicode names to hide.
227
+
228
+ For example:
229
+
230
+ ```js
231
+ ['1f600', '1f601', '1f602']; // will remove: 😀, 😁, 😂
232
+ ```
222
233
 
223
234
  ### Usage Example
224
235
 
@@ -36,6 +36,7 @@ export declare type PickerConfigInternal = {
36
36
  reactions: string[];
37
37
  open: boolean;
38
38
  allowExpandReactions: boolean;
39
+ hiddenEmojis: string[];
39
40
  };
40
41
  export declare type PreviewConfig = {
41
42
  defaultEmoji: string;
@@ -16810,6 +16810,9 @@ function mergeConfig(userConfig) {
16810
16810
  var categories = mergeCategoriesConfig(userConfig.categories, {
16811
16811
  suggestionMode: config.suggestedEmojisMode
16812
16812
  });
16813
+ config.hiddenEmojis.forEach(function (emoji) {
16814
+ config.unicodeToHide.add(emoji);
16815
+ });
16813
16816
  setCustomEmojis((_config$customEmojis = config.customEmojis) != null ? _config$customEmojis : []);
16814
16817
  var skinTonePickerLocation = config.searchDisabled ? exports.SkinTonePickerLocation.PREVIEW : config.skinTonePickerLocation;
16815
16818
  return _extends({}, config, {
@@ -16844,7 +16847,8 @@ function basePickerConfig() {
16844
16847
  reactionsDefaultOpen: false,
16845
16848
  reactions: DEFAULT_REACTIONS,
16846
16849
  open: true,
16847
- allowExpandReactions: true
16850
+ allowExpandReactions: true,
16851
+ hiddenEmojis: []
16848
16852
  };
16849
16853
  }
16850
16854
  var basePreviewConfig = {