react-input-emoji 5.6.7 → 5.6.9

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/dist/index.es.js CHANGED
@@ -832,7 +832,9 @@ function replaceAllHtmlToString(html, shouldReturn) {
832
832
 
833
833
  // remove all ↵ for safari
834
834
  text = text.replace(/\n/gi, "");
835
- return text;
835
+ var tempContainer = document.createElement("div");
836
+ tempContainer.innerHTML = text;
837
+ return tempContainer.innerText || "";
836
838
  }
837
839
 
838
840
  // @ts-check
@@ -3583,6 +3585,9 @@ function $e5534fc185f7111e$export$2e2bcd8739ae039(props) {
3583
3585
  });
3584
3586
  }
3585
3587
 
3588
+ var EMOJI_MART_DATA_URL = "https://cdn.jsdelivr.net/npm/@emoji-mart/data";
3589
+ var cacheI18n = {};
3590
+
3586
3591
  /**
3587
3592
  * @typedef {object} Props
3588
3593
  * @property {'light' | 'dark' | 'auto'} theme
@@ -3618,10 +3623,33 @@ function EmojiPicker(props) {
3618
3623
  i18n = _useState2[0],
3619
3624
  setI18n = _useState2[1];
3620
3625
  useEffect(function () {
3626
+ var _ref2;
3621
3627
  if (!language) {
3628
+ var _ref;
3629
+ if (cacheI18n.en) {
3630
+ setI18n(cacheI18n.en);
3631
+ return;
3632
+ }
3633
+
3622
3634
  // @ts-ignore
3623
- Promise.resolve().then(function () { return en$1; }).then(function (translations) {
3624
- setI18n(translations);
3635
+ fetch("".concat(EMOJI_MART_DATA_URL, "/i18n/en.json")).then(function (_x) {
3636
+ return (_ref = _ref || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
3637
+ var translations;
3638
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3639
+ while (1) switch (_context.prev = _context.next) {
3640
+ case 0:
3641
+ _context.next = 2;
3642
+ return data.json();
3643
+ case 2:
3644
+ translations = _context.sent;
3645
+ setI18n(translations);
3646
+ cacheI18n.en = translations;
3647
+ case 5:
3648
+ case "end":
3649
+ return _context.stop();
3650
+ }
3651
+ }, _callee);
3652
+ }))).apply(this, arguments);
3625
3653
  })["catch"](function (error) {
3626
3654
  console.error("Failed to load translations:", error);
3627
3655
  });
@@ -3629,8 +3657,24 @@ function EmojiPicker(props) {
3629
3657
  }
3630
3658
 
3631
3659
  // @ts-ignore
3632
- import("@emoji-mart/data/i18n/".concat(language, ".json")).then(function (translations) {
3633
- setI18n(translations);
3660
+ fetch("".concat(EMOJI_MART_DATA_URL, "/i18n/").concat(language, ".json")).then(function (_x2) {
3661
+ return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {
3662
+ var translations;
3663
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3664
+ while (1) switch (_context2.prev = _context2.next) {
3665
+ case 0:
3666
+ _context2.next = 2;
3667
+ return data.json();
3668
+ case 2:
3669
+ translations = _context2.sent;
3670
+ setI18n(translations);
3671
+ cacheI18n[language] = translations;
3672
+ case 5:
3673
+ case "end":
3674
+ return _context2.stop();
3675
+ }
3676
+ }, _callee2);
3677
+ }))).apply(this, arguments);
3634
3678
  })["catch"](function (error) {
3635
3679
  console.error("Failed to load translations:", error);
3636
3680
  });
@@ -4699,54 +4743,5 @@ InputEmojiWithRef.defaultProps = {
4699
4743
  language: undefined
4700
4744
  };
4701
4745
 
4702
- var search = "Search";
4703
- var search_no_results_1 = "Oh no!";
4704
- var search_no_results_2 = "That emoji couldn’t be found";
4705
- var pick = "Pick an emoji…";
4706
- var add_custom = "Add custom emoji";
4707
- var categories = {
4708
- activity: "Activity",
4709
- custom: "Custom",
4710
- flags: "Flags",
4711
- foods: "Food & Drink",
4712
- frequent: "Frequently used",
4713
- nature: "Animals & Nature",
4714
- objects: "Objects",
4715
- people: "Smileys & People",
4716
- places: "Travel & Places",
4717
- search: "Search Results",
4718
- symbols: "Symbols"
4719
- };
4720
- var skins = {
4721
- "1": "Default",
4722
- "2": "Light",
4723
- "3": "Medium-Light",
4724
- "4": "Medium",
4725
- "5": "Medium-Dark",
4726
- "6": "Dark",
4727
- choose: "Choose default skin tone"
4728
- };
4729
- var en = {
4730
- search: search,
4731
- search_no_results_1: search_no_results_1,
4732
- search_no_results_2: search_no_results_2,
4733
- pick: pick,
4734
- add_custom: add_custom,
4735
- categories: categories,
4736
- skins: skins
4737
- };
4738
-
4739
- var en$1 = /*#__PURE__*/Object.freeze({
4740
- __proto__: null,
4741
- search: search,
4742
- search_no_results_1: search_no_results_1,
4743
- search_no_results_2: search_no_results_2,
4744
- pick: pick,
4745
- add_custom: add_custom,
4746
- categories: categories,
4747
- skins: skins,
4748
- 'default': en
4749
- });
4750
-
4751
4746
  export { InputEmojiWithRef as default };
4752
4747
  //# sourceMappingURL=index.es.js.map