@xsolla/xui-input-phone 0.154.1 → 0.154.2
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/native/index.js +9 -1
- package/native/index.js.map +1 -1
- package/native/index.mjs +9 -1
- package/native/index.mjs.map +1 -1
- package/package.json +3 -3
- package/web/index.js +9 -1
- package/web/index.js.map +1 -1
- package/web/index.mjs +9 -1
- package/web/index.mjs.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsolla/xui-input-phone",
|
|
3
|
-
"version": "0.154.
|
|
3
|
+
"version": "0.154.2",
|
|
4
4
|
"main": "./web/index.js",
|
|
5
5
|
"module": "./web/index.mjs",
|
|
6
6
|
"types": "./web/index.d.ts",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"test:coverage": "vitest run --coverage"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@xsolla/xui-core": "0.154.
|
|
17
|
-
"@xsolla/xui-primitives-core": "0.154.
|
|
16
|
+
"@xsolla/xui-core": "0.154.2",
|
|
17
|
+
"@xsolla/xui-primitives-core": "0.154.2",
|
|
18
18
|
"libphonenumber-js": "^1.10.56"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
package/web/index.js
CHANGED
|
@@ -2409,7 +2409,7 @@ var InputPhone = (0, import_react4.forwardRef)(
|
|
|
2409
2409
|
errorMessage,
|
|
2410
2410
|
error,
|
|
2411
2411
|
countries = allCountries,
|
|
2412
|
-
selectedCountry,
|
|
2412
|
+
selectedCountry: selectedCountryProp,
|
|
2413
2413
|
onCountryChange,
|
|
2414
2414
|
extraClear = false,
|
|
2415
2415
|
onRemove,
|
|
@@ -2426,6 +2426,11 @@ var InputPhone = (0, import_react4.forwardRef)(
|
|
|
2426
2426
|
"default"
|
|
2427
2427
|
);
|
|
2428
2428
|
const [passValue, setPassValue] = (0, import_react4.useState)(value ?? "");
|
|
2429
|
+
const [internalCountry, setInternalCountry] = (0, import_react4.useState)(
|
|
2430
|
+
selectedCountryProp
|
|
2431
|
+
);
|
|
2432
|
+
const isCountryControlled = selectedCountryProp !== void 0;
|
|
2433
|
+
const selectedCountry = isCountryControlled ? selectedCountryProp : internalCountry;
|
|
2429
2434
|
const [isDropdownOpen, setIsDropdownOpen] = (0, import_react4.useState)(false);
|
|
2430
2435
|
const [highlightedIndex, setHighlightedIndex] = (0, import_react4.useState)(-1);
|
|
2431
2436
|
const [searchQuery, setSearchQuery] = (0, import_react4.useState)("");
|
|
@@ -2549,6 +2554,9 @@ var InputPhone = (0, import_react4.forwardRef)(
|
|
|
2549
2554
|
}
|
|
2550
2555
|
};
|
|
2551
2556
|
const handleCountrySelect = (country) => {
|
|
2557
|
+
if (!isCountryControlled) {
|
|
2558
|
+
setInternalCountry(country);
|
|
2559
|
+
}
|
|
2552
2560
|
onCountryChange?.(country);
|
|
2553
2561
|
setIsDropdownOpen(false);
|
|
2554
2562
|
setHighlightedIndex(-1);
|