@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.
@@ -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
- value: fixedValue,
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 || usedValue);
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={usedValue}
161
+ value={value}
164
162
  onChange={(e) => {
165
163
  setValue(e);
166
164
  onChange && onChange(inputValue(e));
package/vite.config.js CHANGED
@@ -13,7 +13,6 @@ export default defineConfig({
13
13
  "lucide-react",
14
14
  "react",
15
15
  "react-dom",
16
- "@arkyn/components",
17
16
  ],
18
17
  output: { format: "esm" },
19
18
  },