@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.
- package/{component-b3b0e670.d.ts → component-d11f26be.d.ts} +0 -0
- package/{component-b3b0e670.js → component-d11f26be.js} +7 -14
- package/component.d.ts +1 -1
- package/component.js +16 -24
- package/components/flag-icon/component.js +2 -9
- package/components/flag-icon/flagSprite.js +0 -2
- package/components/flag-icon/index.css +3 -3
- package/components/flag-icon/index.js +1 -3
- package/components/index.js +5 -7
- package/components/select/component.js +15 -21
- package/components/select/index.css +6 -6
- package/components/select/index.js +5 -7
- package/components/select-field/component.js +4 -6
- package/components/select-field/index.css +9 -9
- package/components/select-field/index.d.ts +1 -1
- package/components/select-field/index.js +4 -6
- package/cssm/{component-1eeab8e9.d.ts → component-555bdbef.d.ts} +0 -0
- package/cssm/{component-1eeab8e9.js → component-555bdbef.js} +8 -16
- package/cssm/component.d.ts +1 -1
- package/cssm/component.js +17 -26
- package/cssm/components/flag-icon/component.js +1 -9
- package/cssm/components/flag-icon/flagSprite.js +0 -2
- package/cssm/components/flag-icon/index.js +1 -3
- package/cssm/components/index.js +6 -8
- package/cssm/components/select/component.js +16 -23
- package/cssm/components/select/index.js +5 -7
- package/cssm/components/select-field/component.js +5 -7
- package/cssm/components/select-field/index.d.ts +1 -1
- package/cssm/components/select-field/index.js +4 -6
- package/cssm/index.js +10 -12
- package/cssm/{libphonenumber-js.min-903db150.d.ts → libphonenumber-js.min-e2e76e74.d.ts} +0 -0
- package/cssm/{libphonenumber-js.min-903db150.js → libphonenumber-js.min-e2e76e74.js} +0 -0
- package/cssm/useCaretAvoidCountryCode.js +0 -2
- package/cssm/utils/calculateCaretPos.js +0 -2
- package/cssm/utils/format-phone-with-unclearable-country-code.js +2 -4
- package/cssm/utils/preparePasteData.js +7 -9
- package/esm/{component-1fd0e5df.d.ts → component-f7046474.d.ts} +0 -0
- package/esm/{component-1fd0e5df.js → component-f7046474.js} +3 -3
- package/esm/component.d.ts +1 -1
- package/esm/component.js +15 -15
- package/esm/components/flag-icon/component.js +1 -1
- package/esm/components/flag-icon/index.css +3 -3
- package/esm/components/flag-icon/index.js +1 -1
- package/esm/components/index.js +5 -5
- package/esm/components/select/component.js +6 -6
- package/esm/components/select/index.css +6 -6
- package/esm/components/select/index.js +5 -5
- package/esm/components/select-field/component.js +4 -4
- package/esm/components/select-field/index.css +9 -9
- package/esm/components/select-field/index.d.ts +1 -1
- package/esm/components/select-field/index.js +4 -4
- package/esm/index.css +5 -5
- package/esm/index.js +8 -8
- package/esm/{libphonenumber-js.min-ae2df8d5.d.ts → libphonenumber-js.min-2001ae08.d.ts} +0 -0
- package/esm/{libphonenumber-js.min-ae2df8d5.js → libphonenumber-js.min-2001ae08.js} +0 -0
- package/esm/utils/format-phone-with-unclearable-country-code.js +2 -2
- package/esm/utils/preparePasteData.js +7 -7
- package/index.css +5 -5
- package/index.js +8 -10
- package/{libphonenumber-js.min-0775258e.d.ts → libphonenumber-js.min-ebcb18c3.d.ts} +0 -0
- package/{libphonenumber-js.min-0775258e.js → libphonenumber-js.min-ebcb18c3.js} +0 -0
- package/modern/component.d.ts +1 -1
- package/modern/component.js +5 -5
- package/modern/components/flag-icon/component.js +1 -1
- package/modern/components/flag-icon/index.css +3 -3
- package/modern/components/flag-icon/index.js +1 -1
- package/modern/components/index.js +5 -5
- package/modern/components/select/component.js +6 -6
- package/modern/components/select/index.css +6 -6
- package/modern/components/select/index.js +6 -6
- package/modern/components/select-field/component.js +4 -4
- package/modern/components/select-field/index.css +9 -9
- package/modern/components/select-field/index.js +4 -4
- package/modern/index.css +5 -5
- package/modern/index.js +4 -4
- package/modern/{libphonenumber-js.min-ae2df8d5.d.ts → libphonenumber-js.min-2001ae08.d.ts} +0 -0
- package/modern/{libphonenumber-js.min-ae2df8d5.js → libphonenumber-js.min-2001ae08.js} +0 -0
- package/package.json +3 -3
- package/useCaretAvoidCountryCode.js +0 -2
- package/utils/calculateCaretPos.js +0 -2
- package/utils/format-phone-with-unclearable-country-code.js +2 -4
- package/utils/preparePasteData.js +7 -9
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
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-
|
|
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-
|
|
25
|
+
.intl-phone-input__option_fjoop {
|
|
26
26
|
display: flex;
|
|
27
27
|
align-items: flex-start;
|
|
28
28
|
}
|
|
29
|
-
.intl-phone-
|
|
29
|
+
.intl-phone-input__flag_fjoop {
|
|
30
30
|
flex-shrink: 0;
|
|
31
31
|
margin-right: var(--gap-xs);
|
|
32
32
|
}
|
|
33
|
-
.intl-phone-
|
|
33
|
+
.intl-phone-input__countryName_fjoop {
|
|
34
34
|
margin-right: var(--gap-xs);
|
|
35
35
|
}
|
|
36
|
-
.intl-phone-
|
|
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 '
|
|
10
|
-
|
|
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 '
|
|
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
|
-
|
|
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:
|
|
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-
|
|
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-
|
|
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-
|
|
37
|
+
.intl-phone-input__emptyCountryIcon_10mti {
|
|
38
38
|
color: var(--color-light-graphic-secondary);
|
|
39
39
|
}
|
|
40
|
-
.intl-phone-
|
|
40
|
+
.intl-phone-input__disabled_10mti {
|
|
41
41
|
cursor: var(--disabled-cursor);
|
|
42
42
|
}
|
|
43
|
-
.intl-phone-
|
|
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-
|
|
52
|
-
.intl-phone-
|
|
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-
|
|
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 '
|
|
6
|
+
import '@alfalab/icons-glyph/WorldMagnifierMIcon';
|
|
7
7
|
import '../flag-icon/component.js';
|
|
8
|
-
|
|
8
|
+
import '../flag-icon/flagSprite.js';
|
package/modern/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
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-
|
|
16
|
+
.intl-phone-input__addons_1947q {
|
|
17
17
|
padding-left: 0;
|
|
18
18
|
}
|
|
19
|
-
.intl-phone-
|
|
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-
|
|
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-
|
|
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/
|
|
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';
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-intl-phone-input",
|
|
3
|
-
"version": "9.2.
|
|
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.
|
|
22
|
-
"@alfalab/core-components-select": "^13.2.
|
|
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,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 = "+"
|
|
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
|
|
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 = "+"
|
|
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 =
|
|
26
|
+
resultNumber = "+".concat(cutNumber).concat(phoneValue.substring(1)).replace(/[^+\d]/g, '');
|
|
29
27
|
}
|
|
30
28
|
else if (!isTextHavePlus && !isSelectPlus) {
|
|
31
|
-
resultNumber =
|
|
29
|
+
resultNumber = "".concat(startText).concat(cutNumber).concat(endText).replace(/[^+\d]/g, '');
|
|
32
30
|
}
|
|
33
31
|
else if (isTextHavePlus && isSelectPlus) {
|
|
34
|
-
resultNumber =
|
|
32
|
+
resultNumber = "".concat(cutNumberWithPlus).concat(endText).replace(/[^+\d]/g, '');
|
|
35
33
|
}
|
|
36
34
|
else if (!isTextHavePlus && isSelectPlus) {
|
|
37
|
-
resultNumber =
|
|
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"
|
|
46
|
+
resultNumber = "+7".concat(cutNumber.substring(1));
|
|
49
47
|
// вставка номера начинающегося НЕ с "7", "8", "+" в пустое поле
|
|
50
48
|
}
|
|
51
49
|
else {
|
|
52
|
-
resultNumber = "+7"
|
|
50
|
+
resultNumber = "+7".concat(cutNumber);
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
return resultNumber;
|