@alfalab/core-components-phone-input 7.3.24 → 7.4.1

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/Component.js CHANGED
@@ -65,6 +65,10 @@ var PhoneInput = React__default.default.forwardRef(function (_a, ref) {
65
65
  previousConformedValue.length > currentCaretPosition))) {
66
66
  utils_index.setCaretPosition({ position: currentCaretPosition, inputRef: inputRef });
67
67
  }
68
+ // // В режиме clearableCountryCode удаляет лишний пробел, чтобы можно было стереть код города.
69
+ if (rawValue === '+7' && conformedValue === '' && clearableCountryCode) {
70
+ utils_index.setCaretPosition({ position: countryPrefix.length - 1, inputRef: inputRef });
71
+ }
68
72
  // Удаление цифры перед кодом страны удаляет только саму цифру, код остается ("+7 1" -> "+7 ")
69
73
  if (rawValue === countryPrefix) {
70
74
  return rawValue;
package/cssm/Component.js CHANGED
@@ -65,6 +65,10 @@ var PhoneInput = React__default.default.forwardRef(function (_a, ref) {
65
65
  previousConformedValue.length > currentCaretPosition))) {
66
66
  utils_index.setCaretPosition({ position: currentCaretPosition, inputRef: inputRef });
67
67
  }
68
+ // // В режиме clearableCountryCode удаляет лишний пробел, чтобы можно было стереть код города.
69
+ if (rawValue === '+7' && conformedValue === '' && clearableCountryCode) {
70
+ utils_index.setCaretPosition({ position: countryPrefix.length - 1, inputRef: inputRef });
71
+ }
68
72
  // Удаление цифры перед кодом страны удаляет только саму цифру, код остается ("+7 1" -> "+7 ")
69
73
  if (rawValue === countryPrefix) {
70
74
  return rawValue;
package/esm/Component.js CHANGED
@@ -56,6 +56,10 @@ var PhoneInput = React.forwardRef(function (_a, ref) {
56
56
  previousConformedValue.length > currentCaretPosition))) {
57
57
  setCaretPosition({ position: currentCaretPosition, inputRef: inputRef });
58
58
  }
59
+ // // В режиме clearableCountryCode удаляет лишний пробел, чтобы можно было стереть код города.
60
+ if (rawValue === '+7' && conformedValue === '' && clearableCountryCode) {
61
+ setCaretPosition({ position: countryPrefix.length - 1, inputRef: inputRef });
62
+ }
59
63
  // Удаление цифры перед кодом страны удаляет только саму цифру, код остается ("+7 1" -> "+7 ")
60
64
  if (rawValue === countryPrefix) {
61
65
  return rawValue;
@@ -55,6 +55,10 @@ const PhoneInput = React.forwardRef(({ clearableCountryCode = true, ...restProps
55
55
  previousConformedValue.length > currentCaretPosition))) {
56
56
  setCaretPosition({ position: currentCaretPosition, inputRef });
57
57
  }
58
+ // // В режиме clearableCountryCode удаляет лишний пробел, чтобы можно было стереть код города.
59
+ if (rawValue === '+7' && conformedValue === '' && clearableCountryCode) {
60
+ setCaretPosition({ position: countryPrefix.length - 1, inputRef });
61
+ }
58
62
  // Удаление цифры перед кодом страны удаляет только саму цифру, код остается ("+7 1" -> "+7 ")
59
63
  if (rawValue === countryPrefix) {
60
64
  return rawValue;
@@ -55,6 +55,10 @@ const PhoneInput = React.forwardRef(({ clearableCountryCode = true, ...restProps
55
55
  previousConformedValue.length > currentCaretPosition))) {
56
56
  setCaretPosition({ position: currentCaretPosition, inputRef });
57
57
  }
58
+ // // В режиме clearableCountryCode удаляет лишний пробел, чтобы можно было стереть код города.
59
+ if (rawValue === '+7' && conformedValue === '' && clearableCountryCode) {
60
+ setCaretPosition({ position: countryPrefix.length - 1, inputRef });
61
+ }
58
62
  // Удаление цифры перед кодом страны удаляет только саму цифру, код остается ("+7 1" -> "+7 ")
59
63
  if (rawValue === countryPrefix) {
60
64
  return rawValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-phone-input",
3
- "version": "7.3.24",
3
+ "version": "7.4.1",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -14,11 +14,11 @@
14
14
  "react": "^16.9.0 || ^17.0.1 || ^18.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@alfalab/core-components-masked-input": "^6.3.23",
17
+ "@alfalab/core-components-masked-input": "^6.3.24",
18
18
  "react-merge-refs": "^1.1.0",
19
19
  "text-mask-core": "^5.1.2",
20
20
  "tslib": "^2.4.0"
21
21
  },
22
- "themesVersion": "13.4.0",
23
- "varsVersion": "9.13.1"
22
+ "themesVersion": "13.5.0",
23
+ "varsVersion": "9.15.0"
24
24
  }
package/src/Component.tsx CHANGED
@@ -76,6 +76,11 @@ export const PhoneInput = React.forwardRef<HTMLInputElement, PhoneInputProps>(
76
76
  setCaretPosition({ position: currentCaretPosition, inputRef });
77
77
  }
78
78
 
79
+ // // В режиме clearableCountryCode удаляет лишний пробел, чтобы можно было стереть код города.
80
+ if (rawValue === '+7' && conformedValue === '' && clearableCountryCode) {
81
+ setCaretPosition({ position: countryPrefix.length - 1, inputRef });
82
+ }
83
+
79
84
  // Удаление цифры перед кодом страны удаляет только саму цифру, код остается ("+7 1" -> "+7 ")
80
85
  if (rawValue === countryPrefix) {
81
86
  return rawValue;