@trackunit/react-form-components 0.0.143 → 0.0.145
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/index.cjs.js +4 -4
- package/index.esm.js +4 -4
- package/package.json +2 -2
package/index.cjs.js
CHANGED
|
@@ -6322,7 +6322,7 @@ const usePhoneInput = () => {
|
|
|
6322
6322
|
};
|
|
6323
6323
|
const getPhoneNumber = ({ country, phone }) => {
|
|
6324
6324
|
if (country) {
|
|
6325
|
-
return getPhoneNumberWithPlus(`${country}${phone}`);
|
|
6325
|
+
return getPhoneNumberWithPlus(`${country}${phone || ""}`);
|
|
6326
6326
|
}
|
|
6327
6327
|
return phone || "";
|
|
6328
6328
|
};
|
|
@@ -14515,8 +14515,8 @@ const PhoneInput = React.forwardRef((_a, ref) => {
|
|
|
14515
14515
|
const number = parsePhoneNumber(safePhoneNumber);
|
|
14516
14516
|
const [phone, setPhone] = React.useState((_b = number === null || number === void 0 ? void 0 : number.nationalNumber.toString()) !== null && _b !== void 0 ? _b : "");
|
|
14517
14517
|
const [code, setCode] = React.useState((_c = number === null || number === void 0 ? void 0 : number.countryCallingCode.toString()) !== null && _c !== void 0 ? _c : "");
|
|
14518
|
-
const codeRef = React.useRef(); // synchronus reliable source of truth (country code is calling onblur just after onchange, useState is too slow for this)
|
|
14519
|
-
const phoneRef = React.useRef(); // synchronus reliable source of truth
|
|
14518
|
+
const codeRef = React.useRef(code); // synchronus reliable source of truth (country code is calling onblur just after onchange, useState is too slow for this)
|
|
14519
|
+
const phoneRef = React.useRef(phone); // synchronus reliable source of truth
|
|
14520
14520
|
const onChangeHandler = React__default["default"].useCallback(({ newPhone, newCode }) => {
|
|
14521
14521
|
onChangeValue &&
|
|
14522
14522
|
onChangeValue({
|
|
@@ -14555,7 +14555,7 @@ const PhoneInput = React.forwardRef((_a, ref) => {
|
|
|
14555
14555
|
onBlurHandler();
|
|
14556
14556
|
}, onChange: e => {
|
|
14557
14557
|
(e === null || e === void 0 ? void 0 : e.value) && onCodeChangeHandler(e === null || e === void 0 ? void 0 : e.value);
|
|
14558
|
-
codeRef.current = e === null || e === void 0 ? void 0 : e.value;
|
|
14558
|
+
codeRef.current = (e === null || e === void 0 ? void 0 : e.value) || "";
|
|
14559
14559
|
}, disabled: disabled, readOnly: readOnly, isInvalid: isInvalid, placeholder: countryCodePlaceholderValue }), jsxRuntime.jsx(BaseInput, Object.assign({ id: "phoneInput-number", dataTestId: dataTestId && `${dataTestId}-phoneNumberInput`, fieldSize: fieldSize, type: "tel", value: phone, disabled: disabled, readOnly: readOnly, isInvalid: isInvalid, onChange: e => {
|
|
14560
14560
|
(e === null || e === void 0 ? void 0 : e.target.value) && setPhone(e.target.value);
|
|
14561
14561
|
onPhoneChangeHandler(e.target.value);
|
package/index.esm.js
CHANGED
|
@@ -6296,7 +6296,7 @@ const usePhoneInput = () => {
|
|
|
6296
6296
|
};
|
|
6297
6297
|
const getPhoneNumber = ({ country, phone }) => {
|
|
6298
6298
|
if (country) {
|
|
6299
|
-
return getPhoneNumberWithPlus(`${country}${phone}`);
|
|
6299
|
+
return getPhoneNumberWithPlus(`${country}${phone || ""}`);
|
|
6300
6300
|
}
|
|
6301
6301
|
return phone || "";
|
|
6302
6302
|
};
|
|
@@ -14489,8 +14489,8 @@ const PhoneInput = forwardRef((_a, ref) => {
|
|
|
14489
14489
|
const number = parsePhoneNumber(safePhoneNumber);
|
|
14490
14490
|
const [phone, setPhone] = useState((_b = number === null || number === void 0 ? void 0 : number.nationalNumber.toString()) !== null && _b !== void 0 ? _b : "");
|
|
14491
14491
|
const [code, setCode] = useState((_c = number === null || number === void 0 ? void 0 : number.countryCallingCode.toString()) !== null && _c !== void 0 ? _c : "");
|
|
14492
|
-
const codeRef = useRef(); // synchronus reliable source of truth (country code is calling onblur just after onchange, useState is too slow for this)
|
|
14493
|
-
const phoneRef = useRef(); // synchronus reliable source of truth
|
|
14492
|
+
const codeRef = useRef(code); // synchronus reliable source of truth (country code is calling onblur just after onchange, useState is too slow for this)
|
|
14493
|
+
const phoneRef = useRef(phone); // synchronus reliable source of truth
|
|
14494
14494
|
const onChangeHandler = React__default.useCallback(({ newPhone, newCode }) => {
|
|
14495
14495
|
onChangeValue &&
|
|
14496
14496
|
onChangeValue({
|
|
@@ -14529,7 +14529,7 @@ const PhoneInput = forwardRef((_a, ref) => {
|
|
|
14529
14529
|
onBlurHandler();
|
|
14530
14530
|
}, onChange: e => {
|
|
14531
14531
|
(e === null || e === void 0 ? void 0 : e.value) && onCodeChangeHandler(e === null || e === void 0 ? void 0 : e.value);
|
|
14532
|
-
codeRef.current = e === null || e === void 0 ? void 0 : e.value;
|
|
14532
|
+
codeRef.current = (e === null || e === void 0 ? void 0 : e.value) || "";
|
|
14533
14533
|
}, disabled: disabled, readOnly: readOnly, isInvalid: isInvalid, placeholder: countryCodePlaceholderValue }), jsx$1(BaseInput, Object.assign({ id: "phoneInput-number", dataTestId: dataTestId && `${dataTestId}-phoneNumberInput`, fieldSize: fieldSize, type: "tel", value: phone, disabled: disabled, readOnly: readOnly, isInvalid: isInvalid, onChange: e => {
|
|
14534
14534
|
(e === null || e === void 0 ? void 0 : e.target.value) && setPhone(e.target.value);
|
|
14535
14535
|
onPhoneChangeHandler(e.target.value);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.145",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@trackunit/css-class-variance-utilities": "0.0.14",
|
|
11
11
|
"@trackunit/i18n-library-translation": "0.0.78",
|
|
12
|
-
"@trackunit/react-components": "0.1.
|
|
12
|
+
"@trackunit/react-components": "0.1.159",
|
|
13
13
|
"@trackunit/shared-utils": "0.0.7",
|
|
14
14
|
"@trackunit/ui-icons": "0.0.76",
|
|
15
15
|
"date-fns": "2.29.3",
|