@xsolla/xui-input-phone 0.154.1 → 0.154.2-pr290.1778837451

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 CHANGED
@@ -2382,7 +2382,7 @@ var InputPhone = (0, import_react3.forwardRef)(
2382
2382
  errorMessage,
2383
2383
  error,
2384
2384
  countries = allCountries,
2385
- selectedCountry,
2385
+ selectedCountry: selectedCountryProp,
2386
2386
  onCountryChange,
2387
2387
  extraClear = false,
2388
2388
  onRemove,
@@ -2399,6 +2399,11 @@ var InputPhone = (0, import_react3.forwardRef)(
2399
2399
  "default"
2400
2400
  );
2401
2401
  const [passValue, setPassValue] = (0, import_react3.useState)(value ?? "");
2402
+ const [internalCountry, setInternalCountry] = (0, import_react3.useState)(
2403
+ selectedCountryProp
2404
+ );
2405
+ const isCountryControlled = selectedCountryProp !== void 0;
2406
+ const selectedCountry = isCountryControlled ? selectedCountryProp : internalCountry;
2402
2407
  const [isDropdownOpen, setIsDropdownOpen] = (0, import_react3.useState)(false);
2403
2408
  const [highlightedIndex, setHighlightedIndex] = (0, import_react3.useState)(-1);
2404
2409
  const [searchQuery, setSearchQuery] = (0, import_react3.useState)("");
@@ -2522,6 +2527,9 @@ var InputPhone = (0, import_react3.forwardRef)(
2522
2527
  }
2523
2528
  };
2524
2529
  const handleCountrySelect = (country) => {
2530
+ if (!isCountryControlled) {
2531
+ setInternalCountry(country);
2532
+ }
2525
2533
  onCountryChange?.(country);
2526
2534
  setIsDropdownOpen(false);
2527
2535
  setHighlightedIndex(-1);
@@ -2617,13 +2625,6 @@ var InputPhone = (0, import_react3.forwardRef)(
2617
2625
  sm: { vertical: 7, horizontal: 10 },
2618
2626
  xs: { vertical: 7, horizontal: 10 }
2619
2627
  };
2620
- const borderRadiusConfig = {
2621
- xl: 8,
2622
- lg: 8,
2623
- md: 8,
2624
- sm: 4,
2625
- xs: 4
2626
- };
2627
2628
  const iconSizeConfig = {
2628
2629
  xl: 18,
2629
2630
  lg: 18,
@@ -2653,7 +2654,7 @@ var InputPhone = (0, import_react3.forwardRef)(
2653
2654
  xs: { width: 1, offset: -1 }
2654
2655
  };
2655
2656
  const padding = paddingConfig[size];
2656
- const borderRadius = borderRadiusConfig[size];
2657
+ const borderRadius = theme.shape.input[size].borderRadius;
2657
2658
  const iconSize = iconSizeConfig[size];
2658
2659
  const flagSize = flagSizeConfig[size];
2659
2660
  const selectorWidth = selectorWidthConfig[size];