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