@rpcbase/ui 0.246.0 → 0.248.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/components/Notifications/NotificationsDrawer.d.ts.map +1 -1
- package/dist/index10.js +2 -2
- package/dist/index106.js +1 -1
- package/dist/index11.js +2 -2
- package/dist/index12.js +3 -3
- package/dist/index13.js +2 -2
- package/dist/index14.js +2 -2
- package/dist/index15.js +2 -2
- package/dist/index16.js +158 -158
- package/dist/index16.js.map +1 -1
- package/dist/index167.js +3 -3
- package/dist/index17.js +1 -1
- package/dist/index172.js +6 -6
- package/dist/index178.js +1 -1
- package/dist/index18.js +7 -7
- package/dist/index184.js +1 -1
- package/dist/index185.js +1 -1
- package/dist/index186.js +1 -1
- package/dist/index187.js +1 -1
- package/dist/index188.js +2 -2
- package/dist/index189.js +3 -3
- package/dist/index19.js +16 -16
- package/dist/index21.js +1 -1
- package/dist/index22.js +2 -2
- package/dist/index23.js +1 -1
- package/dist/index24.js +1 -1
- package/dist/index246.js +1 -1
- package/dist/index25.js +1 -1
- package/dist/index252.js +1 -1
- package/dist/index272.js +2 -2
- package/dist/index277.js +1 -1
- package/dist/index278.js +1 -1
- package/dist/index28.js +2 -2
- package/dist/index282.js +1 -1
- package/dist/index287.js +1 -1
- package/dist/index29.js +56 -3
- package/dist/index29.js.map +1 -1
- package/dist/index293.js +1 -1
- package/dist/index3.js +2 -2
- package/dist/index30.js +3 -242
- package/dist/index30.js.map +1 -1
- package/dist/index302.js +1 -1
- package/dist/index31.js +239 -21
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +23 -4
- package/dist/index32.js.map +1 -1
- package/dist/index321.js +2 -2
- package/dist/index33.js +3 -6
- package/dist/index33.js.map +1 -1
- package/dist/index334.js +1 -1
- package/dist/index338.js +8 -24
- package/dist/index338.js.map +1 -1
- package/dist/index339.js +11 -28
- package/dist/index339.js.map +1 -1
- package/dist/index34.js +8 -38
- package/dist/index34.js.map +1 -1
- package/dist/index340.js +7 -15
- package/dist/index340.js.map +1 -1
- package/dist/index341.js +13 -8
- package/dist/index341.js.map +1 -1
- package/dist/index342.js +3 -11
- package/dist/index342.js.map +1 -1
- package/dist/index343.js +3 -8
- package/dist/index343.js.map +1 -1
- package/dist/index344.js +16 -12
- package/dist/index344.js.map +1 -1
- package/dist/index345.js +24 -3
- package/dist/index345.js.map +1 -1
- package/dist/index346.js +28 -3
- package/dist/index346.js.map +1 -1
- package/dist/index347.js +15 -16
- package/dist/index347.js.map +1 -1
- package/dist/index349.js +61 -5
- package/dist/index349.js.map +1 -1
- package/dist/index35.js +35 -74
- package/dist/index35.js.map +1 -1
- package/dist/index350.js +65 -60
- package/dist/index350.js.map +1 -1
- package/dist/index351.js +5 -66
- package/dist/index351.js.map +1 -1
- package/dist/index36.js +74 -20
- package/dist/index36.js.map +1 -1
- package/dist/index365.js +4 -12
- package/dist/index365.js.map +1 -1
- package/dist/index366.js +12 -4
- package/dist/index366.js.map +1 -1
- package/dist/index37.js +18 -33
- package/dist/index37.js.map +1 -1
- package/dist/index379.js +2 -2
- package/dist/index38.js +36 -26
- package/dist/index38.js.map +1 -1
- package/dist/index386.js +1 -1
- package/dist/index388.js +1 -1
- package/dist/index39.js +26 -21
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +2 -2
- package/dist/index40.js +20 -56
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +59 -51
- package/dist/index41.js.map +1 -1
- package/dist/index411.js +15 -3
- package/dist/index411.js.map +1 -1
- package/dist/index412.js +3 -15
- package/dist/index412.js.map +1 -1
- package/dist/index417.js +1 -1
- package/dist/index419.js +1 -1
- package/dist/index42.js +50 -21
- package/dist/index42.js.map +1 -1
- package/dist/index420.js +2 -2
- package/dist/index423.js +1 -1
- package/dist/index424.js +1 -1
- package/dist/index427.js +1 -1
- package/dist/index428.js +1 -1
- package/dist/index43.js +18 -127
- package/dist/index43.js.map +1 -1
- package/dist/index430.js +16 -2
- package/dist/index430.js.map +1 -1
- package/dist/index431.js +29 -2
- package/dist/index431.js.map +1 -1
- package/dist/index432.js +13 -2
- package/dist/index432.js.map +1 -1
- package/dist/index433.js +7 -2
- package/dist/index433.js.map +1 -1
- package/dist/index434.js +2 -16
- package/dist/index434.js.map +1 -1
- package/dist/index435.js +2 -29
- package/dist/index435.js.map +1 -1
- package/dist/index436.js +2 -13
- package/dist/index436.js.map +1 -1
- package/dist/index437.js +2 -7
- package/dist/index437.js.map +1 -1
- package/dist/index44.js +122 -39
- package/dist/index44.js.map +1 -1
- package/dist/index45.js +42 -85
- package/dist/index45.js.map +1 -1
- package/dist/index46.js +87 -123
- package/dist/index46.js.map +1 -1
- package/dist/index47.js +126 -5
- package/dist/index47.js.map +1 -1
- package/dist/index48.js +5 -332
- package/dist/index48.js.map +1 -1
- package/dist/index49.js +320 -245
- package/dist/index49.js.map +1 -1
- package/dist/index5.js +2 -2
- package/dist/index50.js +254 -23
- package/dist/index50.js.map +1 -1
- package/dist/index51.js +25 -129
- package/dist/index51.js.map +1 -1
- package/dist/index52.js +129 -24
- package/dist/index52.js.map +1 -1
- package/dist/index53.js +22 -19
- package/dist/index53.js.map +1 -1
- package/dist/index54.js +19 -134
- package/dist/index54.js.map +1 -1
- package/dist/index55.js +133 -30
- package/dist/index55.js.map +1 -1
- package/dist/index56.js +30 -24
- package/dist/index56.js.map +1 -1
- package/dist/index57.js +26 -38
- package/dist/index57.js.map +1 -1
- package/dist/index58.js +38 -18
- package/dist/index58.js.map +1 -1
- package/dist/index59.js +17 -132
- package/dist/index59.js.map +1 -1
- package/dist/index6.js +4 -4
- package/dist/index60.js +134 -49
- package/dist/index60.js.map +1 -1
- package/dist/index61.js +48 -25
- package/dist/index61.js.map +1 -1
- package/dist/index62.js +28 -57
- package/dist/index62.js.map +1 -1
- package/dist/index63.js +57 -56
- package/dist/index63.js.map +1 -1
- package/dist/index7.js +11 -11
- package/dist/index8.js +2 -2
- package/dist/index9.js +1 -1
- package/package.json +1 -1
package/dist/index437.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
return (d = {}) => {
|
|
3
|
-
const n = d.width ? String(d.width) : t.defaultWidth;
|
|
4
|
-
return t.formats[n] || t.formats[t.defaultWidth];
|
|
5
|
-
};
|
|
6
|
-
}
|
|
1
|
+
var e = {};
|
|
7
2
|
export {
|
|
8
|
-
|
|
3
|
+
e as __exports
|
|
9
4
|
};
|
|
10
5
|
//# sourceMappingURL=index437.js.map
|
package/dist/index437.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index437.js","sources":[
|
|
1
|
+
{"version":3,"file":"index437.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/index44.js
CHANGED
|
@@ -1,51 +1,134 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { getCountryList as E } from "./index76.js";
|
|
2
|
+
import { getCountryCallingCode as s } from "./index48.js";
|
|
3
|
+
const f = "US", u = E(), c = /* @__PURE__ */ new Map(), m = "__default_locale__", _ = Array.from(new Set(u.map((e) => s(e)))).sort((e, t) => t.length - e.length);
|
|
4
|
+
_.reduce((e, t) => Math.max(e, t.length), 0);
|
|
5
|
+
const O = ["0011", "001", "011", "00", "810"];
|
|
6
|
+
function y(e) {
|
|
7
|
+
return e && u.includes(e) ? e : f;
|
|
8
|
+
}
|
|
9
|
+
function C(e) {
|
|
10
|
+
if (typeof Intl > "u" || typeof Intl.DisplayNames > "u")
|
|
11
|
+
return null;
|
|
12
|
+
try {
|
|
13
|
+
const t = Array.isArray(e) ? e : e ? [e] : void 0;
|
|
14
|
+
return new Intl.DisplayNames(t, {
|
|
15
|
+
type: "region"
|
|
16
|
+
});
|
|
17
|
+
} catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
14
20
|
}
|
|
15
|
-
function N(
|
|
16
|
-
|
|
21
|
+
function N(e) {
|
|
22
|
+
const t = C(e), r = C("en");
|
|
23
|
+
return u.map((n) => {
|
|
24
|
+
const a = s(n), o = t?.of(n) ?? r?.of(n) ?? n, i = r?.of(n) ?? o, g = T(n), l = Array.from(new Set([o, i, n.toUpperCase(), n.toLowerCase(), ...g].filter(Boolean)));
|
|
17
25
|
return {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
value: n,
|
|
27
|
+
name: o,
|
|
28
|
+
dialCode: a,
|
|
29
|
+
label: `${o} (+${a})`,
|
|
30
|
+
flag: A(n),
|
|
31
|
+
searchableTokens: l,
|
|
32
|
+
normalizedSearchableTokens: l.map((p) => U(p))
|
|
23
33
|
};
|
|
24
|
-
|
|
34
|
+
}).sort((n, a) => {
|
|
35
|
+
const o = d(n.value), i = d(a.value);
|
|
36
|
+
return o !== i ? o - i : n.name.localeCompare(a.name);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function d(e) {
|
|
40
|
+
return e === "US" ? 0 : e === "CA" ? 1 : s(e) === "1" ? 2 : 3;
|
|
41
|
+
}
|
|
42
|
+
function R(e) {
|
|
43
|
+
return e ? Array.isArray(e) ? e.join("\0") : e : m;
|
|
44
|
+
}
|
|
45
|
+
function b(e) {
|
|
46
|
+
if (e !== m) {
|
|
47
|
+
if (e.includes("\0")) {
|
|
48
|
+
const t = e.split("\0").filter(Boolean);
|
|
49
|
+
return t.length === 0 ? void 0 : t.length === 1 ? t[0] ?? void 0 : t;
|
|
50
|
+
}
|
|
51
|
+
return e;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function L(e, t) {
|
|
55
|
+
const r = c.get(t);
|
|
56
|
+
if (r)
|
|
57
|
+
return r;
|
|
58
|
+
const n = N(e);
|
|
59
|
+
return c.set(t, n), n;
|
|
60
|
+
}
|
|
61
|
+
function v(e) {
|
|
25
62
|
return {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
detectedCountry: c
|
|
63
|
+
code: e.value,
|
|
64
|
+
name: e.name,
|
|
65
|
+
dialCode: e.dialCode,
|
|
66
|
+
flag: e.flag
|
|
31
67
|
};
|
|
32
68
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
69
|
+
function F(e) {
|
|
70
|
+
return {
|
|
71
|
+
code: e,
|
|
72
|
+
name: e,
|
|
73
|
+
dialCode: s(e),
|
|
74
|
+
flag: A(e)
|
|
75
|
+
};
|
|
35
76
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
77
|
+
function A(e) {
|
|
78
|
+
const t = e?.toUpperCase();
|
|
79
|
+
if (!t || t.length !== 2 || /[^A-Z]/.test(t))
|
|
80
|
+
return "";
|
|
81
|
+
const r = 127397;
|
|
82
|
+
return String.fromCodePoint(t.charCodeAt(0) + r, t.charCodeAt(1) + r);
|
|
83
|
+
}
|
|
84
|
+
const S = /[\u0300-\u036f]/g;
|
|
85
|
+
function h(e) {
|
|
86
|
+
return e.normalize("NFD").replace(S, "");
|
|
87
|
+
}
|
|
88
|
+
function U(e) {
|
|
89
|
+
return h(e).toLowerCase();
|
|
90
|
+
}
|
|
91
|
+
function B(e, t) {
|
|
92
|
+
let r = Number.MAX_SAFE_INTEGER;
|
|
93
|
+
for (const n of e) {
|
|
94
|
+
const a = n.indexOf(t);
|
|
95
|
+
a >= 0 && a < r && (r = a);
|
|
96
|
+
}
|
|
97
|
+
return r === Number.MAX_SAFE_INTEGER ? Number.MAX_SAFE_INTEGER : r;
|
|
98
|
+
}
|
|
99
|
+
function T(e) {
|
|
100
|
+
switch (e) {
|
|
101
|
+
case "US":
|
|
102
|
+
return ["USA", "United States", "America", "United States of America"];
|
|
103
|
+
case "GB":
|
|
104
|
+
return ["UK", "United Kingdom", "Great Britain", "England"];
|
|
105
|
+
case "AE":
|
|
106
|
+
return ["UAE", "United Arab Emirates"];
|
|
107
|
+
case "KR":
|
|
108
|
+
return ["South Korea", "Korea"];
|
|
109
|
+
case "CN":
|
|
110
|
+
return ["China", "PRC"];
|
|
111
|
+
case "CD":
|
|
112
|
+
return ["DRC", "Congo-Kinshasa"];
|
|
113
|
+
case "CG":
|
|
114
|
+
return ["Congo-Brazzaville"];
|
|
115
|
+
case "BR":
|
|
116
|
+
return ["Brazil"];
|
|
117
|
+
default:
|
|
118
|
+
return [];
|
|
43
119
|
}
|
|
44
120
|
}
|
|
45
121
|
export {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
122
|
+
O as COMMON_IDD_PREFIXES,
|
|
123
|
+
_ as COUNTRY_DIAL_CODES,
|
|
124
|
+
f as DEFAULT_COUNTRY,
|
|
125
|
+
F as buildFallbackSelectedCountry,
|
|
126
|
+
L as getCachedCountryOptions,
|
|
127
|
+
R as getLocaleCacheKey,
|
|
128
|
+
y as getValidCountry,
|
|
129
|
+
U as normalizeSearchValue,
|
|
130
|
+
B as optionMatchIndex,
|
|
131
|
+
b as parseLocaleCacheKey,
|
|
132
|
+
v as toSelectedCountry
|
|
50
133
|
};
|
|
51
134
|
//# sourceMappingURL=index44.js.map
|
package/dist/index44.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index44.js","sources":["../src/components/PhoneNumberInput/normalization.ts"],"sourcesContent":["import type { CountryCode } from \"libphonenumber-js\"\nimport { AsYouType, validatePhoneNumberLength } from \"libphonenumber-js\"\n\n\nexport type LengthIssue = \"TOO_LONG\"\n\nexport function sanitizeDigits(value: string) {\n return value.replace(/\\D/g, \"\")\n}\n\nconst DETECTED_COUNTRY_OVERRIDES: Partial<Record<CountryCode, CountryCode>> = {\n GG: \"GB\",\n JE: \"GB\",\n IM: \"GB\",\n}\n\nfunction canonicalizeDetectedCountry(candidate: CountryCode | undefined): CountryCode | undefined {\n if (!candidate) {\n return undefined\n }\n return DETECTED_COUNTRY_OVERRIDES[candidate] ?? candidate\n}\n\nexport function formatWithAsYouType(value: string, baseCountry?: CountryCode) {\n if (value === \"+\") {\n return {\n international: \"+\",\n national: \"\",\n formatted: \"+\",\n phoneNumber: null,\n detectedCountry: undefined,\n }\n }\n\n const formatter = baseCountry ? new AsYouType(baseCountry) : new AsYouType()\n const formatted = formatter.input(value)\n const phoneNumber = formatter.getNumber()\n const detectedCountry = canonicalizeDetectedCountry(\n (phoneNumber?.country ?? formatter.country ?? undefined) as CountryCode | undefined\n )\n const international = phoneNumber?.formatInternational() ?? formatted\n const national = phoneNumber?.formatNational() ?? sanitizeDigits(international)\n\n return {\n international,\n national,\n formatted,\n phoneNumber,\n detectedCountry,\n }\n}\n\nexport function stripPrefix(value: string, prefix: string) {\n return value.startsWith(prefix) ? value.slice(prefix.length) : value\n}\n\nexport function getLengthIssue(value: string, country: CountryCode | undefined): LengthIssue | null {\n if (!country || !value) {\n return null\n }\n\n try {\n const result = validatePhoneNumberLength(value, country)\n return result === \"TOO_LONG\" ? \"TOO_LONG\" : null\n } catch {\n return null\n }\n}\n"],"names":["sanitizeDigits","value","replace","DETECTED_COUNTRY_OVERRIDES","GG","JE","IM","canonicalizeDetectedCountry","candidate","formatWithAsYouType","baseCountry","international","national","formatted","phoneNumber","detectedCountry","undefined","formatter","AsYouType","input","getNumber","country","formatInternational","formatNational","stripPrefix","prefix","startsWith","slice","length","getLengthIssue","validatePhoneNumberLength"],"mappings":";;AAMO,SAASA,EAAeC,GAAe;AAC5C,SAAOA,EAAMC,QAAQ,OAAO,EAAE;AAChC;AAEA,MAAMC,IAAwE;AAAA,EAC5EC,IAAI;AAAA,EACJC,IAAI;AAAA,EACJC,IAAI;AACN;AAEA,SAASC,EAA4BC,GAA6D;AAChG,MAAKA;AAGL,WAAOL,EAA2BK,CAAS,KAAKA;AAClD;AAEO,SAASC,EAAoBR,GAAeS,GAA2B;AAC5E,MAAIT,MAAU;AACZ,WAAO;AAAA,MACLU,eAAe;AAAA,MACfC,UAAU;AAAA,MACVC,WAAW;AAAA,MACXC,aAAa;AAAA,MACbC,iBAAiBC;AAAAA,IAAAA;AAIrB,QAAMC,IAAYP,IAAc,IAAIQ,EAAUR,CAAW,IAAI,IAAIQ,EAAAA,GAC3DL,IAAYI,EAAUE,MAAMlB,CAAK,GACjCa,IAAcG,EAAUG,UAAAA,GACxBL,IAAkBR,EACrBO,GAAaO,WAAWJ,EAAUI,WAAWL,MAChD,GACML,IAAgBG,GAAaQ,oBAAAA,KAAyBT,GACtDD,IAAWE,GAAaS,eAAAA,KAAoBvB,EAAeW,CAAa;AAE9E,SAAO;AAAA,IACLA,eAAAA;AAAAA,IACAC,UAAAA;AAAAA,IACAC,WAAAA;AAAAA,IACAC,aAAAA;AAAAA,IACAC,iBAAAA;AAAAA,EAAAA;AAEJ;AAEO,SAASS,EAAYvB,GAAewB,GAAgB;AACzD,SAAOxB,EAAMyB,WAAWD,CAAM,IAAIxB,EAAM0B,MAAMF,EAAOG,MAAM,IAAI3B;AACjE;AAEO,SAAS4B,EAAe5B,GAAeoB,GAAsD;AAClG,MAAI,CAACA,KAAW,CAACpB;AACf,WAAO;AAGT,MAAI;AAEF,WADe6B,EAA0B7B,GAAOoB,CAAO,MACrC,aAAa,aAAa;AAAA,EAC9C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;"}
|
|
1
|
+
{"version":3,"file":"index44.js","sources":["../src/components/PhoneNumberInput/country-options.ts"],"sourcesContent":["import type { CountryCode } from \"libphonenumber-js\"\nimport { getCountryCallingCode } from \"libphonenumber-js\"\n\nimport type { CountryOption, PhoneNumberSelectedCountry } from \"./types\"\nimport { getCountryList } from \"./countries\"\n\n\nexport const DEFAULT_COUNTRY: CountryCode = \"US\"\nconst COUNTRY_OPTIONS = getCountryList()\n\nconst COUNTRY_OPTIONS_CACHE = new Map<string, CountryOption[]>()\nconst DEFAULT_LOCALE_CACHE_KEY = \"__default_locale__\"\nexport const COUNTRY_DIAL_CODES = Array.from(\n new Set(COUNTRY_OPTIONS.map((code) => getCountryCallingCode(code)))\n).sort((a, b) => b.length - a.length)\nexport const MAX_DIAL_CODE_LENGTH = COUNTRY_DIAL_CODES.reduce(\n (max, dial) => Math.max(max, dial.length),\n 0\n)\nexport const COMMON_IDD_PREFIXES = [\"0011\", \"001\", \"011\", \"00\", \"810\"]\n\nexport function getValidCountry(input: CountryCode | undefined) {\n if (!input) {\n return DEFAULT_COUNTRY\n }\n\n return COUNTRY_OPTIONS.includes(input) ? input : DEFAULT_COUNTRY\n}\n\nfunction createDisplayNames(locale?: string | string[]) {\n if (typeof Intl === \"undefined\" || typeof Intl.DisplayNames === \"undefined\") {\n return null\n }\n\n try {\n const locales = Array.isArray(locale) ? locale : locale ? [locale] : undefined\n return new Intl.DisplayNames(locales, { type: \"region\" })\n } catch {\n return null\n }\n}\n\nfunction buildCountryOptions(locale?: string | string[]) {\n const displayNames = createDisplayNames(locale)\n const englishDisplayNames = createDisplayNames(\"en\")\n\n return COUNTRY_OPTIONS\n .map((country) => {\n const dialCode = getCountryCallingCode(country)\n const localizedName = displayNames?.of(country) ?? englishDisplayNames?.of(country) ?? country\n const englishName = englishDisplayNames?.of(country) ?? localizedName\n const aliasTokens = getCountryAliases(country)\n const searchableTokens = Array.from(\n new Set(\n [localizedName, englishName, country.toUpperCase(), country.toLowerCase(), ...aliasTokens].filter(\n Boolean\n )\n )\n ) as string[]\n return {\n value: country,\n name: localizedName,\n dialCode,\n label: `${localizedName} (+${dialCode})`,\n flag: countryCodeToFlagEmoji(country),\n searchableTokens,\n normalizedSearchableTokens: searchableTokens.map((token) => normalizeSearchValue(token)),\n }\n })\n .sort((a, b) => {\n const priorityA = getCountryPriority(a.value)\n const priorityB = getCountryPriority(b.value)\n if (priorityA !== priorityB) {\n return priorityA - priorityB\n }\n return a.name.localeCompare(b.name)\n })\n}\n\nfunction getCountryPriority(code: CountryCode) {\n if (code === \"US\") return 0\n if (code === \"CA\") return 1\n if (getCountryCallingCode(code) === \"1\") return 2\n return 3\n}\n\nexport function getLocaleCacheKey(locale?: string | string[]) {\n if (!locale) {\n return DEFAULT_LOCALE_CACHE_KEY\n }\n if (Array.isArray(locale)) {\n return locale.join(\"\\u0000\")\n }\n return locale\n}\n\nexport function parseLocaleCacheKey(cacheKey: string): string | string[] | undefined {\n if (cacheKey === DEFAULT_LOCALE_CACHE_KEY) {\n return undefined\n }\n\n if (cacheKey.includes(\"\\u0000\")) {\n const parts = cacheKey.split(\"\\u0000\").filter(Boolean)\n if (parts.length === 0) {\n return undefined\n }\n if (parts.length === 1) {\n return parts[0] ?? undefined\n }\n return parts\n }\n\n return cacheKey\n}\n\nexport function getCachedCountryOptions(locale: string | string[] | undefined, cacheKey: string) {\n const cached = COUNTRY_OPTIONS_CACHE.get(cacheKey)\n if (cached) {\n return cached\n }\n const built = buildCountryOptions(locale)\n COUNTRY_OPTIONS_CACHE.set(cacheKey, built)\n return built\n}\n\nexport function toSelectedCountry(option: CountryOption): PhoneNumberSelectedCountry {\n return {\n code: option.value,\n name: option.name,\n dialCode: option.dialCode,\n flag: option.flag,\n }\n}\n\nexport function buildFallbackSelectedCountry(country: CountryCode): PhoneNumberSelectedCountry {\n return {\n code: country,\n name: country,\n dialCode: getCountryCallingCode(country),\n flag: countryCodeToFlagEmoji(country),\n }\n}\n\nfunction countryCodeToFlagEmoji(country: CountryCode) {\n const upper = country?.toUpperCase()\n\n if (!upper || upper.length !== 2 || /[^A-Z]/.test(upper)) {\n return \"\"\n }\n\n const base = 127397\n return String.fromCodePoint(\n upper.charCodeAt(0) + base,\n upper.charCodeAt(1) + base\n )\n}\n\nconst DIACRITICS_REGEX = /[\\u0300-\\u036f]/g\n\nfunction stripDiacritics(value: string) {\n return value.normalize(\"NFD\").replace(DIACRITICS_REGEX, \"\")\n}\n\nexport function normalizeSearchValue(value: string) {\n return stripDiacritics(value).toLowerCase()\n}\n\nexport function optionMatchIndex(tokens: string[], query: string) {\n let best = Number.MAX_SAFE_INTEGER\n for (const token of tokens) {\n const index = token.indexOf(query)\n if (index >= 0 && index < best) {\n best = index\n }\n }\n return best === Number.MAX_SAFE_INTEGER ? Number.MAX_SAFE_INTEGER : best\n}\n\nfunction getCountryAliases(code: CountryCode): string[] {\n switch (code) {\n case \"US\":\n return [\"USA\", \"United States\", \"America\", \"United States of America\"]\n case \"GB\":\n return [\"UK\", \"United Kingdom\", \"Great Britain\", \"England\"]\n case \"AE\":\n return [\"UAE\", \"United Arab Emirates\"]\n case \"KR\":\n return [\"South Korea\", \"Korea\"]\n case \"CN\":\n return [\"China\", \"PRC\"]\n case \"CD\":\n return [\"DRC\", \"Congo-Kinshasa\"]\n case \"CG\":\n return [\"Congo-Brazzaville\"]\n case \"BR\":\n return [\"Brazil\"]\n default:\n return []\n }\n}\n\n"],"names":["DEFAULT_COUNTRY","COUNTRY_OPTIONS","getCountryList","COUNTRY_OPTIONS_CACHE","Map","DEFAULT_LOCALE_CACHE_KEY","COUNTRY_DIAL_CODES","Array","from","Set","map","code","getCountryCallingCode","sort","a","b","length","reduce","max","dial","Math","COMMON_IDD_PREFIXES","getValidCountry","input","includes","createDisplayNames","locale","Intl","DisplayNames","locales","isArray","undefined","type","buildCountryOptions","displayNames","englishDisplayNames","country","dialCode","localizedName","of","englishName","aliasTokens","getCountryAliases","searchableTokens","toUpperCase","toLowerCase","filter","Boolean","value","name","label","flag","countryCodeToFlagEmoji","normalizedSearchableTokens","token","normalizeSearchValue","priorityA","getCountryPriority","priorityB","localeCompare","getLocaleCacheKey","join","parseLocaleCacheKey","cacheKey","parts","split","getCachedCountryOptions","cached","get","built","set","toSelectedCountry","option","buildFallbackSelectedCountry","upper","test","base","String","fromCodePoint","charCodeAt","DIACRITICS_REGEX","stripDiacritics","normalize","replace","optionMatchIndex","tokens","query","best","Number","MAX_SAFE_INTEGER","index","indexOf"],"mappings":";;AAOO,MAAMA,IAA+B,MACtCC,IAAkBC,EAAAA,GAElBC,wBAA4BC,IAAAA,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AA,IAC5D,KAAK;AACH,aAAO,CAAC,OAAO,sBAAsB;AAAA,IACvC,KAAK;AACH,aAAO,CAAC,eAAe,OAAO;AAAA,IAChC,KAAK;AACH,aAAO,CAAC,SAAS,KAAK;AAAA,IACxB,KAAK;AACH,aAAO,CAAC,OAAO,gBAAgB;AAAA,IACjC,KAAK;AACH,aAAO,CAAC,mBAAmB;AAAA,IAC7B,KAAK;AACH,aAAO,CAAC,QAAQ;AAAA,IAClB;AACE,aAAO,CAAA;AAAA,EAAA;AAEX;"}
|
package/dist/index45.js
CHANGED
|
@@ -1,94 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
c(t[i] ?? "") && (n += 1);
|
|
12
|
-
return n;
|
|
13
|
-
}
|
|
14
|
-
function a(t, e) {
|
|
15
|
-
if (e <= 0)
|
|
16
|
-
return t.startsWith("+") ? Math.min(1, t.length) : 0;
|
|
17
|
-
let n = 0;
|
|
18
|
-
for (let r = 0; r < t.length; r += 1)
|
|
19
|
-
if (c(t[r] ?? "") && (n += 1, n === e))
|
|
20
|
-
return r + 1;
|
|
21
|
-
return t.length;
|
|
22
|
-
}
|
|
23
|
-
function g(t) {
|
|
24
|
-
return !t || c(t) ? !1 : t !== "+";
|
|
25
|
-
}
|
|
26
|
-
function h(t, e) {
|
|
27
|
-
let n = e;
|
|
28
|
-
for (; n > 0; ) {
|
|
29
|
-
const r = t[n - 1] ?? "";
|
|
30
|
-
if (!g(r))
|
|
31
|
-
break;
|
|
32
|
-
n -= 1;
|
|
33
|
-
}
|
|
34
|
-
return n;
|
|
35
|
-
}
|
|
36
|
-
function S(t, e) {
|
|
37
|
-
let n = e;
|
|
38
|
-
for (; n < t.length; ) {
|
|
39
|
-
const r = t[n] ?? "";
|
|
40
|
-
if (!g(r))
|
|
41
|
-
break;
|
|
42
|
-
n += 1;
|
|
43
|
-
}
|
|
44
|
-
return n;
|
|
45
|
-
}
|
|
1
|
+
import { AsYouType as u } from "./index77.js";
|
|
2
|
+
import { validatePhoneNumberLength as a } from "./index78.js";
|
|
3
|
+
function l(t) {
|
|
4
|
+
return t.replace(/\D/g, "");
|
|
5
|
+
}
|
|
6
|
+
const f = {
|
|
7
|
+
GG: "GB",
|
|
8
|
+
JE: "GB",
|
|
9
|
+
IM: "GB"
|
|
10
|
+
};
|
|
46
11
|
function m(t) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
12
|
+
if (t)
|
|
13
|
+
return f[t] ?? t;
|
|
14
|
+
}
|
|
15
|
+
function N(t, n) {
|
|
16
|
+
if (t === "+")
|
|
17
|
+
return {
|
|
18
|
+
international: "+",
|
|
19
|
+
national: "",
|
|
20
|
+
formatted: "+",
|
|
21
|
+
phoneNumber: null,
|
|
22
|
+
detectedCountry: void 0
|
|
23
|
+
};
|
|
24
|
+
const r = n ? new u(n) : new u(), o = r.input(t), e = r.getNumber(), c = m(e?.country ?? r.country ?? void 0), i = e?.formatInternational() ?? o, s = e?.formatNational() ?? l(i);
|
|
50
25
|
return {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
preserveEndIndex: o,
|
|
57
|
-
wasAtStart: n === 0,
|
|
58
|
-
wasAtEnd: r === e.length
|
|
26
|
+
international: i,
|
|
27
|
+
national: s,
|
|
28
|
+
formatted: o,
|
|
29
|
+
phoneNumber: e,
|
|
30
|
+
detectedCountry: c
|
|
59
31
|
};
|
|
60
32
|
}
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return {
|
|
72
|
-
start: 0,
|
|
73
|
-
end: 0
|
|
74
|
-
};
|
|
33
|
+
function O(t, n) {
|
|
34
|
+
return t.startsWith(n) ? t.slice(n.length) : t;
|
|
35
|
+
}
|
|
36
|
+
function d(t, n) {
|
|
37
|
+
if (!n || !t)
|
|
38
|
+
return null;
|
|
39
|
+
try {
|
|
40
|
+
return a(t, n) === "TOO_LONG" ? "TOO_LONG" : null;
|
|
41
|
+
} catch {
|
|
42
|
+
return null;
|
|
75
43
|
}
|
|
76
|
-
const n = t.preserveStartIndex ? Math.min(t.selectionStart, e.length) : a(e, t.startDigits), r = t.preserveEndIndex ? Math.min(t.selectionEnd, e.length) : a(e, t.endDigits);
|
|
77
|
-
let i = n, o = r;
|
|
78
|
-
t.wasAtStart && (i = 0), t.wasAtEnd && (o = e.length), t.selectionStart === t.selectionEnd && (i = o);
|
|
79
|
-
const d = Math.min(Math.max(i, 0), e.length), s = Math.min(Math.max(o, 0), e.length);
|
|
80
|
-
return d > s ? {
|
|
81
|
-
start: s,
|
|
82
|
-
end: s
|
|
83
|
-
} : {
|
|
84
|
-
start: d,
|
|
85
|
-
end: s
|
|
86
|
-
};
|
|
87
44
|
}
|
|
88
45
|
export {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
46
|
+
N as formatWithAsYouType,
|
|
47
|
+
d as getLengthIssue,
|
|
48
|
+
l as sanitizeDigits,
|
|
49
|
+
O as stripPrefix
|
|
93
50
|
};
|
|
94
51
|
//# sourceMappingURL=index45.js.map
|
package/dist/index45.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index45.js","sources":["../src/components/PhoneNumberInput/
|
|
1
|
+
{"version":3,"file":"index45.js","sources":["../src/components/PhoneNumberInput/normalization.ts"],"sourcesContent":["import type { CountryCode } from \"libphonenumber-js\"\nimport { AsYouType, validatePhoneNumberLength } from \"libphonenumber-js\"\n\n\nexport type LengthIssue = \"TOO_LONG\"\n\nexport function sanitizeDigits(value: string) {\n return value.replace(/\\D/g, \"\")\n}\n\nconst DETECTED_COUNTRY_OVERRIDES: Partial<Record<CountryCode, CountryCode>> = {\n GG: \"GB\",\n JE: \"GB\",\n IM: \"GB\",\n}\n\nfunction canonicalizeDetectedCountry(candidate: CountryCode | undefined): CountryCode | undefined {\n if (!candidate) {\n return undefined\n }\n return DETECTED_COUNTRY_OVERRIDES[candidate] ?? candidate\n}\n\nexport function formatWithAsYouType(value: string, baseCountry?: CountryCode) {\n if (value === \"+\") {\n return {\n international: \"+\",\n national: \"\",\n formatted: \"+\",\n phoneNumber: null,\n detectedCountry: undefined,\n }\n }\n\n const formatter = baseCountry ? new AsYouType(baseCountry) : new AsYouType()\n const formatted = formatter.input(value)\n const phoneNumber = formatter.getNumber()\n const detectedCountry = canonicalizeDetectedCountry(\n (phoneNumber?.country ?? formatter.country ?? undefined) as CountryCode | undefined\n )\n const international = phoneNumber?.formatInternational() ?? formatted\n const national = phoneNumber?.formatNational() ?? sanitizeDigits(international)\n\n return {\n international,\n national,\n formatted,\n phoneNumber,\n detectedCountry,\n }\n}\n\nexport function stripPrefix(value: string, prefix: string) {\n return value.startsWith(prefix) ? value.slice(prefix.length) : value\n}\n\nexport function getLengthIssue(value: string, country: CountryCode | undefined): LengthIssue | null {\n if (!country || !value) {\n return null\n }\n\n try {\n const result = validatePhoneNumberLength(value, country)\n return result === \"TOO_LONG\" ? \"TOO_LONG\" : null\n } catch {\n return null\n }\n}\n"],"names":["sanitizeDigits","value","replace","DETECTED_COUNTRY_OVERRIDES","GG","JE","IM","canonicalizeDetectedCountry","candidate","formatWithAsYouType","baseCountry","international","national","formatted","phoneNumber","detectedCountry","undefined","formatter","AsYouType","input","getNumber","country","formatInternational","formatNational","stripPrefix","prefix","startsWith","slice","length","getLengthIssue","validatePhoneNumberLength"],"mappings":";;AAMO,SAASA,EAAeC,GAAe;AAC5C,SAAOA,EAAMC,QAAQ,OAAO,EAAE;AAChC;AAEA,MAAMC,IAAwE;AAAA,EAC5EC,IAAI;AAAA,EACJC,IAAI;AAAA,EACJC,IAAI;AACN;AAEA,SAASC,EAA4BC,GAA6D;AAChG,MAAKA;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
|
|
6
|
+
}
|
|
7
|
+
function l(t, e) {
|
|
8
|
+
let n = 0;
|
|
9
|
+
const r = Math.min(e, t.length);
|
|
10
|
+
for (let i = 0; i < r; i += 1)
|
|
11
|
+
c(t[i] ?? "") && (n += 1);
|
|
12
|
+
return n;
|
|
13
|
+
}
|
|
14
|
+
function a(t, e) {
|
|
15
|
+
if (e <= 0)
|
|
16
|
+
return t.startsWith("+") ? Math.min(1, t.length) : 0;
|
|
17
|
+
let n = 0;
|
|
18
|
+
for (let r = 0; r < t.length; r += 1)
|
|
19
|
+
if (c(t[r] ?? "") && (n += 1, n === e))
|
|
20
|
+
return r + 1;
|
|
21
|
+
return t.length;
|
|
22
|
+
}
|
|
23
|
+
function g(t) {
|
|
24
|
+
return !t || c(t) ? !1 : t !== "+";
|
|
25
|
+
}
|
|
26
|
+
function h(t, e) {
|
|
27
|
+
let n = e;
|
|
28
|
+
for (; n > 0; ) {
|
|
29
|
+
const r = t[n - 1] ?? "";
|
|
30
|
+
if (!g(r))
|
|
31
|
+
break;
|
|
32
|
+
n -= 1;
|
|
10
33
|
}
|
|
11
|
-
|
|
34
|
+
return n;
|
|
12
35
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return;
|
|
38
|
-
const C = d.parentElement;
|
|
39
|
-
if (!C)
|
|
40
|
-
return;
|
|
41
|
-
const N = d.offsetTop, B = N + d.offsetHeight, O = C.scrollTop, E = O + C.clientHeight;
|
|
42
|
-
N >= O && B <= E || d.scrollIntoView({
|
|
43
|
-
block: "nearest",
|
|
44
|
-
behavior: H
|
|
45
|
-
});
|
|
46
|
-
}, e[8] = n?.consumeScrollBehavior, e[9] = o, e[10] = g) : g = e[10];
|
|
47
|
-
let h;
|
|
48
|
-
e[11] !== n || e[12] !== o ? (h = [n, o], e[11] = n, e[12] = o, e[13] = h) : h = e[13], v.useEffect(g, h);
|
|
49
|
-
let p;
|
|
50
|
-
e[14] !== n || e[15] !== i || e[16] !== t.data ? (p = (c) => {
|
|
51
|
-
i?.(c), n?.setHighlightedOption(t.data);
|
|
52
|
-
}, e[14] = n, e[15] = i, e[16] = t.data, e[17] = p) : p = e[17];
|
|
53
|
-
const R = p, y = o ? "bg-muted text-foreground" : "text-foreground hover:bg-muted";
|
|
54
|
-
let a;
|
|
55
|
-
e[18] !== r || e[19] !== y ? (a = L("flex cursor-pointer items-center justify-between gap-3 px-3 py-2 text-sm", r, y), e[18] = r, e[19] = y, e[20] = a) : a = e[20];
|
|
56
|
-
let u;
|
|
57
|
-
e[21] !== t.data || e[22] !== b ? (u = b(t.data), e[21] = t.data, e[22] = b, e[23] = u) : u = e[23];
|
|
58
|
-
let x;
|
|
59
|
-
return e[24] !== j || e[25] !== R || e[26] !== s || e[27] !== a || e[28] !== u ? (x = /* @__PURE__ */ l.jsx("div", { ref: j, ...s, onMouseMove: R, className: a, children: u }), e[24] = j, e[25] = R, e[26] = s, e[27] = a, e[28] = u, e[29] = x) : x = e[29], x;
|
|
60
|
-
}, $ = {
|
|
61
|
-
control: () => ({
|
|
62
|
-
display: "none"
|
|
63
|
-
}),
|
|
64
|
-
menu: (t) => ({
|
|
65
|
-
...t,
|
|
66
|
-
marginTop: 4,
|
|
67
|
-
borderRadius: "var(--radius)",
|
|
68
|
-
boxShadow: "0 18px 36px rgba(15, 23, 42, 0.18)",
|
|
69
|
-
backgroundColor: "hsl(var(--popover))",
|
|
70
|
-
overflow: "hidden",
|
|
71
|
-
zIndex: 20
|
|
72
|
-
}),
|
|
73
|
-
menuList: (t) => ({
|
|
74
|
-
...t,
|
|
75
|
-
maxHeight: 240,
|
|
76
|
-
padding: 0
|
|
77
|
-
}),
|
|
78
|
-
option: (t, e) => ({
|
|
79
|
-
...t,
|
|
80
|
-
fontSize: "0.875rem",
|
|
81
|
-
backgroundColor: e.isFocused ? "hsl(var(--muted))" : e.isSelected ? "hsl(var(--accent))" : "transparent",
|
|
82
|
-
color: e.isSelected ? "hsl(var(--accent-foreground))" : "hsl(var(--foreground))",
|
|
83
|
-
cursor: "pointer"
|
|
84
|
-
}),
|
|
85
|
-
noOptionsMessage: (t) => ({
|
|
86
|
-
...t,
|
|
87
|
-
fontSize: "0.875rem",
|
|
88
|
-
color: "hsl(var(--muted-foreground))"
|
|
89
|
-
})
|
|
90
|
-
}, A = (t) => {
|
|
91
|
-
const e = M.c(5), {
|
|
92
|
-
children: n,
|
|
93
|
-
innerProps: o,
|
|
94
|
-
innerRef: i
|
|
95
|
-
} = t;
|
|
96
|
-
let r;
|
|
97
|
-
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = {
|
|
98
|
-
height: 0,
|
|
99
|
-
minHeight: 0,
|
|
100
|
-
opacity: 0,
|
|
101
|
-
overflow: "hidden",
|
|
102
|
-
pointerEvents: "none"
|
|
103
|
-
}, e[0] = r) : r = e[0];
|
|
104
|
-
let s;
|
|
105
|
-
return e[1] !== n || e[2] !== o || e[3] !== i ? (s = /* @__PURE__ */ l.jsx("div", { ...o, ref: i, style: r, children: n }), e[1] = n, e[2] = o, e[3] = i, e[4] = s) : s = e[4], s;
|
|
106
|
-
}, q = () => null;
|
|
107
|
-
function k(t) {
|
|
108
|
-
return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
|
109
|
-
/* @__PURE__ */ l.jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
110
|
-
t.flag ? /* @__PURE__ */ l.jsx("span", { "aria-hidden": "true", className: "text-lg leading-none", children: t.flag }) : null,
|
|
111
|
-
/* @__PURE__ */ l.jsx("span", { className: "truncate", children: t.name })
|
|
112
|
-
] }),
|
|
113
|
-
/* @__PURE__ */ l.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
114
|
-
"+",
|
|
115
|
-
t.dialCode
|
|
116
|
-
] })
|
|
117
|
-
] });
|
|
36
|
+
function S(t, e) {
|
|
37
|
+
let n = e;
|
|
38
|
+
for (; n < t.length; ) {
|
|
39
|
+
const r = t[n] ?? "";
|
|
40
|
+
if (!g(r))
|
|
41
|
+
break;
|
|
42
|
+
n += 1;
|
|
43
|
+
}
|
|
44
|
+
return n;
|
|
45
|
+
}
|
|
46
|
+
function m(t) {
|
|
47
|
+
const {
|
|
48
|
+
value: e
|
|
49
|
+
} = t, n = t.selectionStart ?? e.length, r = t.selectionEnd ?? n, i = n <= 1 && e.startsWith("+"), o = r <= 1 && e.startsWith("+");
|
|
50
|
+
return {
|
|
51
|
+
selectionStart: n,
|
|
52
|
+
selectionEnd: r,
|
|
53
|
+
startDigits: l(e, n),
|
|
54
|
+
endDigits: l(e, r),
|
|
55
|
+
preserveStartIndex: i,
|
|
56
|
+
preserveEndIndex: o,
|
|
57
|
+
wasAtStart: n === 0,
|
|
58
|
+
wasAtEnd: r === e.length
|
|
59
|
+
};
|
|
118
60
|
}
|
|
119
|
-
function
|
|
120
|
-
|
|
61
|
+
function u(t, e) {
|
|
62
|
+
if (t.selectionStart === t.selectionEnd) {
|
|
63
|
+
if (t.wasAtEnd) {
|
|
64
|
+
const f = e.length;
|
|
65
|
+
return {
|
|
66
|
+
start: f,
|
|
67
|
+
end: f
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
if (t.wasAtStart)
|
|
71
|
+
return {
|
|
72
|
+
start: 0,
|
|
73
|
+
end: 0
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const n = t.preserveStartIndex ? Math.min(t.selectionStart, e.length) : a(e, t.startDigits), r = t.preserveEndIndex ? Math.min(t.selectionEnd, e.length) : a(e, t.endDigits);
|
|
77
|
+
let i = n, o = r;
|
|
78
|
+
t.wasAtStart && (i = 0), t.wasAtEnd && (o = e.length), t.selectionStart === t.selectionEnd && (i = o);
|
|
79
|
+
const d = Math.min(Math.max(i, 0), e.length), s = Math.min(Math.max(o, 0), e.length);
|
|
80
|
+
return d > s ? {
|
|
81
|
+
start: s,
|
|
82
|
+
end: s
|
|
83
|
+
} : {
|
|
84
|
+
start: d,
|
|
85
|
+
end: s
|
|
86
|
+
};
|
|
121
87
|
}
|
|
122
88
|
export {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
k as formatCountryOption,
|
|
128
|
-
$ as suggestionSelectStyles
|
|
89
|
+
m as captureSelectionSnapshot,
|
|
90
|
+
u as resolveSelection,
|
|
91
|
+
h as skipFormattingCharactersLeft,
|
|
92
|
+
S as skipFormattingCharactersRight
|
|
129
93
|
};
|
|
130
94
|
//# sourceMappingURL=index46.js.map
|