@thecb/components 9.2.4-beta.15 → 9.2.4-beta.16

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.cjs.js CHANGED
@@ -23965,6 +23965,15 @@ var Dropdown = function Dropdown(_ref13) {
23965
23965
  }
23966
23966
  };
23967
23967
 
23968
+ var stringContains = function stringContains(regexp, str) {
23969
+ if (str && typeof str === "string" && regexp && _typeof(regexp) === _typeof(new RegExp(/[]/))) {
23970
+ return regexp.test(str);
23971
+ } else {
23972
+ // If element is not a string, return false
23973
+ return false;
23974
+ }
23975
+ };
23976
+
23968
23977
  React.useEffect(function () {
23969
23978
  var selectedRefExists = selectedRef !== undefined && selectedRef.current !== null;
23970
23979
 
@@ -23998,7 +24007,26 @@ var Dropdown = function Dropdown(_ref13) {
23998
24007
  }
23999
24008
 
24000
24009
  setFilteredOptions(options.filter(function (option) {
24001
- return option.value.toLowerCase().match(inputValue.toLowerCase()) || option.text.toLowerCase().match(inputValue.toLowerCase());
24010
+ var _option$value, _option$value$toLower, _option$text, _option$text$toLowerC;
24011
+
24012
+ var inputString = inputValue === null || inputValue === void 0 ? void 0 : inputValue.toLowerCase();
24013
+ var inputStringContainsPlus = stringContains(/\+/, inputString);
24014
+ var inputStringContainsOpenParen = stringContains(/\(/, inputString);
24015
+ var inputStringContainsCloseParen = stringContains(/\)/, inputString);
24016
+
24017
+ if (inputStringContainsPlus) {
24018
+ inputString = inputString.replace(/\+/, "\\+");
24019
+ }
24020
+
24021
+ if (inputStringContainsOpenParen) {
24022
+ inputString = inputString.replace(/\(/, "\\(");
24023
+ }
24024
+
24025
+ if (inputStringContainsCloseParen) {
24026
+ inputString = inputString.replace(/\)/, "\\)");
24027
+ }
24028
+
24029
+ return (option === null || option === void 0 ? void 0 : (_option$value = option.value) === null || _option$value === void 0 ? void 0 : (_option$value$toLower = _option$value.toLowerCase()) === null || _option$value$toLower === void 0 ? void 0 : _option$value$toLower.match(inputString)) || ((_option$text = option.text) === null || _option$text === void 0 ? void 0 : (_option$text$toLowerC = _option$text.toLowerCase()) === null || _option$text$toLowerC === void 0 ? void 0 : _option$text$toLowerC.match(inputString));
24002
24030
  }));
24003
24031
  }, [inputValue]);
24004
24032
  React.useEffect(function () {