@rpcbase/ui 0.197.0 → 0.198.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/index151.js +1 -1
- package/dist/index152.js +605 -5
- package/dist/index152.js.map +1 -1
- package/dist/index153.js +5 -68
- package/dist/index153.js.map +1 -1
- package/dist/index154.js +69 -2
- package/dist/index154.js.map +1 -1
- package/dist/index155.js +2 -364
- package/dist/index155.js.map +1 -1
- package/dist/index156.js +303 -201
- package/dist/index156.js.map +1 -1
- package/dist/index157.js +247 -46
- package/dist/index157.js.map +1 -1
- package/dist/index158.js +56 -42
- package/dist/index158.js.map +1 -1
- package/dist/index159.js +46 -169
- package/dist/index159.js.map +1 -1
- package/dist/index160.js +156 -96
- package/dist/index160.js.map +1 -1
- package/dist/index161.js +109 -24
- package/dist/index161.js.map +1 -1
- package/dist/index162.js +25 -8
- package/dist/index162.js.map +1 -1
- package/dist/index163.js +8 -5
- package/dist/index163.js.map +1 -1
- package/dist/index164.js +4 -5
- 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 -466
- package/dist/index166.js.map +1 -1
- package/dist/index167.js +420 -139
- package/dist/index167.js.map +1 -1
- package/dist/index168.js +149 -71
- package/dist/index168.js.map +1 -1
- package/dist/index169.js +74 -229
- package/dist/index169.js.map +1 -1
- package/dist/index170.js +262 -9
- package/dist/index170.js.map +1 -1
- package/dist/index171.js +9 -42
- package/dist/index171.js.map +1 -1
- package/dist/index172.js +42 -4
- package/dist/index172.js.map +1 -1
- package/dist/index173.js +4 -46
- package/dist/index173.js.map +1 -1
- package/dist/index174.js +41 -200
- package/dist/index174.js.map +1 -1
- package/dist/index175.js +204 -20
- package/dist/index175.js.map +1 -1
- package/dist/index176.js +22 -25
- package/dist/index176.js.map +1 -1
- package/dist/index177.js +23 -398
- package/dist/index177.js.map +1 -1
- package/dist/index178.js +383 -589
- package/dist/index178.js.map +1 -1
- package/dist/index19.js +185 -183
- package/dist/index19.js.map +1 -1
- package/dist/index239.js +66 -12
- package/dist/index239.js.map +1 -1
- package/dist/index24.js +1 -1
- package/dist/index240.js +176 -150
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +43 -27
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +13 -9
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +147 -41
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +29 -10
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +9 -44
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +41 -88
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +10 -85
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +41 -102
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +88 -45
- package/dist/index249.js.map +1 -1
- package/dist/index250.js +85 -10
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +96 -28
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +52 -8
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +10 -115
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +36 -16
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +8 -15
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +116 -3
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +16 -35
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +14 -19
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +3 -9
- package/dist/index259.js.map +1 -1
- package/dist/index260.js +36 -8
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +20 -24
- package/dist/index261.js.map +1 -1
- package/dist/index262.js +10 -29
- package/dist/index262.js.map +1 -1
- package/dist/index263.js +9 -5
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +4 -4
- package/dist/index266.js +2 -2
- package/dist/index267.js +22 -65
- package/dist/index267.js.map +1 -1
- package/dist/index268.js +27 -179
- package/dist/index268.js.map +1 -1
- package/dist/index269.js +5 -47
- package/dist/index269.js.map +1 -1
- package/dist/index273.js +1 -1
- package/dist/index277.js +1 -1
- package/dist/index278.js +1 -1
- package/dist/index299.js +1 -1
- package/dist/index31.js +5 -5
- package/dist/index36.js +1 -1
- package/dist/index37.js +2 -2
- package/dist/index40.js +2 -2
- package/dist/index41.js +20 -20
- package/dist/index45.js +1 -1
- package/dist/index46.js +1 -1
- package/dist/index49.js +1 -1
- package/dist/index50.js +1 -1
- package/dist/index51.js +7 -2
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +34 -2
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +27 -2
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +8 -2
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +11 -6
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +2 -34
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +2 -27
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +205 -8
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +3 -11
- package/dist/index59.js.map +1 -1
- package/dist/index60.js +44 -201
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +50 -3
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +7 -47
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +12 -48
- package/dist/index63.js.map +1 -1
- package/dist/index64.js +133 -7
- package/dist/index64.js.map +1 -1
- package/dist/index65.js +10 -14
- package/dist/index65.js.map +1 -1
- package/dist/index66.js +210 -127
- package/dist/index66.js.map +1 -1
- package/dist/index67.js +12 -10
- package/dist/index67.js.map +1 -1
- package/dist/index68.js +44 -214
- package/dist/index68.js.map +1 -1
- package/dist/index69.js +49 -12
- package/dist/index69.js.map +1 -1
- package/dist/index70.js +4 -47
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +5 -49
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +28 -4
- package/dist/index72.js.map +1 -1
- package/dist/index73.js +50 -6
- package/dist/index73.js.map +1 -1
- package/dist/index74.js +9 -28
- package/dist/index74.js.map +1 -1
- package/dist/index75.js +6 -50
- package/dist/index75.js.map +1 -1
- package/dist/index76.js +8 -9
- package/dist/index76.js.map +1 -1
- package/dist/index77.js +5 -5
- package/dist/index77.js.map +1 -1
- package/dist/index78.js +2 -8
- package/dist/index78.js.map +1 -1
- package/dist/index79.js +2 -6
- package/dist/index79.js.map +1 -1
- package/package.json +1 -1
package/dist/index156.js
CHANGED
|
@@ -1,265 +1,367 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
1
|
+
import g from "./index167.js";
|
|
2
|
+
import c from "./index168.js";
|
|
3
|
+
import y from "./index169.js";
|
|
4
|
+
import C from "./index157.js";
|
|
5
|
+
import b from "./index170.js";
|
|
6
|
+
import v from "./index171.js";
|
|
7
|
+
import p from "./index172.js";
|
|
8
|
+
import N from "./index173.js";
|
|
9
|
+
import { DIGIT_PLACEHOLDER as P } from "./index158.js";
|
|
10
|
+
function f(n) {
|
|
9
11
|
"@babel/helpers - typeof";
|
|
10
|
-
return
|
|
11
|
-
return typeof
|
|
12
|
-
} : function(
|
|
13
|
-
return
|
|
14
|
-
},
|
|
12
|
+
return f = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
13
|
+
return typeof e;
|
|
14
|
+
} : function(e) {
|
|
15
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
16
|
+
}, f(n);
|
|
15
17
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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.
|
|
18
|
+
function S(n, e) {
|
|
19
|
+
return A(n) || _(n, e) || k(n, e) || T();
|
|
20
|
+
}
|
|
21
|
+
function T() {
|
|
22
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
27
23
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
28
24
|
}
|
|
29
|
-
function
|
|
30
|
-
if (
|
|
31
|
-
if (typeof
|
|
32
|
-
var t = {}.toString.call(
|
|
33
|
-
return t === "Object" &&
|
|
25
|
+
function k(n, e) {
|
|
26
|
+
if (n) {
|
|
27
|
+
if (typeof n == "string") return h(n, e);
|
|
28
|
+
var t = {}.toString.call(n).slice(8, -1);
|
|
29
|
+
return t === "Object" && n.constructor && (t = n.constructor.name), t === "Map" || t === "Set" ? Array.from(n) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? h(n, e) : void 0;
|
|
34
30
|
}
|
|
35
31
|
}
|
|
36
|
-
function
|
|
37
|
-
(
|
|
38
|
-
for (var t = 0,
|
|
39
|
-
return
|
|
32
|
+
function h(n, e) {
|
|
33
|
+
(e == null || e > n.length) && (e = n.length);
|
|
34
|
+
for (var t = 0, i = Array(e); t < e; t++) i[t] = n[t];
|
|
35
|
+
return i;
|
|
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
|
+
}
|
|
40
54
|
}
|
|
41
|
-
function
|
|
42
|
-
if (
|
|
55
|
+
function A(n) {
|
|
56
|
+
if (Array.isArray(n)) return n;
|
|
43
57
|
}
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
function I(n, e) {
|
|
59
|
+
if (!(n instanceof e)) throw new TypeError("Cannot call a class as a function");
|
|
60
|
+
}
|
|
61
|
+
function F(n, e) {
|
|
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);
|
|
48
65
|
}
|
|
49
66
|
}
|
|
50
|
-
function
|
|
51
|
-
return
|
|
67
|
+
function w(n, e, t) {
|
|
68
|
+
return e && F(n.prototype, e), Object.defineProperty(n, "prototype", { writable: !1 }), n;
|
|
52
69
|
}
|
|
53
|
-
function
|
|
54
|
-
var
|
|
55
|
-
return
|
|
70
|
+
function x(n) {
|
|
71
|
+
var e = j(n, "string");
|
|
72
|
+
return f(e) == "symbol" ? e : e + "";
|
|
56
73
|
}
|
|
57
|
-
function
|
|
58
|
-
if (
|
|
59
|
-
var t =
|
|
74
|
+
function j(n, e) {
|
|
75
|
+
if (f(n) != "object" || !n) return n;
|
|
76
|
+
var t = n[Symbol.toPrimitive];
|
|
60
77
|
if (t !== void 0) {
|
|
61
|
-
var
|
|
62
|
-
if (
|
|
78
|
+
var i = t.call(n, e);
|
|
79
|
+
if (f(i) != "object") return i;
|
|
63
80
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
64
81
|
}
|
|
65
|
-
return String(
|
|
82
|
+
return String(n);
|
|
66
83
|
}
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
function r(a) {
|
|
73
|
-
a.state;
|
|
74
|
-
var t = a.metadata;
|
|
75
|
-
O(this, r), this.metadata = t, this.resetFormat();
|
|
84
|
+
var H = /* @__PURE__ */ (function() {
|
|
85
|
+
function n(e, t) {
|
|
86
|
+
I(this, n), this.metadata = new g(t);
|
|
87
|
+
var i = this.getCountryAndCallingCode(e), a = S(i, 2), o = a[0], r = a[1];
|
|
88
|
+
this.defaultCountry = o, this.defaultCallingCode = r, this.reset();
|
|
76
89
|
}
|
|
77
|
-
return
|
|
78
|
-
key: "
|
|
79
|
-
value: function() {
|
|
80
|
-
|
|
90
|
+
return w(n, [{
|
|
91
|
+
key: "getCountryAndCallingCode",
|
|
92
|
+
value: function(t) {
|
|
93
|
+
var i, a;
|
|
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;
|
|
81
118
|
}
|
|
82
119
|
}, {
|
|
83
120
|
key: "reset",
|
|
84
|
-
value: function(
|
|
85
|
-
|
|
121
|
+
value: function() {
|
|
122
|
+
var t = this;
|
|
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;
|
|
86
145
|
}
|
|
87
146
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* @
|
|
91
|
-
* @return {[string]} Returns undefined if the updated phone number can't be formatted using any of the available formats.
|
|
147
|
+
* Returns `true` if the phone number is being input in international format.
|
|
148
|
+
* In other words, returns `true` if and only if the parsed phone number starts with a `"+"`.
|
|
149
|
+
* @return {boolean}
|
|
92
150
|
*/
|
|
93
151
|
}, {
|
|
94
|
-
key: "
|
|
95
|
-
value: function(
|
|
96
|
-
|
|
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);
|
|
152
|
+
key: "isInternational",
|
|
153
|
+
value: function() {
|
|
154
|
+
return this.state.international;
|
|
115
155
|
}
|
|
116
|
-
|
|
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
|
+
*/
|
|
117
162
|
}, {
|
|
118
|
-
key: "
|
|
119
|
-
value: function(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return n === i ? this.formatNextNationalNumberDigits(t) : this.formatNextNationalNumberDigits(e.getNationalDigits());
|
|
163
|
+
key: "getCallingCode",
|
|
164
|
+
value: function() {
|
|
165
|
+
if (this.isInternational())
|
|
166
|
+
return this.state.callingCode;
|
|
123
167
|
}
|
|
168
|
+
// A legacy alias.
|
|
124
169
|
}, {
|
|
125
|
-
key: "
|
|
126
|
-
value: function(
|
|
127
|
-
|
|
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();
|
|
170
|
+
key: "getCountryCallingCode",
|
|
171
|
+
value: function() {
|
|
172
|
+
return this.getCallingCode();
|
|
131
173
|
}
|
|
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
|
+
*/
|
|
132
180
|
}, {
|
|
133
|
-
key: "
|
|
134
|
-
value: function(
|
|
135
|
-
|
|
136
|
-
|
|
181
|
+
key: "getCountry",
|
|
182
|
+
value: function() {
|
|
183
|
+
var t = this.state.digits;
|
|
184
|
+
if (t)
|
|
185
|
+
return this._getCountry();
|
|
137
186
|
}
|
|
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
|
+
*/
|
|
138
192
|
}, {
|
|
139
|
-
key: "
|
|
140
|
-
value: function(
|
|
141
|
-
var
|
|
142
|
-
|
|
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);
|
|
193
|
+
key: "_getCountry",
|
|
194
|
+
value: function() {
|
|
195
|
+
var t = this.state.country;
|
|
196
|
+
return t;
|
|
155
197
|
}
|
|
156
198
|
}, {
|
|
157
|
-
key: "
|
|
158
|
-
value: function(
|
|
159
|
-
|
|
199
|
+
key: "determineTheCountryIfNeeded",
|
|
200
|
+
value: function() {
|
|
201
|
+
(!this.state.country || this.isCountryCallingCodeAmbiguous()) && this.determineTheCountry();
|
|
160
202
|
}
|
|
203
|
+
// Prepends `+CountryCode ` in case of an international phone number
|
|
161
204
|
}, {
|
|
162
|
-
key: "
|
|
205
|
+
key: "getFullNumber",
|
|
163
206
|
value: function(t) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
;
|
|
171
|
-
|
|
207
|
+
var i = this;
|
|
208
|
+
if (this.isInternational()) {
|
|
209
|
+
var a = function(u) {
|
|
210
|
+
return i.formatter.getInternationalPrefixBeforeCountryCallingCode(i.state, {
|
|
211
|
+
spacing: !!u
|
|
212
|
+
}) + u;
|
|
213
|
+
}, o = this.state.callingCode;
|
|
214
|
+
return a(o ? t ? "".concat(o, " ").concat(t) : o : "".concat(this.state.getDigitsWithoutInternationalPrefix()));
|
|
215
|
+
}
|
|
216
|
+
return t;
|
|
172
217
|
}
|
|
173
218
|
}, {
|
|
174
|
-
key: "
|
|
175
|
-
value: function(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
if (i)
|
|
179
|
-
return this.setNationalNumberTemplate(i, e), !0;
|
|
180
|
-
}
|
|
219
|
+
key: "getNonFormattedNationalNumberWithPrefix",
|
|
220
|
+
value: function() {
|
|
221
|
+
var t = this.state, i = t.nationalSignificantNumber, a = t.prefixBeforeNationalSignificantNumberThatIsNotNationalPrefix, o = t.nationalPrefix, r = i, u = a || o;
|
|
222
|
+
return u && (r = u + r), r;
|
|
181
223
|
}
|
|
182
224
|
}, {
|
|
183
|
-
key: "
|
|
184
|
-
value: function(
|
|
185
|
-
|
|
225
|
+
key: "getNonFormattedNumber",
|
|
226
|
+
value: function() {
|
|
227
|
+
var t = this.state.nationalSignificantNumberIsModified;
|
|
228
|
+
return this.getFullNumber(t ? this.state.getNationalDigits() : this.getNonFormattedNationalNumberWithPrefix());
|
|
186
229
|
}
|
|
187
230
|
}, {
|
|
188
|
-
key: "
|
|
189
|
-
value: function(
|
|
190
|
-
var
|
|
191
|
-
|
|
231
|
+
key: "getNonFormattedTemplate",
|
|
232
|
+
value: function() {
|
|
233
|
+
var t = this.getNonFormattedNumber();
|
|
234
|
+
if (t)
|
|
235
|
+
return t.replace(/[\+\d]/g, P);
|
|
192
236
|
}
|
|
193
237
|
}, {
|
|
194
|
-
key: "
|
|
195
|
-
value: function(
|
|
196
|
-
|
|
197
|
-
|
|
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
|
-
}
|
|
238
|
+
key: "isCountryCallingCodeAmbiguous",
|
|
239
|
+
value: function() {
|
|
240
|
+
var t = this.state.callingCode, i = this.metadata.getCountryCodesForCallingCode(t);
|
|
241
|
+
return i && i.length > 1;
|
|
203
242
|
}
|
|
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.
|
|
204
246
|
}, {
|
|
205
|
-
key: "
|
|
206
|
-
value: function(
|
|
207
|
-
this.
|
|
247
|
+
key: "determineTheCountry",
|
|
248
|
+
value: function() {
|
|
249
|
+
this.state.setCountry(v(this.isInternational() ? this.state.callingCode : this.defaultCallingCode, {
|
|
250
|
+
nationalNumber: this.state.nationalSignificantNumber,
|
|
251
|
+
metadata: this.metadata
|
|
252
|
+
}));
|
|
208
253
|
}
|
|
209
254
|
/**
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
255
|
+
* Returns a E.164 phone number value for the user's input.
|
|
256
|
+
*
|
|
257
|
+
* For example, for country `"US"` and input `"(222) 333-4444"`
|
|
258
|
+
* it will return `"+12223334444"`.
|
|
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]
|
|
215
271
|
*/
|
|
216
272
|
}, {
|
|
217
|
-
key: "
|
|
218
|
-
value: function(
|
|
219
|
-
var
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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--;
|
|
273
|
+
key: "getNumberValue",
|
|
274
|
+
value: function() {
|
|
275
|
+
var t = this.state, i = t.digits, a = t.callingCode, o = t.country, r = t.nationalSignificantNumber;
|
|
276
|
+
if (i) {
|
|
277
|
+
if (this.isInternational())
|
|
278
|
+
return a ? "+" + a + r : "+" + i;
|
|
279
|
+
if (o || a) {
|
|
280
|
+
var u = o ? this.metadata.countryCallingCode() : a;
|
|
281
|
+
return "+" + u + r;
|
|
234
282
|
}
|
|
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;
|
|
237
283
|
}
|
|
238
284
|
}
|
|
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
|
+
*/
|
|
239
291
|
}, {
|
|
240
|
-
key: "
|
|
241
|
-
value: function(
|
|
242
|
-
var
|
|
243
|
-
if (!
|
|
244
|
-
this.
|
|
245
|
-
|
|
292
|
+
key: "getNumber",
|
|
293
|
+
value: function() {
|
|
294
|
+
var t = this.state, i = t.nationalSignificantNumber, a = t.carrierCode, o = t.callingCode, r = this._getCountry();
|
|
295
|
+
if (i && !(!r && !o)) {
|
|
296
|
+
if (r && r === this.defaultCountry) {
|
|
297
|
+
var u = new g(this.metadata.metadata);
|
|
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;
|
|
246
310
|
}
|
|
247
|
-
return this.populatedNationalNumberTemplate = e[0], this.populatedNationalNumberTemplatePosition = e[1], P(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1);
|
|
248
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Returns `true` if the phone number is "possible".
|
|
314
|
+
* Is just a shortcut for `PhoneNumber.isPossible()`.
|
|
315
|
+
* @return {boolean}
|
|
316
|
+
*/
|
|
249
317
|
}, {
|
|
250
|
-
key: "
|
|
251
|
-
value: function(
|
|
252
|
-
var
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
+
}, {
|
|
358
|
+
key: "getTemplate",
|
|
359
|
+
value: function() {
|
|
360
|
+
return this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || "";
|
|
258
361
|
}
|
|
259
362
|
}]);
|
|
260
363
|
})();
|
|
261
364
|
export {
|
|
262
|
-
|
|
263
|
-
Q as default
|
|
365
|
+
H as default
|
|
264
366
|
};
|
|
265
367
|
//# sourceMappingURL=index156.js.map
|