@alfalab/core-components-intl-phone-input 9.3.2 → 9.3.3

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
@@ -26,7 +26,7 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
26
26
  var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
27
27
  var WorldMagnifierMIcon__default = /*#__PURE__*/_interopDefaultCompat(WorldMagnifierMIcon);
28
28
 
29
- var styles = {"addons":"intl-phone-input__addons_1d53g","l":"intl-phone-input__l_1d53g","xl":"intl-phone-input__xl_1d53g","flagIconWrapper":"intl-phone-input__flagIconWrapper_1d53g","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_1d53g"};
29
+ var styles = {"addons":"intl-phone-input__addons_u0bog","l":"intl-phone-input__l_u0bog","xl":"intl-phone-input__xl_u0bog","flagIconWrapper":"intl-phone-input__flagIconWrapper_u0bog","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_u0bog"};
30
30
  require('./index.css')
31
31
 
32
32
  var countriesHash = utils.getCountriesHash();
@@ -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":"intl-phone-input__flagIcon_1j3gq","flagPlaceholder":"intl-phone-input__flagPlaceholder_1j3gq"};
14
+ var styles = {"flagIcon":"intl-phone-input__flagIcon_1szsk","flagPlaceholder":"intl-phone-input__flagPlaceholder_1szsk"};
15
15
  require('./index.css')
16
16
 
