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 +49 -54
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +49 -72
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -5,24 +5,6 @@ var ReactDOM = require('react-dom');
|
|
5
5
|
|
6
6
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
7
7
|
|
8
|
-
function _interopNamespace(e) {
|
9
|
-
if (e && e.__esModule) return e;
|
10
|
-
var n = Object.create(null);
|
11
|
-
if (e) {
|
12
|
-
Object.keys(e).forEach(function (k) {
|
13
|
-
if (k !== 'default') {
|
14
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
15
|
-
Object.defineProperty(n, k, d.get ? d : {
|
16
|
-
enumerable: true,
|
17
|
-
get: function () { return e[k]; }
|
18
|
-
});
|
19
|
-
}
|
20
|
-
});
|
21
|
-
}
|
22
|
-
n["default"] = e;
|
23
|
-
return Object.freeze(n);
|
24
|
-
}
|
25
|
-
|
26
8
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
27
9
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
28
10
|
|
@@ -857,7 +839,9 @@ function replaceAllHtmlToString(html, shouldReturn) {
|
|
857
839
|
|
858
840
|
// remove all ↵ for safari
|
859
841
|
text = text.replace(/\n/gi, "");
|
860
|
-
|
842
|
+
var tempContainer = document.createElement("div");
|
843
|
+
tempContainer.innerHTML = text;
|
844
|
+
return tempContainer.innerText || "";
|
861
845
|
}
|
862
846
|
|
863
847
|
// @ts-check
|
@@ -3608,6 +3592,9 @@ function $e5534fc185f7111e$export$2e2bcd8739ae039(props) {
|
|
3608
3592
|
});
|
3609
3593
|
}
|
3610
3594
|
|
3595
|
+
var EMOJI_MART_DATA_URL = "https://cdn.jsdelivr.net/npm/@emoji-mart/data";
|
3596
|
+
var cacheI18n = {};
|
3597
|
+
|
3611
3598
|
/**
|
3612
3599
|
* @typedef {object} Props
|
3613
3600
|
* @property {'light' | 'dark' | 'auto'} theme
|
@@ -3643,10 +3630,33 @@ function EmojiPicker(props) {
|
|
3643
3630
|
i18n = _useState2[0],
|
3644
3631
|
setI18n = _useState2[1];
|
3645
3632
|
React.useEffect(function () {
|
3633
|
+
var _ref2;
|
3646
3634
|
if (!language) {
|
3635
|
+
var _ref;
|
3636
|
+
if (cacheI18n.en) {
|
3637
|
+
setI18n(cacheI18n.en);
|
3638
|
+
return;
|
3639
|
+
}
|
3640
|
+
|
3647
3641
|
// @ts-ignore
|
3648
|
-
|
3649
|
-
|
3642
|
+
fetch("".concat(EMOJI_MART_DATA_URL, "/i18n/en.json")).then(function (_x) {
|
3643
|
+
return (_ref = _ref || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
3644
|
+
var translations;
|
3645
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
3646
|
+
while (1) switch (_context.prev = _context.next) {
|
3647
|
+
case 0:
|
3648
|
+
_context.next = 2;
|
3649
|
+
return data.json();
|
3650
|
+
case 2:
|
3651
|
+
translations = _context.sent;
|
3652
|
+
setI18n(translations);
|
3653
|
+
cacheI18n.en = translations;
|
3654
|
+
case 5:
|
3655
|
+
case "end":
|
3656
|
+
return _context.stop();
|
3657
|
+
}
|
3658
|
+
}, _callee);
|
3659
|
+
}))).apply(this, arguments);
|
3650
3660
|
})["catch"](function (error) {
|
3651
3661
|
console.error("Failed to load translations:", error);
|
3652
3662
|
});
|
@@ -3654,8 +3664,24 @@ function EmojiPicker(props) {
|
|
3654
3664
|
}
|
3655
3665
|
|
3656
3666
|
// @ts-ignore
|
3657
|
-
(
|
3658
|
-
|
3667
|
+
fetch("".concat(EMOJI_MART_DATA_URL, "/i18n/").concat(language, ".json")).then(function (_x2) {
|
3668
|
+
return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {
|
3669
|
+
var translations;
|
3670
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
3671
|
+
while (1) switch (_context2.prev = _context2.next) {
|
3672
|
+
case 0:
|
3673
|
+
_context2.next = 2;
|
3674
|
+
return data.json();
|
3675
|
+
case 2:
|
3676
|
+
translations = _context2.sent;
|
3677
|
+
setI18n(translations);
|
3678
|
+
cacheI18n[language] = translations;
|
3679
|
+
case 5:
|
3680
|
+
case "end":
|
3681
|
+
return _context2.stop();
|
3682
|
+
}
|
3683
|
+
}, _callee2);
|
3684
|
+
}))).apply(this, arguments);
|
3659
3685
|
})["catch"](function (error) {
|
3660
3686
|
console.error("Failed to load translations:", error);
|
3661
3687
|
});
|
@@ -4724,54 +4750,5 @@ InputEmojiWithRef.defaultProps = {
|
|
4724
4750
|
language: undefined
|
4725
4751
|
};
|
4726
4752
|
|
4727
|
-
var search = "Search";
|
4728
|
-
var search_no_results_1 = "Oh no!";
|
4729
|
-
var search_no_results_2 = "That emoji couldn’t be found";
|
4730
|
-
var pick = "Pick an emoji…";
|
4731
|
-
var add_custom = "Add custom emoji";
|
4732
|
-
var categories = {
|
4733
|
-
activity: "Activity",
|
4734
|
-
custom: "Custom",
|
4735
|
-
flags: "Flags",
|
4736
|
-
foods: "Food & Drink",
|
4737
|
-
frequent: "Frequently used",
|
4738
|
-
nature: "Animals & Nature",
|
4739
|
-
objects: "Objects",
|
4740
|
-
people: "Smileys & People",
|
4741
|
-
places: "Travel & Places",
|
4742
|
-
search: "Search Results",
|
4743
|
-
symbols: "Symbols"
|
4744
|
-
};
|
4745
|
-
var skins = {
|
4746
|
-
"1": "Default",
|
4747
|
-
"2": "Light",
|
4748
|
-
"3": "Medium-Light",
|
4749
|
-
"4": "Medium",
|
4750
|
-
"5": "Medium-Dark",
|
4751
|
-
"6": "Dark",
|
4752
|
-
choose: "Choose default skin tone"
|
4753
|
-
};
|
4754
|
-
var en = {
|
4755
|
-
search: search,
|
4756
|
-
search_no_results_1: search_no_results_1,
|
4757
|
-
search_no_results_2: search_no_results_2,
|
4758
|
-
pick: pick,
|
4759
|
-
add_custom: add_custom,
|
4760
|
-
categories: categories,
|
4761
|
-
skins: skins
|
4762
|
-
};
|
4763
|
-
|
4764
|
-
var en$1 = /*#__PURE__*/Object.freeze({
|
4765
|
-
__proto__: null,
|
4766
|
-
search: search,
|
4767
|
-
search_no_results_1: search_no_results_1,
|
4768
|
-
search_no_results_2: search_no_results_2,
|
4769
|
-
pick: pick,
|
4770
|
-
add_custom: add_custom,
|
4771
|
-
categories: categories,
|
4772
|
-
skins: skins,
|
4773
|
-
'default': en
|
4774
|
-
});
|
4775
|
-
|
4776
4753
|
module.exports = InputEmojiWithRef;
|
4777
4754
|
//# sourceMappingURL=index.js.map
|