emoji-picker-react 4.1.0-rc.1 → 4.1.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
@@ -1,4 +1,4 @@
1
- # Emoji Picker React (v4) | [Live Demo](https://codesandbox.io/s/emoji-picker-react-4-z2gkzp)
1
+ \*\*\*\*# Emoji Picker React (v4) | [Live Demo](https://codesandbox.io/s/emoji-picker-react-4-z2gkzp)
2
2
 
3
3
  ![Picker](https://user-images.githubusercontent.com/11255103/192167134-8205eb89-a71d-4463-8f3a-940e844917d5.gif)
4
4
 
@@ -56,6 +56,7 @@ The following props are accepted by them picker:
56
56
  | suggestedEmojisMode | string | `frequent` | Controls the suggested emojis mode. Possible values are `frequent` and `recent`. |
57
57
  | skinTonesDisabled | boolean | `false` | Controls whether the skin tones are disabled or not. |
58
58
  | `width` | number | `350` | Controls the width of the picker. |
59
+ | emojiVersion | `string` | - | Allows displaying emojis up to a certain version for compatibility. |
59
60
  | `height` | number | `450` | Controls the height of the picker. |
60
61
 
61
62
  ## Full details
@@ -139,12 +140,12 @@ import { SkinTones } from 'emoji-picker-react';
139
140
  [
140
141
  {
141
142
  category: 'suggested',
142
- name: 'Recently Used'
143
+ name: 'Recently Used',
143
144
  },
144
145
  {
145
146
  category: 'smileys_people',
146
- name: 'Faces...'
147
- }
147
+ name: 'Faces...',
148
+ },
148
149
  ];
149
150
  ```
150
151
 
@@ -155,6 +156,14 @@ import { SkinTones } from 'emoji-picker-react';
155
156
  import { SuggestionMode } from 'emoji-picker-react';
156
157
  ```
157
158
 
159
+ - `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:
160
+ - `"0.6"`
161
+ - `"1.0"`
162
+ - `"2.0"`
163
+ - `"3.0"`
164
+ - `"4.0"`
165
+ - `"5.0"`
166
+
158
167
  # Customization
159
168
 
160
169
  ## Custom Picker Width and Height
@@ -3,7 +3,7 @@ import { CategoriesConfig } from './categoryConfig';
3
3
  export declare function mergeConfig(userConfig?: PickerConfig): PickerConfigInternal;
4
4
  export declare function basePickerConfig(): PickerConfigInternal;
5
5
  export declare type PickerConfigInternal = {
6
- addedIn: string | null;
6
+ emojiVersion: string | null;
7
7
  searchPlaceHolder: string;
8
8
  defaultSkinTone: SkinTones;
9
9
  skinTonesDisabled: boolean;
@@ -16,4 +16,4 @@ export declare function usePickerSizeConfig(): {
16
16
  height: number;
17
17
  width: number;
18
18
  };
19
- export declare function useAddedInConfig(): string | null;
19
+ export declare function useEmojiVersionConfig(): string | null;
@@ -335,11 +335,11 @@ function mergeConfig(userConfig) {
335
335
  }
336
336
  function basePickerConfig() {
337
337
  return {
338
- addedIn: null,
339
338
  autoFocusSearch: true,
340
339
  categories: baseCategoriesConfig(),
341
340
  defaultSkinTone: exports.SkinTones.NEUTRAL,
342
341
  emojiStyle: exports.EmojiStyle.APPLE,
342
+ emojiVersion: null,
343
343
  height: 450,
344
344
  lazyLoadEmojis: false,
345
345
  onEmojiClick: function defaultOnClickHandler( // @ts-ignore
@@ -455,11 +455,11 @@ function usePickerSizeConfig() {
455
455
  width: width
456
456
  };
457
457
  }
458
- function useAddedInConfig() {
458
+ function useEmojiVersionConfig() {
459
459
  var _usePickerConfig13 = usePickerConfig(),
460
- addedIn = _usePickerConfig13.addedIn;
460
+ emojiVersion = _usePickerConfig13.emojiVersion;
461
461
 
462
- return addedIn;
462
+ return emojiVersion;
463
463
  }
464
464
 
465
465
  var CDN_URL_APPLE = 'https://cdn.jsdelivr.net/npm/emoji-datasource-apple/img/apple/64/';
@@ -16953,22 +16953,22 @@ function useDebouncedState(initialValue, delay) {
16953
16953
 
16954
16954
  function useDisallowedEmojis() {
16955
16955
  var DisallowedEmojisRef = React.useRef({});
16956
- var addedInConfig = useAddedInConfig();
16956
+ var emojiVersionConfig = useEmojiVersionConfig();
16957
16957
  return React.useMemo(function () {
16958
- var addedInFloat = parseFloat("" + addedInConfig);
16958
+ var emojiVersion = parseFloat("" + emojiVersionConfig);
16959
16959
 
16960
- if (!addedInConfig || Number.isNaN(addedInFloat)) {
16960
+ if (!emojiVersionConfig || Number.isNaN(emojiVersion)) {
16961
16961
  return DisallowedEmojisRef.current;
16962
16962
  }
16963
16963
 
16964
16964
  return allEmojis.reduce(function (disallowedEmojis, emoji) {
16965
- if (addedInNewerVersion(emoji, addedInFloat)) {
16965
+ if (addedInNewerVersion(emoji, emojiVersion)) {
16966
16966
  disallowedEmojis[emojiUnified(emoji)] = true;
16967
16967
  }
16968
16968
 
16969
16969
  return disallowedEmojis;
16970
16970
  }, DisallowedEmojisRef.current);
16971
- }, [addedInConfig]);
16971
+ }, [emojiVersionConfig]);
16972
16972
  }
16973
16973
 
16974
16974
  function addedInNewerVersion(emoji, supportedLevel) {