17
17
  /**
@@ -1,4 +1,4 @@
1
- /* hash: 1fgo1 */
1
+ /* hash: qmt4e */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-specialbg-tertiary-transparent: rgba(11, 31, 53, 0.1); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* 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
- } .intl-phone-input__flagIcon_1j3gq {
20
+ } .intl-phone-input__flagIcon_1szsk {
21
21
  max-width: 24px;
22
22
  max-height: 24px;
23
- } .intl-phone-input__flagPlaceholder_1j3gq {
23
+ } .intl-phone-input__flagPlaceholder_1szsk {
24
24
  width: 24px;
25
25
  height: 16px;
26
26
  max-height: 16px;
@@ -17,7 +17,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
17
17
 
18
18
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
19
19
 
20
- var styles = {"component":"intl-phone-input__component_17e6h","option":"intl-phone-input__option_17e6h","flag":"intl-phone-input__flag_17e6h","countryName":"intl-phone-input__countryName_17e6h","dialCode":"intl-phone-input__dialCode_17e6h"};
20
+ var styles = {"component":"intl-phone-input__component_1cvpy","option":"intl-phone-input__option_1cvpy","flag":"intl-phone-input__flag_1cvpy","countryName":"intl-phone-input__countryName_1cvpy","dialCode":"intl-phone-input__dialCode_1cvpy"};
21
21
  require('./index.css')
22
22
 
23
23
  var CountriesSelect = function (_a) {
@@ -1,4 +1,4 @@
1
- /* hash: 1vh8j */
1
+ /* hash: z304d */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-text-secondary: rgba(60, 60, 67, 0.66); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* 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,19 +17,19 @@
17
17
  } :root {
18
18
  } :root {
19
19
  --text-secondary-color: var(--color-light-text-secondary);
20
- } .intl-phone-input__component_17e6h {
20
+ } .intl-phone-input__component_1cvpy {
21
21
  position: static;
22
22
  display: flex;
23
23
  min-width: initial;
24
24
  height: 100%;
25
- } .intl-phone-input__option_17e6h {
25
+ } .intl-phone-input__option_1cvpy {
26
26
  display: flex;
27
27
  align-items: flex-start;
28
- } .intl-phone-input__flag_17e6h {
28
+ } .intl-phone-input__flag_1cvpy {
29
29
  flex-shrink: 0;
30
30
  margin-right: var(--gap-xs);
31
- } .intl-phone-input__countryName_17e6h {
31
+ } .intl-phone-input__countryName_1cvpy {
32
32
  margin-right: var(--gap-xs);
33
- } .intl-phone-input__dialCode_17e6h {
33
+ } .intl-phone-input__dialCode_1cvpy {
34
34
  color: var(--text-secondary-color);
35
35
  }
@@ -18,7 +18,7 @@ var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
18
18
  var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
19
19
  var WorldMagnifierMIcon__default = /*#__PURE__*/_interopDefaultCompat(WorldMagnifierMIcon);
20
20
 
21
- var styles = {"component":"intl-phone-input__component_1g81e","flagIconContainer":"intl-phone-input__flagIconContainer_1g81e","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_1g81e","disabled":"intl-phone-input__disabled_1g81e","inner":"intl-phone-input__inner_1g81e","l":"intl-phone-input__l_1g81e","xl":"intl-phone-input__xl_1g81e","focusVisible":"intl-phone-input__focusVisible_1g81e"};
21
+ var styles = {"component":"intl-phone-input__component_1465p","flagIconContainer":"intl-phone-input__flagIconContainer_1465p","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_1465p","disabled":"intl-phone-input__disabled_1465p","inner":"intl-phone-input__inner_1465p","l":"intl-phone-input__l_1465p","xl":"intl-phone-input__xl_1465p","focusVisible":"intl-phone-input__focusVisible_1465p"};
22
22
  require('./index.css')
23
23
 
24
24
  var EMPTY_COUNTRY_SELECT_FIELD = {
@@ -1,4 +1,4 @@
1
- /* hash: e0afr */
1
+ /* hash: 1eams */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-border-link: #0072ef;
@@ -21,33 +21,33 @@
21
21
  } :root {
22
22
  --focus-color: var(--color-light-border-link);
23
23
  --disabled-cursor: not-allowed;
24
- } .intl-phone-input__component_1g81e {
24
+ } .intl-phone-input__component_1465p {
25
25
  height: 100%;
26
26
  cursor: pointer;
27
27
  outline: none;
28
28
  position: relative;
29
- } .intl-phone-input__flagIconContainer_1g81e {
29
+ } .intl-phone-input__flagIconContainer_1465p {
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
- } .intl-phone-input__emptyCountryIcon_1g81e {
36
+ } .intl-phone-input__emptyCountryIcon_1465p {
37
37
  color: var(--color-light-graphic-secondary);
38
- } .intl-phone-input__disabled_1g81e {
38
+ } .intl-phone-input__disabled_1465p {
39
39
  cursor: var(--disabled-cursor);
40
- } .intl-phone-input__inner_1g81e {
40
+ } .intl-phone-input__inner_1465p {
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
- } .intl-phone-input__l_1g81e .intl-phone-input__inner_1g81e,
48
- .intl-phone-input__xl_1g81e .intl-phone-input__inner_1g81e {
47
+ } .intl-phone-input__l_1465p .intl-phone-input__inner_1465p,
48
+ .intl-phone-input__xl_1465p .intl-phone-input__inner_1465p {
49
49
  padding-left: var(--gap-m);
50
- } .intl-phone-input__focusVisible_1g81e {
50
+ } .intl-phone-input__focusVisible_1465p {
51
51
  outline: 2px solid var(--focus-color);
52
52
  outline-offset: 2px;
53
53
  }
@@ -2,7 +2,9 @@
2
2
  * Подготовка данных для вставки из буфера обмена.
3
3
  * @param phoneValue Телефон уже введённый в поле ввода.
4
4
  * @param phoneFromBuffer Текст номера телефона из буфера обмена.
5
- * @param input Input в который осуществляется вставка.
5
+ * @param selectionStart Начало выделенного в инпуте текста
6
+ * @param selectionEnd Конец выделенного в инпуте текста
7
+ * @param ruNumberPriority Приоритетность российского номера в инпуте
6
8
  */
7
9
  declare function preparePasteData(phoneValue: string, phoneFromBuffer: string, selectionStart?: number, selectionEnd?: number, ruNumberPriority?: boolean): string;
8
10
  export { preparePasteData };
@@ -6,20 +6,26 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  * Подготовка данных для вставки из буфера обмена.
7
7
  * @param phoneValue Телефон уже введённый в поле ввода.
8
8
  * @param phoneFromBuffer Текст номера телефона из буфера обмена.
9
- * @param input Input в который осуществляется вставка.
9
+ * @param selectionStart Начало выделенного в инпуте текста
10
+ * @param selectionEnd Конец выделенного в инпуте текста
11
+ * @param ruNumberPriority Приоритетность российского номера в инпуте
10
12
  */
13
+ /* eslint complexity: [1, 25] */
11
14
  function preparePasteData(phoneValue, phoneFromBuffer, selectionStart, selectionEnd, ruNumberPriority) {
12
- var trimNuber = phoneFromBuffer.trim();
13
- var cutNumberWithPlus = trimNuber.replace(/[^+\d]/g, '');
15
+ var trimNumber = phoneFromBuffer.trim();
16
+ var cutNumberWithPlus = trimNumber.replace(/[^+\d]/g, '');
14
17
  var isTextHavePlus = cutNumberWithPlus[0] === '+';
15
- var cutNumber = trimNuber.replace(/[^\d]/g, '');
16
- var isRuNumberInBuffer = cutNumber[0] === '7' || cutNumber[0] === '8';
18
+ var cutNumber = trimNumber.replace(/[^\d]/g, '');
19
+ var isRuNumberInBuffer = cutNumber[0] === '7' || cutNumber[0] === '8' || cutNumber.substring(0, 2) === '+7';
17
20
  var resultNumber = '';
18
21
  // вставка в поле c "+"
19
22
  if (phoneValue === '+') {
20
23
  resultNumber = "+".concat(cutNumber);
21
24
  // вставка в поле, в которое введена часть номера
22
25
  }
26
+ else if (phoneValue === '+7' && isRuNumberInBuffer) {
27
+ resultNumber = "+7".concat(cutNumber.substring(cutNumber.length - 10));
28
+ }
23
29
  else if (phoneValue) {
24
30
  var startText = phoneValue.substring(0, selectionStart || 0);
25
31
  var endText = phoneValue.substring(selectionEnd || 0);
package/esm/component.js CHANGED
@@ -16,7 +16,7 @@ import './components/flag-icon/flagSprite.js';
16
16
  import '@alfalab/core-components-select/esm';
17
17
  import './components/select-field/component.js';
18
18
 
19
- var styles = {"addons":"intl-phone-input__addons_1d53g","l":"intl-phone-input__l_1d53g","xl":"intl-phone-input__xl_1d53g","flagIconWrapper":"intl-phone-input__flagIconWrapper_1d53g","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_1d53g"};
19
+ var styles = {"addons":"intl-phone-input__addons_u0bog","l":"intl-phone-input__l_u0bog","xl":"intl-phone-input__xl_u0bog","flagIconWrapper":"intl-phone-input__flagIconWrapper_u0bog","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_u0bog"};
20
20
  require('./index.css')
21
21
 
22
22
  var countriesHash = getCountriesHash();
@@ -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":"intl-phone-input__flagIcon_1j3gq","flagPlaceholder":"intl-phone-input__flagPlaceholder_1j3gq"};
5
+ var styles = {"flagIcon":"intl-phone-input__flagIcon_1szsk","flagPlaceholder":"intl-phone-input__flagPlaceholder_1szsk"};
6
6
  require('./index.css')
7
7
 
8
8
  /**
@@ -1,4 +1,4 @@
1
- /* hash: 1fgo1 */
1
+ /* hash: qmt4e */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-specialbg-tertiary-transparent: rgba(11, 31, 53, 0.1); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* 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
- } .intl-phone-input__flagIcon_1j3gq {
20
+ } .intl-phone-input__flagIcon_1szsk {
21
21
  max-width: 24px;
22
22
  max-height: 24px;
23
- } .intl-phone-input__flagPlaceholder_1j3gq {
23
+ } .intl-phone-input__flagPlaceholder_1szsk {
24
24
  width: 24px;
25
25
  height: 16px;
26
26
  max-height: 16px;
@@ -9,7 +9,7 @@ import 'react-merge-refs';
9
9
  import '@alfalab/hooks';
10
10
  import '@alfalab/icons-glyph/WorldMagnifierMIcon';
11
11
 
12
- var styles = {"component":"intl-phone-input__component_17e6h","option":"intl-phone-input__option_17e6h","flag":"intl-phone-input__flag_17e6h","countryName":"intl-phone-input__countryName_17e6h","dialCode":"intl-phone-input__dialCode_17e6h"};
12
+ var styles = {"component":"intl-phone-input__component_1cvpy","option":"intl-phone-input__option_1cvpy","flag":"intl-phone-input__flag_1cvpy","countryName":"intl-phone-input__countryName_1cvpy","dialCode":"intl-phone-input__dialCode_1cvpy"};
13
13
  require('./index.css')
14
14
 
15
15
  var CountriesSelect = function (_a) {
@@ -1,4 +1,4 @@
1
- /* hash: 1vh8j */
1
+ /* hash: z304d */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-text-secondary: rgba(60, 60, 67, 0.66); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* 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,19 +17,19 @@
17
17
  } :root {
18
18
  } :root {
19
19
  --text-secondary-color: var(--color-light-text-secondary);
20
- } .intl-phone-input__component_17e6h {
20
+ } .intl-phone-input__component_1cvpy {
21
21
  position: static;
22
22
  display: flex;
23
23
  min-width: initial;
24
24
  height: 100%;
25
- } .intl-phone-input__option_17e6h {
25
+ } .intl-phone-input__option_1cvpy {
26
26
  display: flex;
27
27
  align-items: flex-start;
28
- } .intl-phone-input__flag_17e6h {
28
+ } .intl-phone-input__flag_1cvpy {
29
29
  flex-shrink: 0;
30
30
  margin-right: var(--gap-xs);
31
- } .intl-phone-input__countryName_17e6h {
31
+ } .intl-phone-input__countryName_1cvpy {
32
32
  margin-right: var(--gap-xs);
33
- } .intl-phone-input__dialCode_17e6h {
33
+ } .intl-phone-input__dialCode_1cvpy {
34
34
  color: var(--text-secondary-color);
35
35
  }
@@ -7,7 +7,7 @@ import WorldMagnifierMIcon from '@alfalab/icons-glyph/WorldMagnifierMIcon';
7
7
  import { FlagIcon } from '../flag-icon/component.js';
8
8
  import '../flag-icon/flagSprite.js';
9
9
 
10
- var styles = {"component":"intl-phone-input__component_1g81e","flagIconContainer":"intl-phone-input__flagIconContainer_1g81e","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_1g81e","disabled":"intl-phone-input__disabled_1g81e","inner":"intl-phone-input__inner_1g81e","l":"intl-phone-input__l_1g81e","xl":"intl-phone-input__xl_1g81e","focusVisible":"intl-phone-input__focusVisible_1g81e"};
10
+ var styles = {"component":"intl-phone-input__component_1465p","flagIconContainer":"intl-phone-input__flagIconContainer_1465p","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_1465p","disabled":"intl-phone-input__disabled_1465p","inner":"intl-phone-input__inner_1465p","l":"intl-phone-input__l_1465p","xl":"intl-phone-input__xl_1465p","focusVisible":"intl-phone-input__focusVisible_1465p"};
11
11
  require('./index.css')
12
12
 
13
13
  var EMPTY_COUNTRY_SELECT_FIELD = {
@@ -1,4 +1,4 @@
1
- /* hash: e0afr */
1
+ /* hash: 1eams */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-border-link: #0072ef;
@@ -21,33 +21,33 @@
21
21
  } :root {
22
22
  --focus-color: var(--color-light-border-link);
23
23
  --disabled-cursor: not-allowed;
24
- } .intl-phone-input__component_1g81e {
24
+ } .intl-phone-input__component_1465p {
25
25
  height: 100%;
26
26
  cursor: pointer;
27
27
  outline: none;
28
28
  position: relative;
29
- } .intl-phone-input__flagIconContainer_1g81e {
29
+ } .intl-phone-input__flagIconContainer_1465p {
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
- } .intl-phone-input__emptyCountryIcon_1g81e {
36
+ } .intl-phone-input__emptyCountryIcon_1465p {
37
37
  color: var(--color-light-graphic-secondary);
38
- } .intl-phone-input__disabled_1g81e {
38
+ } .intl-phone-input__disabled_1465p {
39
39
  cursor: var(--disabled-cursor);
40
- } .intl-phone-input__inner_1g81e {
40
+ } .intl-phone-input__inner_1465p {
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
- } .intl-phone-input__l_1g81e .intl-phone-input__inner_1g81e,
48
- .intl-phone-input__xl_1g81e .intl-phone-input__inner_1g81e {
47
+ } .intl-phone-input__l_1465p .intl-phone-input__inner_1465p,
48
+ .intl-phone-input__xl_1465p .intl-phone-input__inner_1465p {
49
49
  padding-left: var(--gap-m);
50
- } .intl-phone-input__focusVisible_1g81e {
50
+ } .intl-phone-input__focusVisible_1465p {
51
51
  outline: 2px solid var(--focus-color);
52
52
  outline-offset: 2px;
53
53
  }
package/esm/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: 1vyok */
1
+ /* hash: 19y6b */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-graphic-secondary: #86868a; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
@@ -16,17 +16,17 @@
16
16
  --gap-s: 12px;
17
17
  } :root {
18
18
  } :root {
19
- } .intl-phone-input__addons_1d53g {
19
+ } .intl-phone-input__addons_u0bog {
20
20
  padding-left: 0;
21
- } .intl-phone-input__l_1d53g .intl-phone-input__addons_1d53g, .intl-phone-input__xl_1d53g .intl-phone-input__addons_1d53g {
21
+ } .intl-phone-input__l_u0bog .intl-phone-input__addons_u0bog, .intl-phone-input__xl_u0bog .intl-phone-input__addons_u0bog {
22
22
  padding-left: 0;
23
- } .intl-phone-input__flagIconWrapper_1d53g {
23
+ } .intl-phone-input__flagIconWrapper_u0bog {
24
24
  display: flex;
25
25
  justify-content: center;
26
26
  align-items: center;
27
27
  width: 24px;
28
28
  height: 24px;
29
29
  margin-left: var(--gap-s);
30
- } .intl-phone-input__emptyCountryIcon_1d53g {
30
+ } .intl-phone-input__emptyCountryIcon_u0bog {
31
31
  color: var(--color-light-graphic-secondary);
32
32
  }
@@ -2,7 +2,9 @@
2
2
  * Подготовка данных для вставки из буфера обмена.
3
3
  * @param phoneValue Телефон уже введённый в поле ввода.
4
4
  * @param phoneFromBuffer Текст номера телефона из буфера обмена.
5
- * @param input Input в который осуществляется вставка.
5
+ * @param selectionStart Начало выделенного в инпуте текста
6
+ * @param selectionEnd Конец выделенного в инпуте текста
7
+ * @param ruNumberPriority Приоритетность российского номера в инпуте
6
8
  */
7
9
  declare function preparePasteData(phoneValue: string, phoneFromBuffer: string, selectionStart?: number, selectionEnd?: number, ruNumberPriority?: boolean): string;
8
10
  export { preparePasteData };
@@ -2,20 +2,26 @@
2
2
  * Подготовка данных для вставки из буфера обмена.
3
3
  * @param phoneValue Телефон уже введённый в поле ввода.
4
4
  * @param phoneFromBuffer Текст номера телефона из буфера обмена.
5
- * @param input Input в который осуществляется вставка.
5
+ * @param selectionStart Начало выделенного в инпуте текста
6
+ * @param selectionEnd Конец выделенного в инпуте текста
7
+ * @param ruNumberPriority Приоритетность российского номера в инпуте
6
8
  */
9
+ /* eslint complexity: [1, 25] */
7
10
  function preparePasteData(phoneValue, phoneFromBuffer, selectionStart, selectionEnd, ruNumberPriority) {
8
- var trimNuber = phoneFromBuffer.trim();
9
- var cutNumberWithPlus = trimNuber.replace(/[^+\d]/g, '');
11
+ var trimNumber = phoneFromBuffer.trim();
12
+ var cutNumberWithPlus = trimNumber.replace(/[^+\d]/g, '');
10
13
  var isTextHavePlus = cutNumberWithPlus[0] === '+';
11
- var cutNumber = trimNuber.replace(/[^\d]/g, '');
12
- var isRuNumberInBuffer = cutNumber[0] === '7' || cutNumber[0] === '8';
14
+ var cutNumber = trimNumber.replace(/[^\d]/g, '');
15
+ var isRuNumberInBuffer = cutNumber[0] === '7' || cutNumber[0] === '8' || cutNumber.substring(0, 2) === '+7';
13
16
  var resultNumber = '';
14
17
  // вставка в поле c "+"
15
18
  if (phoneValue === '+') {
16
19
  resultNumber = "+".concat(cutNumber);
17
20
  // вставка в поле, в которое введена часть номера
18
21
  }
22
+ else if (phoneValue === '+7' && isRuNumberInBuffer) {
23
+ resultNumber = "+7".concat(cutNumber.substring(cutNumber.length - 10));
24
+ }
19
25
  else if (phoneValue) {
20
26
  var startText = phoneValue.substring(0, selectionStart || 0);
21
27
  var endText = phoneValue.substring(selectionEnd || 0);
package/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: 1vyok */
1
+ /* hash: 19y6b */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-graphic-secondary: #86868a; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
@@ -16,17 +16,17 @@
16
16
  --gap-s: 12px;
17
17
  } :root {
18
18
  } :root {
19
- } .intl-phone-input__addons_1d53g {
19
+ } .intl-phone-input__addons_u0bog {
20
20
  padding-left: 0;
21
- } .intl-phone-input__l_1d53g .intl-phone-input__addons_1d53g, .intl-phone-input__xl_1d53g .intl-phone-input__addons_1d53g {
21
+ } .intl-phone-input__l_u0bog .intl-phone-input__addons_u0bog, .intl-phone-input__xl_u0bog .intl-phone-input__addons_u0bog {
22
22
  padding-left: 0;
23
- } .intl-phone-input__flagIconWrapper_1d53g {
23
+ } .intl-phone-input__flagIconWrapper_u0bog {
24
24
  display: flex;
25
25
  justify-content: center;
26
26
  align-items: center;
27
27
  width: 24px;
28
28
  height: 24px;
29
29
  margin-left: var(--gap-s);
30
- } .intl-phone-input__emptyCountryIcon_1d53g {
30
+ } .intl-phone-input__emptyCountryIcon_u0bog {
31
31
  color: var(--color-light-graphic-secondary);
32
32
  }
@@ -15,7 +15,7 @@ import './components/flag-icon/flagSprite.js';
15
15
  import '@alfalab/core-components-select/modern';
16
16
  import './components/select-field/component.js';
17
17
 
18
- const styles = {"addons":"intl-phone-input__addons_1d53g","l":"intl-phone-input__l_1d53g","xl":"intl-phone-input__xl_1d53g","flagIconWrapper":"intl-phone-input__flagIconWrapper_1d53g","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_1d53g"};
18
+ const styles = {"addons":"intl-phone-input__addons_u0bog","l":"intl-phone-input__l_u0bog","xl":"intl-phone-input__xl_u0bog","flagIconWrapper":"intl-phone-input__flagIconWrapper_u0bog","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_u0bog"};
19
19
  require('./index.css')
20
20
 
21
21
  const countriesHash = getCountriesHash();
@@ -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":"intl-phone-input__flagIcon_1j3gq","flagPlaceholder":"intl-phone-input__flagPlaceholder_1j3gq"};
5
+ const styles = {"flagIcon":"intl-phone-input__flagIcon_1szsk","flagPlaceholder":"intl-phone-input__flagPlaceholder_1szsk"};
6
6
  require('./index.css')
7
7
 
8
8
  /**
@@ -1,4 +1,4 @@
1
- /* hash: 1fgo1 */
1
+ /* hash: qmt4e */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-specialbg-tertiary-transparent: rgba(11, 31, 53, 0.1); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* 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
- } .intl-phone-input__flagIcon_1j3gq {
20
+ } .intl-phone-input__flagIcon_1szsk {
21
21
  max-width: 24px;
22
22
  max-height: 24px;
23
- } .intl-phone-input__flagPlaceholder_1j3gq {
23
+ } .intl-phone-input__flagPlaceholder_1szsk {
24
24
  width: 24px;
25
25
  height: 16px;
26
26
  max-height: 16px;
@@ -8,7 +8,7 @@ import 'react-merge-refs';
8
8
  import '@alfalab/hooks';
9
9
  import '@alfalab/icons-glyph/WorldMagnifierMIcon';
10
10
 
11
- const styles = {"component":"intl-phone-input__component_17e6h","option":"intl-phone-input__option_17e6h","flag":"intl-phone-input__flag_17e6h","countryName":"intl-phone-input__countryName_17e6h","dialCode":"intl-phone-input__dialCode_17e6h"};
11
+ const styles = {"component":"intl-phone-input__component_1cvpy","option":"intl-phone-input__option_1cvpy","flag":"intl-phone-input__flag_1cvpy","countryName":"intl-phone-input__countryName_1cvpy","dialCode":"intl-phone-input__dialCode_1cvpy"};
12
12
  require('./index.css')
13
13
 
14
14
  /* eslint-disable jsx-a11y/no-static-element-interactions */
@@ -1,4 +1,4 @@
1
- /* hash: 1vh8j */
1
+ /* hash: z304d */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-text-secondary: rgba(60, 60, 67, 0.66); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* 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,19 +17,19 @@
17
17
  } :root {
18
18
  } :root {
19
19
  --text-secondary-color: var(--color-light-text-secondary);
20
- } .intl-phone-input__component_17e6h {
20
+ } .intl-phone-input__component_1cvpy {
21
21
  position: static;
22
22
  display: flex;
23
23
  min-width: initial;
24
24
  height: 100%;
25
- } .intl-phone-input__option_17e6h {
25
+ } .intl-phone-input__option_1cvpy {
26
26
  display: flex;
27
27
  align-items: flex-start;
28
- } .intl-phone-input__flag_17e6h {
28
+ } .intl-phone-input__flag_1cvpy {
29
29
  flex-shrink: 0;
30
30
  margin-right: var(--gap-xs);
31
- } .intl-phone-input__countryName_17e6h {
31
+ } .intl-phone-input__countryName_1cvpy {
32
32
  margin-right: var(--gap-xs);
33
- } .intl-phone-input__dialCode_17e6h {
33
+ } .intl-phone-input__dialCode_1cvpy {
34
34
  color: var(--text-secondary-color);
35
35
  }
@@ -6,7 +6,7 @@ import WorldMagnifierMIcon from '@alfalab/icons-glyph/WorldMagnifierMIcon';
6
6
  import { FlagIcon } from '../flag-icon/component.js';
7
7
  import '../flag-icon/flagSprite.js';
8
8
 
9
- const styles = {"component":"intl-phone-input__component_1g81e","flagIconContainer":"intl-phone-input__flagIconContainer_1g81e","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_1g81e","disabled":"intl-phone-input__disabled_1g81e","inner":"intl-phone-input__inner_1g81e","l":"intl-phone-input__l_1g81e","xl":"intl-phone-input__xl_1g81e","focusVisible":"intl-phone-input__focusVisible_1g81e"};
9
+ const styles = {"component":"intl-phone-input__component_1465p","flagIconContainer":"intl-phone-input__flagIconContainer_1465p","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_1465p","disabled":"intl-phone-input__disabled_1465p","inner":"intl-phone-input__inner_1465p","l":"intl-phone-input__l_1465p","xl":"intl-phone-input__xl_1465p","focusVisible":"intl-phone-input__focusVisible_1465p"};
10
10
  require('./index.css')
11
11
 
12
12
  const EMPTY_COUNTRY_SELECT_FIELD = {
@@ -1,4 +1,4 @@
1
- /* hash: e0afr */
1
+ /* hash: 1eams */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-border-link: #0072ef;
@@ -21,33 +21,33 @@
21
21
  } :root {
22
22
  --focus-color: var(--color-light-border-link);
23
23
  --disabled-cursor: not-allowed;
24
- } .intl-phone-input__component_1g81e {
24
+ } .intl-phone-input__component_1465p {
25
25
  height: 100%;
26
26
  cursor: pointer;
27
27
  outline: none;
28
28
  position: relative;
29
- } .intl-phone-input__flagIconContainer_1g81e {
29
+ } .intl-phone-input__flagIconContainer_1465p {
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
- } .intl-phone-input__emptyCountryIcon_1g81e {
36
+ } .intl-phone-input__emptyCountryIcon_1465p {
37
37
  color: var(--color-light-graphic-secondary);
38
- } .intl-phone-input__disabled_1g81e {
38
+ } .intl-phone-input__disabled_1465p {
39
39
  cursor: var(--disabled-cursor);
40
- } .intl-phone-input__inner_1g81e {
40
+ } .intl-phone-input__inner_1465p {
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
- } .intl-phone-input__l_1g81e .intl-phone-input__inner_1g81e,
48
- .intl-phone-input__xl_1g81e .intl-phone-input__inner_1g81e {
47
+ } .intl-phone-input__l_1465p .intl-phone-input__inner_1465p,
48
+ .intl-phone-input__xl_1465p .intl-phone-input__inner_1465p {
49
49
  padding-left: var(--gap-m);
50
- } .intl-phone-input__focusVisible_1g81e {
50
+ } .intl-phone-input__focusVisible_1465p {
51
51
  outline: 2px solid var(--focus-color);
52
52
  outline-offset: 2px;
53
53
  }
package/modern/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: 1vyok */
1
+ /* hash: 19y6b */
2
2
  :root {
3
3
  } /* deprecated */ :root {
4
4
  --color-light-graphic-secondary: #86868a; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
@@ -16,17 +16,17 @@
16
16
  --gap-s: 12px;
17
17
  } :root {
18
18
  } :root {
19
- } .intl-phone-input__addons_1d53g {
19
+ } .intl-phone-input__addons_u0bog {
20
20
  padding-left: 0;
21
- } .intl-phone-input__l_1d53g .intl-phone-input__addons_1d53g, .intl-phone-input__xl_1d53g .intl-phone-input__addons_1d53g {
21
+ } .intl-phone-input__l_u0bog .intl-phone-input__addons_u0bog, .intl-phone-input__xl_u0bog .intl-phone-input__addons_u0bog {
22
22
  padding-left: 0;
23
- } .intl-phone-input__flagIconWrapper_1d53g {
23
+ } .intl-phone-input__flagIconWrapper_u0bog {
24
24
  display: flex;
25
25
  justify-content: center;
26
26
  align-items: center;
27
27
  width: 24px;
28
28
  height: 24px;
29
29
  margin-left: var(--gap-s);
30
- } .intl-phone-input__emptyCountryIcon_1d53g {
30
+ } .intl-phone-input__emptyCountryIcon_u0bog {
31
31
  color: var(--color-light-graphic-secondary);
32
32
  }
@@ -2,7 +2,9 @@
2
2
  * Подготовка данных для вставки из буфера обмена.
3
3
  * @param phoneValue Телефон уже введённый в поле ввода.
4
4
  * @param phoneFromBuffer Текст номера телефона из буфера обмена.
5
- * @param input Input в который осуществляется вставка.
5
+ * @param selectionStart Начало выделенного в инпуте текста
6
+ * @param selectionEnd Конец выделенного в инпуте текста
7
+ * @param ruNumberPriority Приоритетность российского номера в инпуте
6
8
  */
7
9
  declare function preparePasteData(phoneValue: string, phoneFromBuffer: string, selectionStart?: number, selectionEnd?: number, ruNumberPriority?: boolean): string;
8
10
  export { preparePasteData };
@@ -2,20 +2,26 @@
2
2
  * Подготовка данных для вставки из буфера обмена.
3
3
  * @param phoneValue Телефон уже введённый в поле ввода.
4
4
  * @param phoneFromBuffer Текст номера телефона из буфера обмена.
5
- * @param input Input в который осуществляется вставка.
5
+ * @param selectionStart Начало выделенного в инпуте текста
6
+ * @param selectionEnd Конец выделенного в инпуте текста
7
+ * @param ruNumberPriority Приоритетность российского номера в инпуте
6
8
  */
9
+ /* eslint complexity: [1, 25] */
7
10
  function preparePasteData(phoneValue, phoneFromBuffer, selectionStart, selectionEnd, ruNumberPriority) {
8
- const trimNuber = phoneFromBuffer.trim();
9
- const cutNumberWithPlus = trimNuber.replace(/[^+\d]/g, '');
11
+ const trimNumber = phoneFromBuffer.trim();
12
+ const cutNumberWithPlus = trimNumber.replace(/[^+\d]/g, '');
10
13
  const isTextHavePlus = cutNumberWithPlus[0] === '+';
11
- const cutNumber = trimNuber.replace(/[^\d]/g, '');
12
- const isRuNumberInBuffer = cutNumber[0] === '7' || cutNumber[0] === '8';
14
+ const cutNumber = trimNumber.replace(/[^\d]/g, '');
15
+ const isRuNumberInBuffer = cutNumber[0] === '7' || cutNumber[0] === '8' || cutNumber.substring(0, 2) === '+7';
13
16
  let resultNumber = '';
14
17
  // вставка в поле c "+"
15
18
  if (phoneValue === '+') {
16
19
  resultNumber = `+${cutNumber}`;
17
20
  // вставка в поле, в которое введена часть номера
18
21
  }
22
+ else if (phoneValue === '+7' && isRuNumberInBuffer) {
23
+ resultNumber = `+7${cutNumber.substring(cutNumber.length - 10)}`;
24
+ }
19
25
  else if (phoneValue) {
20
26
  const startText = phoneValue.substring(0, selectionStart || 0);
21
27
  const endText = phoneValue.substring(selectionEnd || 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-intl-phone-input",
3
- "version": "9.3.2",
3
+ "version": "9.3.3",
4
4
  "description": "Phone input for international phones",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -2,7 +2,9 @@
2
2
  * Подготовка данных для вставки из буфера обмена.
3
3
  * @param phoneValue Телефон уже введённый в поле ввода.
4
4
  * @param phoneFromBuffer Текст номера телефона из буфера обмена.
5
- * @param input Input в который осуществляется вставка.
5
+ * @param selectionStart Начало выделенного в инпуте текста
6
+ * @param selectionEnd Конец выделенного в инпуте текста
7
+ * @param ruNumberPriority Приоритетность российского номера в инпуте
6
8
  */
7
9
  declare function preparePasteData(phoneValue: string, phoneFromBuffer: string, selectionStart?: number, selectionEnd?: number, ruNumberPriority?: boolean): string;
8
10
  export { preparePasteData };
@@ -6,20 +6,26 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  * Подготовка данных для вставки из буфера обмена.
7
7
  * @param phoneValue Телефон уже введённый в поле ввода.
8
8
  * @param phoneFromBuffer Текст номера телефона из буфера обмена.
9
- * @param input Input в который осуществляется вставка.
9
+ * @param selectionStart Начало выделенного в инпуте текста
10
+ * @param selectionEnd Конец выделенного в инпуте текста
11
+ * @param ruNumberPriority Приоритетность российского номера в инпуте
10
12
  */
13
+ /* eslint complexity: [1, 25] */
11
14
  function preparePasteData(phoneValue, phoneFromBuffer, selectionStart, selectionEnd, ruNumberPriority) {
12
- var trimNuber = phoneFromBuffer.trim();
13
- var cutNumberWithPlus = trimNuber.replace(/[^+\d]/g, '');
15
+ var trimNumber = phoneFromBuffer.trim();
16
+ var cutNumberWithPlus = trimNumber.replace(/[^+\d]/g, '');
14
17
  var isTextHavePlus = cutNumberWithPlus[0] === '+';
15
- var cutNumber = trimNuber.replace(/[^\d]/g, '');
16
- var isRuNumberInBuffer = cutNumber[0] === '7' || cutNumber[0] === '8';
18
+ var cutNumber = trimNumber.replace(/[^\d]/g, '');
19
+ var isRuNumberInBuffer = cutNumber[0] === '7' || cutNumber[0] === '8' || cutNumber.substring(0, 2) === '+7';
17
20
  var resultNumber = '';
18
21
  // вставка в поле c "+"
19
22
  if (phoneValue === '+') {
20
23
  resultNumber = "+".concat(cutNumber);
21
24
  // вставка в поле, в которое введена часть номера
22
25
  }
26
+ else if (phoneValue === '+7' && isRuNumberInBuffer) {
27
+ resultNumber = "+7".concat(cutNumber.substring(cutNumber.length - 10));
28
+ }
23
29
  else if (phoneValue) {
24
30
  var startText = phoneValue.substring(0, selectionStart || 0);
25
31
  var endText = phoneValue.substring(selectionEnd || 0);