react-input-emoji 5.2.1 → 5.3.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import React, { useRef, useCallback, useImperativeHandle, useEffect, forwardRef, useState, useMemo, memo } from 'react';
1
+ import React, { useRef, useCallback, useImperativeHandle, useEffect, forwardRef, useState, memo, useMemo } from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
  import t from 'prop-types';
4
4
 
@@ -3925,6 +3925,7 @@ function $e5534fc185f7111e$export$2e2bcd8739ae039(props) {
3925
3925
  * @property {function(import("../types/types").EmojiMartItem): void} onSelectEmoji
3926
3926
  * @property {boolean} disableRecent
3927
3927
  * @property {import("emoji-mart").CustomEmoji[]=} customEmojis
3928
+ * @property {import('../types/types').Languages=} language
3928
3929
  */
3929
3930
 
3930
3931
  /**
@@ -3937,7 +3938,8 @@ function EmojiPicker(props) {
3937
3938
  var theme = props.theme,
3938
3939
  onSelectEmoji = props.onSelectEmoji,
3939
3940
  disableRecent = props.disableRecent,
3940
- customEmojis = props.customEmojis;
3941
+ customEmojis = props.customEmojis,
3942
+ language = props.language;
3941
3943
  /** @type {string[]} */
3942
3944
 
3943
3945
  var categories = useMemo(function () {
@@ -3951,6 +3953,13 @@ function EmojiPicker(props) {
3951
3953
  categoryies = [].concat(_toConsumableArray(categoryies), ["people", "nature", "foods", "activity", "places", "objects", "symbols", "flags"]);
3952
3954
  return categoryies;
3953
3955
  }, [disableRecent]);
3956
+ var i18n = useMemo(function () {
3957
+ if (!language) {
3958
+ return undefined;
3959
+ }
3960
+
3961
+ return require("@emoji-mart/data/i18n/".concat(language !== null && language !== void 0 ? language : 'en', ".json"));
3962
+ }, [language]);
3954
3963
  return /*#__PURE__*/React.createElement($e5534fc185f7111e$export$2e2bcd8739ae039, {
3955
3964
  data: undefined,
3956
3965
  theme: theme,
@@ -3958,16 +3967,11 @@ function EmojiPicker(props) {
3958
3967
  onEmojiSelect: onSelectEmoji,
3959
3968
  custom: customEmojis,
3960
3969
  categories: categories,
3961
- set: "apple"
3970
+ set: "apple",
3971
+ i18n: i18n
3962
3972
  });
3963
3973
  }
3964
3974
 
3965
- EmojiPicker.propTypes = {
3966
- theme: t.oneOf(["light", "dark", "auto"]),
3967
- onSelectEmoji: t.func,
3968
- disableRecent: t.bool,
3969
- customEmojis: t.array
3970
- };
3971
3975
  var EmojiPicker$1 = /*#__PURE__*/memo(EmojiPicker);
3972
3976
 
3973
3977
  /**
@@ -3978,6 +3982,7 @@ var EmojiPicker$1 = /*#__PURE__*/memo(EmojiPicker);
3978
3982
  * @property {boolean} disableRecent
3979
3983
  * @property {import("emoji-mart").CustomEmoji[]=} customEmojis
3980
3984
  * @property {('above' | 'below')=} position
3985
+ * @property {import('../types/types').Languages=} language
3981
3986
  */
3982
3987
 
3983
3988
  /**
@@ -3992,7 +3997,8 @@ function EmojiPickerContainer(_ref) {
3992
3997
  handleSelectEmoji = _ref.handleSelectEmoji,
3993
3998
  disableRecent = _ref.disableRecent,
3994
3999
  customEmojis = _ref.customEmojis,
3995
- position = _ref.position;
4000
+ position = _ref.position,
4001
+ language = _ref.language;
3996
4002
  return /*#__PURE__*/React.createElement("div", {
3997
4003
  className: "react-emoji-picker--container"
3998
4004
  }, showPicker && /*#__PURE__*/React.createElement("div", {
@@ -4009,7 +4015,8 @@ function EmojiPickerContainer(_ref) {
4009
4015
  theme: theme,
4010
4016
  onSelectEmoji: handleSelectEmoji,
4011
4017
  disableRecent: disableRecent,
4012
- customEmojis: customEmojis
4018
+ customEmojis: customEmojis,
4019
+ language: language
4013
4020
  }))));
4014
4021
  }
