emoji-picker-react 4.1.0-rc.1 → 4.1.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.
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
@@ -10,6 +10,8 @@ export declare enum ClassNames {
10
10
  categoryContent = "epr-emoji-category-content",
11
11
  emojiHasVariatios = "epr-emoji-has-variations",
12
12
  scrollBody = "epr-body",
13
- external = "__EmojiPicker__"
13
+ emojiList = "epr-emoji-list",
14
+ external = "__EmojiPicker__",
15
+ emojiPicker = "EmojiPickerReact"
14
16
  }
15
17
  export declare function asSelectors(...classNames: ClassNames[]): string;
@@ -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;
@@ -21,7 +21,9 @@ var ClassNames;
21
21
  ClassNames["categoryContent"] = "epr-emoji-category-content";
22
22
  ClassNames["emojiHasVariatios"] = "epr-emoji-has-variations";
23
23
  ClassNames["scrollBody"] = "epr-body";
24
+ ClassNames["emojiList"] = "epr-emoji-list";
24
25
  ClassNames["external"] = "__EmojiPicker__";
26
+ ClassNames["emojiPicker"] = "EmojiPickerReact";
25
27
  })(ClassNames || (ClassNames = {}));
26
28
 
27
29
  function asSelectors() {
@@ -335,11 +337,11 @@ function mergeConfig(userConfig) {
335
337
  }
336
338
  function basePickerConfig() {
337
339
  return {
338
- addedIn: null,
339
340
  autoFocusSearch: true,
340
341
  categories: baseCategoriesConfig(),
341
342
  defaultSkinTone: exports.SkinTones.NEUTRAL,
342
343
  emojiStyle: exports.EmojiStyle.APPLE,
344
+ emojiVersion: null,
343
345
  height: 450,
344
346
  lazyLoadEmojis: false,
345
347
  onEmojiClick: function defaultOnClickHandler( // @ts-ignore
@@ -455,11 +457,11 @@ function usePickerSizeConfig() {
455
457
  width: width
456
458
  };
457
459
  }
458
- function useAddedInConfig() {
460
+ function useEmojiVersionConfig() {
459
461
  var _usePickerConfig13 = usePickerConfig(),
460
- addedIn = _usePickerConfig13.addedIn;
462
+ emojiVersion = _usePickerConfig13.emojiVersion;
461
463
 
462
- return addedIn;
464
+ return emojiVersion;
463
465
  }
464
466
 
465
467
  var CDN_URL_APPLE = 'https://cdn.jsdelivr.net/npm/emoji-datasource-apple/img/apple/64/';
@@ -16953,22 +16955,22 @@ function useDebouncedState(initialValue, delay) {
16953
16955
 
16954
16956
  function useDisallowedEmojis() {
16955
16957
  var DisallowedEmojisRef = React.useRef({});
16956
- var addedInConfig = useAddedInConfig();
16958
+ var emojiVersionConfig = useEmojiVersionConfig();
16957
16959
  return React.useMemo(function () {
16958
- var addedInFloat = parseFloat("" + addedInConfig);
16960
+ var emojiVersion = parseFloat("" + emojiVersionConfig);
16959
16961
 
16960
- if (!addedInConfig || Number.isNaN(addedInFloat)) {
16962
+ if (!emojiVersionConfig || Number.isNaN(emojiVersion)) {
16961
16963
  return DisallowedEmojisRef.current;
16962
16964
  }
16963
16965
 
16964
16966
  return allEmojis.reduce(function (disallowedEmojis, emoji) {
16965
- if (addedInNewerVersion(emoji, addedInFloat)) {
16967
+ if (addedInNewerVersion(emoji, emojiVersion)) {
16966
16968
  disallowedEmojis[emojiUnified(emoji)] = true;
16967
16969
  }
16968
16970
 
16969
16971
  return disallowedEmojis;
16970
16972
  }, DisallowedEmojisRef.current);
16971
- }, [addedInConfig]);
16973
+ }, [emojiVersionConfig]);
16972
16974
  }
16973
16975
 
16974
16976
  function addedInNewerVersion(emoji, supportedLevel) {
@@ -18308,7 +18310,7 @@ function Suggested(_ref) {
18308
18310
  function EmojiList() {
18309
18311
  var categories = useCategoriesConfig();
18310
18312
  return React.createElement("ul", {
18311
- className: "epr-emoji-list"
18313
+ className: ClassNames.emojiList
18312
18314
  }, categories.map(function (categoryConfig, index) {
18313
18315
  var category = categoryFromCategoryConfig(categoryConfig);
18314
18316
 
@@ -18827,10 +18829,17 @@ function Search() {
18827
18829
  className: "epr-icn-clear-search"
18828
18830
  })));
18829
18831
  }
18832
+ var CSS_SEARCH_SELECTOR = /*#__PURE__*/asSelectors(ClassNames.emojiPicker) + " " + /*#__PURE__*/asSelectors(ClassNames.emojiList);
18830
18833
 
18831
18834
  function CssSearch(_ref) {
18832
18835
  var value = _ref.value;
18833
- return value ? React.createElement("style", null, "\n .EmojiPickerReact button.epr-emoji:not([data-full-name*=\"" + getNormalizedSearchTerm(value) + "\"]) {\n display: none;\n }\n ") : null;
18836
+
18837
+ if (!value) {
18838
+ return null;
18839
+ }
18840
+
18841
+ var searchQuery = "button[data-full-name*=\"" + getNormalizedSearchTerm(value) + "\"]";
18842
+ return React.createElement("style", null, "\n " + CSS_SEARCH_SELECTOR + " " + asSelectors(ClassNames.category) + ":not(:has(" + searchQuery + ")) {\n display: none;\n }\n\n " + CSS_SEARCH_SELECTOR + " button" + asSelectors(ClassNames.emoji) + ":not(" + searchQuery + ") {\n display: none;\n }\n ");
18834
18843
  }
18835
18844
 
18836
18845
  function SkinTonePicker() {
@@ -19362,7 +19371,7 @@ function PickerRootElement(_ref2) {
19362
19371
  width: width + "px"
19363
19372
  };
19364
19373
  return React.createElement("aside", {
19365
- className: clsx('EmojiPickerReact', 'epr-main', (_clsx = {}, _clsx[ClassNames.searchActive] = searchModeActive, _clsx['epr-dark-theme'] = theme === exports.Theme.DARK, _clsx)),
19374
+ className: clsx(ClassNames.emojiPicker, 'epr-main', (_clsx = {}, _clsx[ClassNames.searchActive] = searchModeActive, _clsx['epr-dark-theme'] = theme === exports.Theme.DARK, _clsx)),
19366
19375
  ref: PickerMainRef,
19367
19376
  style: style
19368
19377
  }, children);