@alfadocs/ui-kit-debug 1.123.0 → 1.125.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/_chunks/{contact-profile-card-BubJPyRB.js → contact-profile-card-Jz2aSh7T.js} +172 -168
- package/dist/_chunks/contact-profile-card-Jz2aSh7T.js.map +1 -0
- package/dist/_chunks/{map-view-BqJMJ0Bj.js → map-view-DRd_GRQf.js} +140 -136
- package/dist/_chunks/map-view-DRd_GRQf.js.map +1 -0
- package/dist/_chunks/{practice-results-D3yWSNq8.js → practice-results-CbxBCDaU.js} +2 -2
- package/dist/_chunks/{practice-results-D3yWSNq8.js.map → practice-results-CbxBCDaU.js.map} +1 -1
- package/dist/agent-catalog.json +1 -1
- package/dist/browser-support.js +1 -1
- package/dist/components/_shared/format-phone.d.ts +24 -0
- package/dist/components/_shared/format-phone.d.ts.map +1 -0
- package/dist/components/contact-profile-card/contact-profile-card.d.ts +15 -3
- package/dist/components/contact-profile-card/contact-profile-card.d.ts.map +1 -1
- package/dist/components/contact-profile-card/index.js +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/map-view/index.js +1 -1
- package/dist/components/map-view/map-view.d.ts.map +1 -1
- package/dist/components/practice-results/index.js +1 -1
- package/dist/core.css +1 -1
- package/dist/format-phone/index.js +20 -0
- package/dist/format-phone/index.js.map +1 -0
- package/dist/index.js +1281 -1279
- package/dist/index.js.map +1 -1
- package/dist/tokens.css +1 -1
- package/package.json +5 -1
- package/dist/_chunks/contact-profile-card-BubJPyRB.js.map +0 -1
- package/dist/_chunks/map-view-BqJMJ0Bj.js.map +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { parsePhoneNumberFromString as l } from "libphonenumber-js/min";
|
|
2
|
+
function u(e, o = {}) {
|
|
3
|
+
const t = e.trim();
|
|
4
|
+
if (!t) return e;
|
|
5
|
+
const { defaultCountry: a, digitsAreInternational: s } = o;
|
|
6
|
+
if (!/^\+?[\d\s().\-/]+$/.test(t)) return e;
|
|
7
|
+
let r = t, n = t.startsWith("+");
|
|
8
|
+
s && /^00\d+$/.test(t) ? (r = `+${t.slice(2)}`, n = !1) : s && /^\d+$/.test(t) && (r = `+${t}`, n = !1);
|
|
9
|
+
try {
|
|
10
|
+
const i = l(r, a);
|
|
11
|
+
if (i && (i.isValid() || n && i.isPossible()))
|
|
12
|
+
return i.formatInternational();
|
|
13
|
+
} catch {
|
|
14
|
+
}
|
|
15
|
+
return e;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
u as formatPhoneForDisplay
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/components/_shared/format-phone.ts"],"sourcesContent":["import {\n parsePhoneNumberFromString,\n type CountryCode,\n} from 'libphonenumber-js/min';\n\nexport interface FormatPhoneOptions {\n /**\n * Country (ISO 3166-1 alpha-2) used when the number has no `+` country\n * code, for example `\"IT\"` for `0701234567`.\n */\n defaultCountry?: CountryCode;\n /**\n * The input is digits only and already starts with the country code, as\n * in a WhatsApp number (`393312345678`). It is read as `+393312345678`.\n */\n digitsAreInternational?: boolean;\n}\n\n/**\n * Format a stored phone number for display in international format, the\n * same grouping `PhoneInput` shows (`+39 331 234 5678`).\n *\n * Never drops or invents digits: a number that cannot be read, or that is\n * not valid for its country, is returned unchanged. Grouping comes from\n * libphonenumber, so it can differ from `PhoneInput`, which splits the\n * dial code from the national number.\n */\nexport function formatPhoneForDisplay(\n raw: string,\n options: FormatPhoneOptions = {},\n): string {\n const input = raw.trim();\n if (!input) return raw;\n const { defaultCountry, digitsAreInternational } = options;\n\n // Only plain phone text is formatted. A note around the number\n // (\"Tel. 0701234567 (reception)\") is kept exactly as given.\n if (!/^\\+?[\\d\\s().\\-/]+$/.test(input)) return raw;\n\n let candidate = input;\n let explicitCountry = input.startsWith('+');\n if (digitsAreInternational && /^00\\d+$/.test(input)) {\n candidate = `+${input.slice(2)}`;\n explicitCountry = false;\n } else if (digitsAreInternational && /^\\d+$/.test(input)) {\n candidate = `+${input}`;\n explicitCountry = false;\n }\n\n try {\n const parsed = parsePhoneNumberFromString(candidate, defaultCountry);\n // A number guessed from bare digits or a default country must be fully\n // valid, so a wrong country is never shown. One typed with its own `+`\n // may be merely possible.\n if (\n parsed &&\n (parsed.isValid() || (explicitCountry && parsed.isPossible()))\n ) {\n return parsed.formatInternational();\n }\n } catch {\n // Fall through to the raw value.\n }\n return raw;\n}\n"],"names":["formatPhoneForDisplay","raw","options","input","defaultCountry","digitsAreInternational","candidate","explicitCountry","parsed","parsePhoneNumberFromString"],"mappings":";AA2BO,SAASA,EACdC,GACAC,IAA8B,IACtB;AACR,QAAMC,IAAQF,EAAI,KAAA;AAClB,MAAI,CAACE,EAAO,QAAOF;AACnB,QAAM,EAAE,gBAAAG,GAAgB,wBAAAC,EAAA,IAA2BH;AAInD,MAAI,CAAC,qBAAqB,KAAKC,CAAK,EAAG,QAAOF;AAE9C,MAAIK,IAAYH,GACZI,IAAkBJ,EAAM,WAAW,GAAG;AAC1C,EAAIE,KAA0B,UAAU,KAAKF,CAAK,KAChDG,IAAY,IAAIH,EAAM,MAAM,CAAC,CAAC,IAC9BI,IAAkB,MACTF,KAA0B,QAAQ,KAAKF,CAAK,MACrDG,IAAY,IAAIH,CAAK,IACrBI,IAAkB;AAGpB,MAAI;AACF,UAAMC,IAASC,EAA2BH,GAAWF,CAAc;AAInE,QACEI,MACCA,EAAO,QAAA,KAAcD,KAAmBC,EAAO;AAEhD,aAAOA,EAAO,oBAAA;AAAA,EAElB,QAAQ;AAAA,EAER;AACA,SAAOP;AACT;"}
|