@arkyn/components 1.4.56 → 1.5.0
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/bundle.js +117994 -12201
- package/dist/bundle.umd.cjs +2412 -72
- package/dist/components/PhoneInput/index.d.ts.map +1 -1
- package/dist/components/PhoneInput/index.js +3 -5
- package/dist/components/PhoneInput/services/getDefaultFormatPhoneNumber.d.ts +75 -75
- package/package.json +1 -1
- package/src/components/PhoneInput/index.tsx +3 -5
- package/vite.config.js +0 -1
@@ -1,5 +1,4 @@
|
|
1
1
|
import { countries } from "@arkyn/templates";
|
2
|
-
import { formatToPhone } from "@arkyn/shared";
|
3
2
|
import { CountryType, PhoneInputProps } from "@arkyn/types";
|
4
3
|
import { useRef, useState } from "react";
|
5
4
|
|
@@ -27,7 +26,7 @@ function PhoneInput(props: PhoneInputProps) {
|
|
27
26
|
onChange,
|
28
27
|
searchCountryPlaceholder = "Pesquisar país",
|
29
28
|
notFoundCountryText = "Nenhum país encontrado",
|
30
|
-
|
29
|
+
...rest
|
31
30
|
} = props;
|
32
31
|
|
33
32
|
const defaultData = getDefaultFormatPhoneNumber(defaultValue);
|
@@ -36,7 +35,6 @@ function PhoneInput(props: PhoneInputProps) {
|
|
36
35
|
const [search, setSearch] = useState("");
|
37
36
|
const [showCountryOptions, setShowCountryOptions] = useState(false);
|
38
37
|
const [value, setValue] = useState(defaultData.formattedNumber || "");
|
39
|
-
const usedValue = formatToPhone(fixedValue) || value;
|
40
38
|
|
41
39
|
const [currentCountry, setCurrentCountry] = useState<CountryType>(() => {
|
42
40
|
if (defaultData.country) return defaultData.country;
|
@@ -103,7 +101,7 @@ function PhoneInput(props: PhoneInputProps) {
|
|
103
101
|
let returnValue = currentCountry.code;
|
104
102
|
if (currentCountry.prefix) returnValue += `-${currentCountry.prefix}`;
|
105
103
|
returnValue += " ";
|
106
|
-
returnValue += removeNumberMasks(props ||
|
104
|
+
returnValue += removeNumberMasks(props || value);
|
107
105
|
return returnValue;
|
108
106
|
}
|
109
107
|
|
@@ -160,7 +158,7 @@ function PhoneInput(props: PhoneInputProps) {
|
|
160
158
|
<PhoneInputMask
|
161
159
|
ref={inputPhoneMaskRef}
|
162
160
|
currentCountry={currentCountry}
|
163
|
-
value={
|
161
|
+
value={value}
|
164
162
|
onChange={(e) => {
|
165
163
|
setValue(e);
|
166
164
|
onChange && onChange(inputValue(e));
|