@bigbinary/neeto-molecules 3.5.13 → 3.5.15
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/dist/PhoneNumber.js +2 -2
- package/dist/SessionEnvironment.js +1 -1
- package/dist/cjs/PhoneNumber.js +1 -1
- package/dist/cjs/SessionEnvironment.js +1 -1
- package/dist/cjs/{phone-number-904b0a70.js → phone-number-b28bc9dd.js} +21 -6
- package/dist/cjs/{phone-number-904b0a70.js.map → phone-number-b28bc9dd.js.map} +1 -1
- package/dist/{phone-number-cf3e77d7.js → phone-number-1d33eea1.js} +23 -8
- package/dist/{phone-number-cf3e77d7.js.map → phone-number-1d33eea1.js.map} +1 -1
- package/package.json +3 -3
package/dist/PhoneNumber.js
CHANGED
|
@@ -2,8 +2,8 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
2
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
4
|
import { useField } from 'formik';
|
|
5
|
-
import { P as PhoneNumberInput, g as getPhoneData, S as SingleValue } from './phone-number-
|
|
6
|
-
export { P as PhoneNumberInput, i as isPhoneNumberValid, v as validation } from './phone-number-
|
|
5
|
+
import { P as PhoneNumberInput, g as getPhoneData, S as SingleValue } from './phone-number-1d33eea1.js';
|
|
6
|
+
export { P as PhoneNumberInput, i as isPhoneNumberValid, v as validation } from './phone-number-1d33eea1.js';
|
|
7
7
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
8
|
import { memo } from 'react';
|
|
9
9
|
import classnames from 'classnames';
|
|
@@ -19,7 +19,7 @@ import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
|
19
19
|
import CopyToClipboardButton from './CopyToClipboardButton.js';
|
|
20
20
|
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
21
21
|
import 'formik';
|
|
22
|
-
import { P as PhoneNumberInput } from './phone-number-
|
|
22
|
+
import { P as PhoneNumberInput } from './phone-number-1d33eea1.js';
|
|
23
23
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
24
24
|
import 'i18next';
|
|
25
25
|
import 'libphonenumber-js/min';
|
package/dist/cjs/PhoneNumber.js
CHANGED
|
@@ -6,7 +6,7 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
6
6
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
7
7
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
8
|
var formik = require('formik');
|
|
9
|
-
var phoneNumber = require('./phone-number-
|
|
9
|
+
var phoneNumber = require('./phone-number-b28bc9dd.js');
|
|
10
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
11
|
var React = require('react');
|
|
12
12
|
var classnames = require('classnames');
|
|
@@ -21,7 +21,7 @@ var Tooltip = require('@bigbinary/neetoui/Tooltip');
|
|
|
21
21
|
var CopyToClipboardButton = require('./CopyToClipboardButton.js');
|
|
22
22
|
require('@babel/runtime/helpers/objectWithoutProperties');
|
|
23
23
|
require('formik');
|
|
24
|
-
var phoneNumber = require('./phone-number-
|
|
24
|
+
var phoneNumber = require('./phone-number-b28bc9dd.js');
|
|
25
25
|
var jsxRuntime = require('react/jsx-runtime');
|
|
26
26
|
require('i18next');
|
|
27
27
|
require('libphonenumber-js/min');
|
|
@@ -251,7 +251,14 @@ var getCursorPosition = function getCursorPosition(_ref) {
|
|
|
251
251
|
};
|
|
252
252
|
|
|
253
253
|
var useSetInitialCountry = function useSetInitialCountry(initialCountryCode, initialValue) {
|
|
254
|
-
var
|
|
254
|
+
var _useCountryCodeStore = useCountryCodeStore(function (store) {
|
|
255
|
+
return {
|
|
256
|
+
countryCode: store["countryCode"],
|
|
257
|
+
setCountryCode: store["setCountryCode"]
|
|
258
|
+
};
|
|
259
|
+
}, shallow.shallow),
|
|
260
|
+
countryCode = _useCountryCodeStore.countryCode,
|
|
261
|
+
setCountryCode = _useCountryCodeStore.setCountryCode;
|
|
255
262
|
var _getPhoneData = getPhoneData(initialValue),
|
|
256
263
|
countryCodeFromInitialValue = _getPhoneData.countryCode;
|
|
257
264
|
var isFetchLocationEnabled = !initialCountryCode && !countryCodeFromInitialValue;
|
|
@@ -262,15 +269,23 @@ var useSetInitialCountry = function useSetInitialCountry(initialCountryCode, ini
|
|
|
262
269
|
},
|
|
263
270
|
enabled: isFetchLocationEnabled
|
|
264
271
|
}),
|
|
265
|
-
data = _useQuery.data
|
|
272
|
+
data = _useQuery.data,
|
|
273
|
+
isLoading = _useQuery.isLoading;
|
|
266
274
|
React.useEffect(function () {
|
|
267
275
|
if (isFetchLocationEnabled) return;
|
|
268
276
|
setCountryCode(countryCodeFromInitialValue || initialCountryCode);
|
|
269
277
|
}, []);
|
|
270
278
|
React.useEffect(function () {
|
|
271
|
-
if (!
|
|
272
|
-
|
|
273
|
-
|
|
279
|
+
if (isLoading || !isFetchLocationEnabled) return;
|
|
280
|
+
var newCountryCode = neetoCist.findBy({
|
|
281
|
+
value: data === null || data === void 0 ? void 0 : data.countryCode
|
|
282
|
+
}, COUNTRY_PICKER_OPTIONS) ? data === null || data === void 0 ? void 0 : data.countryCode : countryCode || "US";
|
|
283
|
+
|
|
284
|
+
// Only update state if the new country code is different from the current one
|
|
285
|
+
if (newCountryCode !== countryCode) {
|
|
286
|
+
setCountryCode(newCountryCode);
|
|
287
|
+
}
|
|
288
|
+
}, [data, isLoading, isFetchLocationEnabled, countryCode]);
|
|
274
289
|
};
|
|
275
290
|
|
|
276
291
|
var _excluded = ["value", "onChange", "className", "error", "selectProps", "initialCountryCode"];
|
|
@@ -358,4 +373,4 @@ exports.SingleValue = SingleValue$1;
|
|
|
358
373
|
exports.getPhoneData = getPhoneData;
|
|
359
374
|
exports.isPhoneNumberValid = isPhoneNumberValid;
|
|
360
375
|
exports.validation = validation;
|
|
361
|
-
//# sourceMappingURL=phone-number-
|
|
376
|
+
//# sourceMappingURL=phone-number-b28bc9dd.js.map
|