react-mentions 4.4.5 → 4.4.6

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # react-mentions
2
2
 
3
+ ## 4.4.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 959625b: Suggestions.js refactored to functional component
8
+
3
9
  ## 4.4.5
4
10
 
5
11
  ### Patch Changes
@@ -892,89 +892,68 @@ var styled = createDefaultStyle({
892
892
  });
893
893
  var Highlighter$1 = styled(Highlighter);
894
894
 
895
- function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
896
-
897
- function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
898
-
899
- var Suggestion = /*#__PURE__*/function (_Component) {
900
- _inherits(Suggestion, _Component);
895
+ function Suggestion(_ref) {
896
+ var id = _ref.id,
897
+ focused = _ref.focused,
898
+ ignoreAccents = _ref.ignoreAccents,
899
+ index = _ref.index,
900
+ onClick = _ref.onClick,
901
+ onMouseEnter = _ref.onMouseEnter,
902
+ query = _ref.query,
903
+ renderSuggestion = _ref.renderSuggestion,
904
+ suggestion = _ref.suggestion,
905
+ style = _ref.style,
906
+ className = _ref.className,
907
+ classNames = _ref.classNames;
908
+ var rest = {
909
+ onClick: onClick,
910
+ onMouseEnter: onMouseEnter
911
+ };
901
912
 
902
- var _super = _createSuper$1(Suggestion);
913
+ var renderContent = function renderContent() {
914
+ var display = getDisplay();
915
+ var highlightedDisplay = renderHighlightedDisplay(display);
903
916
 
904
- function Suggestion() {
905
- _classCallCheck(this, Suggestion);
917
+ if (renderSuggestion) {
918
+ return renderSuggestion(suggestion, query, highlightedDisplay, index, focused);
919
+ }
906
920
 
907
- return _super.apply(this, arguments);
908
- }
921
+ return highlightedDisplay;
922
+ };
909
923
 
910
- _createClass(Suggestion, [{
911
- key: "render",
912
- value: function render() {
913
- var rest = omit(this.props, ['style', 'classNames', 'className'], // substyle props
914
- keys(Suggestion.propTypes));
915
- return /*#__PURE__*/React__default.createElement("li", _extends({
916
- id: this.props.id,
917
- role: "option",
918
- "aria-selected": this.props.focused
919
- }, rest, this.props.style), this.renderContent());
924
+ var getDisplay = function getDisplay() {
925
+ if (typeof suggestion === 'string') {
926
+ return suggestion;
920
927
  }
921
- }, {
922
- key: "renderContent",
923
- value: function renderContent() {
924
- var _this$props = this.props,
925
- query = _this$props.query,
926
- renderSuggestion = _this$props.renderSuggestion,
927
- suggestion = _this$props.suggestion,
928
- index = _this$props.index,
929
- focused = _this$props.focused;
930
- var display = this.getDisplay();
931
- var highlightedDisplay = this.renderHighlightedDisplay(display, query);
932
-
933
- if (renderSuggestion) {
934
- return renderSuggestion(suggestion, query, highlightedDisplay, index, focused);
935
- }
936
928
 
937
- return highlightedDisplay;
938
- }
939
- }, {
940
- key: "getDisplay",
941
- value: function getDisplay() {
942
- var suggestion = this.props.suggestion;
929
+ var id = suggestion.id,
930
+ display = suggestion.display;
943
931
 
944
- if (typeof suggestion === 'string') {
945
- return suggestion;
946
- }
932
+ if (id === undefined || !display) {
933
+ return id;
934
+ }
947
935
 
948
- var id = suggestion.id,
949
- display = suggestion.display;
936
+ return display;
937
+ };
950
938
 
951
- if (id === undefined || !display) {
952
- return id;
953
- }
939
+ var renderHighlightedDisplay = function renderHighlightedDisplay(display) {
940
+ var i = getSubstringIndex(display, query, ignoreAccents);
954
941
 
955
- return display;
942
+ if (i === -1) {
943
+ return /*#__PURE__*/React__default.createElement("span", style('display'), display);
956
944
  }
957
- }, {
958
- key: "renderHighlightedDisplay",
959
- value: function renderHighlightedDisplay(display) {
960
- var _this$props2 = this.props,
961
- ignoreAccents = _this$props2.ignoreAccents,
962
- query = _this$props2.query,
963
- style = _this$props2.style;
964
- var i = getSubstringIndex(display, query, ignoreAccents);
965
-
966
- if (i === -1) {
967
- return /*#__PURE__*/React__default.createElement("span", style('display'), display);
968
- }
969
945
 
970
- return /*#__PURE__*/React__default.createElement("span", style('display'), display.substring(0, i), /*#__PURE__*/React__default.createElement("b", style('highlight'), display.substring(i, i + query.length)), display.substring(i + query.length));
971
- }
972
- }]);
946
+ return /*#__PURE__*/React__default.createElement("span", style('display'), display.substring(0, i), /*#__PURE__*/React__default.createElement("b", style('highlight'), display.substring(i, i + query.length)), display.substring(i + query.length));
947
+ };
973
948
 
974
- return Suggestion;
975
- }(React.Component);
949
+ return /*#__PURE__*/React__default.createElement("li", _extends({
950
+ id: id,
951
+ role: "option",
952
+ "aria-selected": focused
953
+ }, rest, style), renderContent());
954
+ }
976
955
 
977
- _defineProperty(Suggestion, "propTypes", {
956
+ Suggestion.propTypes = {
978
957
  id: PropTypes.string.isRequired,
979
958
  query: PropTypes.string.isRequired,
980
959
  index: PropTypes.number.isRequired,
@@ -985,8 +964,7 @@ _defineProperty(Suggestion, "propTypes", {
985
964
  })]).isRequired,
986
965
  renderSuggestion: PropTypes.func,
987
966
  focused: PropTypes.bool
988
- });
989
-
967
+ };
990
968
  var styled$1 = createDefaultStyle({
991
969
  cursor: 'pointer'
992
970
  }, function (props) {
@@ -1011,14 +989,14 @@ function LoadingIndicator(_ref) {
1011
989
 
1012
990
  var defaultstyle = {};
1013
991
 
1014
- function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
992
+ function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1015
993
 
1016
- function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
994
+ function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1017
995
 
1018
996
  var SuggestionsOverlay = /*#__PURE__*/function (_Component) {
1019
997
  _inherits(SuggestionsOverlay, _Component);
1020
998
 
1021
- var _super = _createSuper$2(SuggestionsOverlay);
999
+ var _super = _createSuper$1(SuggestionsOverlay);
1022
1000
 
1023
1001
  function SuggestionsOverlay() {
1024
1002
  var _this;
@@ -1218,9 +1196,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
1218
1196
 
1219
1197
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1220
1198
 
1221
- function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1199
+ function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1222
1200
 
1223
- function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1201
+ function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1224
1202
  var makeTriggerRegex = function makeTriggerRegex(trigger) {
1225
1203
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1226
1204
 
@@ -1292,7 +1270,7 @@ var propTypes = {
1292
1270
  var MentionsInput = /*#__PURE__*/function (_React$Component) {
1293
1271
  _inherits(MentionsInput, _React$Component);
1294
1272
 
1295
- var _super = _createSuper$3(MentionsInput);
1273
+ var _super = _createSuper$2(MentionsInput);
1296
1274
 
1297
1275
  function MentionsInput(_props) {
1298
1276
  var _this;
@@ -585,70 +585,28 @@ var styled = createDefaultStyle({
585
585
  };
586
586
  }), Highlighter$1 = styled(Highlighter);
587
587
 
588
- function _createSuper$1(Derived) {
589
- var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
590
- return function() {
591
- var result, Super = _getPrototypeOf(Derived);
592
- if (hasNativeReflectConstruct) {
593
- var NewTarget = _getPrototypeOf(this).constructor;
594
- result = Reflect.construct(Super, arguments, NewTarget);
595
- } else result = Super.apply(this, arguments);
596
- return _possibleConstructorReturn(this, result);
588
+ function Suggestion(_ref) {
589
+ var display, highlightedDisplay, id = _ref.id, focused = _ref.focused, ignoreAccents = _ref.ignoreAccents, index = _ref.index, onClick = _ref.onClick, onMouseEnter = _ref.onMouseEnter, query = _ref.query, renderSuggestion = _ref.renderSuggestion, suggestion = _ref.suggestion, style = _ref.style, rest = (_ref.className,
590
+ _ref.classNames, {
591
+ onClick: onClick,
592
+ onMouseEnter: onMouseEnter
593
+ }), getDisplay = function() {
594
+ if ("string" == typeof suggestion) return suggestion;
595
+ var id = suggestion.id, display = suggestion.display;
596
+ return void 0 !== id && display ? display : id;
597
+ }, renderHighlightedDisplay = function(display) {
598
+ var i = getSubstringIndex(display, query, ignoreAccents);
599
+ return -1 === i ? React__default.createElement("span", style("display"), display) : React__default.createElement("span", style("display"), display.substring(0, i), React__default.createElement("b", style("highlight"), display.substring(i, i + query.length)), display.substring(i + query.length));
597
600
  };
601
+ return React__default.createElement("li", _extends({
602
+ id: id,
603
+ role: "option",
604
+ "aria-selected": focused
605
+ }, rest, style), (display = getDisplay(), highlightedDisplay = renderHighlightedDisplay(display),
606
+ renderSuggestion ? renderSuggestion(suggestion, query, highlightedDisplay, index, focused) : highlightedDisplay));
598
607
  }
599
608
 
600
- function _isNativeReflectConstruct$1() {
601
- if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
602
- if (Reflect.construct.sham) return !1;
603
- if ("function" == typeof Proxy) return !0;
604
- try {
605
- return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})),
606
- !0;
607
- } catch (e) {
608
- return !1;
609
- }
610
- }
611
-
612
- var Suggestion = function(_Component) {
613
- _inherits(Suggestion, _Component);
614
- var _super = _createSuper$1(Suggestion);
615
- function Suggestion() {
616
- return _classCallCheck(this, Suggestion), _super.apply(this, arguments);
617
- }
618
- return _createClass(Suggestion, [ {
619
- key: "render",
620
- value: function() {
621
- var rest = omit(this.props, [ "style", "classNames", "className" ], keys(Suggestion.propTypes));
622
- return React__default.createElement("li", _extends({
623
- id: this.props.id,
624
- role: "option",
625
- "aria-selected": this.props.focused
626
- }, rest, this.props.style), this.renderContent());
627
- }
628
- }, {
629
- key: "renderContent",
630
- value: function() {
631
- var _this$props = this.props, query = _this$props.query, renderSuggestion = _this$props.renderSuggestion, suggestion = _this$props.suggestion, index = _this$props.index, focused = _this$props.focused, display = this.getDisplay(), highlightedDisplay = this.renderHighlightedDisplay(display, query);
632
- return renderSuggestion ? renderSuggestion(suggestion, query, highlightedDisplay, index, focused) : highlightedDisplay;
633
- }
634
- }, {
635
- key: "getDisplay",
636
- value: function() {
637
- var suggestion = this.props.suggestion;
638
- if ("string" == typeof suggestion) return suggestion;
639
- var id = suggestion.id, display = suggestion.display;
640
- return void 0 !== id && display ? display : id;
641
- }
642
- }, {
643
- key: "renderHighlightedDisplay",
644
- value: function(display) {
645
- var _this$props2 = this.props, ignoreAccents = _this$props2.ignoreAccents, query = _this$props2.query, style = _this$props2.style, i = getSubstringIndex(display, query, ignoreAccents);
646
- return -1 === i ? React__default.createElement("span", style("display"), display) : React__default.createElement("span", style("display"), display.substring(0, i), React__default.createElement("b", style("highlight"), display.substring(i, i + query.length)), display.substring(i + query.length));
647
- }
648
- } ]), Suggestion;
649
- }(React.Component);
650
-
651
- _defineProperty(Suggestion, "propTypes", {
609
+ Suggestion.propTypes = {
652
610
  id: PropTypes.string.isRequired,
653
611
  query: PropTypes.string.isRequired,
654
612
  index: PropTypes.number.isRequired,
@@ -659,7 +617,7 @@ _defineProperty(Suggestion, "propTypes", {
659
617
  }) ]).isRequired,
660
618
  renderSuggestion: PropTypes.func,
661
619
  focused: PropTypes.bool
662
- });
620
+ };
663
621
 
664
622
  var styled$1 = createDefaultStyle({
665
623
  cursor: "pointer"
@@ -680,8 +638,8 @@ function LoadingIndicator(_ref) {
680
638
 
681
639
  var defaultstyle = {};
682
640
 
683
- function _createSuper$2(Derived) {
684
- var hasNativeReflectConstruct = _isNativeReflectConstruct$2();
641
+ function _createSuper$1(Derived) {
642
+ var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
685
643
  return function() {
686
644
  var result, Super = _getPrototypeOf(Derived);
687
645
  if (hasNativeReflectConstruct) {
@@ -692,7 +650,7 @@ function _createSuper$2(Derived) {
692
650
  };
693
651
  }
694
652
 
695
- function _isNativeReflectConstruct$2() {
653
+ function _isNativeReflectConstruct$1() {
696
654
  if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
697
655
  if (Reflect.construct.sham) return !1;
698
656
  if ("function" == typeof Proxy) return !0;
@@ -706,7 +664,7 @@ function _isNativeReflectConstruct$2() {
706
664
 
707
665
  var SuggestionsOverlay = function(_Component) {
708
666
  _inherits(SuggestionsOverlay, _Component);
709
- var _super = _createSuper$2(SuggestionsOverlay);
667
+ var _super = _createSuper$1(SuggestionsOverlay);
710
668
  function SuggestionsOverlay() {
711
669
  var _this;
712
670
  _classCallCheck(this, SuggestionsOverlay);
@@ -851,8 +809,8 @@ function _objectSpread(target) {
851
809
  return target;
852
810
  }
853
811
 
854
- function _createSuper$3(Derived) {
855
- var hasNativeReflectConstruct = _isNativeReflectConstruct$3();
812
+ function _createSuper$2(Derived) {
813
+ var hasNativeReflectConstruct = _isNativeReflectConstruct$2();
856
814
  return function() {
857
815
  var result, Super = _getPrototypeOf(Derived);
858
816
  if (hasNativeReflectConstruct) {
@@ -863,7 +821,7 @@ function _createSuper$3(Derived) {
863
821
  };
864
822
  }
865
823
 
866
- function _isNativeReflectConstruct$3() {
824
+ function _isNativeReflectConstruct$2() {
867
825
  if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
868
826
  if (Reflect.construct.sham) return !1;
869
827
  if ("function" == typeof Proxy) return !0;
@@ -914,7 +872,7 @@ var makeTriggerRegex = function(trigger) {
914
872
  children: PropTypes.oneOfType([ PropTypes.element, PropTypes.arrayOf(PropTypes.element) ]).isRequired
915
873
  }, MentionsInput = function(_React$Component) {
916
874
  _inherits(MentionsInput, _React$Component);
917
- var _super = _createSuper$3(MentionsInput);
875
+ var _super = _createSuper$2(MentionsInput);
918
876
  function MentionsInput(_props) {
919
877
  var _this;
920
878
  return _classCallCheck(this, MentionsInput), _this = _super.call(this, _props),
@@ -884,89 +884,68 @@ var styled = createDefaultStyle({
884
884
  });
885
885
  var Highlighter$1 = styled(Highlighter);
886
886
 
887
- function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
888
-
889
- function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
890
-
891
- var Suggestion = /*#__PURE__*/function (_Component) {
892
- _inherits(Suggestion, _Component);
887
+ function Suggestion(_ref) {
888
+ var id = _ref.id,
889
+ focused = _ref.focused,
890
+ ignoreAccents = _ref.ignoreAccents,
891
+ index = _ref.index,
892
+ onClick = _ref.onClick,
893
+ onMouseEnter = _ref.onMouseEnter,
894
+ query = _ref.query,
895
+ renderSuggestion = _ref.renderSuggestion,
896
+ suggestion = _ref.suggestion,
897
+ style = _ref.style,
898
+ className = _ref.className,
899
+ classNames = _ref.classNames;
900
+ var rest = {
901
+ onClick: onClick,
902
+ onMouseEnter: onMouseEnter
903
+ };
893
904
 
894
- var _super = _createSuper$1(Suggestion);
905
+ var renderContent = function renderContent() {
906
+ var display = getDisplay();
907
+ var highlightedDisplay = renderHighlightedDisplay(display);
895
908
 
896
- function Suggestion() {
897
- _classCallCheck(this, Suggestion);
909
+ if (renderSuggestion) {
910
+ return renderSuggestion(suggestion, query, highlightedDisplay, index, focused);
911
+ }
898
912
 
899
- return _super.apply(this, arguments);
900
- }
913
+ return highlightedDisplay;
914
+ };
901
915
 
902
- _createClass(Suggestion, [{
903
- key: "render",
904
- value: function render() {
905
- var rest = omit(this.props, ['style', 'classNames', 'className'], // substyle props
906
- keys(Suggestion.propTypes));
907
- return /*#__PURE__*/React.createElement("li", _extends({
908
- id: this.props.id,
909
- role: "option",
910
- "aria-selected": this.props.focused
911
- }, rest, this.props.style), this.renderContent());
916
+ var getDisplay = function getDisplay() {
917
+ if (typeof suggestion === 'string') {
918
+ return suggestion;
912
919
  }
913
- }, {
914
- key: "renderContent",
915
- value: function renderContent() {
916
- var _this$props = this.props,
917
- query = _this$props.query,
918
- renderSuggestion = _this$props.renderSuggestion,
919
- suggestion = _this$props.suggestion,
920
- index = _this$props.index,
921
- focused = _this$props.focused;
922
- var display = this.getDisplay();
923
- var highlightedDisplay = this.renderHighlightedDisplay(display, query);
924
-
925
- if (renderSuggestion) {
926
- return renderSuggestion(suggestion, query, highlightedDisplay, index, focused);
927
- }
928
920
 
929
- return highlightedDisplay;
930
- }
931
- }, {
932
- key: "getDisplay",
933
- value: function getDisplay() {
934
- var suggestion = this.props.suggestion;
921
+ var id = suggestion.id,
922
+ display = suggestion.display;
935
923
 
936
- if (typeof suggestion === 'string') {
937
- return suggestion;
938
- }
924
+ if (id === undefined || !display) {
925
+ return id;
926
+ }
939
927
 
940
- var id = suggestion.id,
941
- display = suggestion.display;
928
+ return display;
929
+ };
942
930
 
943
- if (id === undefined || !display) {
944
- return id;
945
- }
931
+ var renderHighlightedDisplay = function renderHighlightedDisplay(display) {
932
+ var i = getSubstringIndex(display, query, ignoreAccents);
946
933
 
947
- return display;
934
+ if (i === -1) {
935
+ return /*#__PURE__*/React.createElement("span", style('display'), display);
948
936
  }
949
- }, {
950
- key: "renderHighlightedDisplay",
951
- value: function renderHighlightedDisplay(display) {
952
- var _this$props2 = this.props,
953
- ignoreAccents = _this$props2.ignoreAccents,
954
- query = _this$props2.query,
955
- style = _this$props2.style;
956
- var i = getSubstringIndex(display, query, ignoreAccents);
957
-
958
- if (i === -1) {
959
- return /*#__PURE__*/React.createElement("span", style('display'), display);
960
- }
961
937
 
962
- return /*#__PURE__*/React.createElement("span", style('display'), display.substring(0, i), /*#__PURE__*/React.createElement("b", style('highlight'), display.substring(i, i + query.length)), display.substring(i + query.length));
963
- }
964
- }]);
938
+ return /*#__PURE__*/React.createElement("span", style('display'), display.substring(0, i), /*#__PURE__*/React.createElement("b", style('highlight'), display.substring(i, i + query.length)), display.substring(i + query.length));
939
+ };
965
940
 
966
- return Suggestion;
967
- }(Component);
941
+ return /*#__PURE__*/React.createElement("li", _extends({
942
+ id: id,
943
+ role: "option",
944
+ "aria-selected": focused
945
+ }, rest, style), renderContent());
946
+ }
968
947
 
969
- _defineProperty(Suggestion, "propTypes", {
948
+ Suggestion.propTypes = {
970
949
  id: PropTypes.string.isRequired,
971
950
  query: PropTypes.string.isRequired,
972
951
  index: PropTypes.number.isRequired,
@@ -977,8 +956,7 @@ _defineProperty(Suggestion, "propTypes", {
977
956
  })]).isRequired,
978
957
  renderSuggestion: PropTypes.func,
979
958
  focused: PropTypes.bool
980
- });
981
-
959
+ };
982
960
  var styled$1 = createDefaultStyle({
983
961
  cursor: 'pointer'
984
962
  }, function (props) {
@@ -1003,14 +981,14 @@ function LoadingIndicator(_ref) {
1003
981
 
1004
982
  var defaultstyle = {};
1005
983
 
1006
- function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
984
+ function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1007
985
 
1008
- function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
986
+ function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1009
987
 
1010
988
  var SuggestionsOverlay = /*#__PURE__*/function (_Component) {
1011
989
  _inherits(SuggestionsOverlay, _Component);
1012
990
 
1013
- var _super = _createSuper$2(SuggestionsOverlay);
991
+ var _super = _createSuper$1(SuggestionsOverlay);
1014
992
 
1015
993
  function SuggestionsOverlay() {
1016
994
  var _this;
@@ -1210,9 +1188,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
1210
1188
 
1211
1189
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1212
1190
 
1213
- function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1191
+ function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1214
1192
 
1215
- function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1193
+ function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1216
1194
  var makeTriggerRegex = function makeTriggerRegex(trigger) {
1217
1195
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1218
1196
 
@@ -1284,7 +1262,7 @@ var propTypes = {
1284
1262
  var MentionsInput = /*#__PURE__*/function (_React$Component) {
1285
1263
  _inherits(MentionsInput, _React$Component);
1286
1264
 
1287
- var _super = _createSuper$3(MentionsInput);
1265
+ var _super = _createSuper$2(MentionsInput);
1288
1266
 
1289
1267
  function MentionsInput(_props) {
1290
1268
  var _this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-mentions",
3
- "version": "4.4.5",
3
+ "version": "4.4.6",
4
4
  "description": "React mentions input",
5
5
  "main": "dist/react-mentions.cjs.js",
6
6
  "module": "dist/react-mentions.esm.js",