@rpcbase/ui 0.181.0 → 0.182.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/dist/index103.js +36 -36
- package/dist/index115.js +6 -6
- package/dist/index122.js +1 -1
- package/dist/index124.js +2 -2
- package/dist/index126.js +1 -1
- package/dist/index151.js +1 -1
- package/dist/index153.js +5 -605
- package/dist/index153.js.map +1 -1
- package/dist/index154.js +68 -5
- package/dist/index154.js.map +1 -1
- package/dist/index155.js +2 -69
- package/dist/index155.js.map +1 -1
- package/dist/index156.js +364 -2
- package/dist/index156.js.map +1 -1
- package/dist/index157.js +201 -303
- package/dist/index157.js.map +1 -1
- package/dist/index158.js +46 -247
- package/dist/index158.js.map +1 -1
- package/dist/index159.js +42 -56
- package/dist/index159.js.map +1 -1
- package/dist/index160.js +169 -46
- package/dist/index160.js.map +1 -1
- package/dist/index161.js +96 -156
- package/dist/index161.js.map +1 -1
- package/dist/index162.js +24 -109
- package/dist/index162.js.map +1 -1
- package/dist/index163.js +8 -25
- package/dist/index163.js.map +1 -1
- package/dist/index164.js +5 -8
- package/dist/index164.js.map +1 -1
- package/dist/index165.js +5 -4
- package/dist/index165.js.map +1 -1
- package/dist/index166.js +4 -5
- package/dist/index166.js.map +1 -1
- package/dist/index167.js +466 -4
- package/dist/index167.js.map +1 -1
- package/dist/index168.js +139 -420
- package/dist/index168.js.map +1 -1
- package/dist/index169.js +71 -149
- package/dist/index169.js.map +1 -1
- package/dist/index170.js +229 -74
- package/dist/index170.js.map +1 -1
- package/dist/index171.js +9 -262
- package/dist/index171.js.map +1 -1
- package/dist/index172.js +42 -9
- package/dist/index172.js.map +1 -1
- package/dist/index173.js +4 -42
- package/dist/index173.js.map +1 -1
- package/dist/index174.js +605 -4
- package/dist/index174.js.map +1 -1
- package/dist/index175.js +57 -15
- package/dist/index175.js.map +1 -1
- package/dist/index176.js +8 -5
- package/dist/index176.js.map +1 -1
- package/dist/index177.js +65 -4
- package/dist/index177.js.map +1 -1
- package/dist/index178.js +18 -57
- package/dist/index178.js.map +1 -1
- package/dist/index179.js +14 -64
- package/dist/index179.js.map +1 -1
- package/dist/index180.js +5 -6
- package/dist/index180.js.map +1 -1
- package/dist/index181.js +5 -4
- package/dist/index181.js.map +1 -1
- package/dist/index182.js +6 -7
- package/dist/index182.js.map +1 -1
- package/dist/index183.js +4 -17
- package/dist/index183.js.map +1 -1
- package/dist/index184.js +7 -5
- package/dist/index184.js.map +1 -1
- package/dist/index185.js +17 -5
- package/dist/index185.js.map +1 -1
- package/dist/index186.js +5 -13
- package/dist/index186.js.map +1 -1
- package/dist/index187.js +5 -10
- package/dist/index187.js.map +1 -1
- package/dist/index188.js +13 -14
- package/dist/index188.js.map +1 -1
- package/dist/index189.js +10 -14
- package/dist/index189.js.map +1 -1
- package/dist/index190.js +14 -5
- package/dist/index190.js.map +1 -1
- package/dist/index191.js +14 -6
- package/dist/index191.js.map +1 -1
- package/dist/index192.js +5 -7
- package/dist/index192.js.map +1 -1
- package/dist/index193.js +5 -5
- package/dist/index193.js.map +1 -1
- package/dist/index194.js +7 -9
- package/dist/index194.js.map +1 -1
- package/dist/index195.js +6 -5
- package/dist/index195.js.map +1 -1
- package/dist/index196.js +9 -5
- package/dist/index196.js.map +1 -1
- package/dist/index197.js +5 -9
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +5 -5
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +9 -5
- package/dist/index199.js.map +1 -1
- package/dist/index200.js +5 -4
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +5 -11
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +4 -10
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +9 -8
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +10 -11
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +10 -11
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +11 -10
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +10 -6
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +10 -6
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +7 -5
- package/dist/index209.js.map +1 -1
- package/dist/index210.js +5 -5
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +5 -7
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +6 -6
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +7 -55
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +6 -8
- package/dist/index214.js.map +1 -1
- package/dist/index215.js +54 -18
- package/dist/index215.js.map +1 -1
- package/dist/index220.js +3 -3
- package/dist/index227.js +1 -1
- package/dist/index23.js +1 -1
- package/dist/index238.js +12 -66
- package/dist/index238.js.map +1 -1
- package/dist/index239.js +150 -176
- package/dist/index239.js.map +1 -1
- package/dist/index240.js +27 -43
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +9 -13
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +40 -147
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +10 -29
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +44 -9
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +88 -40
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +85 -10
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +102 -41
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +45 -88
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +10 -85
- package/dist/index249.js.map +1 -1
- package/dist/index250.js +28 -96
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +8 -52
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +115 -10
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +16 -36
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +15 -8
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +3 -116
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +35 -16
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +19 -14
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +9 -3
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +8 -36
- package/dist/index259.js.map +1 -1
- package/dist/index260.js +18 -19
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +28 -9
- package/dist/index261.js.map +1 -1
- package/dist/index262.js +15 -7
- package/dist/index262.js.map +1 -1
- package/dist/index263.js +65 -17
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +178 -26
- package/dist/index264.js.map +1 -1
- package/dist/index265.js +44 -14
- package/dist/index265.js.map +1 -1
- package/dist/index270.js +1 -1
- package/dist/index272.js +4 -4
- package/dist/index277.js +1 -1
- package/dist/index285.js +2 -2
- package/dist/index288.js +1 -1
- package/dist/index289.js +2 -2
- package/dist/index291.js +1 -1
- package/dist/index292.js +1 -1
- package/dist/index293.js +1 -1
- package/dist/index294.js +1 -1
- package/dist/index295.js +65 -69
- package/dist/index295.js.map +1 -1
- package/dist/index296.js +68 -8
- package/dist/index296.js.map +1 -1
- package/dist/index297.js +9 -14
- package/dist/index297.js.map +1 -1
- package/dist/index298.js +14 -66
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +65 -64
- package/dist/index299.js.map +1 -1
- package/dist/index313.js +21 -11
- package/dist/index313.js.map +1 -1
- package/dist/index314.js +11 -26
- package/dist/index314.js.map +1 -1
- package/dist/index315.js +27 -4
- package/dist/index315.js.map +1 -1
- package/dist/index316.js +4 -22
- package/dist/index316.js.map +1 -1
- package/dist/index33.js +1 -1
- package/dist/index41.js +2 -2
- package/dist/index42.js +16 -16
- package/dist/index46.js +1 -1
- package/dist/index47.js +1 -1
- package/dist/index53.js +4 -205
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +47 -3
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +48 -45
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +7 -50
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +14 -7
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +133 -14
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +10 -133
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +216 -10
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +12 -216
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +47 -13
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +47 -44
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +4 -50
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +6 -4
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +28 -6
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +50 -28
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +9 -50
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +2 -9
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +2 -54
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +205 -2
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +54 -2
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +1 -1
- package/dist/index74.js +2 -2
- package/dist/index75.js +2 -2
- package/package.json +1 -1
package/dist/index157.js
CHANGED
|
@@ -1,367 +1,265 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import { DIGIT_PLACEHOLDER as P } from "./index159.js";
|
|
10
|
-
function f(n) {
|
|
1
|
+
import { DIGIT_PLACEHOLDER as m, cutAndStripNonPairedParens as P, repeat as N, populateTemplateWithDigits as I } from "./index158.js";
|
|
2
|
+
import R, { canFormatCompleteNumber as E } from "./index159.js";
|
|
3
|
+
import D from "./index160.js";
|
|
4
|
+
import T from "./index161.js";
|
|
5
|
+
import { FIRST_GROUP_PATTERN as _ } from "./index162.js";
|
|
6
|
+
import { VALID_PUNCTUATION as g } from "./index163.js";
|
|
7
|
+
import C from "./index164.js";
|
|
8
|
+
function c(r) {
|
|
11
9
|
"@babel/helpers - typeof";
|
|
12
|
-
return
|
|
13
|
-
return typeof
|
|
14
|
-
} : function(
|
|
15
|
-
return
|
|
16
|
-
},
|
|
10
|
+
return c = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(a) {
|
|
11
|
+
return typeof a;
|
|
12
|
+
} : function(a) {
|
|
13
|
+
return a && typeof Symbol == "function" && a.constructor === Symbol && a !== Symbol.prototype ? "symbol" : typeof a;
|
|
14
|
+
}, c(r);
|
|
17
15
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
function b(r, a) {
|
|
17
|
+
var t = typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
|
|
18
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
19
|
+
if (Array.isArray(r) || (t = w(r)) || a) {
|
|
20
|
+
t && (r = t);
|
|
21
|
+
var e = 0;
|
|
22
|
+
return function() {
|
|
23
|
+
return e >= r.length ? { done: !0 } : { done: !1, value: r[e++] };
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
23
27
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
24
28
|
}
|
|
25
|
-
function
|
|
26
|
-
if (
|
|
27
|
-
if (typeof
|
|
28
|
-
var t = {}.toString.call(
|
|
29
|
-
return t === "Object" &&
|
|
29
|
+
function w(r, a) {
|
|
30
|
+
if (r) {
|
|
31
|
+
if (typeof r == "string") return x(r, a);
|
|
32
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
33
|
+
return t === "Object" && r.constructor && (t = r.constructor.name), t === "Map" || t === "Set" ? Array.from(r) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? x(r, a) : void 0;
|
|
30
34
|
}
|
|
31
35
|
}
|
|
32
|
-
function
|
|
33
|
-
(
|
|
34
|
-
for (var t = 0,
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
function _(n, e) {
|
|
38
|
-
var t = n == null ? null : typeof Symbol < "u" && n[Symbol.iterator] || n["@@iterator"];
|
|
39
|
-
if (t != null) {
|
|
40
|
-
var i, a, o, r, u = [], l = !0, s = !1;
|
|
41
|
-
try {
|
|
42
|
-
if (o = (t = t.call(n)).next, e !== 0) for (; !(l = (i = o.call(t)).done) && (u.push(i.value), u.length !== e); l = !0) ;
|
|
43
|
-
} catch (d) {
|
|
44
|
-
s = !0, a = d;
|
|
45
|
-
} finally {
|
|
46
|
-
try {
|
|
47
|
-
if (!l && t.return != null && (r = t.return(), Object(r) !== r)) return;
|
|
48
|
-
} finally {
|
|
49
|
-
if (s) throw a;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return u;
|
|
53
|
-
}
|
|
36
|
+
function x(r, a) {
|
|
37
|
+
(a == null || a > r.length) && (a = r.length);
|
|
38
|
+
for (var t = 0, e = Array(a); t < a; t++) e[t] = r[t];
|
|
39
|
+
return e;
|
|
54
40
|
}
|
|
55
|
-
function
|
|
56
|
-
if (
|
|
41
|
+
function O(r, a) {
|
|
42
|
+
if (!(r instanceof a)) throw new TypeError("Cannot call a class as a function");
|
|
57
43
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
for (var t = 0; t < e.length; t++) {
|
|
63
|
-
var i = e[t];
|
|
64
|
-
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(n, x(i.key), i);
|
|
44
|
+
function k(r, a) {
|
|
45
|
+
for (var t = 0; t < a.length; t++) {
|
|
46
|
+
var e = a[t];
|
|
47
|
+
e.enumerable = e.enumerable || !1, e.configurable = !0, "value" in e && (e.writable = !0), Object.defineProperty(r, L(e.key), e);
|
|
65
48
|
}
|
|
66
49
|
}
|
|
67
|
-
function
|
|
68
|
-
return
|
|
50
|
+
function M(r, a, t) {
|
|
51
|
+
return a && k(r.prototype, a), Object.defineProperty(r, "prototype", { writable: !1 }), r;
|
|
69
52
|
}
|
|
70
|
-
function
|
|
71
|
-
var
|
|
72
|
-
return
|
|
53
|
+
function L(r) {
|
|
54
|
+
var a = G(r, "string");
|
|
55
|
+
return c(a) == "symbol" ? a : a + "";
|
|
73
56
|
}
|
|
74
|
-
function
|
|
75
|
-
if (
|
|
76
|
-
var t =
|
|
57
|
+
function G(r, a) {
|
|
58
|
+
if (c(r) != "object" || !r) return r;
|
|
59
|
+
var t = r[Symbol.toPrimitive];
|
|
77
60
|
if (t !== void 0) {
|
|
78
|
-
var
|
|
79
|
-
if (
|
|
61
|
+
var e = t.call(r, a);
|
|
62
|
+
if (c(e) != "object") return e;
|
|
80
63
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
81
64
|
}
|
|
82
|
-
return String(
|
|
65
|
+
return String(r);
|
|
83
66
|
}
|
|
84
|
-
var H =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
67
|
+
var v = "9", B = 15, U = N(v, B), H = /[- ]/, W = function() {
|
|
68
|
+
return /\[([^\[\]])*\]/g;
|
|
69
|
+
}, j = function() {
|
|
70
|
+
return /\d(?=[^,}][^,}])/g;
|
|
71
|
+
}, $ = new RegExp("[" + g + "]*\\$1[" + g + "]*(\\$\\d[" + g + "]*)*$"), A = 3, Q = /* @__PURE__ */ (function() {
|
|
72
|
+
function r(a) {
|
|
73
|
+
a.state;
|
|
74
|
+
var t = a.metadata;
|
|
75
|
+
O(this, r), this.metadata = t, this.resetFormat();
|
|
89
76
|
}
|
|
90
|
-
return
|
|
91
|
-
key: "
|
|
92
|
-
value: function(
|
|
93
|
-
|
|
94
|
-
return t && (N(t) ? (i = t.defaultCountry, a = t.defaultCallingCode) : i = t), i && !this.metadata.hasCountry(i) && (i = void 0), [i, a];
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Inputs "next" phone number characters.
|
|
98
|
-
* @param {string} text
|
|
99
|
-
* @return {string} Formatted phone number characters that have been input so far.
|
|
100
|
-
*/
|
|
101
|
-
}, {
|
|
102
|
-
key: "input",
|
|
103
|
-
value: function(t) {
|
|
104
|
-
var i = this.parser.input(t, this.state), a = i.digits, o = i.justLeadingPlus;
|
|
105
|
-
if (o)
|
|
106
|
-
this.formattedOutput = "+";
|
|
107
|
-
else if (a) {
|
|
108
|
-
this.determineTheCountryIfNeeded(), this.state.nationalSignificantNumber && this.formatter.narrowDownMatchingFormats(this.state);
|
|
109
|
-
var r;
|
|
110
|
-
if (this.metadata.hasSelectedNumberingPlan() && (r = this.formatter.format(a, this.state)), r === void 0 && this.parser.reExtractNationalSignificantNumber(this.state)) {
|
|
111
|
-
this.determineTheCountryIfNeeded();
|
|
112
|
-
var u = this.state.getNationalDigits();
|
|
113
|
-
u && (r = this.formatter.format(u, this.state));
|
|
114
|
-
}
|
|
115
|
-
this.formattedOutput = r ? this.getFullNumber(r) : this.getNonFormattedNumber();
|
|
116
|
-
}
|
|
117
|
-
return this.formattedOutput;
|
|
77
|
+
return M(r, [{
|
|
78
|
+
key: "resetFormat",
|
|
79
|
+
value: function() {
|
|
80
|
+
this.chosenFormat = void 0, this.template = void 0, this.nationalNumberTemplate = void 0, this.populatedNationalNumberTemplate = void 0, this.populatedNationalNumberTemplatePosition = -1;
|
|
118
81
|
}
|
|
119
82
|
}, {
|
|
120
83
|
key: "reset",
|
|
121
|
-
value: function() {
|
|
122
|
-
|
|
123
|
-
return this.state = new y({
|
|
124
|
-
onCountryChange: function(a) {
|
|
125
|
-
t.country = a;
|
|
126
|
-
},
|
|
127
|
-
onCallingCodeChange: function(a, o) {
|
|
128
|
-
t.metadata.selectNumberingPlan(o, a), t.formatter.reset(t.metadata.numberingPlan, t.state), t.parser.reset(t.metadata.numberingPlan);
|
|
129
|
-
}
|
|
130
|
-
}), this.formatter = new C({
|
|
131
|
-
state: this.state,
|
|
132
|
-
metadata: this.metadata
|
|
133
|
-
}), this.parser = new b({
|
|
134
|
-
defaultCountry: this.defaultCountry,
|
|
135
|
-
defaultCallingCode: this.defaultCallingCode,
|
|
136
|
-
metadata: this.metadata,
|
|
137
|
-
state: this.state,
|
|
138
|
-
onNationalSignificantNumberChange: function() {
|
|
139
|
-
t.determineTheCountryIfNeeded(), t.formatter.reset(t.metadata.numberingPlan, t.state);
|
|
140
|
-
}
|
|
141
|
-
}), this.state.reset({
|
|
142
|
-
country: this.defaultCountry,
|
|
143
|
-
callingCode: this.defaultCallingCode
|
|
144
|
-
}), this.formattedOutput = "", this;
|
|
84
|
+
value: function(t, e) {
|
|
85
|
+
this.resetFormat(), t ? (this.isNANP = t.callingCode() === "1", this.matchingFormats = t.formats(), e.nationalSignificantNumber && this.narrowDownMatchingFormats(e)) : (this.isNANP = void 0, this.matchingFormats = []);
|
|
145
86
|
}
|
|
146
87
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* @
|
|
88
|
+
* Formats an updated phone number.
|
|
89
|
+
* @param {string} nextDigits — Additional phone number digits.
|
|
90
|
+
* @param {object} state — `AsYouType` state.
|
|
91
|
+
* @return {[string]} Returns undefined if the updated phone number can't be formatted using any of the available formats.
|
|
150
92
|
*/
|
|
151
93
|
}, {
|
|
152
|
-
key: "
|
|
153
|
-
value: function() {
|
|
154
|
-
|
|
94
|
+
key: "format",
|
|
95
|
+
value: function(t, e) {
|
|
96
|
+
var i = this;
|
|
97
|
+
if (E(e.nationalSignificantNumber, e.country, this.metadata))
|
|
98
|
+
for (var n = b(this.matchingFormats), o; !(o = n()).done; ) {
|
|
99
|
+
var s = o.value, l = R(e, s, {
|
|
100
|
+
metadata: this.metadata,
|
|
101
|
+
shouldTryNationalPrefixFormattingRule: function(f) {
|
|
102
|
+
return i.shouldTryNationalPrefixFormattingRule(f, {
|
|
103
|
+
international: e.international,
|
|
104
|
+
nationalPrefix: e.nationalPrefix
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
getSeparatorAfterNationalPrefix: function(f) {
|
|
108
|
+
return i.getSeparatorAfterNationalPrefix(f);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
if (l)
|
|
112
|
+
return this.resetFormat(), this.chosenFormat = s, this.setNationalNumberTemplate(l.replace(/\d/g, m), e), this.populatedNationalNumberTemplate = l, this.populatedNationalNumberTemplatePosition = this.template.lastIndexOf(m), l;
|
|
113
|
+
}
|
|
114
|
+
return this.formatNationalNumberWithNextDigits(t, e);
|
|
155
115
|
}
|
|
156
|
-
|
|
157
|
-
* Returns the "calling code" part of the phone number when it's being input
|
|
158
|
-
* in an international format.
|
|
159
|
-
* If no valid calling code has been entered so far, returns `undefined`.
|
|
160
|
-
* @return {string} [callingCode]
|
|
161
|
-
*/
|
|
116
|
+
// Formats the next phone number digits.
|
|
162
117
|
}, {
|
|
163
|
-
key: "
|
|
164
|
-
value: function() {
|
|
165
|
-
|
|
166
|
-
|
|
118
|
+
key: "formatNationalNumberWithNextDigits",
|
|
119
|
+
value: function(t, e) {
|
|
120
|
+
var i = this.chosenFormat, n = this.chooseFormat(e);
|
|
121
|
+
if (n)
|
|
122
|
+
return n === i ? this.formatNextNationalNumberDigits(t) : this.formatNextNationalNumberDigits(e.getNationalDigits());
|
|
167
123
|
}
|
|
168
|
-
// A legacy alias.
|
|
169
124
|
}, {
|
|
170
|
-
key: "
|
|
171
|
-
value: function() {
|
|
172
|
-
|
|
125
|
+
key: "narrowDownMatchingFormats",
|
|
126
|
+
value: function(t) {
|
|
127
|
+
var e = this, i = t.nationalSignificantNumber, n = t.nationalPrefix, o = t.international, s = i, l = s.length - A;
|
|
128
|
+
l < 0 && (l = 0), this.matchingFormats = this.matchingFormats.filter(function(u) {
|
|
129
|
+
return e.formatSuits(u, o, n) && e.formatMatches(u, s, l);
|
|
130
|
+
}), this.chosenFormat && this.matchingFormats.indexOf(this.chosenFormat) === -1 && this.resetFormat();
|
|
173
131
|
}
|
|
174
|
-
/**
|
|
175
|
-
* Returns a two-letter country code of the phone number.
|
|
176
|
-
* Returns `undefined` for "non-geographic" phone numbering plans.
|
|
177
|
-
* Returns `undefined` if no phone number has been input yet.
|
|
178
|
-
* @return {string} [country]
|
|
179
|
-
*/
|
|
180
132
|
}, {
|
|
181
|
-
key: "
|
|
182
|
-
value: function() {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return this._getCountry();
|
|
133
|
+
key: "formatSuits",
|
|
134
|
+
value: function(t, e, i) {
|
|
135
|
+
return !(i && !t.usesNationalPrefix() && // !format.domesticCarrierCodeFormattingRule() &&
|
|
136
|
+
!t.nationalPrefixIsOptionalWhenFormattingInNationalFormat() || !e && !i && t.nationalPrefixIsMandatoryWhenFormattingInNationalFormat());
|
|
186
137
|
}
|
|
187
|
-
/**
|
|
188
|
-
* Returns a two-letter country code of the phone number.
|
|
189
|
-
* Returns `undefined` for "non-geographic" phone numbering plans.
|
|
190
|
-
* @return {string} [country]
|
|
191
|
-
*/
|
|
192
138
|
}, {
|
|
193
|
-
key: "
|
|
194
|
-
value: function() {
|
|
195
|
-
var
|
|
196
|
-
|
|
139
|
+
key: "formatMatches",
|
|
140
|
+
value: function(t, e, i) {
|
|
141
|
+
var n = t.leadingDigitsPatterns().length;
|
|
142
|
+
if (n === 0)
|
|
143
|
+
return !0;
|
|
144
|
+
i = Math.min(i, n - 1);
|
|
145
|
+
var o = t.leadingDigitsPatterns()[i];
|
|
146
|
+
if (e.length < A)
|
|
147
|
+
try {
|
|
148
|
+
return new D(o).match(e, {
|
|
149
|
+
allowOverflow: !0
|
|
150
|
+
}) !== void 0;
|
|
151
|
+
} catch (s) {
|
|
152
|
+
return console.error(s), !0;
|
|
153
|
+
}
|
|
154
|
+
return new RegExp("^(".concat(o, ")")).test(e);
|
|
197
155
|
}
|
|
198
156
|
}, {
|
|
199
|
-
key: "
|
|
200
|
-
value: function() {
|
|
201
|
-
|
|
157
|
+
key: "getFormatFormat",
|
|
158
|
+
value: function(t, e) {
|
|
159
|
+
return e ? t.internationalFormat() : t.format();
|
|
202
160
|
}
|
|
203
|
-
// Prepends `+CountryCode ` in case of an international phone number
|
|
204
161
|
}, {
|
|
205
|
-
key: "
|
|
162
|
+
key: "chooseFormat",
|
|
206
163
|
value: function(t) {
|
|
207
|
-
var i =
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}
|
|
216
|
-
return t;
|
|
164
|
+
for (var e = this, i = function() {
|
|
165
|
+
var u = s.value;
|
|
166
|
+
return e.chosenFormat === u ? 0 : $.test(e.getFormatFormat(u, t.international)) ? e.createTemplateForFormat(u, t) ? (e.chosenFormat = u, 0) : (e.matchingFormats = e.matchingFormats.filter(function(f) {
|
|
167
|
+
return f !== u;
|
|
168
|
+
}), 1) : 1;
|
|
169
|
+
}, n, o = b(this.matchingFormats.slice()), s; !(s = o()).done && (n = i(), n !== 0); )
|
|
170
|
+
;
|
|
171
|
+
return this.chosenFormat || this.resetFormat(), this.chosenFormat;
|
|
217
172
|
}
|
|
218
173
|
}, {
|
|
219
|
-
key: "
|
|
220
|
-
value: function() {
|
|
221
|
-
|
|
222
|
-
|
|
174
|
+
key: "createTemplateForFormat",
|
|
175
|
+
value: function(t, e) {
|
|
176
|
+
if (!(t.pattern().indexOf("|") >= 0)) {
|
|
177
|
+
var i = this.getTemplateForFormat(t, e);
|
|
178
|
+
if (i)
|
|
179
|
+
return this.setNationalNumberTemplate(i, e), !0;
|
|
180
|
+
}
|
|
223
181
|
}
|
|
224
182
|
}, {
|
|
225
|
-
key: "
|
|
226
|
-
value: function() {
|
|
227
|
-
|
|
228
|
-
return this.getFullNumber(t ? this.state.getNationalDigits() : this.getNonFormattedNationalNumberWithPrefix());
|
|
183
|
+
key: "getSeparatorAfterNationalPrefix",
|
|
184
|
+
value: function(t) {
|
|
185
|
+
return this.isNANP || t && t.nationalPrefixFormattingRule() && H.test(t.nationalPrefixFormattingRule()) ? " " : "";
|
|
229
186
|
}
|
|
230
187
|
}, {
|
|
231
|
-
key: "
|
|
232
|
-
value: function() {
|
|
233
|
-
var t =
|
|
234
|
-
|
|
235
|
-
return t.replace(/[\+\d]/g, P);
|
|
188
|
+
key: "getInternationalPrefixBeforeCountryCallingCode",
|
|
189
|
+
value: function(t, e) {
|
|
190
|
+
var i = t.IDDPrefix, n = t.missingPlus;
|
|
191
|
+
return i ? e && e.spacing === !1 ? i : i + " " : n ? "" : "+";
|
|
236
192
|
}
|
|
237
193
|
}, {
|
|
238
|
-
key: "
|
|
239
|
-
value: function() {
|
|
240
|
-
|
|
241
|
-
|
|
194
|
+
key: "getTemplate",
|
|
195
|
+
value: function(t) {
|
|
196
|
+
if (this.template) {
|
|
197
|
+
for (var e = -1, i = 0, n = t.international ? this.getInternationalPrefixBeforeCountryCallingCode(t, {
|
|
198
|
+
spacing: !1
|
|
199
|
+
}) : ""; i < n.length + t.getDigitsWithoutInternationalPrefix().length; )
|
|
200
|
+
e = this.template.indexOf(m, e + 1), i++;
|
|
201
|
+
return P(this.template, e + 1);
|
|
202
|
+
}
|
|
242
203
|
}
|
|
243
|
-
// Determines the exact country of the phone number
|
|
244
|
-
// entered so far based on the country phone code
|
|
245
|
-
// and the national phone number.
|
|
246
204
|
}, {
|
|
247
|
-
key: "
|
|
248
|
-
value: function() {
|
|
249
|
-
this.
|
|
250
|
-
nationalNumber: this.state.nationalSignificantNumber,
|
|
251
|
-
metadata: this.metadata
|
|
252
|
-
}));
|
|
205
|
+
key: "setNationalNumberTemplate",
|
|
206
|
+
value: function(t, e) {
|
|
207
|
+
this.nationalNumberTemplate = t, this.populatedNationalNumberTemplate = t, this.populatedNationalNumberTemplatePosition = -1, e.international ? this.template = this.getInternationalPrefixBeforeCountryCallingCode(e).replace(/[\d\+]/g, m) + N(m, e.callingCode.length) + " " + t : this.template = t;
|
|
253
208
|
}
|
|
254
209
|
/**
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
* For international phone number input, it will also auto-correct
|
|
261
|
-
* some minor errors such as using a national prefix when writing
|
|
262
|
-
* an international phone number. For example, if the user inputs
|
|
263
|
-
* `"+44 0 7400 000000"` then it will return an auto-corrected
|
|
264
|
-
* `"+447400000000"` phone number value.
|
|
265
|
-
*
|
|
266
|
-
* Will return `undefined` if no digits have been input,
|
|
267
|
-
* or when inputting a phone number in national format and no
|
|
268
|
-
* default country or default "country calling code" have been set.
|
|
269
|
-
*
|
|
270
|
-
* @return {string} [value]
|
|
210
|
+
* Generates formatting template for a national phone number,
|
|
211
|
+
* optionally containing a national prefix, for a format.
|
|
212
|
+
* @param {Format} format
|
|
213
|
+
* @param {string} nationalPrefix
|
|
214
|
+
* @return {string}
|
|
271
215
|
*/
|
|
272
216
|
}, {
|
|
273
|
-
key: "
|
|
274
|
-
value: function() {
|
|
275
|
-
var
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
217
|
+
key: "getTemplateForFormat",
|
|
218
|
+
value: function(t, e) {
|
|
219
|
+
var i = e.nationalSignificantNumber, n = e.international, o = e.nationalPrefix, s = e.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix, l = t.pattern();
|
|
220
|
+
l = l.replace(W(), "\\d").replace(j(), "\\d");
|
|
221
|
+
var u = U.match(l)[0];
|
|
222
|
+
if (!(i.length > u.length)) {
|
|
223
|
+
var f = new RegExp("^" + l + "$"), y = i.replace(/\d/g, v);
|
|
224
|
+
f.test(y) && (u = y);
|
|
225
|
+
var p = this.getFormatFormat(t, n), F;
|
|
226
|
+
if (this.shouldTryNationalPrefixFormattingRule(t, {
|
|
227
|
+
international: n,
|
|
228
|
+
nationalPrefix: o
|
|
229
|
+
})) {
|
|
230
|
+
var S = p.replace(_, t.nationalPrefixFormattingRule());
|
|
231
|
+
if (T(t.nationalPrefixFormattingRule()) === (o || "") + T("$1") && (p = S, F = !0, o))
|
|
232
|
+
for (var d = o.length; d > 0; )
|
|
233
|
+
p = p.replace(/\d/, m), d--;
|
|
282
234
|
}
|
|
235
|
+
var h = u.replace(new RegExp(l), p).replace(new RegExp(v, "g"), m);
|
|
236
|
+
return F || (s ? h = N(m, s.length) + " " + h : o && (h = N(m, o.length) + this.getSeparatorAfterNationalPrefix(t) + h)), n && (h = C(h)), h;
|
|
283
237
|
}
|
|
284
238
|
}
|
|
285
|
-
/**
|
|
286
|
-
* Returns an instance of `PhoneNumber` class.
|
|
287
|
-
* Will return `undefined` if no national (significant) number
|
|
288
|
-
* digits have been entered so far, or if no `defaultCountry` has been
|
|
289
|
-
* set and the user enters a phone number not in international format.
|
|
290
|
-
*/
|
|
291
239
|
}, {
|
|
292
|
-
key: "
|
|
293
|
-
value: function() {
|
|
294
|
-
var
|
|
295
|
-
if (
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
u.selectNumberingPlan(r);
|
|
299
|
-
var l = u.numberingPlan.callingCode(), s = this.metadata.getCountryCodesForCallingCode(l);
|
|
300
|
-
if (s.length > 1) {
|
|
301
|
-
var d = p(i, {
|
|
302
|
-
countries: s,
|
|
303
|
-
metadata: this.metadata.metadata
|
|
304
|
-
});
|
|
305
|
-
d && (r = d);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
var m = new c(r || o, i, this.metadata.metadata);
|
|
309
|
-
return a && (m.carrierCode = a), m;
|
|
240
|
+
key: "formatNextNationalNumberDigits",
|
|
241
|
+
value: function(t) {
|
|
242
|
+
var e = I(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition, t);
|
|
243
|
+
if (!e) {
|
|
244
|
+
this.resetFormat();
|
|
245
|
+
return;
|
|
310
246
|
}
|
|
247
|
+
return this.populatedNationalNumberTemplate = e[0], this.populatedNationalNumberTemplatePosition = e[1], P(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1);
|
|
311
248
|
}
|
|
312
|
-
/**
|
|
313
|
-
* Returns `true` if the phone number is "possible".
|
|
314
|
-
* Is just a shortcut for `PhoneNumber.isPossible()`.
|
|
315
|
-
* @return {boolean}
|
|
316
|
-
*/
|
|
317
|
-
}, {
|
|
318
|
-
key: "isPossible",
|
|
319
|
-
value: function() {
|
|
320
|
-
var t = this.getNumber();
|
|
321
|
-
return t ? t.isPossible() : !1;
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Returns `true` if the phone number is "valid".
|
|
325
|
-
* Is just a shortcut for `PhoneNumber.isValid()`.
|
|
326
|
-
* @return {boolean}
|
|
327
|
-
*/
|
|
328
|
-
}, {
|
|
329
|
-
key: "isValid",
|
|
330
|
-
value: function() {
|
|
331
|
-
var t = this.getNumber();
|
|
332
|
-
return t ? t.isValid() : !1;
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* @deprecated
|
|
336
|
-
* This method is used in `react-phone-number-input/source/input-control.js`
|
|
337
|
-
* in versions before `3.0.16`.
|
|
338
|
-
*/
|
|
339
|
-
}, {
|
|
340
|
-
key: "getNationalNumber",
|
|
341
|
-
value: function() {
|
|
342
|
-
return this.state.nationalSignificantNumber;
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Returns the phone number characters entered by the user.
|
|
346
|
-
* @return {string}
|
|
347
|
-
*/
|
|
348
|
-
}, {
|
|
349
|
-
key: "getChars",
|
|
350
|
-
value: function() {
|
|
351
|
-
return (this.state.international ? "+" : "") + this.state.digits;
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* Returns the template for the formatted phone number.
|
|
355
|
-
* @return {string}
|
|
356
|
-
*/
|
|
357
249
|
}, {
|
|
358
|
-
key: "
|
|
359
|
-
value: function() {
|
|
360
|
-
|
|
250
|
+
key: "shouldTryNationalPrefixFormattingRule",
|
|
251
|
+
value: function(t, e) {
|
|
252
|
+
var i = e.international, n = e.nationalPrefix;
|
|
253
|
+
if (t.nationalPrefixFormattingRule()) {
|
|
254
|
+
var o = t.usesNationalPrefix();
|
|
255
|
+
if (o && n || !o && !i)
|
|
256
|
+
return !0;
|
|
257
|
+
}
|
|
361
258
|
}
|
|
362
259
|
}]);
|
|
363
260
|
})();
|
|
364
261
|
export {
|
|
365
|
-
|
|
262
|
+
m as DIGIT_PLACEHOLDER,
|
|
263
|
+
Q as default
|
|
366
264
|
};
|
|
367
265
|
//# sourceMappingURL=index157.js.map
|