@dialpad/dialtone-vue 4.7.0 → 4.8.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/common/phone/index.cjs +2 -0
- package/dist/common/phone/index.cjs.map +1 -0
- package/dist/common/phone/index.d.ts +4 -0
- package/dist/common/phone/index.d.ts.map +1 -0
- package/dist/common/phone/index.js +25 -0
- package/dist/common/phone/index.js.map +1 -0
- package/dist/component-documentation.json +1 -1
- package/dist/components/FilterPill/FilterPill.vue.d.ts +9 -0
- package/dist/components/FilterPill/FilterPill.vue.d.ts.map +1 -1
- package/dist/components/RichTextEditor/Extensions/Channels/ChannelComponent.vue.d.ts +9 -0
- package/dist/components/RichTextEditor/Extensions/Channels/ChannelSuggestion.vue.d.ts +9 -0
- package/dist/components/RichTextEditor/Extensions/Channels/ChannelSuggestion.vue.d.ts.map +1 -1
- package/dist/components/RichTextEditor/Extensions/Emoji/EmojiSuggestion.vue.d.ts +9 -0
- package/dist/components/RichTextEditor/Extensions/Mentions/MentionSuggestion.vue.d.ts +9 -0
- package/dist/components/SegmentedControl/SegmentedControl.vue.d.ts +20 -0
- package/dist/components/SegmentedControl/SegmentedControl.vue.d.ts.map +1 -1
- package/dist/components/Stack/Stack.vue.d.ts +9 -0
- package/dist/components/Stack/Stack.vue.d.ts.map +1 -1
- package/dist/components/Stack/StackConstants.d.ts +2 -0
- package/dist/components/Stack/StackConstants.d.ts.map +1 -1
- package/dist/components/Stack/Utils.d.ts +2 -1
- package/dist/components/Stack/Utils.d.ts.map +1 -1
- package/dist/components/Stack/Validators.d.ts +1 -0
- package/dist/components/Stack/Validators.d.ts.map +1 -1
- package/dist/dialtone-vue.cjs +1 -1
- package/dist/dialtone-vue.js +131 -130
- package/dist/index.d.ts +1 -0
- package/dist/lib/stack/stack-constants.cjs +1 -1
- package/dist/lib/stack/stack-constants.cjs.map +1 -1
- package/dist/lib/stack/stack-constants.js +5 -4
- package/dist/lib/stack/stack-constants.js.map +1 -1
- package/dist/lib/stack/stack.cjs +1 -1
- package/dist/lib/stack/stack.cjs.map +1 -1
- package/dist/lib/stack/stack.js +26 -18
- package/dist/lib/stack/stack.js.map +1 -1
- package/dist/lib/stack/utils.cjs +1 -1
- package/dist/lib/stack/utils.cjs.map +1 -1
- package/dist/lib/stack/utils.js +44 -36
- package/dist/lib/stack/utils.js.map +1 -1
- package/dist/lib/stack/validators.cjs +1 -1
- package/dist/lib/stack/validators.cjs.map +1 -1
- package/dist/lib/stack/validators.js +16 -13
- package/dist/lib/stack/validators.js.map +1 -1
- package/package.json +6 -5
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../../chunk-Bmb41Sf3.cjs`);let e=require(`libphonenumber-js/min`);function t(t,{defaultCountry:r}={}){if(!t||typeof t!=`string`)return``;let a=n(r),o=(0,e.parsePhoneNumberFromString)(t.trim(),{defaultCountry:a,extract:!1});if(!o?.isValid())return t;let s=i(o,a);return o.ext?`${s} Ext. ${o.ext}`:s}function n(t){let n=typeof t==`string`?t.toUpperCase():void 0;return(0,e.isSupportedCountry)(n)?n:void 0}var r={formatExtension:e=>e};function i(t,n){let i=t.formatNational(r);return n&&(0,e.getCountryCallingCode)(n)===t.countryCallingCode?i:t.countryCallingCode===`1`?`+1 ${i}`:t.formatInternational(r)}exports.formatPhoneNumber=t;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../common/phone/index.js"],"sourcesContent":["import { parsePhoneNumberFromString, getCountryCallingCode, isSupportedCountry } from 'libphonenumber-js/min';\n\n/**\n * Formats a phone number for display, following the Dialtone content guide:\n * https://dialtone.dialpad.com/guides/content/grammar-and-mechanics/#numbers\n *\n * Input may use spaces, dots, dashes and parentheses, with an extension after `x`, `ext.` or `#`.\n * It needs a country code (`+44 20 7946 0958`) unless `defaultCountry` is set; then national input\n * (`(415) 555-0123`) and that country's international prefix (`011 44 …` in the US) work too.\n * A number that fails a basic check is returned unchanged: the wrong number of digits, an unused area\n * code such as 555, national input without `defaultCountry`, short codes like `911`, and letters\n * (`1-800-FLOWERS`). The check uses the small `libphonenumber-js/min` data, so some numbers that are\n * not real (wrong mobile prefix, not in service) still format.\n *\n * To show the viewer's own numbers without a country code, pass their country (from their account\n * or the request) as `defaultCountry`. The US and Canada share +1, so with `US` a Canadian number\n * also shows without it.\n *\n * Each country's own digit grouping is used. To keep a number on one line, put the `d-ws-nowrap`\n * class on the element.\n *\n * @example\n * formatPhoneNumber('+14155550123'); // '+1 (415) 555-0123'\n * formatPhoneNumber('+14155550123', { defaultCountry: 'US' }); // '(415) 555-0123'\n * formatPhoneNumber('+16045550123', { defaultCountry: 'US' }); // '(604) 555-0123'\n * formatPhoneNumber('+442079460958'); // '+44 20 7946 0958'\n * formatPhoneNumber('+1 415 555 0123 x55555'); // '+1 (415) 555-0123 Ext. 55555'\n *\n * @param {string} value The phone number to format\n * @param {Object} [options]\n * @param {string} [options.defaultCountry] Two-letter country code of the viewer, passed as\n * `{ defaultCountry: 'US' }`. Numbers that share its calling code show without it, and national input\n * like `415.555.0123` is read as that country's. Unknown codes are ignored.\n * @returns {string} The formatted number, the input unchanged if it fails the check above,\n * or an empty string if the input is empty or not a string\n */\nexport function formatPhoneNumber (value, { defaultCountry } = {}) {\n if (!value || typeof value !== 'string') return '';\n const country = _supportedCountry(defaultCountry);\n const phoneNumber = parsePhoneNumberFromString(value.trim(), { defaultCountry: country, extract: false });\n if (!phoneNumber?.isValid()) return value;\n\n const formatted = _formatWithoutExtension(phoneNumber, country);\n return phoneNumber.ext ? `${formatted} Ext. ${phoneNumber.ext}` : formatted;\n}\n\nfunction _supportedCountry (code) {\n const upper = typeof code === 'string' ? code.toUpperCase() : undefined;\n return isSupportedCountry(upper) ? upper : undefined;\n}\n\n// The content guide writes \"Ext. 55555\"; libphonenumber writes \"ext. 55555\", so it is added separately.\nconst _withoutExtension = { formatExtension: (number) => number };\n\nfunction _formatWithoutExtension (phoneNumber, country) {\n const national = phoneNumber.formatNational(_withoutExtension);\n if (country && getCountryCallingCode(country) === phoneNumber.countryCallingCode) return national;\n // libphonenumber writes +1 numbers as \"+1 800 555 1234\"; the content guide wants \"+1 (800) 555-1234\".\n return phoneNumber.countryCallingCode === '1'\n ? `+1 ${national}`\n : phoneNumber.formatInternational(_withoutExtension);\n}\n"],"mappings":"8IAoCA,SAAgB,EAAmB,EAAO,CAAE,kBAAmB,EAAE,CAAE,CACjE,GAAI,CAAC,GAAS,OAAO,GAAU,SAAU,MAAO,GAChD,IAAM,EAAU,EAAkB,EAAe,CAC3C,GAAA,EAAA,EAAA,4BAAyC,EAAM,MAAM,CAAE,CAAE,eAAgB,EAAS,QAAS,GAAO,CAAC,CACzG,GAAI,CAAC,GAAa,SAAS,CAAE,OAAO,EAEpC,IAAM,EAAY,EAAwB,EAAa,EAAQ,CAC/D,OAAO,EAAY,IAAM,GAAG,EAAU,QAAQ,EAAY,MAAQ,EAGpE,SAAS,EAAmB,EAAM,CAChC,IAAM,EAAQ,OAAO,GAAS,SAAW,EAAK,aAAa,CAAG,IAAA,GAC9D,OAAA,EAAA,EAAA,oBAA0B,EAAM,CAAG,EAAQ,IAAA,GAI7C,IAAM,EAAoB,CAAE,gBAAkB,GAAW,EAAQ,CAEjE,SAAS,EAAyB,EAAa,EAAS,CACtD,IAAM,EAAW,EAAY,eAAe,EAAkB,CAG9D,OAFI,IAAA,EAAA,EAAA,uBAAiC,EAAQ,GAAK,EAAY,mBAA2B,EAElF,EAAY,qBAAuB,IACtC,MAAM,IACN,EAAY,oBAAoB,EAAkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../common/phone/index.js"],"names":[],"mappings":"AAoCA,yCARW,MAAM,uBAEd;IAAyB,cAAc;CAGvC,GAAU,MAAM,CAWlB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getCountryCallingCode as e, isSupportedCountry as t, parsePhoneNumberFromString as n } from "libphonenumber-js/min";
|
|
2
|
+
//#region common/phone/index.js
|
|
3
|
+
function r(e, { defaultCountry: t } = {}) {
|
|
4
|
+
if (!e || typeof e != "string") return "";
|
|
5
|
+
let r = i(t), a = n(e.trim(), {
|
|
6
|
+
defaultCountry: r,
|
|
7
|
+
extract: !1
|
|
8
|
+
});
|
|
9
|
+
if (!a?.isValid()) return e;
|
|
10
|
+
let s = o(a, r);
|
|
11
|
+
return a.ext ? `${s} Ext. ${a.ext}` : s;
|
|
12
|
+
}
|
|
13
|
+
function i(e) {
|
|
14
|
+
let n = typeof e == "string" ? e.toUpperCase() : void 0;
|
|
15
|
+
return t(n) ? n : void 0;
|
|
16
|
+
}
|
|
17
|
+
var a = { formatExtension: (e) => e };
|
|
18
|
+
function o(t, n) {
|
|
19
|
+
let r = t.formatNational(a);
|
|
20
|
+
return n && e(n) === t.countryCallingCode ? r : t.countryCallingCode === "1" ? `+1 ${r}` : t.formatInternational(a);
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { r as formatPhoneNumber };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../common/phone/index.js"],"sourcesContent":["import { parsePhoneNumberFromString, getCountryCallingCode, isSupportedCountry } from 'libphonenumber-js/min';\n\n/**\n * Formats a phone number for display, following the Dialtone content guide:\n * https://dialtone.dialpad.com/guides/content/grammar-and-mechanics/#numbers\n *\n * Input may use spaces, dots, dashes and parentheses, with an extension after `x`, `ext.` or `#`.\n * It needs a country code (`+44 20 7946 0958`) unless `defaultCountry` is set; then national input\n * (`(415) 555-0123`) and that country's international prefix (`011 44 …` in the US) work too.\n * A number that fails a basic check is returned unchanged: the wrong number of digits, an unused area\n * code such as 555, national input without `defaultCountry`, short codes like `911`, and letters\n * (`1-800-FLOWERS`). The check uses the small `libphonenumber-js/min` data, so some numbers that are\n * not real (wrong mobile prefix, not in service) still format.\n *\n * To show the viewer's own numbers without a country code, pass their country (from their account\n * or the request) as `defaultCountry`. The US and Canada share +1, so with `US` a Canadian number\n * also shows without it.\n *\n * Each country's own digit grouping is used. To keep a number on one line, put the `d-ws-nowrap`\n * class on the element.\n *\n * @example\n * formatPhoneNumber('+14155550123'); // '+1 (415) 555-0123'\n * formatPhoneNumber('+14155550123', { defaultCountry: 'US' }); // '(415) 555-0123'\n * formatPhoneNumber('+16045550123', { defaultCountry: 'US' }); // '(604) 555-0123'\n * formatPhoneNumber('+442079460958'); // '+44 20 7946 0958'\n * formatPhoneNumber('+1 415 555 0123 x55555'); // '+1 (415) 555-0123 Ext. 55555'\n *\n * @param {string} value The phone number to format\n * @param {Object} [options]\n * @param {string} [options.defaultCountry] Two-letter country code of the viewer, passed as\n * `{ defaultCountry: 'US' }`. Numbers that share its calling code show without it, and national input\n * like `415.555.0123` is read as that country's. Unknown codes are ignored.\n * @returns {string} The formatted number, the input unchanged if it fails the check above,\n * or an empty string if the input is empty or not a string\n */\nexport function formatPhoneNumber (value, { defaultCountry } = {}) {\n if (!value || typeof value !== 'string') return '';\n const country = _supportedCountry(defaultCountry);\n const phoneNumber = parsePhoneNumberFromString(value.trim(), { defaultCountry: country, extract: false });\n if (!phoneNumber?.isValid()) return value;\n\n const formatted = _formatWithoutExtension(phoneNumber, country);\n return phoneNumber.ext ? `${formatted} Ext. ${phoneNumber.ext}` : formatted;\n}\n\nfunction _supportedCountry (code) {\n const upper = typeof code === 'string' ? code.toUpperCase() : undefined;\n return isSupportedCountry(upper) ? upper : undefined;\n}\n\n// The content guide writes \"Ext. 55555\"; libphonenumber writes \"ext. 55555\", so it is added separately.\nconst _withoutExtension = { formatExtension: (number) => number };\n\nfunction _formatWithoutExtension (phoneNumber, country) {\n const national = phoneNumber.formatNational(_withoutExtension);\n if (country && getCountryCallingCode(country) === phoneNumber.countryCallingCode) return national;\n // libphonenumber writes +1 numbers as \"+1 800 555 1234\"; the content guide wants \"+1 (800) 555-1234\".\n return phoneNumber.countryCallingCode === '1'\n ? `+1 ${national}`\n : phoneNumber.formatInternational(_withoutExtension);\n}\n"],"mappings":";;AAoCA,SAAgB,EAAmB,GAAO,EAAE,sBAAmB,EAAE,EAAE;AACjE,KAAI,CAAC,KAAS,OAAO,KAAU,SAAU,QAAO;CAChD,IAAM,IAAU,EAAkB,EAAe,EAC3C,IAAc,EAA2B,EAAM,MAAM,EAAE;EAAE,gBAAgB;EAAS,SAAS;EAAO,CAAC;AACzG,KAAI,CAAC,GAAa,SAAS,CAAE,QAAO;CAEpC,IAAM,IAAY,EAAwB,GAAa,EAAQ;AAC/D,QAAO,EAAY,MAAM,GAAG,EAAU,QAAQ,EAAY,QAAQ;;AAGpE,SAAS,EAAmB,GAAM;CAChC,IAAM,IAAQ,OAAO,KAAS,WAAW,EAAK,aAAa,GAAG,KAAA;AAC9D,QAAO,EAAmB,EAAM,GAAG,IAAQ,KAAA;;AAI7C,IAAM,IAAoB,EAAE,kBAAkB,MAAW,GAAQ;AAEjE,SAAS,EAAyB,GAAa,GAAS;CACtD,IAAM,IAAW,EAAY,eAAe,EAAkB;AAG9D,QAFI,KAAW,EAAsB,EAAQ,KAAK,EAAY,qBAA2B,IAElF,EAAY,uBAAuB,MACtC,MAAM,MACN,EAAY,oBAAoB,EAAkB"}
|