@alfalab/core-components-international-phone-input 2.0.0 → 2.0.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.
Files changed (32) hide show
  1. package/components/base-international-phone-input/Component.js +9 -3
  2. package/components/base-international-phone-input/index.css +2 -2
  3. package/components/country-select/Component.js +1 -1
  4. package/components/country-select/index.css +8 -8
  5. package/components/flag-icon/component.js +1 -1
  6. package/components/flag-icon/index.css +3 -3
  7. package/components/select-field/component.js +1 -1
  8. package/components/select-field/index.css +9 -9
  9. package/cssm/components/base-international-phone-input/Component.js +8 -2
  10. package/cssm/utils/index.js +1 -2
  11. package/esm/components/base-international-phone-input/Component.js +9 -3
  12. package/esm/components/base-international-phone-input/index.css +2 -2
  13. package/esm/components/country-select/Component.js +1 -1
  14. package/esm/components/country-select/index.css +8 -8
  15. package/esm/components/flag-icon/component.js +1 -1
  16. package/esm/components/flag-icon/index.css +3 -3
  17. package/esm/components/select-field/component.js +1 -1
  18. package/esm/components/select-field/index.css +9 -9
  19. package/esm/utils/index.js +1 -2
  20. package/modern/components/base-international-phone-input/Component.js +9 -3
  21. package/modern/components/base-international-phone-input/index.css +2 -2
  22. package/modern/components/country-select/Component.js +1 -1
  23. package/modern/components/country-select/index.css +8 -8
  24. package/modern/components/flag-icon/component.js +1 -1
  25. package/modern/components/flag-icon/index.css +3 -3
  26. package/modern/components/select-field/component.js +1 -1
  27. package/modern/components/select-field/index.css +9 -9
  28. package/modern/utils/index.js +1 -2
  29. package/package.json +3 -3
  30. package/src/components/base-international-phone-input/Component.tsx +7 -2
  31. package/src/utils/index.ts +1 -1
  32. package/utils/index.js +1 -2
@@ -16,7 +16,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
16
16
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
17
17
  var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
18
18
 
19
- var styles = {"component":"international-phone-input__component_1gdiu","addons":"international-phone-input__addons_1gdiu"};
19
+ var styles = {"component":"international-phone-input__component_1x67s","addons":"international-phone-input__addons_1x67s"};
20
20
  require('./index.css')
21
21
 
