react-simple-phone-input 1.0.8-beta → 1.0.9-beta
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/cjs/index.js +8 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/PhoneInput/PhoneInput.d.ts +3 -3
- package/dist/esm/index.js +8 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/PhoneInput/PhoneInput.d.ts +3 -3
- package/dist/index.d.ts +3 -3
- package/package.json +1 -1
- package/dist/cjs/types/components/button/Button.d.ts +0 -7
- package/dist/cjs/types/components/button/index.d.ts +0 -1
- package/dist/esm/types/components/button/Button.d.ts +0 -7
- package/dist/esm/types/components/button/index.d.ts +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -4024,7 +4024,7 @@ const getCountryByFilter = (onlyCountry, excludeCountry, preferredCountry) => {
|
|
|
4024
4024
|
};
|
|
4025
4025
|
|
|
4026
4026
|
function useOnClickOutside(ref, handler) {
|
|
4027
|
-
|
|
4027
|
+
React.useEffect(() => {
|
|
4028
4028
|
const listener = (event) => {
|
|
4029
4029
|
if (!ref.current || ref.current.contains(event.target)) {
|
|
4030
4030
|
return;
|
|
@@ -4041,11 +4041,11 @@ function useOnClickOutside(ref, handler) {
|
|
|
4041
4041
|
}
|
|
4042
4042
|
|
|
4043
4043
|
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" }) => {
|
|
4044
|
-
const [selected, setSelected] =
|
|
4045
|
-
const [isDropdown, setDropdown] =
|
|
4046
|
-
const [inputValue, setInputValue] =
|
|
4047
|
-
const [countryDataInfo, setCountryData] =
|
|
4048
|
-
const ref =
|
|
4044
|
+
const [selected, setSelected] = React.useState({});
|
|
4045
|
+
const [isDropdown, setDropdown] = React.useState(false);
|
|
4046
|
+
const [inputValue, setInputValue] = React.useState(value || "");
|
|
4047
|
+
const [countryDataInfo, setCountryData] = React.useState(countryData);
|
|
4048
|
+
const ref = React.useRef();
|
|
4049
4049
|
useOnClickOutside(ref, () => setDropdown(false));
|
|
4050
4050
|
//Handler
|
|
4051
4051
|
const handleChange = (e) => {
|
|
@@ -4075,7 +4075,7 @@ const PhoneInput = ({ placeholder, country, onChange, value, iconComponent, inpu
|
|
|
4075
4075
|
setSelected(item);
|
|
4076
4076
|
setDropdown(false);
|
|
4077
4077
|
};
|
|
4078
|
-
|
|
4078
|
+
React.useMemo(() => {
|
|
4079
4079
|
if (dialCodeInputField) {
|
|
4080
4080
|
const result = inputValue === null || inputValue === void 0 ? void 0 : inputValue.replace(selected.callingCode, getDefaultCountry(country).callingCode);
|
|
4081
4081
|
console.log(result);
|
|
@@ -4083,7 +4083,7 @@ const PhoneInput = ({ placeholder, country, onChange, value, iconComponent, inpu
|
|
|
4083
4083
|
}
|
|
4084
4084
|
setSelected(getDefaultCountry(country));
|
|
4085
4085
|
}, [country, dialCodeInputField]);
|
|
4086
|
-
|
|
4086
|
+
React.useMemo(() => {
|
|
4087
4087
|
setCountryData(getCountryByFilter(onlyCountries, excludeCountries, preferredCountries));
|
|
4088
4088
|
}, [onlyCountries, excludeCountries, preferredCountries]);
|
|
4089
4089
|
return (React.createElement("div", { className: "simple-phone-input-sri198-container" },
|