@alfalab/core-components-phone-input 6.1.6 → 7.0.0
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.d.ts +1 -1
- package/Component.js +1 -1
- package/cssm/Component.d.ts +1 -1
- package/cssm/Component.js +1 -1
- package/esm/Component.d.ts +1 -1
- package/esm/Component.js +1 -1
- package/modern/Component.d.ts +1 -1
- package/modern/Component.js +1 -1
- package/package.json +2 -2
- package/utils/index.js +7 -5
package/Component.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { MaskedInputProps } from "@alfalab/core-components-masked-input";
|
|
|
4
4
|
type PhoneInputProps = Omit<MaskedInputProps, 'onBeforeDisplay' | 'type' | 'mask'> & {
|
|
5
5
|
clearableCountryCode?: boolean;
|
|
6
6
|
};
|
|
7
|
-
declare const PhoneInput: React.ForwardRefExoticComponent<
|
|
7
|
+
declare const PhoneInput: React.ForwardRefExoticComponent<Omit<MaskedInputProps, "mask" | "type" | "onBeforeDisplay"> & {
|
|
8
8
|
clearableCountryCode?: boolean | undefined;
|
|
9
9
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
10
10
|
export { PhoneInputProps, PhoneInput };
|
package/Component.js
CHANGED
|
@@ -11,7 +11,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
|
|
12
12
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/******************************************************************************
|
|
15
15
|
Copyright (c) Microsoft Corporation.
|
|
16
16
|
|
|
17
17
|
Permission to use, copy, modify, and/or distribute this software for any
|
package/cssm/Component.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { MaskedInputProps } from "@alfalab/core-components-masked-input";
|
|
|
4
4
|
type PhoneInputProps = Omit<MaskedInputProps, 'onBeforeDisplay' | 'type' | 'mask'> & {
|
|
5
5
|
clearableCountryCode?: boolean;
|
|
6
6
|
};
|
|
7
|
-
declare const PhoneInput: React.ForwardRefExoticComponent<
|
|
7
|
+
declare const PhoneInput: React.ForwardRefExoticComponent<Omit<MaskedInputProps, "mask" | "type" | "onBeforeDisplay"> & {
|
|
8
8
|
clearableCountryCode?: boolean | undefined;
|
|
9
9
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
10
10
|
export { PhoneInputProps, PhoneInput };
|
package/cssm/Component.js
CHANGED
|
@@ -11,7 +11,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
|
|
12
12
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/******************************************************************************
|
|
15
15
|
Copyright (c) Microsoft Corporation.
|
|
16
16
|
|
|
17
17
|
Permission to use, copy, modify, and/or distribute this software for any
|
package/esm/Component.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { MaskedInputProps } from "@alfalab/core-components-masked-input";
|
|
|
4
4
|
type PhoneInputProps = Omit<MaskedInputProps, 'onBeforeDisplay' | 'type' | 'mask'> & {
|
|
5
5
|
clearableCountryCode?: boolean;
|
|
6
6
|
};
|
|
7
|
-
declare const PhoneInput: React.ForwardRefExoticComponent<
|
|
7
|
+
declare const PhoneInput: React.ForwardRefExoticComponent<Omit<MaskedInputProps, "mask" | "type" | "onBeforeDisplay"> & {
|
|
8
8
|
clearableCountryCode?: boolean | undefined;
|
|
9
9
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
10
10
|
export { PhoneInputProps, PhoneInput };
|
package/esm/Component.js
CHANGED
|
@@ -3,7 +3,7 @@ import { conformToMask } from 'text-mask-core';
|
|
|
3
3
|
import { MaskedInput } from '@alfalab/core-components-masked-input/esm';
|
|
4
4
|
import { deleteFormatting, setCaretPosition, getInsertedNumber } from './utils/index.js';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/******************************************************************************
|
|
7
7
|
Copyright (c) Microsoft Corporation.
|
|
8
8
|
|
|
9
9
|
Permission to use, copy, modify, and/or distribute this software for any
|
package/modern/Component.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { MaskedInputProps } from "@alfalab/core-components-masked-input";
|
|
|
4
4
|
type PhoneInputProps = Omit<MaskedInputProps, 'onBeforeDisplay' | 'type' | 'mask'> & {
|
|
5
5
|
clearableCountryCode?: boolean;
|
|
6
6
|
};
|
|
7
|
-
declare const PhoneInput: React.ForwardRefExoticComponent<
|
|
7
|
+
declare const PhoneInput: React.ForwardRefExoticComponent<Omit<MaskedInputProps, "mask" | "type" | "onBeforeDisplay"> & {
|
|
8
8
|
clearableCountryCode?: boolean | undefined;
|
|
9
9
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
10
10
|
export { PhoneInputProps, PhoneInput };
|
package/modern/Component.js
CHANGED
|
@@ -82,7 +82,7 @@ const PhoneInput = React.forwardRef(({ clearableCountryCode = true, ...restProps
|
|
|
82
82
|
}
|
|
83
83
|
return conformedValue;
|
|
84
84
|
}, [clearableCountryCode]);
|
|
85
|
-
return (React.createElement(MaskedInput,
|
|
85
|
+
return (React.createElement(MaskedInput, { ...restProps, defaultValue: clearableCountryCode ? restProps.defaultValue : countryPrefix, mask: mask, onBeforeDisplay: handleBeforeDisplay, type: 'tel', ref: inputRef }));
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
export { PhoneInput };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfalab/core-components-phone-input",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"react": "^16.9.0 || ^17.0.1 || ^18.0.0"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@alfalab/core-components-masked-input": "^
|
|
20
|
+
"@alfalab/core-components-masked-input": "^6.0.0",
|
|
21
21
|
"classnames": "^2.3.1",
|
|
22
22
|
"text-mask-core": "^5.1.2"
|
|
23
23
|
}
|
package/utils/index.js
CHANGED
|
@@ -6,11 +6,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
* Удаляет форматирование номера телефона
|
|
7
7
|
* @param phone Номер телефона
|
|
8
8
|
*/
|
|
9
|
-
var deleteFormatting = function (phone) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
var deleteFormatting = function (phone) {
|
|
10
|
+
return phone
|
|
11
|
+
.replace('+', '')
|
|
12
|
+
.replace(/^7/, '')
|
|
13
|
+
.replace(/\s/g, '')
|
|
14
|
+
.replace(/-/g, '');
|
|
15
|
+
};
|
|
14
16
|
function setCaretPosition(_a) {
|
|
15
17
|
var position = _a.position, inputRef = _a.inputRef;
|
|
16
18
|
window.requestAnimationFrame(function () {
|