22
22
  var BaseInternationalPhoneInput = React.forwardRef(function (_a, ref) {
@@ -65,8 +65,14 @@ var BaseInternationalPhoneInput = React.forwardRef(function (_a, ref) {
65
65
  var handleClear = function (event) {
66
66
  var _a, _b;
67
67
  (_b = (_a = restProps.inputProps) === null || _a === void 0 ? void 0 : _a.onClear) === null || _b === void 0 ? void 0 : _b.call(_a, event);
68
- var countryCode = (country === null || country === void 0 ? void 0 : country.countryCode) || '';
69
- changeNumber(clearableCountryCode ? '' : "+".concat(countryCode));
68
+ if (clearableCountryCode) {
69
+ var nextCountry = utils_index.findCountry(countriesData, '', defaultIso2, countryProp);
70
+ changeNumber('');
71
+ handleCountryChange(nextCountry);
72
+ }
73
+ else {
74
+ changeNumber("+".concat(country === null || country === void 0 ? void 0 : country.countryCode) || '');
75
+ }
70
76
  };
71
77
  React.useEffect(function () {
72
78
  if (value) {
@@ -1,5 +1,5 @@
1
- /* hash: ri3ng */
1
+ /* hash: 1h0lf */
2
2
 
3
- .international-phone-input__component_1gdiu .international-phone-input__addons_1gdiu {
3
+ .international-phone-input__component_1x67s .international-phone-input__addons_1x67s {
4
4
  padding-left: 0;
5
5
  }
@@ -14,7 +14,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
14
14
 
15
15
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
16
16
 
17
- var styles = {"component":"international-phone-input__component_1opig","option":"international-phone-input__option_1opig","flag":"international-phone-input__flag_1opig","countryName":"international-phone-input__countryName_1opig","dialCode":"international-phone-input__dialCode_1opig","flagIconWrapper":"international-phone-input__flagIconWrapper_1opig","emptyCountryIcon":"international-phone-input__emptyCountryIcon_1opig"};
17
+ var styles = {"component":"international-phone-input__component_1d85v","option":"international-phone-input__option_1d85v","flag":"international-phone-input__flag_1d85v","countryName":"international-phone-input__countryName_1d85v","dialCode":"international-phone-input__dialCode_1d85v","flagIconWrapper":"international-phone-input__flagIconWrapper_1d85v","emptyCountryIcon":"international-phone-input__emptyCountryIcon_1d85v"};
18
18
  require('./index.css')
19
19
 
20
20
  var CountrySelect = function (_a) {
@@ -1,4 +1,4 @@
1
- /* hash: 1r5mu */
1
+ /* hash: 1ad4t */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
4
  --color-light-neutral-translucent-700: rgba(4, 4, 21, 0.47);
@@ -18,29 +18,29 @@
18
18
  --gap-s: 12px;
19
19
  } :root {
20
20
  } :root {
21
- } .international-phone-input__component_1opig {
21
+ } .international-phone-input__component_1d85v {
22
22
  position: static;
23
23
  display: flex;
24
24
  min-width: initial;
25
25
  height: 100%;
26
- } .international-phone-input__option_1opig {
26
+ } .international-phone-input__option_1d85v {
27
27
  display: flex;
28
28
  align-items: flex-start;
29
29
  padding: var(--gap-s);
30
- } .international-phone-input__flag_1opig {
30
+ } .international-phone-input__flag_1d85v {
31
31
  flex-shrink: 0;
32
32
  margin-right: var(--gap-xs);
33
- } .international-phone-input__countryName_1opig {
33
+ } .international-phone-input__countryName_1d85v {
34
34
  margin-right: var(--gap-xs);
35
- } .international-phone-input__dialCode_1opig {
35
+ } .international-phone-input__dialCode_1d85v {
36
36
  color: var(--color-light-text-secondary);
37
- } .international-phone-input__flagIconWrapper_1opig {
37
+ } .international-phone-input__flagIconWrapper_1d85v {
38
38
  display: flex;
39
39
  justify-content: center;
40
40
  align-items: center;
41
41
  width: 24px;
42
42
  height: 24px;
43
43
  margin-left: var(--gap-s);
44
- } .international-phone-input__emptyCountryIcon_1opig {
44
+ } .international-phone-input__emptyCountryIcon_1d85v {
45
45
  color: var(--color-light-neutral-translucent-700);
46
46
  }
@@ -11,7 +11,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
11
11
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
12
12
  var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
13
13
 
14
- var styles = {"flagIcon":"international-phone-input__flagIcon_1305a","flagPlaceholder":"international-phone-input__flagPlaceholder_1305a"};
14
+ var styles = {"flagIcon":"international-phone-input__flagIcon_1ehhv","flagPlaceholder":"international-phone-input__flagPlaceholder_1ehhv"};
15
15
  require('./index.css')
16
16
 
17
17
  /**
@@ -1,4 +1,4 @@
1
- /* hash: 1agf3 */
1
+ /* hash: 1r8x4 */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
4
  --color-light-neutral-translucent-100: rgba(38, 55, 88, 0.06); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
@@ -17,10 +17,10 @@
17
17
  --gap-3xs: 2px;
18
18
  } :root {
19
19
  } :root {
20
- } .international-phone-input__flagIcon_1305a {
20
+ } .international-phone-input__flagIcon_1ehhv {
21
21
  max-width: 24px;
22
22
  max-height: 24px;
23
- } .international-phone-input__flagPlaceholder_1305a {
23
+ } .international-phone-input__flagPlaceholder_1ehhv {
24
24
  width: 24px;
25
25
  height: 16px;
26
26
  max-height: 16px;
@@ -16,7 +16,7 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
16
16
  var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
17
17
  var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
18
18
 
19
- var styles = {"component":"international-phone-input__component_1vizw","flagIconContainer":"international-phone-input__flagIconContainer_1vizw","emptyCountryIcon":"international-phone-input__emptyCountryIcon_1vizw","disabled":"international-phone-input__disabled_1vizw","inner":"international-phone-input__inner_1vizw","size-64":"international-phone-input__size-64_1vizw","size-72":"international-phone-input__size-72_1vizw","focusVisible":"international-phone-input__focusVisible_1vizw"};
19
+ var styles = {"component":"international-phone-input__component_1sfpy","flagIconContainer":"international-phone-input__flagIconContainer_1sfpy","emptyCountryIcon":"international-phone-input__emptyCountryIcon_1sfpy","disabled":"international-phone-input__disabled_1sfpy","inner":"international-phone-input__inner_1sfpy","size-64":"international-phone-input__size-64_1sfpy","size-72":"international-phone-input__size-72_1sfpy","focusVisible":"international-phone-input__focusVisible_1sfpy"};
20
20
  require('./index.css')
21
21
 
22
22
  var EMPTY_COUNTRY_SELECT_FIELD = {
@@ -1,4 +1,4 @@
1
- /* hash: 1h39k */
1
+ /* hash: rkrs6 */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
4
  --color-light-border-link: #2288fa;
@@ -21,33 +21,33 @@
21
21
  } :root {
22
22
  --focus-color: var(--color-light-border-link);
23
23
  --disabled-cursor: not-allowed;
24
- } .international-phone-input__component_1vizw {
24
+ } .international-phone-input__component_1sfpy {
25
25
  height: 100%;
26
26
  cursor: pointer;
27
27
  outline: none;
28
28
  position: relative;
29
- } .international-phone-input__flagIconContainer_1vizw {
29
+ } .international-phone-input__flagIconContainer_1sfpy {
30
30
  display: flex;
31
31
  justify-content: center;
32
32
  align-items: center;
33
33
  width: 24px;
34
34
  height: 24px;
35
35
  margin-right: var(--gap-2xs);
36
- } .international-phone-input__emptyCountryIcon_1vizw {
36
+ } .international-phone-input__emptyCountryIcon_1sfpy {
37
37
  color: var(--color-light-neutral-translucent-700);
38
- } .international-phone-input__disabled_1vizw {
38
+ } .international-phone-input__disabled_1sfpy {
39
39
  cursor: var(--disabled-cursor);
40
- } .international-phone-input__inner_1vizw {
40
+ } .international-phone-input__inner_1sfpy {
41
41
  position: relative;
42
42
  display: flex;
43
43
  align-items: center;
44
44
  height: 100%;
45
45
  padding-left: var(--gap-s);
46
46
  outline: none;
47
- } .international-phone-input__size-64_1vizw .international-phone-input__inner_1vizw,
48
- .international-phone-input__size-72_1vizw .international-phone-input__inner_1vizw {
47
+ } .international-phone-input__size-64_1sfpy .international-phone-input__inner_1sfpy,
48
+ .international-phone-input__size-72_1sfpy .international-phone-input__inner_1sfpy {
49
49
  padding-left: var(--gap-m);
50
- } .international-phone-input__focusVisible_1vizw {
50
+ } .international-phone-input__focusVisible_1sfpy {
51
51
  outline: 2px solid var(--focus-color);
52
52
  outline-offset: 2px;
53
53
  }
@@ -64,8 +64,14 @@ var BaseInternationalPhoneInput = React.forwardRef(function (_a, ref) {
64
64
  var handleClear = function (event) {
65
65
  var _a, _b;
66
66
  (_b = (_a = restProps.inputProps) === null || _a === void 0 ? void 0 : _a.onClear) === null || _b === void 0 ? void 0 : _b.call(_a, event);
67
- var countryCode = (country === null || country === void 0 ? void 0 : country.countryCode) || '';
68
- changeNumber(clearableCountryCode ? '' : "+".concat(countryCode));
67
+ if (clearableCountryCode) {
68
+ var nextCountry = utils_index.findCountry(countriesData, '', defaultIso2, countryProp);
69
+ changeNumber('');
70
+ handleCountryChange(nextCountry);
71
+ }
72
+ else {
73
+ changeNumber("+".concat(country === null || country === void 0 ? void 0 : country.countryCode) || '');
74
+ }
69
75
  };
70
76
  React.useEffect(function () {
71
77
  if (value) {
@@ -47,8 +47,7 @@ function findCountry(countries, value, iso2, country) {
47
47
  if (value) {
48
48
  var inputNumber = clearMask(value);
49
49
  var nextCountry = guessCountry(inputNumber, countries);
50
- if (nextCountry)
51
- return nextCountry;
50
+ return nextCountry;
52
51
  }
53
52
  if (!iso2)
54
53
  return undefined;
@@ -7,7 +7,7 @@ import { BaseOption } from '@alfalab/core-components-select/esm/shared';
7
7
  import { initCountries, findCountry, filterPhones, createMaskOptions, getClear, getPhoneData } from '../../utils/index.js';
8
8
  import { CountrySelect } from '../country-select/Component.js';
9
9
 
10
- var styles = {"component":"international-phone-input__component_1gdiu","addons":"international-phone-input__addons_1gdiu"};
10
+ var styles = {"component":"international-phone-input__component_1x67s","addons":"international-phone-input__addons_1x67s"};
11
11
  require('./index.css')
12
12
 
13
13
  var BaseInternationalPhoneInput = forwardRef(function (_a, ref) {
@@ -56,8 +56,14 @@ var BaseInternationalPhoneInput = forwardRef(function (_a, ref) {
56
56
  var handleClear = function (event) {
57
57
  var _a, _b;
58
58
  (_b = (_a = restProps.inputProps) === null || _a === void 0 ? void 0 : _a.onClear) === null || _b === void 0 ? void 0 : _b.call(_a, event);
59
- var countryCode = (country === null || country === void 0 ? void 0 : country.countryCode) || '';
60
- changeNumber(clearableCountryCode ? '' : "+".concat(countryCode));
59
+ if (clearableCountryCode) {
60
+ var nextCountry = findCountry(countriesData, '', defaultIso2, countryProp);
61
+ changeNumber('');
62
+ handleCountryChange(nextCountry);
63
+ }
64
+ else {
65
+ changeNumber("+".concat(country === null || country === void 0 ? void 0 : country.countryCode) || '');
66
+ }
61
67
  };
62
68
  useEffect(function () {
63
69
  if (value) {
@@ -1,5 +1,5 @@
1
- /* hash: ri3ng */
1
+ /* hash: 1h0lf */
2
2
 
3
- .international-phone-input__component_1gdiu .international-phone-input__addons_1gdiu {
3
+ .international-phone-input__component_1x67s .international-phone-input__addons_1x67s {
4
4
  padding-left: 0;
5
5
  }
@@ -6,7 +6,7 @@ import { WorldMagnifierMIcon } from '@alfalab/icons-glyph/WorldMagnifierMIcon';
6
6
  import { FlagIcon } from '../flag-icon/component.js';
7
7
  import { EMPTY_COUNTRY_SELECT_FIELD, SelectField } from '../select-field/component.js';
8
8
 
9
- var styles = {"component":"international-phone-input__component_1opig","option":"international-phone-input__option_1opig","flag":"international-phone-input__flag_1opig","countryName":"international-phone-input__countryName_1opig","dialCode":"international-phone-input__dialCode_1opig","flagIconWrapper":"international-phone-input__flagIconWrapper_1opig","emptyCountryIcon":"international-phone-input__emptyCountryIcon_1opig"};
9
+ var styles = {"component":"international-phone-input__component_1d85v","option":"international-phone-input__option_1d85v","flag":"international-phone-input__flag_1d85v","countryName":"international-phone-input__countryName_1d85v","dialCode":"international-phone-input__dialCode_1d85v","flagIconWrapper":"international-phone-input__flagIconWrapper_1d85v","emptyCountryIcon":"international-phone-input__emptyCountryIcon_1d85v"};
10
10
  require('./index.css')
11
11
 
12
12
  var CountrySelect = function (_a) {
@@ -1,4 +1,4 @@
1
- /* hash: 1r5mu */
1
+ /* hash: 1ad4t */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
4
  --color-light-neutral-translucent-700: rgba(4, 4, 21, 0.47);
@@ -18,29 +18,29 @@
18
18
  --gap-s: 12px;
19
19
  } :root {
20
20
  } :root {
21
- } .international-phone-input__component_1opig {
21
+ } .international-phone-input__component_1d85v {
22
22
  position: static;
23
23
  display: flex;
24
24
  min-width: initial;
25
25
  height: 100%;
26
- } .international-phone-input__option_1opig {
26
+ } .international-phone-input__option_1d85v {
27
27
  display: flex;
28
28
  align-items: flex-start;
29
29
  padding: var(--gap-s);
30
- } .international-phone-input__flag_1opig {
30
+ } .international-phone-input__flag_1d85v {
31
31
  flex-shrink: 0;
32
32
  margin-right: var(--gap-xs);
33
- } .international-phone-input__countryName_1opig {
33
+ } .international-phone-input__countryName_1d85v {
34
34
  margin-right: var(--gap-xs);
35
- } .international-phone-input__dialCode_1opig {
35
+ } .international-phone-input__dialCode_1d85v {
36
36
  color: var(--color-light-text-secondary);
37
- } .international-phone-input__flagIconWrapper_1opig {
37
+ } .international-phone-input__flagIconWrapper_1d85v {
38
38
  display: flex;
39
39
  justify-content: center;
40
40
  align-items: center;
41
41
  width: 24px;
42
42
  height: 24px;
43
43
  margin-left: var(--gap-s);
44
- } .international-phone-input__emptyCountryIcon_1opig {
44
+ } .international-phone-input__emptyCountryIcon_1d85v {
45
45
  color: var(--color-light-neutral-translucent-700);
46
46
  }
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import cn from 'classnames';
3
3
  import { flagSprite } from './flagSprite.js';
4
4
 
5
- var styles = {"flagIcon":"international-phone-input__flagIcon_1305a","flagPlaceholder":"international-phone-input__flagPlaceholder_1305a"};
5
+ var styles = {"flagIcon":"international-phone-input__flagIcon_1ehhv","flagPlaceholder":"international-phone-input__flagPlaceholder_1ehhv"};
6
6
  require('./index.css')
7
7
 
8
8
  /**
@@ -1,4 +1,4 @@
1
- /* hash: 1agf3 */
1
+ /* hash: 1r8x4 */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
4
  --color-light-neutral-translucent-100: rgba(38, 55, 88, 0.06); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
@@ -17,10 +17,10 @@
17
17
  --gap-3xs: 2px;
18
18
  } :root {
19
19
  } :root {
20
- } .international-phone-input__flagIcon_1305a {
20
+ } .international-phone-input__flagIcon_1ehhv {
21
21
  max-width: 24px;
22
22
  max-height: 24px;
23
- } .international-phone-input__flagPlaceholder_1305a {
23
+ } .international-phone-input__flagPlaceholder_1ehhv {
24
24
  width: 24px;
25
25
  height: 16px;
26
26
  max-height: 16px;
@@ -6,7 +6,7 @@ import { useFocus } from '@alfalab/hooks';
6
6
  import { WorldMagnifierMIcon } from '@alfalab/icons-glyph/WorldMagnifierMIcon';
7
7
  import { FlagIcon } from '../flag-icon/component.js';
8
8
 
9
- var styles = {"component":"international-phone-input__component_1vizw","flagIconContainer":"international-phone-input__flagIconContainer_1vizw","emptyCountryIcon":"international-phone-input__emptyCountryIcon_1vizw","disabled":"international-phone-input__disabled_1vizw","inner":"international-phone-input__inner_1vizw","size-64":"international-phone-input__size-64_1vizw","size-72":"international-phone-input__size-72_1vizw","focusVisible":"international-phone-input__focusVisible_1vizw"};
9
+ var styles = {"component":"international-phone-input__component_1sfpy","flagIconContainer":"international-phone-input__flagIconContainer_1sfpy","emptyCountryIcon":"international-phone-input__emptyCountryIcon_1sfpy","disabled":"international-phone-input__disabled_1sfpy","inner":"international-phone-input__inner_1sfpy","size-64":"international-phone-input__size-64_1sfpy","size-72":"international-phone-input__size-72_1sfpy","focusVisible":"international-phone-input__focusVisible_1sfpy"};
10
10
  require('./index.css')
11
11
 
12
12
  var EMPTY_COUNTRY_SELECT_FIELD = {
@@ -1,4 +1,4 @@
1
- /* hash: 1h39k */
1
+ /* hash: rkrs6 */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
4
  --color-light-border-link: #2288fa;
@@ -21,33 +21,33 @@
21
21
  } :root {
22
22
  --focus-color: var(--color-light-border-link);
23
23
  --disabled-cursor: not-allowed;
24
- } .international-phone-input__component_1vizw {
24
+ } .international-phone-input__component_1sfpy {
25
25
  height: 100%;
26
26
  cursor: pointer;
27
27
  outline: none;
28
28
  position: relative;
29
- } .international-phone-input__flagIconContainer_1vizw {
29
+ } .international-phone-input__flagIconContainer_1sfpy {
30
30
  display: flex;
31
31
  justify-content: center;
32
32
  align-items: center;
33
33
  width: 24px;
34
34
  height: 24px;
35
35
  margin-right: var(--gap-2xs);
36
- } .international-phone-input__emptyCountryIcon_1vizw {
36
+ } .international-phone-input__emptyCountryIcon_1sfpy {
37
37
  color: var(--color-light-neutral-translucent-700);
38
- } .international-phone-input__disabled_1vizw {
38
+ } .international-phone-input__disabled_1sfpy {
39
39
  cursor: var(--disabled-cursor);
40
- } .international-phone-input__inner_1vizw {
40
+ } .international-phone-input__inner_1sfpy {
41
41
  position: relative;
42
42
  display: flex;
43
43
  align-items: center;
44
44
  height: 100%;
45
45
  padding-left: var(--gap-s);
46
46
  outline: none;
47
- } .international-phone-input__size-64_1vizw .international-phone-input__inner_1vizw,
48
- .international-phone-input__size-72_1vizw .international-phone-input__inner_1vizw {
47
+ } .international-phone-input__size-64_1sfpy .international-phone-input__inner_1sfpy,
48
+ .international-phone-input__size-72_1sfpy .international-phone-input__inner_1sfpy {
49
49
  padding-left: var(--gap-m);
50
- } .international-phone-input__focusVisible_1vizw {
50
+ } .international-phone-input__focusVisible_1sfpy {
51
51
  outline: 2px solid var(--focus-color);
52
52
  outline-offset: 2px;
53
53
  }
@@ -43,8 +43,7 @@ function findCountry(countries, value, iso2, country) {
43
43
  if (value) {
44
44
  var inputNumber = clearMask(value);
45
45
  var nextCountry = guessCountry(inputNumber, countries);
46
- if (nextCountry)
47
- return nextCountry;
46
+ return nextCountry;
48
47
  }
49
48
  if (!iso2)
50
49
  return undefined;
@@ -6,7 +6,7 @@ import { BaseOption } from '@alfalab/core-components-select/modern/shared';
6
6
  import { initCountries, findCountry, filterPhones, createMaskOptions, getClear, getPhoneData } from '../../utils/index.js';
7
7
  import { CountrySelect } from '../country-select/Component.js';
8
8
 
9
- const styles = {"component":"international-phone-input__component_1gdiu","addons":"international-phone-input__addons_1gdiu"};
9
+ const styles = {"component":"international-phone-input__component_1x67s","addons":"international-phone-input__addons_1x67s"};
10
10
  require('./index.css')
11
11
 
12
12
  const BaseInternationalPhoneInput = forwardRef(({ clearableCountryCode, value, country: countryProp, filterFn, onChange, onCountryChange, countrySelectProps, countries, defaultIso2, disabled, options, size = 56, Input, InputAutocomplete, SelectComponent, view, clear: clearProp, ...restProps }, ref) => {
@@ -49,8 +49,14 @@ const BaseInternationalPhoneInput = forwardRef(({ clearableCountryCode, value, c
49
49
  };
50
50
  const handleClear = (event) => {
51
51
  restProps.inputProps?.onClear?.(event);
52
- const countryCode = country?.countryCode || '';
53
- changeNumber(clearableCountryCode ? '' : `+${countryCode}`);
52
+ if (clearableCountryCode) {
53
+ const nextCountry = findCountry(countriesData, '', defaultIso2, countryProp);
54
+ changeNumber('');
55
+ handleCountryChange(nextCountry);
56
+ }
57
+ else {
58
+ changeNumber(`+${country?.countryCode}` || '');
59
+ }
54
60
  };
55
61
  useEffect(() => {
56
62
  if (value) {
@@ -1,5 +1,5 @@
1
- /* hash: ri3ng */
1
+ /* hash: 1h0lf */
2
2
 
3
- .international-phone-input__component_1gdiu .international-phone-input__addons_1gdiu {
3
+ .international-phone-input__component_1x67s .international-phone-input__addons_1x67s {
4
4
  padding-left: 0;
5
5
  }
@@ -5,7 +5,7 @@ import { WorldMagnifierMIcon } from '@alfalab/icons-glyph/WorldMagnifierMIcon';
5
5
  import { FlagIcon } from '../flag-icon/component.js';
6
6
  import { EMPTY_COUNTRY_SELECT_FIELD, SelectField } from '../select-field/component.js';
7
7
 
8
- const styles = {"component":"international-phone-input__component_1opig","option":"international-phone-input__option_1opig","flag":"international-phone-input__flag_1opig","countryName":"international-phone-input__countryName_1opig","dialCode":"international-phone-input__dialCode_1opig","flagIconWrapper":"international-phone-input__flagIconWrapper_1opig","emptyCountryIcon":"international-phone-input__emptyCountryIcon_1opig"};
8
+ const styles = {"component":"international-phone-input__component_1d85v","option":"international-phone-input__option_1d85v","flag":"international-phone-input__flag_1d85v","countryName":"international-phone-input__countryName_1d85v","dialCode":"international-phone-input__dialCode_1d85v","flagIconWrapper":"international-phone-input__flagIconWrapper_1d85v","emptyCountryIcon":"international-phone-input__emptyCountryIcon_1d85v"};
9
9
  require('./index.css')
10
10
 
11
11
  const CountrySelect = ({ hideCountrySelect, countries, country, dataTestId, fieldWidth, onChange, view = 'desktop', SelectComponent, ...restProps }) => {
@@ -1,4 +1,4 @@
1
- /* hash: 1r5mu */
1
+ /* hash: 1ad4t */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
4
  --color-light-neutral-translucent-700: rgba(4, 4, 21, 0.47);
@@ -18,29 +18,29 @@
18
18
  --gap-s: 12px;
19
19
  } :root {
20
20
  } :root {
21
- } .international-phone-input__component_1opig {
21
+ } .international-phone-input__component_1d85v {
22
22
  position: static;
23
23
  display: flex;
24
24
  min-width: initial;
25
25
  height: 100%;
26
- } .international-phone-input__option_1opig {
26
+ } .international-phone-input__option_1d85v {
27
27
  display: flex;
28
28
  align-items: flex-start;
29
29
  padding: var(--gap-s);
30
- } .international-phone-input__flag_1opig {
30
+ } .international-phone-input__flag_1d85v {
31
31
  flex-shrink: 0;
32
32
  margin-right: var(--gap-xs);
33
- } .international-phone-input__countryName_1opig {
33
+ } .international-phone-input__countryName_1d85v {
34
34
  margin-right: var(--gap-xs);
35
- } .international-phone-input__dialCode_1opig {
35
+ } .international-phone-input__dialCode_1d85v {
36
36
  color: var(--color-light-text-secondary);
37
- } .international-phone-input__flagIconWrapper_1opig {
37
+ } .international-phone-input__flagIconWrapper_1d85v {
38
38
  display: flex;
39
39
  justify-content: center;
40
40
  align-items: center;
41
41
  width: 24px;
42
42
  height: 24px;
43
43
  margin-left: var(--gap-s);
44
- } .international-phone-input__emptyCountryIcon_1opig {
44
+ } .international-phone-input__emptyCountryIcon_1d85v {
45
45
  color: var(--color-light-neutral-translucent-700);
46
46
  }
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import cn from 'classnames';
3
3
  import { flagSprite } from './flagSprite.js';
4
4
 
5
- const styles = {"flagIcon":"international-phone-input__flagIcon_1305a","flagPlaceholder":"international-phone-input__flagPlaceholder_1305a"};
5
+ const styles = {"flagIcon":"international-phone-input__flagIcon_1ehhv","flagPlaceholder":"international-phone-input__flagPlaceholder_1ehhv"};
6
6
  require('./index.css')
7
7
 
8
8
  /**
@@ -1,4 +1,4 @@
1
- /* hash: 1agf3 */
1
+ /* hash: 1r8x4 */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
4
  --color-light-neutral-translucent-100: rgba(38, 55, 88, 0.06); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
@@ -17,10 +17,10 @@
17
17
  --gap-3xs: 2px;
18
18
  } :root {
19
19
  } :root {
20
- } .international-phone-input__flagIcon_1305a {
20
+ } .international-phone-input__flagIcon_1ehhv {
21
21
  max-width: 24px;
22
22
  max-height: 24px;
23
- } .international-phone-input__flagPlaceholder_1305a {
23
+ } .international-phone-input__flagPlaceholder_1ehhv {
24
24
  width: 24px;
25
25
  height: 16px;
26
26
  max-height: 16px;
@@ -5,7 +5,7 @@ import { useFocus } from '@alfalab/hooks';
5
5
  import { WorldMagnifierMIcon } from '@alfalab/icons-glyph/WorldMagnifierMIcon';
6
6
  import { FlagIcon } from '../flag-icon/component.js';
7
7
 
8
- const styles = {"component":"international-phone-input__component_1vizw","flagIconContainer":"international-phone-input__flagIconContainer_1vizw","emptyCountryIcon":"international-phone-input__emptyCountryIcon_1vizw","disabled":"international-phone-input__disabled_1vizw","inner":"international-phone-input__inner_1vizw","size-64":"international-phone-input__size-64_1vizw","size-72":"international-phone-input__size-72_1vizw","focusVisible":"international-phone-input__focusVisible_1vizw"};
8
+ const styles = {"component":"international-phone-input__component_1sfpy","flagIconContainer":"international-phone-input__flagIconContainer_1sfpy","emptyCountryIcon":"international-phone-input__emptyCountryIcon_1sfpy","disabled":"international-phone-input__disabled_1sfpy","inner":"international-phone-input__inner_1sfpy","size-64":"international-phone-input__size-64_1sfpy","size-72":"international-phone-input__size-72_1sfpy","focusVisible":"international-phone-input__focusVisible_1sfpy"};
9
9
  require('./index.css')
10
10
 
11
11
  const EMPTY_COUNTRY_SELECT_FIELD = {
@@ -1,4 +1,4 @@
1
- /* hash: 1h39k */
1
+ /* hash: rkrs6 */
2
2
  :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
3
3
  } /* deprecated */ :root {
4
4
  --color-light-border-link: #2288fa;
@@ -21,33 +21,33 @@
21
21
  } :root {
22
22
  --focus-color: var(--color-light-border-link);
23
23
  --disabled-cursor: not-allowed;
24
- } .international-phone-input__component_1vizw {
24
+ } .international-phone-input__component_1sfpy {
25
25
  height: 100%;
26
26
  cursor: pointer;
27
27
  outline: none;
28
28
  position: relative;
29
- } .international-phone-input__flagIconContainer_1vizw {
29
+ } .international-phone-input__flagIconContainer_1sfpy {
30
30
  display: flex;
31
31
  justify-content: center;
32
32
  align-items: center;
33
33
  width: 24px;
34
34
  height: 24px;
35
35
  margin-right: var(--gap-2xs);
36
- } .international-phone-input__emptyCountryIcon_1vizw {
36
+ } .international-phone-input__emptyCountryIcon_1sfpy {
37
37
  color: var(--color-light-neutral-translucent-700);
38
- } .international-phone-input__disabled_1vizw {
38
+ } .international-phone-input__disabled_1sfpy {
39
39
  cursor: var(--disabled-cursor);
40
- } .international-phone-input__inner_1vizw {
40
+ } .international-phone-input__inner_1sfpy {
41
41
  position: relative;
42
42
  display: flex;
43
43
  align-items: center;
44
44
  height: 100%;
45
45
  padding-left: var(--gap-s);
46
46
  outline: none;
47
- } .international-phone-input__size-64_1vizw .international-phone-input__inner_1vizw,
48
- .international-phone-input__size-72_1vizw .international-phone-input__inner_1vizw {
47
+ } .international-phone-input__size-64_1sfpy .international-phone-input__inner_1sfpy,
48
+ .international-phone-input__size-72_1sfpy .international-phone-input__inner_1sfpy {
49
49
  padding-left: var(--gap-m);
50
- } .international-phone-input__focusVisible_1vizw {
50
+ } .international-phone-input__focusVisible_1sfpy {
51
51
  outline: 2px solid var(--focus-color);
52
52
  outline-offset: 2px;
53
53
  }
@@ -40,8 +40,7 @@ function findCountry(countries, value, iso2, country) {
40
40
  if (value) {
41
41
  const inputNumber = clearMask(value);
42
42
  const nextCountry = guessCountry(inputNumber, countries);
43
- if (nextCountry)
44
- return nextCountry;
43
+ return nextCountry;
45
44
  }
46
45
  if (!iso2)
47
46
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-international-phone-input",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -14,9 +14,9 @@
14
14
  "react": "^16.9.0 || ^17.0.1 || ^18.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@alfalab/core-components-input-autocomplete": "12.0.0",
17
+ "@alfalab/core-components-input-autocomplete": "12.0.2",
18
18
  "@alfalab/core-components-input": "^14.3.0",
19
- "@alfalab/core-components-select": "^17.3.0",
19
+ "@alfalab/core-components-select": "^17.3.2",
20
20
  "@alfalab/core-components-shared": "^0.9.1",
21
21
  "@alfalab/core-components-mq": "^4.2.0",
22
22
  "@alfalab/hooks": "^1.13.0",
@@ -118,9 +118,14 @@ export const BaseInternationalPhoneInput = forwardRef<
118
118
  const handleClear = (event: MouseEvent<HTMLButtonElement>) => {
119
119
  restProps.inputProps?.onClear?.(event);
120
120
 
121
- const countryCode = country?.countryCode || '';
121
+ if (clearableCountryCode) {
122
+ const nextCountry = findCountry(countriesData, '', defaultIso2, countryProp);
122
123
 
123
- changeNumber(clearableCountryCode ? '' : `+${countryCode}`);
124
+ changeNumber('');
125
+ handleCountryChange(nextCountry);
126
+ } else {
127
+ changeNumber(`+${country?.countryCode}` || '');
128
+ }
124
129
  };
125
130
 
126
131
  useEffect(() => {
@@ -60,7 +60,7 @@ export function findCountry(
60
60
  const inputNumber = clearMask(value);
61
61
  const nextCountry = guessCountry(inputNumber, countries);
62
62
 
63
- if (nextCountry) return nextCountry;
63
+ return nextCountry;
64
64
  }
65
65
 
66
66
  if (!iso2) return undefined;
package/utils/index.js CHANGED
@@ -47,8 +47,7 @@ function findCountry(countries, value, iso2, country) {
47
47
  if (value) {
48
48
  var inputNumber = clearMask(value);
49
49
  var nextCountry = guessCountry(inputNumber, countries);
50
- if (nextCountry)
51
- return nextCountry;
50
+ return nextCountry;
52
51
  }
53
52
  if (!iso2)
54
53
  return undefined;