@alfalab/core-components-intl-phone-input 9.2.0 → 9.2.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.
Files changed (82) hide show
  1. package/{component-b3b0e670.d.ts → component-d11f26be.d.ts} +0 -0
  2. package/{component-b3b0e670.js → component-d11f26be.js} +7 -14
  3. package/component.d.ts +1 -1
  4. package/component.js +16 -24
  5. package/components/flag-icon/component.js +2 -9
  6. package/components/flag-icon/flagSprite.js +0 -2
  7. package/components/flag-icon/index.css +3 -3
  8. package/components/flag-icon/index.js +1 -3
  9. package/components/index.js +5 -7
  10. package/components/select/component.js +15 -21
  11. package/components/select/index.css +6 -6
  12. package/components/select/index.js +5 -7
  13. package/components/select-field/component.js +4 -6
  14. package/components/select-field/index.css +9 -9
  15. package/components/select-field/index.d.ts +1 -1
  16. package/components/select-field/index.js +4 -6
  17. package/cssm/{component-1eeab8e9.d.ts → component-555bdbef.d.ts} +0 -0
  18. package/cssm/{component-1eeab8e9.js → component-555bdbef.js} +8 -16
  19. package/cssm/component.d.ts +1 -1
  20. package/cssm/component.js +17 -26
  21. package/cssm/components/flag-icon/component.js +1 -9
  22. package/cssm/components/flag-icon/flagSprite.js +0 -2
  23. package/cssm/components/flag-icon/index.js +1 -3
  24. package/cssm/components/index.js +6 -8
  25. package/cssm/components/select/component.js +16 -23
  26. package/cssm/components/select/index.js +5 -7
  27. package/cssm/components/select-field/component.js +5 -7
  28. package/cssm/components/select-field/index.d.ts +1 -1
  29. package/cssm/components/select-field/index.js +4 -6
  30. package/cssm/index.js +10 -12
  31. package/cssm/{libphonenumber-js.min-903db150.d.ts → libphonenumber-js.min-e2e76e74.d.ts} +0 -0
  32. package/cssm/{libphonenumber-js.min-903db150.js → libphonenumber-js.min-e2e76e74.js} +0 -0
  33. package/cssm/useCaretAvoidCountryCode.js +0 -2
  34. package/cssm/utils/calculateCaretPos.js +0 -2
  35. package/cssm/utils/format-phone-with-unclearable-country-code.js +2 -4
  36. package/cssm/utils/preparePasteData.js +7 -9
  37. package/esm/{component-1fd0e5df.d.ts → component-f7046474.d.ts} +0 -0
  38. package/esm/{component-1fd0e5df.js → component-f7046474.js} +3 -3
  39. package/esm/component.d.ts +1 -1
  40. package/esm/component.js +15 -15
  41. package/esm/components/flag-icon/component.js +1 -1
  42. package/esm/components/flag-icon/index.css +3 -3
  43. package/esm/components/flag-icon/index.js +1 -1
  44. package/esm/components/index.js +5 -5
  45. package/esm/components/select/component.js +6 -6
  46. package/esm/components/select/index.css +6 -6
  47. package/esm/components/select/index.js +5 -5
  48. package/esm/components/select-field/component.js +4 -4
  49. package/esm/components/select-field/index.css +9 -9
  50. package/esm/components/select-field/index.d.ts +1 -1
  51. package/esm/components/select-field/index.js +4 -4
  52. package/esm/index.css +5 -5
  53. package/esm/index.js +8 -8
  54. package/esm/{libphonenumber-js.min-ae2df8d5.d.ts → libphonenumber-js.min-2001ae08.d.ts} +0 -0
  55. package/esm/{libphonenumber-js.min-ae2df8d5.js → libphonenumber-js.min-2001ae08.js} +0 -0
  56. package/esm/utils/format-phone-with-unclearable-country-code.js +2 -2
  57. package/esm/utils/preparePasteData.js +7 -7
  58. package/index.css +5 -5
  59. package/index.js +8 -10
  60. package/{libphonenumber-js.min-0775258e.d.ts → libphonenumber-js.min-ebcb18c3.d.ts} +0 -0
  61. package/{libphonenumber-js.min-0775258e.js → libphonenumber-js.min-ebcb18c3.js} +0 -0
  62. package/modern/component.d.ts +1 -1
  63. package/modern/component.js +5 -5
  64. package/modern/components/flag-icon/component.js +1 -1
  65. package/modern/components/flag-icon/index.css +3 -3
  66. package/modern/components/flag-icon/index.js +1 -1
  67. package/modern/components/index.js +5 -5
  68. package/modern/components/select/component.js +6 -6
  69. package/modern/components/select/index.css +6 -6
  70. package/modern/components/select/index.js +6 -6
  71. package/modern/components/select-field/component.js +4 -4
  72. package/modern/components/select-field/index.css +9 -9
  73. package/modern/components/select-field/index.js +4 -4
  74. package/modern/index.css +5 -5
  75. package/modern/index.js +4 -4
  76. package/modern/{libphonenumber-js.min-ae2df8d5.d.ts → libphonenumber-js.min-2001ae08.d.ts} +0 -0
  77. package/modern/{libphonenumber-js.min-ae2df8d5.js → libphonenumber-js.min-2001ae08.js} +0 -0
  78. package/package.json +3 -3
  79. package/useCaretAvoidCountryCode.js +0 -2
  80. package/utils/calculateCaretPos.js +0 -2
  81. package/utils/format-phone-with-unclearable-country-code.js +2 -4
  82. package/utils/preparePasteData.js +7 -9
