@alfalab/core-components-international-phone-input 2.0.24 → 2.1.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-9d430401.d.ts → Component-f48223d2.d.ts} +1 -1
- package/Component.responsive.d.ts +6 -6
- package/components/base-international-phone-input/Component.d.ts +2 -2
- package/components/base-international-phone-input/Component.js +14 -11
- package/components/base-international-phone-input/index.css +2 -2
- package/components/country-select/Component.js +1 -1
- package/components/country-select/index.css +11 -9
- package/components/flag-icon/component.js +1 -1
- package/components/flag-icon/index.css +6 -4
- package/components/select-field/component.js +1 -1
- package/components/select-field/index.css +12 -10
- package/cssm/{Component-9d430401.d.ts → Component-f48223d2.d.ts} +1 -1
- package/cssm/Component.responsive.d.ts +6 -6
- package/cssm/components/base-international-phone-input/Component.d.ts +2 -2
- package/cssm/components/base-international-phone-input/Component.js +13 -10
- package/cssm/components/country-select/index.module.css +3 -1
- package/cssm/components/flag-icon/index.module.css +3 -1
- package/cssm/components/select-field/index.module.css +3 -1
- package/cssm/desktop/Component.desktop.js +1 -4
- package/cssm/mobile/Component.mobile.js +1 -4
- package/cssm/types.d.ts +4 -2
- package/{esm/typings-9d430401.d.ts → cssm/typings-f48223d2.d.ts} +8 -0
- package/cssm/utils/index.d.ts +4 -3
- package/cssm/utils/index.js +12 -7
- package/cssm/utils-87b0c1c6.d.ts +1 -1
- package/desktop/Component.desktop.js +1 -4
- package/{modern/Component-9d430401.d.ts → esm/Component-f48223d2.d.ts} +1 -1
- package/esm/Component.responsive.d.ts +6 -6
- package/esm/components/base-international-phone-input/Component.d.ts +2 -2
- package/esm/components/base-international-phone-input/Component.js +15 -12
- package/esm/components/base-international-phone-input/index.css +2 -2
- package/esm/components/country-select/Component.js +1 -1
- package/esm/components/country-select/index.css +11 -9
- package/esm/components/flag-icon/component.js +1 -1
- package/esm/components/flag-icon/index.css +6 -4
- package/esm/components/select-field/component.js +1 -1
- package/esm/components/select-field/index.css +12 -10
- package/esm/desktop/Component.desktop.js +2 -5
- package/esm/mobile/Component.mobile.js +2 -5
- package/esm/types.d.ts +4 -2
- package/{modern/typings-9d430401.d.ts → esm/typings-f48223d2.d.ts} +8 -0
- package/esm/utils/index.d.ts +4 -3
- package/esm/utils/index.js +12 -8
- package/esm/utils-87b0c1c6.d.ts +1 -1
- package/mobile/Component.mobile.js +1 -4
- package/{esm/Component-9d430401.d.ts → modern/Component-f48223d2.d.ts} +1 -1
- package/modern/Component.responsive.d.ts +6 -6
- package/modern/components/base-international-phone-input/Component.d.ts +2 -2
- package/modern/components/base-international-phone-input/Component.js +10 -8
- package/modern/components/base-international-phone-input/index.css +2 -2
- package/modern/components/country-select/Component.js +1 -1
- package/modern/components/country-select/index.css +11 -9
- package/modern/components/flag-icon/component.js +1 -1
- package/modern/components/flag-icon/index.css +6 -4
- package/modern/components/select-field/component.js +1 -1
- package/modern/components/select-field/index.css +12 -10
- package/modern/desktop/Component.desktop.js +1 -1
- package/modern/mobile/Component.mobile.js +1 -1
- package/modern/types.d.ts +4 -2
- package/{cssm/typings-9d430401.d.ts → modern/typings-f48223d2.d.ts} +8 -0
- package/modern/utils/index.d.ts +4 -3
- package/modern/utils/index.js +12 -8
- package/modern/utils-87b0c1c6.d.ts +1 -1
- package/package.json +6 -6
- package/src/components/base-international-phone-input/Component.tsx +10 -7
- package/src/desktop/Component.desktop.tsx +3 -5
- package/src/mobile/Component.mobile.tsx +3 -5
- package/src/types.ts +3 -1
- package/src/utils/index.ts +16 -12
- package/types.d.ts +4 -2
- package/{typings-9d430401.d.ts → typings-f48223d2.d.ts} +8 -0
- package/utils/index.d.ts +4 -3
- package/utils/index.js +12 -7
- package/utils-87b0c1c6.d.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { OptgroupProps } from "./typings-
|
|
3
|
+
import { OptgroupProps } from "./typings-f48223d2";
|
|
4
4
|
declare const Optgroup: ({ children, className, label, size }: OptgroupProps) => React.JSX.Element;
|
|
5
5
|
export { Optgroup };
|
|
@@ -4,10 +4,10 @@ declare const InternationalPhoneInput: React.ForwardRefExoticComponent<(({
|
|
|
4
4
|
country?: import("./types").Country | undefined;
|
|
5
5
|
countries?: string[] | undefined;
|
|
6
6
|
defaultIso2?: string | undefined;
|
|
7
|
-
clearableCountryCode?: boolean | undefined;
|
|
7
|
+
clearableCountryCode?: boolean | "preserve" | undefined;
|
|
8
8
|
countrySelectProps?: import("./components/country-select/index").SharedCountrySelectProps | undefined;
|
|
9
9
|
clear?: boolean | undefined;
|
|
10
|
-
filterFn?: ((value: string | undefined, option: import("./typings-
|
|
10
|
+
filterFn?: ((value: string | undefined, option: import("./typings-f48223d2").OptionShape) => boolean) | undefined;
|
|
11
11
|
onCountryChange?: ((country?: import("./types").Country | undefined) => void) | undefined;
|
|
12
12
|
onChange?: ((phone: string) => void) | undefined;
|
|
13
13
|
onBlur?: ((event: React.FocusEvent<HTMLDivElement | HTMLInputElement, Element>) => void) | undefined;
|
|
@@ -23,18 +23,18 @@ declare const InternationalPhoneInput: React.ForwardRefExoticComponent<(({
|
|
|
23
23
|
country?: import("./types").Country | undefined;
|
|
24
24
|
countries?: string[] | undefined;
|
|
25
25
|
defaultIso2?: string | undefined;
|
|
26
|
-
clearableCountryCode?: boolean | undefined;
|
|
26
|
+
clearableCountryCode?: boolean | "preserve" | undefined;
|
|
27
27
|
countrySelectProps?: import("./components/country-select/index").SharedCountrySelectProps | undefined;
|
|
28
28
|
clear?: boolean | undefined;
|
|
29
|
-
filterFn?: ((value: string | undefined, option: import("./typings-
|
|
29
|
+
filterFn?: ((value: string | undefined, option: import("./typings-f48223d2").OptionShape) => boolean) | undefined;
|
|
30
30
|
onCountryChange?: ((country?: import("./types").Country | undefined) => void) | undefined;
|
|
31
31
|
onChange?: ((phone: string) => void) | undefined;
|
|
32
32
|
onBlur?: ((event: React.FocusEvent<HTMLDivElement | HTMLInputElement, Element>) => void) | undefined;
|
|
33
33
|
onFocus?: ((event: React.FocusEvent<HTMLDivElement | HTMLInputElement, Element>) => void) | undefined;
|
|
34
34
|
} & {
|
|
35
|
-
options: (import("./typings-
|
|
35
|
+
options: (import("./typings-f48223d2").OptionShape | import("./typings-f48223d2").GroupShape)[];
|
|
36
36
|
} & Omit<import("@alfalab/core-components-input-autocomplete/types").InputAutocompleteCommonProps, "onChange" | "onInput"> & {
|
|
37
|
-
options: (import("./typings-
|
|
37
|
+
options: (import("./typings-f48223d2").OptionShape | import("./typings-f48223d2").GroupShape)[];
|
|
38
38
|
} & Omit<import("@alfalab/core-components-input-autocomplete/types").InputAutocompleteMobileProps, "onChange" | "onInput"> & {
|
|
39
39
|
breakpoint?: number | undefined;
|
|
40
40
|
defaultMatchMediaValue?: boolean | (() => boolean) | undefined;
|
|
@@ -6,10 +6,10 @@ declare const BaseInternationalPhoneInput: React.ForwardRefExoticComponent<{
|
|
|
6
6
|
country?: Country | undefined;
|
|
7
7
|
countries?: string[] | undefined;
|
|
8
8
|
defaultIso2?: string | undefined;
|
|
9
|
-
clearableCountryCode?: boolean | undefined;
|
|
9
|
+
clearableCountryCode?: boolean | "preserve" | undefined;
|
|
10
10
|
countrySelectProps?: import("../country-select/index").SharedCountrySelectProps | undefined;
|
|
11
11
|
clear?: boolean | undefined;
|
|
12
|
-
filterFn?: ((value: string | undefined, option: import("../../typings-
|
|
12
|
+
filterFn?: ((value: string | undefined, option: import("../../typings-f48223d2").OptionShape) => boolean) | undefined;
|
|
13
13
|
onCountryChange?: ((country?: Country | undefined) => void) | undefined;
|
|
14
14
|
onChange?: ((phone: string) => void) | undefined;
|
|
15
15
|
onBlur?: ((event: React.FocusEvent<HTMLDivElement | HTMLInputElement, Element>) => void) | undefined;
|
|
@@ -16,19 +16,19 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
16
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
17
17
|
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
18
18
|
|
|
19
|
-
var styles = {"component":"international-phone-
|
|
19
|
+
var styles = {"component":"international-phone-input__component_17rro","addons":"international-phone-input__addons_17rro"};
|
|
20
20
|
require('./index.css')
|
|
21
21
|
|
|
22
22
|
var BaseInternationalPhoneInput = React.forwardRef(function (_a, ref) {
|
|
23
|
-
var
|
|
23
|
+
var _b = _a.clearableCountryCode, clearableCountryCodeFromProps = _b === void 0 ? true : _b, value = _a.value, countryProp = _a.country, filterFn = _a.filterFn, onChange = _a.onChange, onCountryChange = _a.onCountryChange, countrySelectProps = _a.countrySelectProps, countries = _a.countries, defaultIso2 = _a.defaultIso2, disabled = _a.disabled, options = _a.options, _c = _a.size, size = _c === void 0 ? 56 : _c, Input = _a.Input, InputAutocomplete = _a.InputAutocomplete, SelectComponent = _a.SelectComponent, view = _a.view, clearProp = _a.clear, openProps = _a.open, defaultOpen = _a.defaultOpen, restProps = tslib.__rest(_a, ["clearableCountryCode", "value", "country", "filterFn", "onChange", "onCountryChange", "countrySelectProps", "countries", "defaultIso2", "disabled", "options", "size", "Input", "InputAutocomplete", "SelectComponent", "view", "clear", "open", "defaultOpen"]);
|
|
24
24
|
var countriesData = React.useMemo(function () { return utils_index.initCountries(countries); }, [countries]);
|
|
25
25
|
var inputRef = React.useRef(null);
|
|
26
26
|
var inputWrapperRef = React.useRef(null);
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
27
|
+
var _d = React.useState(defaultOpen), open = _d[0], setOpen = _d[1];
|
|
28
|
+
var _e = React.useState(countrySelectProps === null || countrySelectProps === void 0 ? void 0 : countrySelectProps.defaultOpen), openCountry = _e[0], setOpenCountry = _e[1];
|
|
29
|
+
var _f = React.useState(function () {
|
|
30
30
|
return utils_index.findCountry(countriesData, value, defaultIso2, countryProp);
|
|
31
|
-
}), selectedCountry =
|
|
31
|
+
}), selectedCountry = _f[0], setSelectedCountry = _f[1];
|
|
32
32
|
var filteredOptions = utils_index.filterPhones(value, options, filterFn);
|
|
33
33
|
var country = countryProp !== null && countryProp !== void 0 ? countryProp : selectedCountry;
|
|
34
34
|
var handleCountryChange = function (nextCountry) {
|
|
@@ -36,7 +36,9 @@ var BaseInternationalPhoneInput = React.forwardRef(function (_a, ref) {
|
|
|
36
36
|
setSelectedCountry(nextCountry);
|
|
37
37
|
onCountryChange === null || onCountryChange === void 0 ? void 0 : onCountryChange(nextCountry);
|
|
38
38
|
};
|
|
39
|
-
var
|
|
39
|
+
var preserveCountryCode = clearableCountryCodeFromProps === 'preserve';
|
|
40
|
+
var clearableCountryCode = preserveCountryCode || clearableCountryCodeFromProps;
|
|
41
|
+
var maskOptions = React.useMemo(function () { return utils_index.createMaskOptions(country, clearableCountryCode, preserveCountryCode); }, [country, clearableCountryCode, preserveCountryCode]);
|
|
40
42
|
var maskRef = react.useMaskito({ options: maskOptions });
|
|
41
43
|
var changeNumber = function (phone) {
|
|
42
44
|
onChange === null || onChange === void 0 ? void 0 : onChange(phone);
|
|
@@ -53,7 +55,7 @@ var BaseInternationalPhoneInput = React.forwardRef(function (_a, ref) {
|
|
|
53
55
|
var nextCountry = selected === null || selected === void 0 ? void 0 : selected.value;
|
|
54
56
|
handleCountryChange === null || handleCountryChange === void 0 ? void 0 : handleCountryChange(nextCountry);
|
|
55
57
|
if (nextCountry) {
|
|
56
|
-
changeNumber(
|
|
58
|
+
changeNumber(utils_index.getInitialValueFromCountry(nextCountry.countryCode));
|
|
57
59
|
}
|
|
58
60
|
requestAnimationFrame(function () { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
59
61
|
};
|
|
@@ -61,8 +63,9 @@ var BaseInternationalPhoneInput = React.forwardRef(function (_a, ref) {
|
|
|
61
63
|
var _a;
|
|
62
64
|
updatePhoneData(core.maskitoTransform(typeof payload === 'string' ? payload : ((_a = payload.selected) === null || _a === void 0 ? void 0 : _a.key) || '', maskOptions));
|
|
63
65
|
};
|
|
64
|
-
var handleInput = function (
|
|
65
|
-
|
|
66
|
+
var handleInput = function (_a) {
|
|
67
|
+
var inputValue = _a.target.value;
|
|
68
|
+
updatePhoneData(inputValue);
|
|
66
69
|
};
|
|
67
70
|
var handleClear = function (event) {
|
|
68
71
|
var _a, _b;
|
|
@@ -73,7 +76,7 @@ var BaseInternationalPhoneInput = React.forwardRef(function (_a, ref) {
|
|
|
73
76
|
handleCountryChange(nextCountry);
|
|
74
77
|
}
|
|
75
78
|
else {
|
|
76
|
-
changeNumber(
|
|
79
|
+
changeNumber(country ? utils_index.getInitialValueFromCountry(country.countryCode) : '');
|
|
77
80
|
}
|
|
78
81
|
};
|
|
79
82
|
React.useEffect(function () {
|
|
@@ -14,7 +14,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
14
14
|
|
|
15
15
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
16
16
|
|
|
17
|
-
var styles = {"component":"international-phone-
|
|
17
|
+
var styles = {"component":"international-phone-input__component_12v2y","option":"international-phone-input__option_12v2y","flag":"international-phone-input__flag_12v2y","countryName":"international-phone-input__countryName_12v2y","dialCode":"international-phone-input__dialCode_12v2y","flagIconWrapper":"international-phone-input__flagIconWrapper_12v2y","emptyCountryIcon":"international-phone-input__emptyCountryIcon_12v2y"};
|
|
18
18
|
require('./index.css')
|
|
19
19
|
|
|
20
20
|
var CountrySelect = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: i4kfa */
|
|
2
2
|
:root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-neutral-translucent-700: rgba(4, 4, 21, 0.47);
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
/* Up */
|
|
13
13
|
|
|
14
14
|
/* Hard up */
|
|
15
|
-
} :root {
|
|
15
|
+
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
16
|
+
|
|
17
|
+
/* новые значения, используйте их */
|
|
16
18
|
} :root { /* deprecated */ /* deprecated */
|
|
17
19
|
--gap-xs: 8px; /* deprecated */
|
|
18
20
|
--gap-s: 12px; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -20,29 +22,29 @@
|
|
|
20
22
|
/* новые значения, используйте их */
|
|
21
23
|
} :root {
|
|
22
24
|
} :root {
|
|
23
|
-
} .international-phone-
|
|
25
|
+
} .international-phone-input__component_12v2y {
|
|
24
26
|
position: static;
|
|
25
27
|
display: flex;
|
|
26
28
|
min-width: initial;
|
|
27
29
|
height: 100%;
|
|
28
|
-
} .international-phone-
|
|
30
|
+
} .international-phone-input__option_12v2y {
|
|
29
31
|
display: flex;
|
|
30
32
|
align-items: flex-start;
|
|
31
33
|
padding: var(--gap-s);
|
|
32
|
-
} .international-phone-
|
|
34
|
+
} .international-phone-input__flag_12v2y {
|
|
33
35
|
flex-shrink: 0;
|
|
34
36
|
margin-right: var(--gap-xs);
|
|
35
|
-
} .international-phone-
|
|
37
|
+
} .international-phone-input__countryName_12v2y {
|
|
36
38
|
margin-right: var(--gap-xs);
|
|
37
|
-
} .international-phone-
|
|
39
|
+
} .international-phone-input__dialCode_12v2y {
|
|
38
40
|
color: var(--color-light-text-secondary);
|
|
39
|
-
} .international-phone-
|
|
41
|
+
} .international-phone-input__flagIconWrapper_12v2y {
|
|
40
42
|
display: flex;
|
|
41
43
|
justify-content: center;
|
|
42
44
|
align-items: center;
|
|
43
45
|
width: 24px;
|
|
44
46
|
height: 24px;
|
|
45
47
|
margin-left: var(--gap-s);
|
|
46
|
-
} .international-phone-
|
|
48
|
+
} .international-phone-input__emptyCountryIcon_12v2y {
|
|
47
49
|
color: var(--color-light-neutral-translucent-700);
|
|
48
50
|
}
|
|
@@ -11,7 +11,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
12
12
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
13
13
|
|
|
14
|
-
var styles = {"flagIcon":"international-phone-
|
|
14
|
+
var styles = {"flagIcon":"international-phone-input__flagIcon_ouaol","flagPlaceholder":"international-phone-input__flagPlaceholder_ouaol"};
|
|
15
15
|
require('./index.css')
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: kgdgr */
|
|
2
2
|
:root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-neutral-translucent-100: rgba(38, 55, 88, 0.06); /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -12,17 +12,19 @@
|
|
|
12
12
|
|
|
13
13
|
/* Hard up */
|
|
14
14
|
} :root {
|
|
15
|
-
--border-radius-xs: 2px;
|
|
15
|
+
--border-radius-xs: 2px; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
16
|
+
|
|
17
|
+
/* новые значения, используйте их */
|
|
16
18
|
} :root {
|
|
17
19
|
--gap-3xs: 2px; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
18
20
|
|
|
19
21
|
/* новые значения, используйте их */
|
|
20
22
|
} :root {
|
|
21
23
|
} :root {
|
|
22
|
-
} .international-phone-
|
|
24
|
+
} .international-phone-input__flagIcon_ouaol {
|
|
23
25
|
max-width: 24px;
|
|
24
26
|
max-height: 24px;
|
|
25
|
-
} .international-phone-
|
|
27
|
+
} .international-phone-input__flagPlaceholder_ouaol {
|
|
26
28
|
width: 24px;
|
|
27
29
|
height: 16px;
|
|
28
30
|
max-height: 16px;
|
|
@@ -16,7 +16,7 @@ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
|
16
16
|
var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
17
17
|
var cn__default = /*#__PURE__*/_interopDefaultCompat(cn);
|
|
18
18
|
|
|
19
|
-
var styles = {"component":"international-phone-
|
|
19
|
+
var styles = {"component":"international-phone-input__component_11hgq","flagIconContainer":"international-phone-input__flagIconContainer_11hgq","emptyCountryIcon":"international-phone-input__emptyCountryIcon_11hgq","disabled":"international-phone-input__disabled_11hgq","inner":"international-phone-input__inner_11hgq","size-64":"international-phone-input__size-64_11hgq","size-72":"international-phone-input__size-72_11hgq","focusVisible":"international-phone-input__focusVisible_11hgq"};
|
|
20
20
|
require('./index.css')
|
|
21
21
|
|
|
22
22
|
var EMPTY_COUNTRY_SELECT_FIELD = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1qjpg */
|
|
2
2
|
:root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
3
3
|
} /* deprecated */ :root {
|
|
4
4
|
--color-light-neutral-translucent-700: rgba(4, 4, 21, 0.47);
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
/* Up */
|
|
13
13
|
|
|
14
14
|
/* Hard up */
|
|
15
|
-
} :root {
|
|
15
|
+
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
16
|
+
|
|
17
|
+
/* новые значения, используйте их */
|
|
16
18
|
} :root { /* deprecated */
|
|
17
19
|
--gap-2xs: 4px; /* deprecated */ /* deprecated */
|
|
18
20
|
--gap-s: 12px; /* deprecated */ /* deprecated */
|
|
@@ -23,33 +25,33 @@
|
|
|
23
25
|
} :root {
|
|
24
26
|
--focus-color: var(--color-light-status-info);
|
|
25
27
|
--disabled-cursor: not-allowed;
|
|
26
|
-
} .international-phone-
|
|
28
|
+
} .international-phone-input__component_11hgq {
|
|
27
29
|
height: 100%;
|
|
28
30
|
cursor: pointer;
|
|
29
31
|
outline: none;
|
|
30
32
|
position: relative;
|
|
31
|
-
} .international-phone-
|
|
33
|
+
} .international-phone-input__flagIconContainer_11hgq {
|
|
32
34
|
display: flex;
|
|
33
35
|
justify-content: center;
|
|
34
36
|
align-items: center;
|
|
35
37
|
width: 24px;
|
|
36
38
|
height: 24px;
|
|
37
39
|
margin-right: var(--gap-2xs);
|
|
38
|
-
} .international-phone-
|
|
40
|
+
} .international-phone-input__emptyCountryIcon_11hgq {
|
|
39
41
|
color: var(--color-light-neutral-translucent-700);
|
|
40
|
-
} .international-phone-
|
|
42
|
+
} .international-phone-input__disabled_11hgq {
|
|
41
43
|
cursor: var(--disabled-cursor);
|
|
42
|
-
} .international-phone-
|
|
44
|
+
} .international-phone-input__inner_11hgq {
|
|
43
45
|
position: relative;
|
|
44
46
|
display: flex;
|
|
45
47
|
align-items: center;
|
|
46
48
|
height: 100%;
|
|
47
49
|
padding-left: var(--gap-s);
|
|
48
50
|
outline: none;
|
|
49
|
-
} .international-phone-input__size-
|
|
50
|
-
.international-phone-input__size-
|
|
51
|
+
} .international-phone-input__size-64_11hgq .international-phone-input__inner_11hgq,
|
|
52
|
+
.international-phone-input__size-72_11hgq .international-phone-input__inner_11hgq {
|
|
51
53
|
padding-left: var(--gap-m);
|
|
52
|
-
} .international-phone-
|
|
54
|
+
} .international-phone-input__focusVisible_11hgq {
|
|
53
55
|
outline: 2px solid var(--focus-color);
|
|
54
56
|
outline-offset: 2px;
|
|
55
57
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { OptgroupProps } from "./typings-
|
|
3
|
+
import { OptgroupProps } from "./typings-f48223d2";
|
|
4
4
|
declare const Optgroup: ({ children, className, label, size }: OptgroupProps) => React.JSX.Element;
|
|
5
5
|
export { Optgroup };
|
|
@@ -4,10 +4,10 @@ declare const InternationalPhoneInput: React.ForwardRefExoticComponent<(({
|
|
|
4
4
|
country?: import("./types").Country | undefined;
|
|
5
5
|
countries?: string[] | undefined;
|
|
6
6
|
defaultIso2?: string | undefined;
|
|
7
|
-
clearableCountryCode?: boolean | undefined;
|
|
7
|
+
clearableCountryCode?: boolean | "preserve" | undefined;
|
|
8
8
|
countrySelectProps?: import("./components/country-select/index").SharedCountrySelectProps | undefined;
|
|
9
9
|
clear?: boolean | undefined;
|
|
10
|
-
filterFn?: ((value: string | undefined, option: import("./typings-
|
|
10
|
+
filterFn?: ((value: string | undefined, option: import("./typings-f48223d2").OptionShape) => boolean) | undefined;
|
|
11
11
|
onCountryChange?: ((country?: import("./types").Country | undefined) => void) | undefined;
|
|
12
12
|
onChange?: ((phone: string) => void) | undefined;
|
|
13
13
|
onBlur?: ((event: React.FocusEvent<HTMLDivElement | HTMLInputElement, Element>) => void) | undefined;
|
|
@@ -23,18 +23,18 @@ declare const InternationalPhoneInput: React.ForwardRefExoticComponent<(({
|
|
|
23
23
|
country?: import("./types").Country | undefined;
|
|
24
24
|
countries?: string[] | undefined;
|
|
25
25
|
defaultIso2?: string | undefined;
|
|
26
|
-
clearableCountryCode?: boolean | undefined;
|
|
26
|
+
clearableCountryCode?: boolean | "preserve" | undefined;
|
|
27
27
|
countrySelectProps?: import("./components/country-select/index").SharedCountrySelectProps | undefined;
|
|
28
28
|
clear?: boolean | undefined;
|
|
29
|
-
filterFn?: ((value: string | undefined, option: import("./typings-
|
|
29
|
+
filterFn?: ((value: string | undefined, option: import("./typings-f48223d2").OptionShape) => boolean) | undefined;
|
|
30
30
|
onCountryChange?: ((country?: import("./types").Country | undefined) => void) | undefined;
|
|
31
31
|
onChange?: ((phone: string) => void) | undefined;
|
|
32
32
|
onBlur?: ((event: React.FocusEvent<HTMLDivElement | HTMLInputElement, Element>) => void) | undefined;
|
|
33
33
|
onFocus?: ((event: React.FocusEvent<HTMLDivElement | HTMLInputElement, Element>) => void) | undefined;
|
|
34
34
|
} & {
|
|
35
|
-
options: (import("./typings-
|
|
35
|
+
options: (import("./typings-f48223d2").OptionShape | import("./typings-f48223d2").GroupShape)[];
|
|
36
36
|
} & Omit<import("@alfalab/core-components-input-autocomplete/types").InputAutocompleteCommonProps, "onChange" | "onInput"> & {
|
|
37
|
-
options: (import("./typings-
|
|
37
|
+
options: (import("./typings-f48223d2").OptionShape | import("./typings-f48223d2").GroupShape)[];
|
|
38
38
|
} & Omit<import("@alfalab/core-components-input-autocomplete/types").InputAutocompleteMobileProps, "onChange" | "onInput"> & {
|
|
39
39
|
breakpoint?: number | undefined;
|
|
40
40
|
defaultMatchMediaValue?: boolean | (() => boolean) | undefined;
|
|
@@ -6,10 +6,10 @@ declare const BaseInternationalPhoneInput: React.ForwardRefExoticComponent<{
|
|
|
6
6
|
country?: Country | undefined;
|
|
7
7
|
countries?: string[] | undefined;
|
|
8
8
|
defaultIso2?: string | undefined;
|
|
9
|
-
clearableCountryCode?: boolean | undefined;
|
|
9
|
+
clearableCountryCode?: boolean | "preserve" | undefined;
|
|
10
10
|
countrySelectProps?: import("../country-select/index").SharedCountrySelectProps | undefined;
|
|
11
11
|
clear?: boolean | undefined;
|
|
12
|
-
filterFn?: ((value: string | undefined, option: import("../../typings-
|
|
12
|
+
filterFn?: ((value: string | undefined, option: import("../../typings-f48223d2").OptionShape) => boolean) | undefined;
|
|
13
13
|
onCountryChange?: ((country?: Country | undefined) => void) | undefined;
|
|
14
14
|
onChange?: ((phone: string) => void) | undefined;
|
|
15
15
|
onBlur?: ((event: React.FocusEvent<HTMLDivElement | HTMLInputElement, Element>) => void) | undefined;
|
|
@@ -19,15 +19,15 @@ var mergeRefs__default = /*#__PURE__*/_interopDefaultCompat(mergeRefs);
|
|
|
19
19
|
var styles__default = /*#__PURE__*/_interopDefaultCompat(styles);
|
|
20
20
|
|
|
21
21
|
var BaseInternationalPhoneInput = React.forwardRef(function (_a, ref) {
|
|
22
|
-
var
|
|
22
|
+
var _b = _a.clearableCountryCode, clearableCountryCodeFromProps = _b === void 0 ? true : _b, value = _a.value, countryProp = _a.country, filterFn = _a.filterFn, onChange = _a.onChange, onCountryChange = _a.onCountryChange, countrySelectProps = _a.countrySelectProps, countries = _a.countries, defaultIso2 = _a.defaultIso2, disabled = _a.disabled, options = _a.options, _c = _a.size, size = _c === void 0 ? 56 : _c, Input = _a.Input, InputAutocomplete = _a.InputAutocomplete, SelectComponent = _a.SelectComponent, view = _a.view, clearProp = _a.clear, openProps = _a.open, defaultOpen = _a.defaultOpen, restProps = tslib.__rest(_a, ["clearableCountryCode", "value", "country", "filterFn", "onChange", "onCountryChange", "countrySelectProps", "countries", "defaultIso2", "disabled", "options", "size", "Input", "InputAutocomplete", "SelectComponent", "view", "clear", "open", "defaultOpen"]);
|
|
23
23
|
var countriesData = React.useMemo(function () { return utils_index.initCountries(countries); }, [countries]);
|
|
24
24
|
var inputRef = React.useRef(null);
|
|
25
25
|
var inputWrapperRef = React.useRef(null);
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
26
|
+
var _d = React.useState(defaultOpen), open = _d[0], setOpen = _d[1];
|
|
27
|
+
var _e = React.useState(countrySelectProps === null || countrySelectProps === void 0 ? void 0 : countrySelectProps.defaultOpen), openCountry = _e[0], setOpenCountry = _e[1];
|
|
28
|
+
var _f = React.useState(function () {
|
|
29
29
|
return utils_index.findCountry(countriesData, value, defaultIso2, countryProp);
|
|
30
|
-
}), selectedCountry =
|
|
30
|
+
}), selectedCountry = _f[0], setSelectedCountry = _f[1];
|
|
31
31
|
var filteredOptions = utils_index.filterPhones(value, options, filterFn);
|
|
32
32
|
var country = countryProp !== null && countryProp !== void 0 ? countryProp : selectedCountry;
|
|
33
33
|
var handleCountryChange = function (nextCountry) {
|
|
@@ -35,7 +35,9 @@ var BaseInternationalPhoneInput = React.forwardRef(function (_a, ref) {
|
|
|
35
35
|
setSelectedCountry(nextCountry);
|
|
36
36
|
onCountryChange === null || onCountryChange === void 0 ? void 0 : onCountryChange(nextCountry);
|
|
37
37
|
};
|
|
38
|
-
var
|
|
38
|
+
var preserveCountryCode = clearableCountryCodeFromProps === 'preserve';
|
|
39
|
+
var clearableCountryCode = preserveCountryCode || clearableCountryCodeFromProps;
|
|
40
|
+
var maskOptions = React.useMemo(function () { return utils_index.createMaskOptions(country, clearableCountryCode, preserveCountryCode); }, [country, clearableCountryCode, preserveCountryCode]);
|
|
39
41
|
var maskRef = react.useMaskito({ options: maskOptions });
|
|
40
42
|
var changeNumber = function (phone) {
|
|
41
43
|
onChange === null || onChange === void 0 ? void 0 : onChange(phone);
|
|
@@ -52,7 +54,7 @@ var BaseInternationalPhoneInput = React.forwardRef(function (_a, ref) {
|
|
|
52
54
|
var nextCountry = selected === null || selected === void 0 ? void 0 : selected.value;
|
|
53
55
|
handleCountryChange === null || handleCountryChange === void 0 ? void 0 : handleCountryChange(nextCountry);
|
|
54
56
|
if (nextCountry) {
|
|
55
|
-
changeNumber(
|
|
57
|
+
changeNumber(utils_index.getInitialValueFromCountry(nextCountry.countryCode));
|
|
56
58
|
}
|
|
57
59
|
requestAnimationFrame(function () { var _a; return (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus(); });
|
|
58
60
|
};
|
|
@@ -60,8 +62,9 @@ var BaseInternationalPhoneInput = React.forwardRef(function (_a, ref) {
|
|
|
60
62
|
var _a;
|
|
61
63
|
updatePhoneData(core.maskitoTransform(typeof payload === 'string' ? payload : ((_a = payload.selected) === null || _a === void 0 ? void 0 : _a.key) || '', maskOptions));
|
|
62
64
|
};
|
|
63
|
-
var handleInput = function (
|
|
64
|
-
|
|
65
|
+
var handleInput = function (_a) {
|
|
66
|
+
var inputValue = _a.target.value;
|
|
67
|
+
updatePhoneData(inputValue);
|
|
65
68
|
};
|
|
66
69
|
var handleClear = function (event) {
|
|
67
70
|
var _a, _b;
|
|
@@ -72,7 +75,7 @@ var BaseInternationalPhoneInput = React.forwardRef(function (_a, ref) {
|
|
|
72
75
|
handleCountryChange(nextCountry);
|
|
73
76
|
}
|
|
74
77
|
else {
|
|
75
|
-
changeNumber(
|
|
78
|
+
changeNumber(country ? utils_index.getInitialValueFromCountry(country.countryCode) : '');
|
|
76
79
|
}
|
|
77
80
|
};
|
|
78
81
|
React.useEffect(function () {
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
/* Up */
|
|
12
12
|
|
|
13
13
|
/* Hard up */
|
|
14
|
-
} :root {
|
|
14
|
+
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
15
|
+
|
|
16
|
+
/* новые значения, используйте их */
|
|
15
17
|
} :root { /* deprecated */ /* deprecated */
|
|
16
18
|
--gap-xs: 8px; /* deprecated */
|
|
17
19
|
--gap-s: 12px; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
/* Hard up */
|
|
13
13
|
} :root {
|
|
14
|
-
--border-radius-xs: 2px;
|
|
14
|
+
--border-radius-xs: 2px; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
15
|
+
|
|
16
|
+
/* новые значения, используйте их */
|
|
15
17
|
} :root {
|
|
16
18
|
--gap-3xs: 2px; /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* 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
|
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
/* Up */
|
|
12
12
|
|
|
13
13
|
/* Hard up */
|
|
14
|
-
} :root {
|
|
14
|
+
} :root { /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */ /* deprecated */
|
|
15
|
+
|
|
16
|
+
/* новые значения, используйте их */
|
|
15
17
|
} :root { /* deprecated */
|
|
16
18
|
--gap-2xs: 4px; /* deprecated */ /* deprecated */
|
|
17
19
|
--gap-s: 12px; /* deprecated */ /* deprecated */
|
|
@@ -13,9 +13,6 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
13
|
|
|
14
14
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
15
15
|
|
|
16
|
-
var InternationalPhoneInputDesktop = React.forwardRef(function (
|
|
17
|
-
var value = _a.value, _b = _a.clearableCountryCode, clearableCountryCode = _b === void 0 ? true : _b, restProps = tslib.__rest(_a, ["value", "clearableCountryCode"]);
|
|
18
|
-
return (React__default.default.createElement(components_baseInternationalPhoneInput_Component.BaseInternationalPhoneInput, tslib.__assign({ selected: value }, restProps, { clearableCountryCode: clearableCountryCode, value: value, view: 'desktop', ref: ref, SelectComponent: desktop.SelectDesktop, Input: desktop$1.InputDesktop, InputAutocomplete: desktop$2.InputAutocompleteDesktop })));
|
|
19
|
-
});
|
|
16
|
+
var InternationalPhoneInputDesktop = React.forwardRef(function (props, ref) { return (React__default.default.createElement(components_baseInternationalPhoneInput_Component.BaseInternationalPhoneInput, tslib.__assign({ selected: props.value }, props, { view: 'desktop', ref: ref, SelectComponent: desktop.SelectDesktop, Input: desktop$1.InputDesktop, InputAutocomplete: desktop$2.InputAutocompleteDesktop }))); });
|
|
20
17
|
|
|
21
18
|
exports.InternationalPhoneInputDesktop = InternationalPhoneInputDesktop;
|
|
@@ -13,9 +13,6 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
13
|
|
|
14
14
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
15
15
|
|
|
16
|
-
var InternationalPhoneInputMobile = React.forwardRef(function (
|
|
17
|
-
var value = _a.value, _b = _a.clearableCountryCode, clearableCountryCode = _b === void 0 ? true : _b, restProps = tslib.__rest(_a, ["value", "clearableCountryCode"]);
|
|
18
|
-
return (React__default.default.createElement(components_baseInternationalPhoneInput_Component.BaseInternationalPhoneInput, tslib.__assign({ selected: value }, restProps, { clearableCountryCode: clearableCountryCode, value: value, view: 'mobile', ref: ref, SelectComponent: mobile.SelectMobile, Input: mobile$1.InputMobile, InputAutocomplete: mobile$2.InputAutocompleteMobile })));
|
|
19
|
-
});
|
|
16
|
+
var InternationalPhoneInputMobile = React.forwardRef(function (props, ref) { return (React__default.default.createElement(components_baseInternationalPhoneInput_Component.BaseInternationalPhoneInput, tslib.__assign({ selected: props.value }, props, { view: 'mobile', ref: ref, SelectComponent: mobile.SelectMobile, Input: mobile$1.InputMobile, InputAutocomplete: mobile$2.InputAutocompleteMobile }))); });
|
|
20
17
|
|
|
21
18
|
exports.InternationalPhoneInputMobile = InternationalPhoneInputMobile;
|
package/cssm/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { InputMobileProps } from "@alfalab/core-components-input/mobile";
|
|
|
5
5
|
import { InputAutocompleteProps } from "@alfalab/core-components-input-autocomplete";
|
|
6
6
|
import { InputAutocompleteDesktopProps } from "@alfalab/core-components-input-autocomplete/desktop";
|
|
7
7
|
import { InputAutocompleteMobileProps } from "@alfalab/core-components-input-autocomplete/mobile";
|
|
8
|
-
import { OptionShape } from "./typings-
|
|
8
|
+
import { OptionShape } from "./typings-f48223d2";
|
|
9
9
|
import { SharedCountrySelectProps } from "./components/country-select/index";
|
|
10
10
|
type Country = {
|
|
11
11
|
name: string;
|
|
@@ -36,8 +36,10 @@ type CommonPhoneInputProps = {
|
|
|
36
36
|
defaultIso2?: string;
|
|
37
37
|
/**
|
|
38
38
|
* Возможность стереть код страны
|
|
39
|
+
* @default true
|
|
40
|
+
* @description Используйте `'preserve'` для сохранения кода страны при автозаполнении (актуально для Safari). При этом код страны можно удалить в случае использования `true`
|
|
39
41
|
*/
|
|
40
|
-
clearableCountryCode?: boolean;
|
|
42
|
+
clearableCountryCode?: boolean | 'preserve';
|
|
41
43
|
/**
|
|
42
44
|
* Свойства селекта выбора стран
|
|
43
45
|
*/
|
|
@@ -1169,6 +1169,10 @@ type BaseSelectProps = {
|
|
|
1169
1169
|
* Пропсы, которые будут прокинуты в компонент пункта меню
|
|
1170
1170
|
*/
|
|
1171
1171
|
optionProps?: unknown;
|
|
1172
|
+
/**
|
|
1173
|
+
* Пропсы, которые будут прокинуты в компонент группового пункта меню
|
|
1174
|
+
*/
|
|
1175
|
+
groupOptionProps?: AnyObject;
|
|
1172
1176
|
/**
|
|
1173
1177
|
* Компонент выпадающего меню
|
|
1174
1178
|
*/
|
|
@@ -1361,6 +1365,10 @@ type OptionsListProps = {
|
|
|
1361
1365
|
* Функция для получения пропсов для ячейки
|
|
1362
1366
|
*/
|
|
1363
1367
|
getOptionProps: (option: OptionShape, index: number) => OptionProps;
|
|
1368
|
+
/**
|
|
1369
|
+
* Пропсы, которые будут прокинуты в компонент группового пункта меню
|
|
1370
|
+
*/
|
|
1371
|
+
groupOptionProps?: AnyObject;
|
|
1364
1372
|
/**
|
|
1365
1373
|
* Список выбранных пунктов
|
|
1366
1374
|
*/
|
package/cssm/utils/index.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ declare function initCountries(iso2s?: string[]): Country[][];
|
|
|
6
6
|
declare function findCountry(countries: Country[][], value?: string, iso2?: string, country?: Country): Country | undefined;
|
|
7
7
|
declare function guessCountry(inputNumber: string, data: Country[][]): Country | undefined;
|
|
8
8
|
declare function clearMask(value: string): string;
|
|
9
|
-
declare function createPhoneMaskExpression(country
|
|
10
|
-
declare function createMaskOptions(country
|
|
9
|
+
declare function createPhoneMaskExpression(country: Country | undefined, clearableCountryCode: boolean): Array<RegExp | string>;
|
|
10
|
+
declare function createMaskOptions(country: Country | undefined, clearableCountryCode: boolean, preserveCountryCode: boolean): MaskitoOptions;
|
|
11
11
|
declare function defaultFilterFn(value: string | undefined, option: OptionShape): boolean;
|
|
12
12
|
declare const filterPhones: (value?: string, options?: InputAutocompleteDesktopProps['options'], filterFn?: typeof defaultFilterFn) => (OptionShape | GroupShape)[];
|
|
13
13
|
declare function getPhoneData(phone: string, countries: Country[][], defaultIso2?: string): {
|
|
@@ -70,4 +70,5 @@ declare function getInternationalPhoneInputMobileTestIds(dataTestId: string): {
|
|
|
70
70
|
searchError: string;
|
|
71
71
|
searchHint: string;
|
|
72
72
|
};
|
|
73
|
-
|
|
73
|
+
declare function getInitialValueFromCountry(countryCode: string): string;
|
|
74
|
+
export { initCountries, findCountry, guessCountry, clearMask, createPhoneMaskExpression, createMaskOptions, filterPhones, getPhoneData, getClear, getInternationalPhoneInputDesktopTestIds, getInternationalPhoneInputMobileTestIds, getInitialValueFromCountry };
|