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 +13 -4
- package/dist/DomUtils/classNames.d.ts +3 -1
- package/dist/config/config.d.ts +1 -1
- package/dist/config/useConfig.d.ts +1 -1
- package/dist/emoji-picker-react.cjs.development.js +21 -12
- 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 +21 -12
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/package.json +5 -5
- package/src/DomUtils/classNames.ts +4 -2
- package/src/components/body/EmojiList.tsx +2 -1
- package/src/components/header/Search.tsx +29 -10
- package/src/components/main/PickerMain.tsx +3 -3
- package/src/config/config.ts +2 -2
- package/src/config/useConfig.ts +3 -3
- package/src/hooks/useDisallowedEmojis.ts +6 -6
- package/src/hooks/useFilter.ts +8 -8
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
\*\*\*\*# Emoji Picker React (v4) | [Live Demo](https://codesandbox.io/s/emoji-picker-react-4-z2gkzp)
|
|
2
2
|
|
|
3
3
|

|
|
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
|
-
|
|
13
|
+
emojiList = "epr-emoji-list",
|
|
14
|
+
external = "__EmojiPicker__",
|
|
15
|
+
emojiPicker = "EmojiPickerReact"
|
|
14
16
|
}
|
|
15
17
|
export declare function asSelectors(...classNames: ClassNames[]): string;
|
package/dist/config/config.d.ts
CHANGED
|
@@ -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
|
-
|
|
6
|
+
emojiVersion: string | null;
|
|
7
7
|
searchPlaceHolder: string;
|
|
8
8
|
defaultSkinTone: SkinTones;
|
|
9
9
|
skinTonesDisabled: boolean;
|
|
@@ -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
|
|
460
|
+
function useEmojiVersionConfig() {
|
|
459
461
|
var _usePickerConfig13 = usePickerConfig(),
|
|
460
|
-
|
|
462
|
+
emojiVersion = _usePickerConfig13.emojiVersion;
|
|
461
463
|
|
|
462
|
-
return
|
|
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
|
|
16958
|
+
var emojiVersionConfig = useEmojiVersionConfig();
|
|
16957
16959
|
return React.useMemo(function () {
|
|
16958
|
-
var
|
|
16960
|
+
var emojiVersion = parseFloat("" + emojiVersionConfig);
|
|
16959
16961
|
|
|
16960
|
-
if (!
|
|
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,
|
|
16967
|
+
if (addedInNewerVersion(emoji, emojiVersion)) {
|
|
16966
16968
|
disallowedEmojis[emojiUnified(emoji)] = true;
|
|
16967
16969
|
}
|
|
16968
16970
|
|
|
16969
16971
|
return disallowedEmojis;
|
|
16970
16972
|
}, DisallowedEmojisRef.current);
|
|
16971
|
-
}, [
|
|
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:
|
|
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
|
-
|
|
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(
|
|
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);
|