react-input-emoji 5.2.1 → 5.4.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/dist/index.es.js +49 -18
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +48 -17
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
@@ -3933,6 +3933,7 @@ function $e5534fc185f7111e$export$2e2bcd8739ae039(props) {
|
|
3933
3933
|
* @property {function(import("../types/types").EmojiMartItem): void} onSelectEmoji
|
3934
3934
|
* @property {boolean} disableRecent
|
3935
3935
|
* @property {import("emoji-mart").CustomEmoji[]=} customEmojis
|
3936
|
+
* @property {import('../types/types').Languages=} language
|
3936
3937
|
*/
|
3937
3938
|
|
3938
3939
|
/**
|
@@ -3945,7 +3946,8 @@ function EmojiPicker(props) {
|
|
3945
3946
|
var theme = props.theme,
|
3946
3947
|
onSelectEmoji = props.onSelectEmoji,
|
3947
3948
|
disableRecent = props.disableRecent,
|
3948
|
-
customEmojis = props.customEmojis
|
3949
|
+
customEmojis = props.customEmojis,
|
3950
|
+
language = props.language;
|
3949
3951
|
/** @type {string[]} */
|
3950
3952
|
|
3951
3953
|
var categories = React.useMemo(function () {
|
@@ -3959,6 +3961,13 @@ function EmojiPicker(props) {
|
|
3959
3961
|
categoryies = [].concat(_toConsumableArray(categoryies), ["people", "nature", "foods", "activity", "places", "objects", "symbols", "flags"]);
|
3960
3962
|
return categoryies;
|
3961
3963
|
}, [disableRecent]);
|
3964
|
+
var i18n = React.useMemo(function () {
|
3965
|
+
if (!language) {
|
3966
|
+
return undefined;
|
3967
|
+
}
|
3968
|
+
|
3969
|
+
return require("@emoji-mart/data/i18n/".concat(language !== null && language !== void 0 ? language : 'en', ".json"));
|
3970
|
+
}, [language]);
|
3962
3971
|
return /*#__PURE__*/React__default["default"].createElement($e5534fc185f7111e$export$2e2bcd8739ae039, {
|
3963
3972
|
data: undefined,
|
3964
3973
|
theme: theme,
|
@@ -3966,16 +3975,11 @@ function EmojiPicker(props) {
|
|
3966
3975
|
onEmojiSelect: onSelectEmoji,
|
3967
3976
|
custom: customEmojis,
|
3968
3977
|
categories: categories,
|
3969
|
-
set: "apple"
|
3978
|
+
set: "apple",
|
3979
|
+
i18n: i18n
|
3970
3980
|
});
|
3971
3981
|
}
|
3972
3982
|
|
3973
|
-
EmojiPicker.propTypes = {
|
3974
|
-
theme: t__default["default"].oneOf(["light", "dark", "auto"]),
|
3975
|
-
onSelectEmoji: t__default["default"].func,
|
3976
|
-
disableRecent: t__default["default"].bool,
|
3977
|
-
customEmojis: t__default["default"].array
|
3978
|
-
};
|
3979
3983
|
var EmojiPicker$1 = /*#__PURE__*/React.memo(EmojiPicker);
|
3980
3984
|
|
3981
3985
|
/**
|
@@ -3986,6 +3990,7 @@ var EmojiPicker$1 = /*#__PURE__*/React.memo(EmojiPicker);
|
|
3986
3990
|
* @property {boolean} disableRecent
|
3987
3991
|
* @property {import("emoji-mart").CustomEmoji[]=} customEmojis
|
3988
3992
|
* @property {('above' | 'below')=} position
|
3993
|
+
* @property {import('../types/types').Languages=} language
|
3989
3994
|
*/
|
3990
3995
|
|
3991
3996
|
/**
|
@@ -4000,7 +4005,8 @@ function EmojiPickerContainer(_ref) {
|
|
4000
4005
|
handleSelectEmoji = _ref.handleSelectEmoji,
|
4001
4006
|
disableRecent = _ref.disableRecent,
|
4002
4007
|
customEmojis = _ref.customEmojis,
|
4003
|
-
position = _ref.position
|
4008
|
+
position = _ref.position,
|
4009
|
+
language = _ref.language;
|
4004
4010
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
4005
4011
|
className: "react-emoji-picker--container"
|
4006
4012
|
}, showPicker && /*#__PURE__*/React__default["default"].createElement("div", {
|
@@ -4017,7 +4023,8 @@ function EmojiPickerContainer(_ref) {
|
|
4017
4023
|
theme: theme,
|
4018
4024
|
onSelectEmoji: handleSelectEmoji,
|
4019
4025
|
disableRecent: disableRecent,
|
4020
|
-
customEmojis: customEmojis
|
4026
|
+
customEmojis: customEmojis,
|
4027
|
+
language: language
|
4021
4028
|
}))));
|
4022
4029
|
}
|
4023
4030
|
|
@@ -4040,6 +4047,7 @@ var EMOJI_PICKER_CONTAINER_HEIGHT = 435;
|
|
4040
4047
|
* @property {(fn: PolluteFn) => void} addPolluteFn
|
4041
4048
|
* @property {(html: string) => void} appendContent
|
4042
4049
|
* @property {HTMLDivElement=} buttonElement
|
4050
|
+
* @property {import('../types/types').Languages=} language
|
4043
4051
|
*/
|
4044
4052
|
// eslint-disable-next-line valid-jsdoc
|
4045
4053
|
|
@@ -4053,7 +4061,8 @@ var EmojiPickerWrapper = function EmojiPickerWrapper(props) {
|
|
4053
4061
|
addSanitizeFn = props.addSanitizeFn,
|
4054
4062
|
addPolluteFn = props.addPolluteFn,
|
4055
4063
|
appendContent = props.appendContent,
|
4056
|
-
buttonElement = props.buttonElement
|
4064
|
+
buttonElement = props.buttonElement,
|
4065
|
+
language = props.language;
|
4057
4066
|
|
4058
4067
|
var _useState = React.useState(false),
|
4059
4068
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -4164,7 +4173,8 @@ var EmojiPickerWrapper = function EmojiPickerWrapper(props) {
|
|
4164
4173
|
handleSelectEmoji: handleSelectEmoji,
|
4165
4174
|
disableRecent: disableRecent,
|
4166
4175
|
customEmojis: customEmojis,
|
4167
|
-
position: emojiPickerPosition
|
4176
|
+
position: emojiPickerPosition,
|
4177
|
+
language: language
|
4168
4178
|
}), /*#__PURE__*/React__default["default"].createElement(EmojiPickerButton, {
|
4169
4179
|
showPicker: showPicker,
|
4170
4180
|
toggleShowPicker: toggleShowPicker,
|
@@ -4175,7 +4185,8 @@ var EmojiPickerWrapper = function EmojiPickerWrapper(props) {
|
|
4175
4185
|
handleSelectEmoji: handleSelectEmoji,
|
4176
4186
|
disableRecent: disableRecent,
|
4177
4187
|
customEmojis: customEmojis,
|
4178
|
-
position: emojiPickerPosition
|
4188
|
+
position: emojiPickerPosition,
|
4189
|
+
language: language
|
4179
4190
|
}), /*#__PURE__*/React__default["default"].createElement(EmojiPickerButton, {
|
4180
4191
|
showPicker: showPicker,
|
4181
4192
|
toggleShowPicker: toggleShowPicker
|
@@ -4835,6 +4846,7 @@ function usePollute() {
|
|
4835
4846
|
* @property {number} fontSize
|
4836
4847
|
* @property {string} fontFamily
|
4837
4848
|
* @property {{id: string; name: string; emojis: {id: string; name: string; keywords: string[], skins: {src: string}[]}}[]=} customEmojis
|
4849
|
+
* @property {import('./types/types').Languages=} language
|
4838
4850
|
* @property {(text: string) => Promise<MetionUser[]>=} searchMention
|
4839
4851
|
* @property {HTMLDivElement=} buttonElement
|
4840
4852
|
*/
|
@@ -4865,6 +4877,7 @@ function InputEmoji(props, ref) {
|
|
4865
4877
|
tabIndex = props.tabIndex,
|
4866
4878
|
value = props.value,
|
4867
4879
|
customEmojis = props.customEmojis,
|
4880
|
+
language = props.language,
|
4868
4881
|
searchMention = props.searchMention,
|
4869
4882
|
buttonElement = props.buttonElement,
|
4870
4883
|
borderRadius = props.borderRadius,
|
@@ -5016,8 +5029,24 @@ function InputEmoji(props, ref) {
|
|
5016
5029
|
|
5017
5030
|
|
5018
5031
|
function handleCopy(event) {
|
5019
|
-
|
5020
|
-
|
5032
|
+
var selection = window.getSelection();
|
5033
|
+
|
5034
|
+
if (selection !== null) {
|
5035
|
+
var selectedText = '';
|
5036
|
+
|
5037
|
+
if (selection.anchorNode && selection.anchorNode.nodeType === Node.ELEMENT_NODE) {
|
5038
|
+
// @ts-ignore
|
5039
|
+
selectedText = selection.anchorNode.innerHTML;
|
5040
|
+
} else if (selection.anchorNode && selection.anchorNode.nodeType === Node.TEXT_NODE) {
|
5041
|
+
var _selection$anchorNode;
|
5042
|
+
|
5043
|
+
selectedText = (_selection$anchorNode = selection.anchorNode.textContent) !== null && _selection$anchorNode !== void 0 ? _selection$anchorNode : '';
|
5044
|
+
}
|
5045
|
+
|
5046
|
+
var text = replaceAllTextEmojiToString(selectedText);
|
5047
|
+
event.clipboardData.setData("text", text);
|
5048
|
+
event.preventDefault();
|
5049
|
+
}
|
5021
5050
|
}
|
5022
5051
|
/**
|
5023
5052
|
* Handle past on input
|
@@ -5073,7 +5102,8 @@ function InputEmoji(props, ref) {
|
|
5073
5102
|
addSanitizeFn: addSanitizeFn,
|
5074
5103
|
addPolluteFn: addPolluteFn,
|
5075
5104
|
appendContent: appendContent,
|
5076
|
-
buttonElement: buttonElement
|
5105
|
+
buttonElement: buttonElement,
|
5106
|
+
language: language
|
5077
5107
|
}));
|
5078
5108
|
}
|
5079
5109
|
|
@@ -5090,7 +5120,8 @@ InputEmojiWithRef.defaultProps = {
|
|
5090
5120
|
fontFamily: "sans-serif",
|
5091
5121
|
tabIndex: 0,
|
5092
5122
|
shouldReturn: false,
|
5093
|
-
customEmojis: []
|
5123
|
+
customEmojis: [],
|
5124
|
+
language: undefined
|
5094
5125
|
};
|
5095
5126
|
|
5096
5127
|
module.exports = InputEmojiWithRef;
|