4015
4022
 
@@ -4032,6 +4039,7 @@ var EMOJI_PICKER_CONTAINER_HEIGHT = 435;
4032
4039
  * @property {(fn: PolluteFn) => void} addPolluteFn
4033
4040
  * @property {(html: string) => void} appendContent
4034
4041
  * @property {HTMLDivElement=} buttonElement
4042
+ * @property {import('../types/types').Languages=} language
4035
4043
  */
4036
4044
  // eslint-disable-next-line valid-jsdoc
4037
4045
 
@@ -4045,7 +4053,8 @@ var EmojiPickerWrapper = function EmojiPickerWrapper(props) {
4045
4053
  addSanitizeFn = props.addSanitizeFn,
4046
4054
  addPolluteFn = props.addPolluteFn,
4047
4055
  appendContent = props.appendContent,
4048
- buttonElement = props.buttonElement;
4056
+ buttonElement = props.buttonElement,
4057
+ language = props.language;
4049
4058
 
4050
4059
  var _useState = useState(false),
4051
4060
  _useState2 = _slicedToArray(_useState, 2),
@@ -4156,7 +4165,8 @@ var EmojiPickerWrapper = function EmojiPickerWrapper(props) {
4156
4165
  handleSelectEmoji: handleSelectEmoji,
4157
4166
  disableRecent: disableRecent,
4158
4167
  customEmojis: customEmojis,
4159
- position: emojiPickerPosition
4168
+ position: emojiPickerPosition,
4169
+ language: language
4160
4170
  }), /*#__PURE__*/React.createElement(EmojiPickerButton, {
4161
4171
  showPicker: showPicker,
4162
4172
  toggleShowPicker: toggleShowPicker,
@@ -4167,7 +4177,8 @@ var EmojiPickerWrapper = function EmojiPickerWrapper(props) {
4167
4177
  handleSelectEmoji: handleSelectEmoji,
4168
4178
  disableRecent: disableRecent,
4169
4179
  customEmojis: customEmojis,
4170
- position: emojiPickerPosition
4180
+ position: emojiPickerPosition,
4181
+ language: language
4171
4182
  }), /*#__PURE__*/React.createElement(EmojiPickerButton, {
4172
4183
  showPicker: showPicker,
4173
4184
  toggleShowPicker: toggleShowPicker
@@ -4827,6 +4838,7 @@ function usePollute() {
4827
4838
  * @property {number} fontSize
4828
4839
  * @property {string} fontFamily
4829
4840
  * @property {{id: string; name: string; emojis: {id: string; name: string; keywords: string[], skins: {src: string}[]}}[]=} customEmojis
4841
+ * @property {import('./types/types').Languages=} language
4830
4842
  * @property {(text: string) => Promise<MetionUser[]>=} searchMention
4831
4843
  * @property {HTMLDivElement=} buttonElement
4832
4844
  */
@@ -4857,6 +4869,7 @@ function InputEmoji(props, ref) {
4857
4869
  tabIndex = props.tabIndex,
4858
4870
  value = props.value,
4859
4871
  customEmojis = props.customEmojis,
4872
+ language = props.language,
4860
4873
  searchMention = props.searchMention,
4861
4874
  buttonElement = props.buttonElement,
4862
4875
  borderRadius = props.borderRadius,
@@ -5065,7 +5078,8 @@ function InputEmoji(props, ref) {
5065
5078
  addSanitizeFn: addSanitizeFn,
5066
5079
  addPolluteFn: addPolluteFn,
5067
5080
  appendContent: appendContent,
5068
- buttonElement: buttonElement
5081
+ buttonElement: buttonElement,
5082
+ language: language
5069
5083
  }));
5070
5084
  }
5071
5085
 
@@ -5082,7 +5096,8 @@ InputEmojiWithRef.defaultProps = {
5082
5096
  fontFamily: "sans-serif",
5083
5097
  tabIndex: 0,
5084
5098
  shouldReturn: false,
5085
- customEmojis: []
5099
+ customEmojis: [],
5100
+ language: undefined
5086
5101
  };
5087
5102
 
5088
5103
  export { InputEmojiWithRef as default };