@@ -1,4 +1,4 @@
1
- /* hash: 3jm6f */
1
+ /* hash: y6xme */
2
2
  :root {
3
3
  --color-light-text-secondary: rgba(11, 31, 53, 0.7);
4
4
  }
@@ -16,23 +16,23 @@
16
16
  :root {
17
17
  --text-secondary-color: var(--color-light-text-secondary);
18
18
  }
19
- .intl-phone-input__component_1hlhb {
19
+ .intl-phone-input__component_fjoop {
20
20
  position: static;
21
21
  display: flex;
22
22
  min-width: initial;
23
23
  height: 100%;
24
24
  }
25
- .intl-phone-input__option_1hlhb {
25
+ .intl-phone-input__option_fjoop {
26
26
  display: flex;
27
27
  align-items: flex-start;
28
28
  }
29
- .intl-phone-input__flag_1hlhb {
29
+ .intl-phone-input__flag_fjoop {
30
30
  flex-shrink: 0;
31
31
  margin-right: var(--gap-xs);
32
32
  }
33
- .intl-phone-input__countryName_1hlhb {
33
+ .intl-phone-input__countryName_fjoop {
34
34
  margin-right: var(--gap-xs);
35
35
  }
36
- .intl-phone-input__dialCode_1hlhb {
36
+ .intl-phone-input__dialCode_fjoop {
37
37
  color: var(--text-secondary-color);
38
38
  }
@@ -1,10 +1,10 @@
1
+ export { CountriesSelect } from './component.js';
1
2
  import 'react';
3
+ import '@alfalab/core-components-select/modern';
4
+ import '../flag-icon/component.js';
2
5
  import 'classnames';
3
- import '@alfalab/icons-glyph/WorldMagnifierMIcon';
4
- import 'react-merge-refs';
5
- import '@alfalab/hooks';
6
6
  import '../flag-icon/flagSprite.js';
7
- import '../flag-icon/component.js';
8
7
  import '../select-field/component.js';
9
- import '@alfalab/core-components-select/modern';
10
- export { CountriesSelect } from './component.js';
8
+ import 'react-merge-refs';
9
+ import '@alfalab/hooks';
10
+ import '@alfalab/icons-glyph/WorldMagnifierMIcon';
@@ -1,12 +1,12 @@
1
1
  import React, { useRef } from 'react';
2
- import cn from 'classnames';
3
- import WorldMagnifierMIcon from '@alfalab/icons-glyph/WorldMagnifierMIcon';
4
2
  import mergeRefs from 'react-merge-refs';
3
+ import cn from 'classnames';
5
4
  import { useFocus } from '@alfalab/hooks';
6
- import '../flag-icon/flagSprite.js';
5
+ import WorldMagnifierMIcon from '@alfalab/icons-glyph/WorldMagnifierMIcon';
7
6
  import { FlagIcon } from '../flag-icon/component.js';
7
+ import '../flag-icon/flagSprite.js';
8
8
 
9
- var styles = {"component":"intl-phone-input__component_1xm4x","flagIconContainer":"intl-phone-input__flagIconContainer_1xm4x","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_1xm4x","disabled":"intl-phone-input__disabled_1xm4x","inner":"intl-phone-input__inner_1xm4x","l":"intl-phone-input__l_1xm4x","xl":"intl-phone-input__xl_1xm4x","focusVisible":"intl-phone-input__focusVisible_1xm4x"};
9
+ const styles = {"component":"intl-phone-input__component_10mti","flagIconContainer":"intl-phone-input__flagIconContainer_10mti","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_10mti","disabled":"intl-phone-input__disabled_10mti","inner":"intl-phone-input__inner_10mti","l":"intl-phone-input__l_10mti","xl":"intl-phone-input__xl_10mti","focusVisible":"intl-phone-input__focusVisible_10mti"};
10
10
  require('./index.css')
11
11
 
12
12
  const EMPTY_COUNTRY_SELECT_FIELD = {
@@ -1,4 +1,4 @@
1
- /* hash: 1sbmn */
1
+ /* hash: xob7f */
2
2
  :root {
3
3
  --color-light-border-link: #007aff;
4
4
  --color-light-graphic-secondary: #6d7986;
@@ -20,13 +20,13 @@
20
20
  --focus-color: var(--color-light-border-link);
21
21
  --disabled-cursor: not-allowed;
22
22
  }
23
- .intl-phone-input__component_1xm4x {
23
+ .intl-phone-input__component_10mti {
24
24
  height: 100%;
25
25
  cursor: pointer;
26
26
  outline: none;
27
27
  position: relative;
28
28
  }
29
- .intl-phone-input__flagIconContainer_1xm4x {
29
+ .intl-phone-input__flagIconContainer_10mti {
30
30
  display: flex;
31
31
  justify-content: center;
32
32
  align-items: center;
@@ -34,13 +34,13 @@
34
34
  height: 24px;
35
35
  margin-right: var(--gap-2xs);
36
36
  }
37
- .intl-phone-input__emptyCountryIcon_1xm4x {
37
+ .intl-phone-input__emptyCountryIcon_10mti {
38
38
  color: var(--color-light-graphic-secondary);
39
39
  }
40
- .intl-phone-input__disabled_1xm4x {
40
+ .intl-phone-input__disabled_10mti {
41
41
  cursor: var(--disabled-cursor);
42
42
  }
43
- .intl-phone-input__inner_1xm4x {
43
+ .intl-phone-input__inner_10mti {
44
44
  position: relative;
45
45
  display: flex;
46
46
  align-items: center;
@@ -48,11 +48,11 @@
48
48
  padding-left: var(--gap-s);
49
49
  outline: none;
50
50
  }
51
- .intl-phone-input__l_1xm4x .intl-phone-input__inner_1xm4x,
52
- .intl-phone-input__xl_1xm4x .intl-phone-input__inner_1xm4x {
51
+ .intl-phone-input__l_10mti .intl-phone-input__inner_10mti,
52
+ .intl-phone-input__xl_10mti .intl-phone-input__inner_10mti {
53
53
  padding-left: var(--gap-m);
54
54
  }
55
- .intl-phone-input__focusVisible_1xm4x {
55
+ .intl-phone-input__focusVisible_10mti {
56
56
  outline: 2px solid var(--focus-color);
57
57
  outline-offset: 2px;
58
58
  }
@@ -1,8 +1,8 @@
1
+ export { EMPTY_COUNTRY_SELECT_FIELD, SelectField } from './component.js';
1
2
  import 'react';
2
- import 'classnames';
3
- import '@alfalab/icons-glyph/WorldMagnifierMIcon';
4
3
  import 'react-merge-refs';
4
+ import 'classnames';
5
5
  import '@alfalab/hooks';
6
- import '../flag-icon/flagSprite.js';
6
+ import '@alfalab/icons-glyph/WorldMagnifierMIcon';
7
7
  import '../flag-icon/component.js';
8
- export { EMPTY_COUNTRY_SELECT_FIELD, SelectField } from './component.js';
8
+ import '../flag-icon/flagSprite.js';
package/modern/index.css CHANGED
@@ -1,4 +1,4 @@
1
- /* hash: 4127a */
1
+ /* hash: zzvdr */
2
2
  :root {
3
3
  --color-light-graphic-secondary: #6d7986;
4
4
  }
@@ -13,13 +13,13 @@
13
13
  :root {
14
14
  --gap-s: 12px;
15
15
  }
16
- .intl-phone-input__addons_bt23w {
16
+ .intl-phone-input__addons_1947q {
17
17
  padding-left: 0;
18
18
  }
19
- .intl-phone-input__l_bt23w .intl-phone-input__addons_bt23w, .intl-phone-input__xl_bt23w .intl-phone-input__addons_bt23w {
19
+ .intl-phone-input__l_1947q .intl-phone-input__addons_1947q, .intl-phone-input__xl_1947q .intl-phone-input__addons_1947q {
20
20
  padding-left: 0;
21
21
  }
22
- .intl-phone-input__flagIconWrapper_bt23w {
22
+ .intl-phone-input__flagIconWrapper_1947q {
23
23
  display: flex;
24
24
  justify-content: center;
25
25
  align-items: center;
@@ -27,6 +27,6 @@
27
27
  height: 24px;
28
28
  margin-left: var(--gap-s);
29
29
  }
30
- .intl-phone-input__emptyCountryIcon_bt23w {
30
+ .intl-phone-input__emptyCountryIcon_1947q {
31
31
  color: var(--color-light-graphic-secondary);
32
32
  }
package/modern/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { IntlPhoneInput } from './component.js';
1
2
  import 'react';
2
3
  import 'classnames';
3
4
  import '@alfalab/core-components-input-autocomplete/modern';
@@ -8,10 +9,9 @@ import './utils/format-phone-with-unclearable-country-code.js';
8
9
  import './utils/preparePasteData.js';
9
10
  import 'react-merge-refs';
10
11
  import '@alfalab/hooks';
11
- import './components/flag-icon/flagSprite.js';
12
12
  import './components/flag-icon/component.js';
13
- import './components/select-field/component.js';
14
- import '@alfalab/core-components-select/modern';
13
+ import './components/flag-icon/flagSprite.js';
15
14
  import './components/select/component.js';
15
+ import '@alfalab/core-components-select/modern';
16
+ import './components/select-field/component.js';
16
17
  import './useCaretAvoidCountryCode.js';
17
- export { IntlPhoneInput } from './component.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-intl-phone-input",
3
- "version": "9.2.0",
3
+ "version": "9.2.1",
4
4
  "description": "Phone input for international phones",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@alfalab/core-components-input": "^11.1.0",
21
- "@alfalab/core-components-input-autocomplete": "9.1.4",
22
- "@alfalab/core-components-select": "^13.2.1",
21
+ "@alfalab/core-components-input-autocomplete": "9.2.0",
22
+ "@alfalab/core-components-select": "^13.2.2",
23
23
  "@alfalab/hooks": "^1.4.1",
24
24
  "@alfalab/utils": "^1.13.3",
25
25
  "classnames": "^2.3.1",
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var React = require('react');
6
4
 
7
5
  function useCaretAvoidCountryCode(_a) {
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  /**
6
4
  * Расчет нового положения каретки.
7
5
  * @param phonePart Шаблон с которым сравнивается новое значение. (Часть телефона без маски с учетом удаленных и добавленных цифр).
@@ -1,14 +1,12 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var RUSSIAN_DIAL_CODE = '7';
6
4
  var RUSSIAN_NATIONAL_DIAL_CODE = '8';
7
5
  /**
8
6
  * Форматирует телефон с неудаляемым кодом страны
9
7
  */
10
8
  var formatPhoneWithUnclearableCountryCode = function (phone, country) {
11
- var countryPrefix = "+" + country.dialCode;
9
+ var countryPrefix = "+".concat(country.dialCode);
12
10
  if (phone.startsWith(countryPrefix)) {
13
11
  return phone;
14
12
  }
@@ -18,7 +16,7 @@ var formatPhoneWithUnclearableCountryCode = function (phone, country) {
18
16
  if (countryPrefix.startsWith(phone) || !phone) {
19
17
  return countryPrefix;
20
18
  }
21
- return countryPrefix + " " + phone;
19
+ return "".concat(countryPrefix, " ").concat(phone);
22
20
  };
23
21
 
24
22
  exports.formatPhoneWithUnclearableCountryCode = formatPhoneWithUnclearableCountryCode;
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  /**
6
4
  * Подготовка данных для вставки из буфера обмена.
7
5
  * @param phoneValue Телефон уже введённый в поле ввода.
@@ -17,7 +15,7 @@ function preparePasteData(phoneValue, phoneFromBuffer, selectionStart, selection
17
15
  var resultNumber = '';
18
16
  // вставка в поле c "+"
19
17
  if (phoneValue === '+') {
20
- resultNumber = "+" + cutNumber;
18
+ resultNumber = "+".concat(cutNumber);
21
19
  // вставка в поле, в которое введена часть номера
22
20
  }
23
21
  else if (phoneValue) {
@@ -25,16 +23,16 @@ function preparePasteData(phoneValue, phoneFromBuffer, selectionStart, selection
25
23
  var endText = phoneValue.substring(selectionEnd || 0);
26
24
  var isSelectPlus = selectionStart === 0 && selectionEnd !== 0;
27
25
  if (selectionStart === 0 && selectionEnd === 0 && !isTextHavePlus) {
28
- resultNumber = ("+" + cutNumber + phoneValue.substring(1)).replace(/[^+\d]/g, '');
26
+ resultNumber = "+".concat(cutNumber).concat(phoneValue.substring(1)).replace(/[^+\d]/g, '');
29
27
  }
30
28
  else if (!isTextHavePlus && !isSelectPlus) {
31
- resultNumber = ("" + startText + cutNumber + endText).replace(/[^+\d]/g, '');
29
+ resultNumber = "".concat(startText).concat(cutNumber).concat(endText).replace(/[^+\d]/g, '');
32
30
  }
33
31
  else if (isTextHavePlus && isSelectPlus) {
34
- resultNumber = ("" + cutNumberWithPlus + endText).replace(/[^+\d]/g, '');
32
+ resultNumber = "".concat(cutNumberWithPlus).concat(endText).replace(/[^+\d]/g, '');
35
33
  }
36
34
  else if (!isTextHavePlus && isSelectPlus) {
37
- resultNumber = ("+" + cutNumber + endText).replace(/[^+\d]/g, '');
35
+ resultNumber = "+".concat(cutNumber).concat(endText).replace(/[^+\d]/g, '');
38
36
  }
39
37
  // вставка в пустое поле
40
38
  }
@@ -45,11 +43,11 @@ function preparePasteData(phoneValue, phoneFromBuffer, selectionStart, selection
45
43
  // вставка номера начинающегося с "7" или "8" в пустое поле
46
44
  }
47
45
  else if (isRuNumberInBuffer) {
48
- resultNumber = "+7" + cutNumber.substring(1);
46
+ resultNumber = "+7".concat(cutNumber.substring(1));
49
47
  // вставка номера начинающегося НЕ с "7", "8", "+" в пустое поле
50
48
  }
51
49
  else {
52
- resultNumber = "+7" + cutNumber;
50
+ resultNumber = "+7".concat(cutNumber);
53
51
  }
54
52
  }
55
53
  return resultNumber;