react-input-emoji 5.6.6 → 5.6.8

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.es.js CHANGED
@@ -3613,12 +3613,63 @@ function EmojiPicker(props) {
3613
3613
  categoryies = [].concat(_toConsumableArray(categoryies), ["people", "nature", "foods", "activity", "places", "objects", "symbols", "flags"]);
3614
3614
  return categoryies;
3615
3615
  }, [disableRecent]);
3616
- var i18n = useMemo(function () {
3616
+ var _useState = useState(undefined),
3617
+ _useState2 = _slicedToArray(_useState, 2),
3618
+ i18n = _useState2[0],
3619
+ setI18n = _useState2[1];
3620
+ useEffect(function () {
3621
+ var _ref2;
3617
3622
  if (!language) {
3618
- return undefined;
3623
+ var _ref;
3624
+ // @ts-ignore
3625
+ fetch("https://cdn.jsdelivr.net/npm/@emoji-mart/data/i18n/en.json").then(function (_x) {
3626
+ return (_ref = _ref || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
3627
+ var translations;
3628
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3629
+ while (1) switch (_context.prev = _context.next) {
3630
+ case 0:
3631
+ _context.next = 2;
3632
+ return data.json();
3633
+ case 2:
3634
+ translations = _context.sent;
3635
+ setI18n(translations);
3636
+ case 4:
3637
+ case "end":
3638
+ return _context.stop();
3639
+ }
3640
+ }, _callee);
3641
+ }))).apply(this, arguments);
3642
+ })["catch"](function (error) {
3643
+ console.error("Failed to load translations:", error);
3644
+ });
3645
+ return;
3619
3646
  }
3620
- return require("@emoji-mart/data/i18n/".concat(language !== null && language !== void 0 ? language : 'en', ".json"));
3647
+
3648
+ // @ts-ignore
3649
+ fetch("https://cdn.jsdelivr.net/npm/@emoji-mart/data/i18n/".concat(language, ".json")).then(function (_x2) {
3650
+ return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {
3651
+ var translations;
3652
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3653
+ while (1) switch (_context2.prev = _context2.next) {
3654
+ case 0:
3655
+ _context2.next = 2;
3656
+ return data.json();
3657
+ case 2:
3658
+ translations = _context2.sent;
3659
+ setI18n(translations);
3660
+ case 4:
3661
+ case "end":
3662
+ return _context2.stop();
3663
+ }
3664
+ }, _callee2);
3665
+ }))).apply(this, arguments);
3666
+ })["catch"](function (error) {
3667
+ console.error("Failed to load translations:", error);
3668
+ });
3621
3669
  }, [language]);
3670
+ if (!i18n) {
3671
+ return null;
3672
+ }
3622
3673
  return /*#__PURE__*/React.createElement($e5534fc185f7111e$export$2e2bcd8739ae039, {
3623
3674
  data: undefined,
3624
3675
  theme: theme,