@mirai/ui 1.0.229 → 1.0.230
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.
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getInputPhoneErrors = void 0;
|
|
7
|
+
var _helpers = require("../components/InputPhone/helpers");
|
|
7
8
|
var getInputPhoneErrors = function getInputPhoneErrors() {
|
|
8
9
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
9
10
|
_ref$prefixes = _ref.prefixes,
|
|
@@ -16,7 +17,7 @@ var getInputPhoneErrors = function getInputPhoneErrors() {
|
|
|
16
17
|
var _value$replace = value.replace(/\D/g, ''),
|
|
17
18
|
length = _value$replace.length;
|
|
18
19
|
if (length < (withPrefix ? 10 : 8)) errors.minLength = true;
|
|
19
|
-
if (withPrefix && !prefixes.some(function (item) {
|
|
20
|
+
if (withPrefix && !(0, _helpers.sanitizePrefixes)(prefixes).some(function (item) {
|
|
20
21
|
return value.includes(item);
|
|
21
22
|
})) errors.format = true;
|
|
22
23
|
return Object.keys(errors).length > 0 ? errors : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInputPhoneErrors.js","names":["getInputPhoneErrors","prefixes","value","trim","length","errors","withPrefix","replace","minLength","some","item","includes","format","Object","keys","undefined"],"sources":["../../src/helpers/getInputPhoneErrors.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"getInputPhoneErrors.js","names":["getInputPhoneErrors","prefixes","value","trim","length","errors","withPrefix","replace","minLength","sanitizePrefixes","some","item","includes","format","Object","keys","undefined"],"sources":["../../src/helpers/getInputPhoneErrors.js"],"sourcesContent":["import { sanitizePrefixes } from '../components/InputPhone/helpers';\n\nexport const getInputPhoneErrors = ({ prefixes = [], value = '' } = {}) => {\n if (value.trim().length === 0) return;\n\n const errors = {};\n const withPrefix = prefixes.length > 0;\n const { length } = value.replace(/\\D/g, '');\n\n if (length < (withPrefix ? 10 : 8)) errors.minLength = true;\n if (withPrefix && !sanitizePrefixes(prefixes).some((item) => value.includes(item))) errors.format = true;\n\n return Object.keys(errors).length > 0 ? errors : undefined;\n};\n"],"mappings":";;;;;;AAAA;AAEO,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAmB,GAA2C;EAAA,+EAAP,CAAC,CAAC;IAAA,qBAAhCC,QAAQ;IAARA,QAAQ,8BAAG,EAAE;IAAA,kBAAEC,KAAK;IAALA,KAAK,2BAAG,EAAE;EAC7D,IAAIA,KAAK,CAACC,IAAI,EAAE,CAACC,MAAM,KAAK,CAAC,EAAE;EAE/B,IAAMC,MAAM,GAAG,CAAC,CAAC;EACjB,IAAMC,UAAU,GAAGL,QAAQ,CAACG,MAAM,GAAG,CAAC;EACtC,qBAAmBF,KAAK,CAACK,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;IAAnCH,MAAM,kBAANA,MAAM;EAEd,IAAIA,MAAM,IAAIE,UAAU,GAAG,EAAE,GAAG,CAAC,CAAC,EAAED,MAAM,CAACG,SAAS,GAAG,IAAI;EAC3D,IAAIF,UAAU,IAAI,CAAC,IAAAG,yBAAgB,EAACR,QAAQ,CAAC,CAACS,IAAI,CAAC,UAACC,IAAI;IAAA,OAAKT,KAAK,CAACU,QAAQ,CAACD,IAAI,CAAC;EAAA,EAAC,EAAEN,MAAM,CAACQ,MAAM,GAAG,IAAI;EAExG,OAAOC,MAAM,CAACC,IAAI,CAACV,MAAM,CAAC,CAACD,MAAM,GAAG,CAAC,GAAGC,MAAM,GAAGW,SAAS;AAC5D,CAAC;AAAC"}
|