react-input-emoji 5.6.1 → 5.6.3

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -2,13 +2,11 @@
2
2
 
3
3
  var React = require('react');
4
4
  var ReactDOM = require('react-dom');
5
- var t = require('prop-types');
6
5
 
7
6
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
7
 
9
8
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
9
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
11
- var t__default = /*#__PURE__*/_interopDefaultLegacy(t);
12
10
 
13
11
  function styleInject(css, ref) {
14
12
  if (ref === void 0) ref = {};
@@ -523,7 +521,7 @@ function replaceAllTextEmojis(text) {
523
521
  allEmojis = _toConsumableArray(new Set(allEmojis)); // remove duplicates
524
522
 
525
523
  allEmojis.forEach(function (emoji) {
526
- text = replaceAll(text, emoji, getInputEmojiHTML(emoji));
524
+ text = replaceAll(text, emoji, getInputEmojiHTML('', emoji));
527
525
  });
528
526
  }
529
527
  return text;
@@ -767,7 +765,7 @@ function useExpose(_ref) {
767
765
  textInputRef = _ref.textInputRef,
768
766
  setValue = _ref.setValue,
769
767
  emitChange = _ref.emitChange;
770
- var _useSanitize = useSanitize(),
768
+ var _useSanitize = useSanitize(false),
771
769
  sanitize = _useSanitize.sanitize,
772
770
  sanitizedTextRef = _useSanitize.sanitizedTextRef;
773
771
  React.useImperativeHandle(ref, function () {
@@ -882,7 +880,7 @@ var TextInput = function TextInput(_ref, ref) {
882
880
  if (textInputRef.current) {
883
881
  textInputRef.current.focus();
884
882
  }
885
- if (textInputRef.current && placeholderRef.current && textInputRef.current.innerHTML.trim() === "") {
883
+ if (textInputRef.current && placeholderRef.current && replaceAllTextEmojiToString(textInputRef.current.innerHTML) === "") {
886
884
  placeholderRef.current.style.visibility = "visible";
887
885
  } else if (placeholderRef.current) {
888
886
  placeholderRef.current.style.visibility = "hidden";
@@ -896,7 +894,8 @@ var TextInput = function TextInput(_ref, ref) {
896
894
  textInputRef.current.innerHTML = value;
897
895
  }
898
896
  if (placeholderRef.current) {
899
- if (value.trim() === "") {
897
+ var text = replaceAllTextEmojiToString(value);
898
+ if (text === "") {
900
899
  placeholderRef.current.style.visibility = "visible";
901
900
  } else {
902
901
  placeholderRef.current.style.visibility = "hidden";
@@ -977,9 +976,9 @@ var TextInput = function TextInput(_ref, ref) {
977
976
  function handleKeyUp(event) {
978
977
  props.onKeyUp(event);
979
978
  var input = textInputRef.current;
980
- if (placeholderRef.current) {
981
- var _input$innerText;
982
- if ((input === null || input === void 0 || (_input$innerText = input.innerText) === null || _input$innerText === void 0 ? void 0 : _input$innerText.trim()) === "") {
979
+ if (placeholderRef.current && input) {
980
+ var text = replaceAllTextEmojiToString(input.innerHTML);
981
+ if (text === "") {
983
982
  placeholderRef.current.style.visibility = "visible";
984
983
  } else {
985
984
  placeholderRef.current.style.visibility = "hidden";
@@ -3501,14 +3500,13 @@ function $e5534fc185f7111e$export$2e2bcd8739ae039(props) {
3501
3500
  * @property {'light' | 'dark' | 'auto'} theme
3502
3501
  * @property {function(import("../types/types").EmojiMartItem): void} onSelectEmoji
3503
3502
  * @property {boolean} disableRecent
3504
- * @property {import("emoji-mart").CustomEmoji[]=} customEmojis
3503
+ * @property {any[]=} customEmojis
3505
3504
  * @property {import('../types/types').Languages=} language
3506
3505
  */
3507
3506
 
3508
3507
  /**
3509
3508
  * Emoji Picker Component
3510
3509
  * @param {Props} props
3511
- * @return {React.FC}
3512
3510
  */
3513
3511
  function EmojiPicker(props) {
3514
3512
  var theme = props.theme,
@@ -3552,7 +3550,7 @@ var EmojiPicker$1 = /*#__PURE__*/React.memo(EmojiPicker);
3552
3550
  * @property {'light' | 'dark' | 'auto'} theme
3553
3551
  * @property {(emoji: import("../types/types").EmojiMartItem) => void} handleSelectEmoji
3554
3552
  * @property {boolean} disableRecent
3555
- * @property {import("emoji-mart").CustomEmoji[]=} customEmojis
3553
+ * @property {any[]=} customEmojis
3556
3554
  * @property {('above' | 'below')=} position
3557
3555
  * @property {import('../types/types').Languages=} language
3558
3556
  */
@@ -3606,7 +3604,7 @@ var EMOJI_PICKER_CONTAINER_HEIGHT = 435;
3606
3604
  * @property {'light' | 'dark' | 'auto'} theme
3607
3605
  * @property {boolean} keepOpened
3608
3606
  * @property {boolean} disableRecent
3609
- * @property {import("emoji-mart").CustomEmoji[]=} customEmojis
3607
+ * @property {any[]=} customEmojis
3610
3608
  * @property {(fn: SanitizeFn) => void} addSanitizeFn
3611
3609
  * @property {(fn: PolluteFn) => void} addPolluteFn
3612
3610
  * @property {(html: string) => void} appendContent
@@ -4082,9 +4080,6 @@ var MentionUserList = function MentionUserList(_ref, ref) {
4082
4080
  }));
4083
4081
  };
4084
4082
  var MentionUserListWithRef = /*#__PURE__*/React.forwardRef(MentionUserList);
4085
- MentionUserListWithRef.propTypes = {
4086
- users: t__default["default"].array.isRequired
4087
- };
4088
4083
 
4089
4084
  /**
4090
4085
  * @typedef {import('../types/types').MentionUser} MetionUser