react-simple-phone-input 4.6.3 → 4.6.4

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/esm/index.js CHANGED
@@ -1,5 +1,31 @@
1
1
  import React from 'react';
2
2
 
3
+ /******************************************************************************
4
+ Copyright (c) Microsoft Corporation.
5
+
6
+ Permission to use, copy, modify, and/or distribute this software for any
7
+ purpose with or without fee is hereby granted.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
16
+ ***************************************************************************** */
17
+
18
+ var __assign = function() {
19
+ __assign = Object.assign || function __assign(t) {
20
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
21
+ s = arguments[i];
22
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+
3
29
  var jsxRuntime = {exports: {}};
4
30
 
5
31
  var reactJsxRuntime_production_min = {};
@@ -1355,7 +1381,7 @@ function requireReactJsxRuntime_development () {
1355
1381
  }
1356
1382
  } (jsxRuntime));
1357
1383
 
1358
- const countryData = [
1384
+ var countryData = [
1359
1385
  {
1360
1386
  country: "Afghanistan",
1361
1387
  countryCode: "AF",
@@ -2539,50 +2565,52 @@ const countryData = [
2539
2565
  ];
2540
2566
 
2541
2567
  //Get default country function
2542
- const getDefaultCountry = (code) => {
2543
- const result = countryData.find((item) => item.countryCode === code);
2568
+ var getDefaultCountry = function (code) {
2569
+ var result = countryData.find(function (item) { return item.countryCode === code; });
2544
2570
  return result;
2545
2571
  };
2546
2572
  //Get country data by search
2547
- const getBySearch = (search, onlyCountry, excludeCountry) => {
2548
- let countries = [];
2573
+ var getBySearch = function (search, onlyCountry, excludeCountry) {
2574
+ var countries = [];
2549
2575
  if (excludeCountry && excludeCountry.length > 0) {
2550
- countries = countryData.filter((item) => !excludeCountry?.includes(item.countryCode));
2576
+ countries = countryData.filter(function (item) { return !(excludeCountry === null || excludeCountry === void 0 ? void 0 : excludeCountry.includes(item.countryCode)); });
2551
2577
  }
2552
- else if (onlyCountry && onlyCountry?.length > 0) {
2553
- countries = countryData.filter((item) => onlyCountry?.includes(item.countryCode));
2578
+ else if (onlyCountry && (onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.length) > 0) {
2579
+ countries = countryData.filter(function (item) { return onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.includes(item.countryCode); });
2554
2580
  }
2555
2581
  else {
2556
2582
  countries = countryData;
2557
2583
  }
2558
- const result = countries.filter((item) => {
2559
- const escapeRegExp = (str) => str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
2560
- const regex = new RegExp(escapeRegExp(search), "gi");
2584
+ var result = countries.filter(function (item) {
2585
+ var escapeRegExp = function (str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); };
2586
+ var regex = new RegExp(escapeRegExp(search), "gi");
2561
2587
  return item.country.match(regex);
2562
2588
  });
2563
2589
  return result;
2564
2590
  };
2565
2591
  //Get country data by filter
2566
- const getCountryByFilter = (onlyCountry, excludeCountry, preferredCountry) => {
2567
- let countries = [];
2592
+ var getCountryByFilter = function (onlyCountry, excludeCountry, preferredCountry) {
2593
+ var countries = [];
2568
2594
  if (excludeCountry && excludeCountry.length > 0) {
2569
- countries = countryData.filter((item) => !excludeCountry?.includes(item.countryCode));
2595
+ countries = countryData.filter(function (item) { return !(excludeCountry === null || excludeCountry === void 0 ? void 0 : excludeCountry.includes(item.countryCode)); });
2570
2596
  }
2571
- else if (onlyCountry && onlyCountry?.length > 0) {
2572
- countries = countryData.filter((item) => onlyCountry?.includes(item.countryCode));
2597
+ else if (onlyCountry && (onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.length) > 0) {
2598
+ countries = countryData.filter(function (item) { return onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.includes(item.countryCode); });
2573
2599
  }
2574
2600
  else {
2575
2601
  countries = countryData;
2576
2602
  }
2577
- const result = countries.sort((a, b) => (Number(preferredCountry?.includes(b.countryCode)) - Number(preferredCountry?.includes(a.countryCode)))
2578
- || (preferredCountry?.indexOf(a.countryCode) - preferredCountry?.indexOf(b.countryCode)));
2603
+ var result = countries.sort(function (a, b) {
2604
+ return (Number(preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.includes(b.countryCode)) - Number(preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.includes(a.countryCode)))
2605
+ || ((preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.indexOf(a.countryCode)) - (preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.indexOf(b.countryCode)));
2606
+ });
2579
2607
  return result;
2580
2608
  };
2581
2609
 
2582
2610
  //Click out side hook
2583
2611
  function useOnClickOutside(ref, handler) {
2584
- React.useEffect(() => {
2585
- const listener = (event) => {
2612
+ React.useEffect(function () {
2613
+ var listener = function (event) {
2586
2614
  if (!ref.current || ref.current.contains(event.target)) {
2587
2615
  return;
2588
2616
  }
@@ -2590,7 +2618,7 @@ function useOnClickOutside(ref, handler) {
2590
2618
  };
2591
2619
  document.addEventListener("mousedown", listener);
2592
2620
  document.addEventListener("touchstart", listener);
2593
- return () => {
2621
+ return function () {
2594
2622
  document.removeEventListener("mousedown", listener);
2595
2623
  document.removeEventListener("touchstart", listener);
2596
2624
  };
@@ -2598,22 +2626,23 @@ function useOnClickOutside(ref, handler) {
2598
2626
  }
2599
2627
 
2600
2628
  //Component
2601
- const PhoneInput = ({ placeholder, country, onChange, value, iconComponent, inputProps, onlyCountries, excludeCountries, preferredCountries, showDropdownIcon = true, dialCodeInputField = false, search = true, searchPlaceholder = "Search country", showSearchIcon = true, searchIconComponent, searchProps, searchNotFound = "Not found" }) => {
2629
+ var PhoneInput = function (_a) {
2630
+ var placeholder = _a.placeholder, country = _a.country, onChange = _a.onChange, value = _a.value, iconComponent = _a.iconComponent, inputProps = _a.inputProps, onlyCountries = _a.onlyCountries, excludeCountries = _a.excludeCountries, preferredCountries = _a.preferredCountries, _b = _a.showDropdownIcon, showDropdownIcon = _b === void 0 ? true : _b, _c = _a.dialCodeInputField, dialCodeInputField = _c === void 0 ? false : _c, _d = _a.search, search = _d === void 0 ? true : _d, _e = _a.searchPlaceholder, searchPlaceholder = _e === void 0 ? "Search country" : _e, _f = _a.showSearchIcon, showSearchIcon = _f === void 0 ? true : _f, searchIconComponent = _a.searchIconComponent, searchProps = _a.searchProps, _g = _a.searchNotFound, searchNotFound = _g === void 0 ? "Not found" : _g;
2602
2631
  //State
2603
- const [selected, setSelected] = React.useState({});
2604
- const [isDropdown, setDropdown] = React.useState(false);
2605
- const [inputValue, setInputValue] = React.useState(value || "");
2606
- const [countryDataInfo, setCountryData] = React.useState(countryData);
2607
- const [cursor, setCursor] = React.useState(0);
2632
+ var _h = React.useState({}), selected = _h[0], setSelected = _h[1];
2633
+ var _j = React.useState(false), isDropdown = _j[0], setDropdown = _j[1];
2634
+ var _k = React.useState(value || ""), inputValue = _k[0], setInputValue = _k[1];
2635
+ var _l = React.useState(countryData), countryDataInfo = _l[0], setCountryData = _l[1];
2636
+ var _m = React.useState(0), cursor = _m[0], setCursor = _m[1];
2608
2637
  //Ref
2609
- const dropdownRef = React.useRef(null);
2610
- const listRef = React.useRef(null);
2638
+ var dropdownRef = React.useRef(null);
2639
+ var listRef = React.useRef(null);
2611
2640
  //Custom Hook Call
2612
- useOnClickOutside(dropdownRef, () => setDropdown(false));
2641
+ useOnClickOutside(dropdownRef, function () { return setDropdown(false); });
2613
2642
  //Handler
2614
2643
  //---Input Onchange Handler//
2615
- const handleChange = (e) => {
2616
- const onlyNumber = e.target.value.replace(/\D/g, '');
2644
+ var handleChange = function (e) {
2645
+ var onlyNumber = e.target.value.replace(/\D/g, '');
2617
2646
  if (dialCodeInputField) {
2618
2647
  onChange("+" + onlyNumber);
2619
2648
  setInputValue("+" + onlyNumber);
@@ -2624,14 +2653,14 @@ const PhoneInput = ({ placeholder, country, onChange, value, iconComponent, inpu
2624
2653
  }
2625
2654
  };
2626
2655
  //---Search Input Onchange Handler//
2627
- const onSearchHandler = (e) => {
2628
- const search = e.target.value;
2656
+ var onSearchHandler = function (e) {
2657
+ var search = e.target.value;
2629
2658
  setCountryData(getBySearch(search, onlyCountries, excludeCountries));
2630
2659
  };
2631
2660
  //---Set Selected Handler//
2632
- const handleSelected = (item, i) => {
2661
+ var handleSelected = function (item, i) {
2633
2662
  if (dialCodeInputField) {
2634
- const result = inputValue?.replace(selected.callingCode, item.callingCode);
2663
+ var result = inputValue === null || inputValue === void 0 ? void 0 : inputValue.replace(selected.callingCode, item.callingCode);
2635
2664
  setInputValue(result.length > 0 ? result : item.callingCode);
2636
2665
  onChange(result.length > 0 ? result : item.callingCode);
2637
2666
  }
@@ -2643,10 +2672,11 @@ const PhoneInput = ({ placeholder, country, onChange, value, iconComponent, inpu
2643
2672
  setCursor(i);
2644
2673
  };
2645
2674
  //---Scroll To View Handler//
2646
- const scrollIntoView = (position) => {
2675
+ var scrollIntoView = function (position) {
2676
+ var _a;
2647
2677
  if (search) {
2648
2678
  if (countryDataInfo.length > 0) {
2649
- listRef.current?.scrollTo({
2679
+ (_a = listRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
2650
2680
  top: position,
2651
2681
  behavior: "smooth"
2652
2682
  });
@@ -2654,15 +2684,15 @@ const PhoneInput = ({ placeholder, country, onChange, value, iconComponent, inpu
2654
2684
  }
2655
2685
  };
2656
2686
  //---Keyboard Navigation//
2657
- const keyBoardNav = (e) => {
2687
+ var keyBoardNav = function (e) {
2658
2688
  if (isDropdown) {
2659
2689
  if (e.key === "ArrowDown") {
2660
2690
  e.preventDefault();
2661
- setCursor(c => (c < countryDataInfo.length - 1 ? c + 1 : c));
2691
+ setCursor(function (c) { return (c < countryDataInfo.length - 1 ? c + 1 : c); });
2662
2692
  }
2663
2693
  if (e.key === "ArrowUp") {
2664
2694
  e.preventDefault();
2665
- setCursor(c => (c > 0 ? c - 1 : 0));
2695
+ setCursor(function (c) { return (c > 0 ? c - 1 : 0); });
2666
2696
  }
2667
2697
  if (e.key === "Escape") {
2668
2698
  setDropdown(false);
@@ -2675,39 +2705,40 @@ const PhoneInput = ({ placeholder, country, onChange, value, iconComponent, inpu
2675
2705
  };
2676
2706
  //React Hook
2677
2707
  //---Scroll to view hook//
2678
- React.useEffect(() => {
2708
+ React.useEffect(function () {
2709
+ var _a;
2679
2710
  if (cursor < 0 || cursor > countryDataInfo.length || !listRef) {
2680
- return () => {
2711
+ return function () {
2681
2712
  };
2682
2713
  }
2683
2714
  if (isDropdown && listRef) {
2684
2715
  if (countryDataInfo.length > 0) {
2685
- let listItems = Array.from(listRef.current?.children);
2716
+ var listItems = Array.from((_a = listRef.current) === null || _a === void 0 ? void 0 : _a.children);
2686
2717
  listItems[cursor] && scrollIntoView(listItems[cursor].offsetTop - 65);
2687
2718
  }
2688
2719
  }
2689
2720
  }, [cursor]);
2690
2721
  //---Dial Code Field Effect//
2691
- React.useMemo(() => {
2722
+ React.useMemo(function () {
2692
2723
  if (dialCodeInputField) {
2693
- const result = inputValue?.replace(selected.callingCode, getDefaultCountry(country).callingCode);
2724
+ var result = inputValue === null || inputValue === void 0 ? void 0 : inputValue.replace(selected.callingCode, getDefaultCountry(country).callingCode);
2694
2725
  console.log(result);
2695
2726
  setInputValue(result.length > 0 ? result : getDefaultCountry(country).callingCode);
2696
2727
  }
2697
2728
  setSelected(getDefaultCountry(country));
2698
2729
  }, [country, dialCodeInputField]);
2699
2730
  //---Country search hook//
2700
- React.useMemo(() => {
2731
+ React.useMemo(function () {
2701
2732
  setCountryData(getCountryByFilter(onlyCountries, excludeCountries, preferredCountries));
2702
2733
  }, [onlyCountries, excludeCountries, preferredCountries]);
2703
- return (jsxRuntime.exports.jsx("div", { className: "simple-phone-input-sri198-container", onKeyDown: (e) => keyBoardNav(e), tabIndex: -1, children: jsxRuntime.exports.jsxs("div", { className: "simple-phone-input-sri198-main", children: [jsxRuntime.exports.jsxs("div", { className: "simple-phone-input-sri198-dropdown-container", ref: dropdownRef, children: [jsxRuntime.exports.jsxs("div", { onClick: () => setDropdown(!isDropdown), className: dialCodeInputField ? "simple-phone-input-sri198-dropdown-container-button dial" : "simple-phone-input-sri198-dropdown-container-button", children: [jsxRuntime.exports.jsx("img", { src: "https://cdn.jsdelivr.net/gh/siamahnaf198/country-flags@main/img/" + selected.countryCode + ".svg", alt: selected.country, width: "20px" }), !dialCodeInputField &&
2704
- jsxRuntime.exports.jsx("span", { className: "simple-phone-input-sri198-selected-code", children: selected.callingCode }), showDropdownIcon &&
2705
- jsxRuntime.exports.jsx("div", { className: isDropdown ? "simple-phone-input-sri198-dropdown-icon" : "simple-phone-input-sri198-dropdown-icon active", children: iconComponent ? iconComponent : (jsxRuntime.exports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", preserveAspectRatio: "xMidYMid meet", viewBox: "0 0 24 24", children: jsxRuntime.exports.jsx("path", { fill: "currentColor", d: "m7 10l5 5l5-5z" }) })) })] }), jsxRuntime.exports.jsxs("ul", { className: isDropdown ? "simple-phone-input-sri198-dropdown active" : "simple-phone-input-sri198-dropdown", ref: listRef, children: [search &&
2706
- jsxRuntime.exports.jsxs("div", { className: "simple-phone-input-sri198-search-container", children: [jsxRuntime.exports.jsx("input", { placeholder: searchPlaceholder, ...searchProps, onChange: onSearchHandler }), showSearchIcon &&
2707
- jsxRuntime.exports.jsx("div", { className: "simple-phone-input-sri198-search-icon", children: searchIconComponent ?? (jsxRuntime.exports.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", preserveAspectRatio: "xMidYMid meet", viewBox: "0 0 48 48", children: [jsxRuntime.exports.jsxs("g", { fill: "#616161", children: [jsxRuntime.exports.jsx("path", { d: "m29.175 31.99l2.828-2.827l12.019 12.019l-2.828 2.827z" }), jsxRuntime.exports.jsx("circle", { cx: "20", cy: "20", r: "16" })] }), jsxRuntime.exports.jsx("path", { fill: "#37474F", d: "m32.45 35.34l2.827-2.828l8.696 8.696l-2.828 2.828z" }), jsxRuntime.exports.jsx("circle", { cx: "20", cy: "20", r: "13", fill: "#64B5F6" }), jsxRuntime.exports.jsx("path", { fill: "#BBDEFB", d: "M26.9 14.2c-1.7-2-4.2-3.2-6.9-3.2s-5.2 1.2-6.9 3.2c-.4.4-.3 1.1.1 1.4c.4.4 1.1.3 1.4-.1C16 13.9 17.9 13 20 13s4 .9 5.4 2.5c.2.2.5.4.8.4c.2 0 .5-.1.6-.2c.4-.4.4-1.1.1-1.5z" })] })) })] }), countryDataInfo.length === 0 &&
2708
- jsxRuntime.exports.jsx("div", { className: "simple-phone-input-sri198-not-found", children: searchNotFound }), countryDataInfo.map((item, i) => (jsxRuntime.exports.jsxs("li", { onClick: () => handleSelected(item, i), className: i === cursor ? "active" : "", children: [jsxRuntime.exports.jsx("img", { src: "https://cdn.jsdelivr.net/gh/siamahnaf198/country-flags@main/img/" + item.countryCode + ".svg", alt: item.country, width: "20px" }), jsxRuntime.exports.jsx("span", { className: "simple-phone-input-sri198-dropdown-text", children: item.country }), jsxRuntime.exports.jsx("span", { className: "simple-phone-input-sri198-dropdown-country-code", children: item.callingCode })] }, i)))] })] }), jsxRuntime.exports.jsx("input", { className: "simple-phone-input-sri198-input", placeholder: placeholder, onChange: handleChange, type: "tel", onInput: (e) => {
2734
+ return (jsxRuntime.exports.jsx("div", __assign({ className: "simple-phone-input-sri198-container", onKeyDown: function (e) { return keyBoardNav(e); }, tabIndex: -1 }, { children: jsxRuntime.exports.jsxs("div", __assign({ className: "simple-phone-input-sri198-main" }, { children: [jsxRuntime.exports.jsxs("div", __assign({ className: "simple-phone-input-sri198-dropdown-container", ref: dropdownRef }, { children: [jsxRuntime.exports.jsxs("div", __assign({ onClick: function () { return setDropdown(!isDropdown); }, className: dialCodeInputField ? "simple-phone-input-sri198-dropdown-container-button dial" : "simple-phone-input-sri198-dropdown-container-button" }, { children: [jsxRuntime.exports.jsx("img", { src: "https://cdn.jsdelivr.net/gh/siamahnaf198/country-flags@main/img/" + selected.countryCode + ".svg", alt: selected.country, width: "20px" }), !dialCodeInputField &&
2735
+ jsxRuntime.exports.jsx("span", __assign({ className: "simple-phone-input-sri198-selected-code" }, { children: selected.callingCode })), showDropdownIcon &&
2736
+ jsxRuntime.exports.jsx("div", __assign({ className: isDropdown ? "simple-phone-input-sri198-dropdown-icon" : "simple-phone-input-sri198-dropdown-icon active" }, { children: iconComponent ? iconComponent : (jsxRuntime.exports.jsx("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", preserveAspectRatio: "xMidYMid meet", viewBox: "0 0 24 24" }, { children: jsxRuntime.exports.jsx("path", { fill: "currentColor", d: "m7 10l5 5l5-5z" }) }))) }))] })), jsxRuntime.exports.jsxs("ul", __assign({ className: isDropdown ? "simple-phone-input-sri198-dropdown active" : "simple-phone-input-sri198-dropdown", ref: listRef }, { children: [search &&
2737
+ jsxRuntime.exports.jsxs("div", __assign({ className: "simple-phone-input-sri198-search-container" }, { children: [jsxRuntime.exports.jsx("input", __assign({ placeholder: searchPlaceholder }, searchProps, { onChange: onSearchHandler })), showSearchIcon &&
2738
+ jsxRuntime.exports.jsx("div", __assign({ className: "simple-phone-input-sri198-search-icon" }, { children: searchIconComponent !== null && searchIconComponent !== void 0 ? searchIconComponent : (jsxRuntime.exports.jsxs("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", preserveAspectRatio: "xMidYMid meet", viewBox: "0 0 48 48" }, { children: [jsxRuntime.exports.jsxs("g", __assign({ fill: "#616161" }, { children: [jsxRuntime.exports.jsx("path", { d: "m29.175 31.99l2.828-2.827l12.019 12.019l-2.828 2.827z" }), jsxRuntime.exports.jsx("circle", { cx: "20", cy: "20", r: "16" })] })), jsxRuntime.exports.jsx("path", { fill: "#37474F", d: "m32.45 35.34l2.827-2.828l8.696 8.696l-2.828 2.828z" }), jsxRuntime.exports.jsx("circle", { cx: "20", cy: "20", r: "13", fill: "#64B5F6" }), jsxRuntime.exports.jsx("path", { fill: "#BBDEFB", d: "M26.9 14.2c-1.7-2-4.2-3.2-6.9-3.2s-5.2 1.2-6.9 3.2c-.4.4-.3 1.1.1 1.4c.4.4 1.1.3 1.4-.1C16 13.9 17.9 13 20 13s4 .9 5.4 2.5c.2.2.5.4.8.4c.2 0 .5-.1.6-.2c.4-.4.4-1.1.1-1.5z" })] }))) }))] })), countryDataInfo.length === 0 &&
2739
+ jsxRuntime.exports.jsx("div", __assign({ className: "simple-phone-input-sri198-not-found" }, { children: searchNotFound })), countryDataInfo.map(function (item, i) { return (jsxRuntime.exports.jsxs("li", __assign({ onClick: function () { return handleSelected(item, i); }, className: i === cursor ? "active" : "" }, { children: [jsxRuntime.exports.jsx("img", { src: "https://cdn.jsdelivr.net/gh/siamahnaf198/country-flags@main/img/" + item.countryCode + ".svg", alt: item.country, width: "20px" }), jsxRuntime.exports.jsx("span", __assign({ className: "simple-phone-input-sri198-dropdown-text" }, { children: item.country })), jsxRuntime.exports.jsx("span", __assign({ className: "simple-phone-input-sri198-dropdown-country-code" }, { children: item.callingCode }))] }), i)); })] }))] })), jsxRuntime.exports.jsx("input", __assign({ className: "simple-phone-input-sri198-input", placeholder: placeholder, onChange: handleChange, type: "tel", onInput: function (e) {
2709
2740
  if (dialCodeInputField) {
2710
- const oldVal = inputValue.slice(selected.callingCode.length);
2741
+ var oldVal = inputValue.slice(selected.callingCode.length);
2711
2742
  if (e.target.value.startsWith(selected.callingCode)) {
2712
2743
  e.target.value = e.target.value;
2713
2744
  }
@@ -2715,7 +2746,7 @@ const PhoneInput = ({ placeholder, country, onChange, value, iconComponent, inpu
2715
2746
  e.target.value = selected.callingCode + oldVal;
2716
2747
  }
2717
2748
  }
2718
- }, onKeyDown: (e) => keyBoardNav(e), value: inputValue, ...inputProps })] }) }));
2749
+ }, onKeyDown: function (e) { return keyBoardNav(e); }, value: inputValue }, inputProps))] })) })));
2719
2750
  };
2720
2751
 
2721
2752
  export { PhoneInput };