@alfalab/core-components-intl-phone-input 9.2.9 → 9.2.11
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 +7 -6
- package/components/flag-icon/component.js +1 -1
- package/components/flag-icon/index.css +3 -3
- package/components/index.js +2 -1
- package/components/select/component.js +6 -5
- package/components/select/index.css +6 -6
- package/components/select/index.js +6 -5
- package/components/select-field/component.d.ts +8 -0
- package/components/select-field/component.js +36 -9
- package/components/select-field/index.css +9 -9
- package/components/select-field/index.d.ts +1 -1
- package/components/select-field/index.js +2 -1
- package/cssm/component.js +5 -4
- package/cssm/components/index.js +2 -1
- package/cssm/components/select/component.js +6 -5
- package/cssm/components/select/index.js +7 -6
- package/cssm/components/select-field/component.d.ts +8 -0
- package/cssm/components/select-field/component.js +35 -10
- package/cssm/components/select-field/index.d.ts +1 -1
- package/cssm/components/select-field/index.js +2 -1
- package/cssm/index.js +9 -8
- package/cssm/utils/preparePasteData.d.ts +1 -1
- package/cssm/utils/preparePasteData.js +7 -3
- package/esm/component.js +5 -4
- package/esm/components/flag-icon/component.js +1 -1
- package/esm/components/flag-icon/index.css +3 -3
- package/esm/components/index.js +2 -1
- package/esm/components/select/component.js +5 -4
- package/esm/components/select/index.css +6 -6
- package/esm/components/select/index.js +6 -5
- package/esm/components/select-field/component.d.ts +8 -0
- package/esm/components/select-field/component.js +31 -7
- 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 +2 -1
- package/esm/index.css +5 -5
- package/esm/index.js +7 -6
- package/esm/{libphonenumber-js.min-cb857554.d.ts → libphonenumber-js.min-1e9caa43.d.ts} +0 -0
- package/esm/{libphonenumber-js.min-cb857554.js → libphonenumber-js.min-1e9caa43.js} +0 -0
- package/esm/utils/preparePasteData.d.ts +1 -1
- package/esm/utils/preparePasteData.js +7 -3
- package/index.css +5 -5
- package/index.js +7 -6
- package/{libphonenumber-js.min-4def49d7.d.ts → libphonenumber-js.min-2b3f9314.d.ts} +0 -0
- package/{libphonenumber-js.min-4def49d7.js → libphonenumber-js.min-2b3f9314.js} +0 -0
- package/modern/component.js +3 -3
- package/modern/components/flag-icon/component.js +1 -1
- package/modern/components/flag-icon/index.css +3 -3
- package/modern/components/select/component.js +1 -1
- package/modern/components/select/index.css +6 -6
- package/modern/components/select-field/component.js +1 -1
- package/modern/components/select-field/index.css +9 -9
- package/modern/index.css +5 -5
- package/modern/{libphonenumber-js.min-cb857554.d.ts → libphonenumber-js.min-1e9caa43.d.ts} +0 -0
- package/modern/{libphonenumber-js.min-cb857554.js → libphonenumber-js.min-1e9caa43.js} +0 -0
- package/modern/utils/preparePasteData.d.ts +1 -1
- package/modern/utils/preparePasteData.js +7 -3
- package/package.json +6 -5
- package/utils/preparePasteData.d.ts +1 -1
- package/utils/preparePasteData.js +7 -3
- package/component-1f1cb3eb.d.ts +0 -41
- package/component-1f1cb3eb.js +0 -80
- package/cssm/component-01884de0.d.ts +0 -41
- package/cssm/component-01884de0.js +0 -79
- package/esm/component-4980ce1c.d.ts +0 -41
- package/esm/component-4980ce1c.js +0 -69
package/esm/component.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __rest, __assign } from 'tslib';
|
|
2
2
|
import React, { forwardRef, useState, useRef, useEffect } from 'react';
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
import { InputAutocomplete } from '@alfalab/core-components-input-autocomplete/esm';
|
|
@@ -14,8 +14,9 @@ import { CountriesSelect } from './components/select/component.js';
|
|
|
14
14
|
import { useCaretAvoidCountryCode } from './useCaretAvoidCountryCode.js';
|
|
15
15
|
import './components/flag-icon/flagSprite.js';
|
|
16
16
|
import '@alfalab/core-components-select/esm';
|
|
17
|
+
import './components/select-field/component.js';
|
|
17
18
|
|
|
18
|
-
var styles = {"addons":"intl-phone-
|
|
19
|
+
var styles = {"addons":"intl-phone-input__addons_1acfj","l":"intl-phone-input__l_1acfj","xl":"intl-phone-input__xl_1acfj","flagIconWrapper":"intl-phone-input__flagIconWrapper_1acfj","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_1acfj"};
|
|
19
20
|
require('./index.css')
|
|
20
21
|
|
|
21
22
|
var countriesHash = getCountriesHash();
|
|
@@ -248,7 +249,7 @@ var IntlPhoneInput = forwardRef(function (_a, ref) {
|
|
|
248
249
|
return;
|
|
249
250
|
}
|
|
250
251
|
var _b = inputRef.current, selectionStart = _b.selectionStart, selectionEnd = _b.selectionEnd;
|
|
251
|
-
var preparedNumber = preparePasteData(value, text, selectionStart || 0, selectionEnd || 0);
|
|
252
|
+
var preparedNumber = preparePasteData(value, text, selectionStart || 0, selectionEnd || 0, ruNumberPriority && countryIso2 === 'ru');
|
|
252
253
|
var targetCountry = getCountryByNumber(preparedNumber);
|
|
253
254
|
var maxPhoneLength = (targetCountry && (maxPhoneLen === null || maxPhoneLen === void 0 ? void 0 : maxPhoneLen[targetCountry.iso2.toUpperCase()])) || MAX_PHONE_LEN;
|
|
254
255
|
var resultNumber = preparedNumber.substring(0, maxPhoneLength + 1);
|
|
@@ -267,7 +268,7 @@ var IntlPhoneInput = forwardRef(function (_a, ref) {
|
|
|
267
268
|
if (phoneLibUtils.current)
|
|
268
269
|
return;
|
|
269
270
|
import(
|
|
270
|
-
/* webpackChunkName: "libphonenumber" */ './libphonenumber-js.min-
|
|
271
|
+
/* webpackChunkName: "libphonenumber" */ './libphonenumber-js.min-1e9caa43.js')
|
|
271
272
|
.then(function (utils) {
|
|
272
273
|
phoneLibUtils.current = utils.AsYouType;
|
|
273
274
|
if (canBeEmptyCountry) {
|
|
@@ -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-
|
|
5
|
+
var styles = {"flagIcon":"intl-phone-input__flagIcon_1ejpq","flagPlaceholder":"intl-phone-input__flagPlaceholder_1ejpq"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: zfmlt */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-specialbg-tertiary-transparent: rgba(11, 31, 53, 0.1);
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
--gap-3xs: 2px;
|
|
18
18
|
} :root {
|
|
19
19
|
} :root {
|
|
20
|
-
} .intl-phone-
|
|
20
|
+
} .intl-phone-input__flagIcon_1ejpq {
|
|
21
21
|
max-width: 24px;
|
|
22
22
|
max-height: 24px;
|
|
23
|
-
} .intl-phone-
|
|
23
|
+
} .intl-phone-input__flagPlaceholder_1ejpq {
|
|
24
24
|
width: 24px;
|
|
25
25
|
height: 16px;
|
|
26
26
|
max-height: 16px;
|
package/esm/components/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { EMPTY_COUNTRY_SELECT_FIELD, SelectField } from './select-field/component.js';
|
|
2
2
|
export { FlagIcon } from './flag-icon/component.js';
|
|
3
3
|
export { CountriesSelect } from './select/component.js';
|
|
4
|
+
import 'tslib';
|
|
4
5
|
import 'react';
|
|
5
6
|
import 'react-merge-refs';
|
|
6
7
|
import 'classnames';
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __assign } from 'tslib';
|
|
2
2
|
import React, { useMemo, useCallback } from 'react';
|
|
3
3
|
import { VirtualOptionsList, Select } from '@alfalab/core-components-select/esm';
|
|
4
4
|
import { FlagIcon } from '../flag-icon/component.js';
|
|
5
|
-
import '
|
|
5
|
+
import { EMPTY_COUNTRY_SELECT_FIELD, SelectField } from '../select-field/component.js';
|
|
6
6
|
import 'classnames';
|
|
7
|
+
import '../flag-icon/flagSprite.js';
|
|
8
|
+
import 'react-merge-refs';
|
|
7
9
|
import '@alfalab/hooks';
|
|
8
10
|
import '@alfalab/icons-glyph/WorldMagnifierMIcon';
|
|
9
|
-
import '../flag-icon/flagSprite.js';
|
|
10
11
|
|
|
11
|
-
var styles = {"component":"intl-phone-
|
|
12
|
+
var styles = {"component":"intl-phone-input__component_1i24a","option":"intl-phone-input__option_1i24a","flag":"intl-phone-input__flag_1i24a","countryName":"intl-phone-input__countryName_1i24a","dialCode":"intl-phone-input__dialCode_1i24a"};
|
|
12
13
|
require('./index.css')
|
|
13
14
|
|
|
14
15
|
var CountriesSelect = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: djruy */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-text-secondary: rgba(11, 31, 53, 0.7);
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
} :root {
|
|
18
18
|
} :root {
|
|
19
19
|
--text-secondary-color: var(--color-light-text-secondary);
|
|
20
|
-
} .intl-phone-
|
|
20
|
+
} .intl-phone-input__component_1i24a {
|
|
21
21
|
position: static;
|
|
22
22
|
display: flex;
|
|
23
23
|
min-width: initial;
|
|
24
24
|
height: 100%;
|
|
25
|
-
} .intl-phone-
|
|
25
|
+
} .intl-phone-input__option_1i24a {
|
|
26
26
|
display: flex;
|
|
27
27
|
align-items: flex-start;
|
|
28
|
-
} .intl-phone-
|
|
28
|
+
} .intl-phone-input__flag_1i24a {
|
|
29
29
|
flex-shrink: 0;
|
|
30
30
|
margin-right: var(--gap-xs);
|
|
31
|
-
} .intl-phone-
|
|
31
|
+
} .intl-phone-input__countryName_1i24a {
|
|
32
32
|
margin-right: var(--gap-xs);
|
|
33
|
-
} .intl-phone-
|
|
33
|
+
} .intl-phone-input__dialCode_1i24a {
|
|
34
34
|
color: var(--text-secondary-color);
|
|
35
35
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { CountriesSelect } from './component.js';
|
|
2
|
-
import '
|
|
2
|
+
import 'tslib';
|
|
3
3
|
import 'react';
|
|
4
|
-
import '
|
|
4
|
+
import '@alfalab/core-components-select/esm';
|
|
5
|
+
import '../flag-icon/component.js';
|
|
5
6
|
import 'classnames';
|
|
7
|
+
import '../flag-icon/flagSprite.js';
|
|
8
|
+
import '../select-field/component.js';
|
|
9
|
+
import 'react-merge-refs';
|
|
6
10
|
import '@alfalab/hooks';
|
|
7
11
|
import '@alfalab/icons-glyph/WorldMagnifierMIcon';
|
|
8
|
-
import '../flag-icon/component.js';
|
|
9
|
-
import '../flag-icon/flagSprite.js';
|
|
10
|
-
import '@alfalab/core-components-select/esm';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { FieldProps } from "@alfalab/core-components-select";
|
|
3
|
+
declare const EMPTY_COUNTRY_SELECT_FIELD: {
|
|
4
|
+
value: string;
|
|
5
|
+
key: string;
|
|
6
|
+
};
|
|
7
|
+
declare const SelectField: FC<FieldProps>;
|
|
8
|
+
export { EMPTY_COUNTRY_SELECT_FIELD, SelectField };
|
|
@@ -1,8 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
import 'react';
|
|
3
|
-
import 'react-merge-refs';
|
|
4
|
-
import 'classnames';
|
|
5
|
-
import '@alfalab/hooks';
|
|
6
|
-
import '@alfalab/icons-glyph/WorldMagnifierMIcon';
|
|
7
|
-
import '../flag-icon/component.js';
|
|
1
|
+
import { __assign } from 'tslib';
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
|
+
import mergeRefs from 'react-merge-refs';
|
|
4
|
+
import cn from 'classnames';
|
|
5
|
+
import { useFocus } from '@alfalab/hooks';
|
|
6
|
+
import WorldMagnifierMIcon from '@alfalab/icons-glyph/WorldMagnifierMIcon';
|
|
7
|
+
import { FlagIcon } from '../flag-icon/component.js';
|
|
8
8
|
import '../flag-icon/flagSprite.js';
|
|
9
|
+
|
|
10
|
+
var styles = {"component":"intl-phone-input__component_11kms","flagIconContainer":"intl-phone-input__flagIconContainer_11kms","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_11kms","disabled":"intl-phone-input__disabled_11kms","inner":"intl-phone-input__inner_11kms","l":"intl-phone-input__l_11kms","xl":"intl-phone-input__xl_11kms","focusVisible":"intl-phone-input__focusVisible_11kms"};
|
|
11
|
+
require('./index.css')
|
|
12
|
+
|
|
13
|
+
var EMPTY_COUNTRY_SELECT_FIELD = {
|
|
14
|
+
value: 'EMPTY_COUNTRY_SELECT_VALUE',
|
|
15
|
+
key: 'EMPTY_COUNTRY_SELECT_KEY',
|
|
16
|
+
};
|
|
17
|
+
var SelectField = function (_a) {
|
|
18
|
+
var _b;
|
|
19
|
+
var selected = _a.selected, Arrow = _a.Arrow, size = _a.size, disabled = _a.disabled, _c = _a.innerProps, innerProps = _c === void 0 ? {} : _c;
|
|
20
|
+
var wrapperRef = useRef(null);
|
|
21
|
+
var focusVisible = useFocus(wrapperRef, 'keyboard')[0];
|
|
22
|
+
var ref = innerProps.ref ? mergeRefs([innerProps.ref, wrapperRef]) : wrapperRef;
|
|
23
|
+
return (React.createElement("div", { ref: ref, className: cn(styles.component, size && styles[size], (_b = {},
|
|
24
|
+
_b[styles.focusVisible] = focusVisible,
|
|
25
|
+
_b[styles.disabled] = disabled,
|
|
26
|
+
_b)) },
|
|
27
|
+
React.createElement("div", __assign({}, innerProps, { className: styles.inner }),
|
|
28
|
+
React.createElement("span", { className: styles.flagIconContainer }, !selected || selected === EMPTY_COUNTRY_SELECT_FIELD ? (React.createElement(WorldMagnifierMIcon, { className: styles.emptyCountryIcon })) : (React.createElement(FlagIcon, { country: selected.value }))),
|
|
29
|
+
Arrow)));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { EMPTY_COUNTRY_SELECT_FIELD, SelectField };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: dzeop */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-border-link: #007aff;
|
|
@@ -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-
|
|
24
|
+
} .intl-phone-input__component_11kms {
|
|
25
25
|
height: 100%;
|
|
26
26
|
cursor: pointer;
|
|
27
27
|
outline: none;
|
|
28
28
|
position: relative;
|
|
29
|
-
} .intl-phone-
|
|
29
|
+
} .intl-phone-input__flagIconContainer_11kms {
|
|
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-
|
|
36
|
+
} .intl-phone-input__emptyCountryIcon_11kms {
|
|
37
37
|
color: var(--color-light-graphic-secondary);
|
|
38
|
-
} .intl-phone-
|
|
38
|
+
} .intl-phone-input__disabled_11kms {
|
|
39
39
|
cursor: var(--disabled-cursor);
|
|
40
|
-
} .intl-phone-
|
|
40
|
+
} .intl-phone-input__inner_11kms {
|
|
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-
|
|
48
|
-
.intl-phone-
|
|
47
|
+
} .intl-phone-input__l_11kms .intl-phone-input__inner_11kms,
|
|
48
|
+
.intl-phone-input__xl_11kms .intl-phone-input__inner_11kms {
|
|
49
49
|
padding-left: var(--gap-m);
|
|
50
|
-
} .intl-phone-
|
|
50
|
+
} .intl-phone-input__focusVisible_11kms {
|
|
51
51
|
outline: 2px solid var(--focus-color);
|
|
52
52
|
outline-offset: 2px;
|
|
53
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "
|
|
1
|
+
export * from "./component";
|
package/esm/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 16dov */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-graphic-secondary: #6d7986;
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
--gap-s: 12px;
|
|
17
17
|
} :root {
|
|
18
18
|
} :root {
|
|
19
|
-
} .intl-phone-
|
|
19
|
+
} .intl-phone-input__addons_1acfj {
|
|
20
20
|
padding-left: 0;
|
|
21
|
-
} .intl-phone-
|
|
21
|
+
} .intl-phone-input__l_1acfj .intl-phone-input__addons_1acfj, .intl-phone-input__xl_1acfj .intl-phone-input__addons_1acfj {
|
|
22
22
|
padding-left: 0;
|
|
23
|
-
} .intl-phone-
|
|
23
|
+
} .intl-phone-input__flagIconWrapper_1acfj {
|
|
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-
|
|
30
|
+
} .intl-phone-input__emptyCountryIcon_1acfj {
|
|
31
31
|
color: var(--color-light-graphic-secondary);
|
|
32
32
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
export { IntlPhoneInput } from './component.js';
|
|
2
|
-
import '
|
|
2
|
+
import 'tslib';
|
|
3
3
|
import 'react';
|
|
4
|
-
import 'react-merge-refs';
|
|
5
4
|
import 'classnames';
|
|
6
|
-
import '@alfalab/hooks';
|
|
7
|
-
import '@alfalab/icons-glyph/WorldMagnifierMIcon';
|
|
8
|
-
import './components/flag-icon/component.js';
|
|
9
|
-
import './components/flag-icon/flagSprite.js';
|
|
10
5
|
import '@alfalab/core-components-input-autocomplete/esm';
|
|
6
|
+
import '@alfalab/icons-glyph/WorldMagnifierMIcon';
|
|
11
7
|
import '@alfalab/utils';
|
|
12
8
|
import './utils/calculateCaretPos.js';
|
|
13
9
|
import './utils/format-phone-with-unclearable-country-code.js';
|
|
14
10
|
import './utils/preparePasteData.js';
|
|
11
|
+
import 'react-merge-refs';
|
|
12
|
+
import '@alfalab/hooks';
|
|
13
|
+
import './components/flag-icon/component.js';
|
|
14
|
+
import './components/flag-icon/flagSprite.js';
|
|
15
15
|
import './components/select/component.js';
|
|
16
16
|
import '@alfalab/core-components-select/esm';
|
|
17
|
+
import './components/select-field/component.js';
|
|
17
18
|
import './useCaretAvoidCountryCode.js';
|
|
File without changes
|
|
File without changes
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* @param phoneFromBuffer Текст номера телефона из буфера обмена.
|
|
5
5
|
* @param input Input в который осуществляется вставка.
|
|
6
6
|
*/
|
|
7
|
-
declare function preparePasteData(phoneValue: string, phoneFromBuffer: string, selectionStart?: number, selectionEnd?: number): string;
|
|
7
|
+
declare function preparePasteData(phoneValue: string, phoneFromBuffer: string, selectionStart?: number, selectionEnd?: number, ruNumberPriority?: boolean): string;
|
|
8
8
|
export { preparePasteData };
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param phoneFromBuffer Текст номера телефона из буфера обмена.
|
|
5
5
|
* @param input Input в который осуществляется вставка.
|
|
6
6
|
*/
|
|
7
|
-
function preparePasteData(phoneValue, phoneFromBuffer, selectionStart, selectionEnd) {
|
|
7
|
+
function preparePasteData(phoneValue, phoneFromBuffer, selectionStart, selectionEnd, ruNumberPriority) {
|
|
8
8
|
var trimNuber = phoneFromBuffer.trim();
|
|
9
9
|
var cutNumberWithPlus = trimNuber.replace(/[^+\d]/g, '');
|
|
10
10
|
var isTextHavePlus = cutNumberWithPlus[0] === '+';
|
|
@@ -42,10 +42,14 @@ function preparePasteData(phoneValue, phoneFromBuffer, selectionStart, selection
|
|
|
42
42
|
}
|
|
43
43
|
else if (isRuNumberInBuffer) {
|
|
44
44
|
resultNumber = "+7".concat(cutNumber.substring(1));
|
|
45
|
-
// вставка номера начинающегося НЕ с "7", "8", "+" в пустое поле
|
|
45
|
+
// вставка номера начинающегося НЕ с "7", "8", "+" в пустое поле с российским флагом
|
|
46
46
|
}
|
|
47
|
-
else {
|
|
47
|
+
else if (ruNumberPriority) {
|
|
48
48
|
resultNumber = "+7".concat(cutNumber);
|
|
49
|
+
// вставка номера начинающегося НЕ с "7", "8", "+" в пустое поле без российского флага
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
resultNumber = "+".concat(cutNumber);
|
|
49
53
|
}
|
|
50
54
|
}
|
|
51
55
|
return resultNumber;
|
package/index.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 16dov */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-graphic-secondary: #6d7986;
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
--gap-s: 12px;
|
|
17
17
|
} :root {
|
|
18
18
|
} :root {
|
|
19
|
-
} .intl-phone-
|
|
19
|
+
} .intl-phone-input__addons_1acfj {
|
|
20
20
|
padding-left: 0;
|
|
21
|
-
} .intl-phone-
|
|
21
|
+
} .intl-phone-input__l_1acfj .intl-phone-input__addons_1acfj, .intl-phone-input__xl_1acfj .intl-phone-input__addons_1acfj {
|
|
22
22
|
padding-left: 0;
|
|
23
|
-
} .intl-phone-
|
|
23
|
+
} .intl-phone-input__flagIconWrapper_1acfj {
|
|
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-
|
|
30
|
+
} .intl-phone-input__emptyCountryIcon_1acfj {
|
|
31
31
|
color: var(--color-light-graphic-secondary);
|
|
32
32
|
}
|
package/index.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var component = require('./component.js');
|
|
4
|
-
require('
|
|
4
|
+
require('tslib');
|
|
5
5
|
require('react');
|
|
6
|
-
require('react-merge-refs');
|
|
7
6
|
require('classnames');
|
|
8
|
-
require('@alfalab/hooks');
|
|
9
|
-
require('@alfalab/icons-glyph/WorldMagnifierMIcon');
|
|
10
|
-
require('./components/flag-icon/component.js');
|
|
11
|
-
require('./components/flag-icon/flagSprite.js');
|
|
12
7
|
require('@alfalab/core-components-input-autocomplete');
|
|
8
|
+
require('@alfalab/icons-glyph/WorldMagnifierMIcon');
|
|
13
9
|
require('@alfalab/utils');
|
|
14
10
|
require('./utils/calculateCaretPos.js');
|
|
15
11
|
require('./utils/format-phone-with-unclearable-country-code.js');
|
|
16
12
|
require('./utils/preparePasteData.js');
|
|
13
|
+
require('react-merge-refs');
|
|
14
|
+
require('@alfalab/hooks');
|
|
15
|
+
require('./components/flag-icon/component.js');
|
|
16
|
+
require('./components/flag-icon/flagSprite.js');
|
|
17
17
|
require('./components/select/component.js');
|
|
18
18
|
require('@alfalab/core-components-select');
|
|
19
|
+
require('./components/select-field/component.js');
|
|
19
20
|
require('./useCaretAvoidCountryCode.js');
|
|
20
21
|
|
|
21
22
|
|
|
File without changes
|
|
File without changes
|
package/modern/component.js
CHANGED
|
@@ -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-
|
|
18
|
+
const styles = {"addons":"intl-phone-input__addons_1acfj","l":"intl-phone-input__l_1acfj","xl":"intl-phone-input__xl_1acfj","flagIconWrapper":"intl-phone-input__flagIconWrapper_1acfj","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_1acfj"};
|
|
19
19
|
require('./index.css')
|
|
20
20
|
|
|
21
21
|
const countriesHash = getCountriesHash();
|
|
@@ -244,7 +244,7 @@ const IntlPhoneInput = forwardRef(({ disabled = false, readOnly = false, hideCou
|
|
|
244
244
|
return;
|
|
245
245
|
}
|
|
246
246
|
const { selectionStart, selectionEnd } = inputRef.current;
|
|
247
|
-
const preparedNumber = preparePasteData(value, text, selectionStart || 0, selectionEnd || 0);
|
|
247
|
+
const preparedNumber = preparePasteData(value, text, selectionStart || 0, selectionEnd || 0, ruNumberPriority && countryIso2 === 'ru');
|
|
248
248
|
const targetCountry = getCountryByNumber(preparedNumber);
|
|
249
249
|
const maxPhoneLength = (targetCountry && maxPhoneLen?.[targetCountry.iso2.toUpperCase()]) || MAX_PHONE_LEN;
|
|
250
250
|
const resultNumber = preparedNumber.substring(0, maxPhoneLength + 1);
|
|
@@ -263,7 +263,7 @@ const IntlPhoneInput = forwardRef(({ disabled = false, readOnly = false, hideCou
|
|
|
263
263
|
if (phoneLibUtils.current)
|
|
264
264
|
return;
|
|
265
265
|
import(
|
|
266
|
-
/* webpackChunkName: "libphonenumber" */ './libphonenumber-js.min-
|
|
266
|
+
/* webpackChunkName: "libphonenumber" */ './libphonenumber-js.min-1e9caa43.js')
|
|
267
267
|
.then((utils) => {
|
|
268
268
|
phoneLibUtils.current = utils.AsYouType;
|
|
269
269
|
if (canBeEmptyCountry) {
|
|
@@ -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-
|
|
5
|
+
const styles = {"flagIcon":"intl-phone-input__flagIcon_1ejpq","flagPlaceholder":"intl-phone-input__flagPlaceholder_1ejpq"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: zfmlt */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-specialbg-tertiary-transparent: rgba(11, 31, 53, 0.1);
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
--gap-3xs: 2px;
|
|
18
18
|
} :root {
|
|
19
19
|
} :root {
|
|
20
|
-
} .intl-phone-
|
|
20
|
+
} .intl-phone-input__flagIcon_1ejpq {
|
|
21
21
|
max-width: 24px;
|
|
22
22
|
max-height: 24px;
|
|
23
|
-
} .intl-phone-
|
|
23
|
+
} .intl-phone-input__flagPlaceholder_1ejpq {
|
|
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-
|
|
11
|
+
const styles = {"component":"intl-phone-input__component_1i24a","option":"intl-phone-input__option_1i24a","flag":"intl-phone-input__flag_1i24a","countryName":"intl-phone-input__countryName_1i24a","dialCode":"intl-phone-input__dialCode_1i24a"};
|
|
12
12
|
require('./index.css')
|
|
13
13
|
|
|
14
14
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: djruy */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-text-secondary: rgba(11, 31, 53, 0.7);
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
} :root {
|
|
18
18
|
} :root {
|
|
19
19
|
--text-secondary-color: var(--color-light-text-secondary);
|
|
20
|
-
} .intl-phone-
|
|
20
|
+
} .intl-phone-input__component_1i24a {
|
|
21
21
|
position: static;
|
|
22
22
|
display: flex;
|
|
23
23
|
min-width: initial;
|
|
24
24
|
height: 100%;
|
|
25
|
-
} .intl-phone-
|
|
25
|
+
} .intl-phone-input__option_1i24a {
|
|
26
26
|
display: flex;
|
|
27
27
|
align-items: flex-start;
|
|
28
|
-
} .intl-phone-
|
|
28
|
+
} .intl-phone-input__flag_1i24a {
|
|
29
29
|
flex-shrink: 0;
|
|
30
30
|
margin-right: var(--gap-xs);
|
|
31
|
-
} .intl-phone-
|
|
31
|
+
} .intl-phone-input__countryName_1i24a {
|
|
32
32
|
margin-right: var(--gap-xs);
|
|
33
|
-
} .intl-phone-
|
|
33
|
+
} .intl-phone-input__dialCode_1i24a {
|
|
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-
|
|
9
|
+
const styles = {"component":"intl-phone-input__component_11kms","flagIconContainer":"intl-phone-input__flagIconContainer_11kms","emptyCountryIcon":"intl-phone-input__emptyCountryIcon_11kms","disabled":"intl-phone-input__disabled_11kms","inner":"intl-phone-input__inner_11kms","l":"intl-phone-input__l_11kms","xl":"intl-phone-input__xl_11kms","focusVisible":"intl-phone-input__focusVisible_11kms"};
|
|
10
10
|
require('./index.css')
|
|
11
11
|
|
|
12
12
|
const EMPTY_COUNTRY_SELECT_FIELD = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: dzeop */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-border-link: #007aff;
|
|
@@ -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-
|
|
24
|
+
} .intl-phone-input__component_11kms {
|
|
25
25
|
height: 100%;
|
|
26
26
|
cursor: pointer;
|
|
27
27
|
outline: none;
|
|
28
28
|
position: relative;
|
|
29
|
-
} .intl-phone-
|
|
29
|
+
} .intl-phone-input__flagIconContainer_11kms {
|
|
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-
|
|
36
|
+
} .intl-phone-input__emptyCountryIcon_11kms {
|
|
37
37
|
color: var(--color-light-graphic-secondary);
|
|
38
|
-
} .intl-phone-
|
|
38
|
+
} .intl-phone-input__disabled_11kms {
|
|
39
39
|
cursor: var(--disabled-cursor);
|
|
40
|
-
} .intl-phone-
|
|
40
|
+
} .intl-phone-input__inner_11kms {
|
|
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-
|
|
48
|
-
.intl-phone-
|
|
47
|
+
} .intl-phone-input__l_11kms .intl-phone-input__inner_11kms,
|
|
48
|
+
.intl-phone-input__xl_11kms .intl-phone-input__inner_11kms {
|
|
49
49
|
padding-left: var(--gap-m);
|
|
50
|
-
} .intl-phone-
|
|
50
|
+
} .intl-phone-input__focusVisible_11kms {
|
|
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:
|
|
1
|
+
/* hash: 16dov */
|
|
2
2
|
:root {
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-graphic-secondary: #6d7986;
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
--gap-s: 12px;
|
|
17
17
|
} :root {
|
|
18
18
|
} :root {
|
|
19
|
-
} .intl-phone-
|
|
19
|
+
} .intl-phone-input__addons_1acfj {
|
|
20
20
|
padding-left: 0;
|
|
21
|
-
} .intl-phone-
|
|
21
|
+
} .intl-phone-input__l_1acfj .intl-phone-input__addons_1acfj, .intl-phone-input__xl_1acfj .intl-phone-input__addons_1acfj {
|
|
22
22
|
padding-left: 0;
|
|
23
|
-
} .intl-phone-
|
|
23
|
+
} .intl-phone-input__flagIconWrapper_1acfj {
|
|
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-
|
|
30
|
+
} .intl-phone-input__emptyCountryIcon_1acfj {
|
|
31
31
|
color: var(--color-light-graphic-secondary);
|
|
32
32
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* @param phoneFromBuffer Текст номера телефона из буфера обмена.
|
|
5
5
|
* @param input Input в который осуществляется вставка.
|
|
6
6
|
*/
|
|
7
|
-
declare function preparePasteData(phoneValue: string, phoneFromBuffer: string, selectionStart?: number, selectionEnd?: number): string;
|
|
7
|
+
declare function preparePasteData(phoneValue: string, phoneFromBuffer: string, selectionStart?: number, selectionEnd?: number, ruNumberPriority?: boolean): string;
|
|
8
8
|
export { preparePasteData };
|