@avakhula/ui 0.0.505-alpha.52 → 0.0.505-alpha.53
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/index.js +12 -8
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
- package/src/App.vue +8 -6
- package/src/components/Form/PhoneInput/PhoneInput.vue +10 -10
package/dist/index.js
CHANGED
|
@@ -11235,7 +11235,7 @@ const q1 = {
|
|
|
11235
11235
|
default: ""
|
|
11236
11236
|
}
|
|
11237
11237
|
},
|
|
11238
|
-
emits: ["update:modelValue"],
|
|
11238
|
+
emits: ["update:modelValue", "onReady"],
|
|
11239
11239
|
components: {
|
|
11240
11240
|
VueTelInput: j1,
|
|
11241
11241
|
IbAlert: $n,
|
|
@@ -11244,18 +11244,22 @@ const q1 = {
|
|
|
11244
11244
|
data() {
|
|
11245
11245
|
return {
|
|
11246
11246
|
vueTel: null,
|
|
11247
|
-
phone: "",
|
|
11248
11247
|
dialCode: "",
|
|
11249
11248
|
defaultCountry: "US",
|
|
11250
11249
|
allowChange: !1
|
|
11251
11250
|
};
|
|
11252
11251
|
},
|
|
11253
11252
|
mounted() {
|
|
11254
|
-
this.vueTel = this.$refs.vueTel, this
|
|
11253
|
+
this.vueTel = this.$refs.vueTel, this.$emit("onReady");
|
|
11255
11254
|
},
|
|
11256
|
-
|
|
11257
|
-
phone
|
|
11258
|
-
|
|
11255
|
+
computed: {
|
|
11256
|
+
phone: {
|
|
11257
|
+
get() {
|
|
11258
|
+
return this.modelValue;
|
|
11259
|
+
},
|
|
11260
|
+
set(t) {
|
|
11261
|
+
this.$emit("update:modelValue", t);
|
|
11262
|
+
}
|
|
11259
11263
|
}
|
|
11260
11264
|
},
|
|
11261
11265
|
methods: {
|
|
@@ -11282,8 +11286,8 @@ function F1(t, n, e, r, o, i) {
|
|
|
11282
11286
|
_: 1
|
|
11283
11287
|
})) : he("", !0),
|
|
11284
11288
|
Me((W(), $e(d, Tt({
|
|
11285
|
-
modelValue:
|
|
11286
|
-
"onUpdate:modelValue": n[0] || (n[0] = (h) =>
|
|
11289
|
+
modelValue: i.phone,
|
|
11290
|
+
"onUpdate:modelValue": n[0] || (n[0] = (h) => i.phone = h)
|
|
11287
11291
|
}, t.$attrs, {
|
|
11288
11292
|
onCountryChanged: i.countryChanged,
|
|
11289
11293
|
"input-options": { name: e.inputName, id: e.inputName },
|
package/dist/index.umd.cjs
CHANGED
|
@@ -86,7 +86,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
86
86
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uf(t,n){if(t){if(typeof t=="string")return ra(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return ra(t,n)}}function ra(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,o=new Array(n);e<n;e++)o[e]=t[e];return o}var Kf=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function ii(t,n,e){if(n=n||{},!(!t.country&&!t.countryCallingCode)){e=new tt(e),e.selectNumberingPlan(t.country,t.countryCallingCode);var o=n.v2?t.nationalNumber:t.phone;if(Dt(o,e.nationalNumberPattern())){if(oi(o,"FIXED_LINE",e))return e.type("MOBILE")&&e.type("MOBILE").pattern()===""||!e.type("MOBILE")||oi(o,"MOBILE",e)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE";for(var a=zf(Kf),r;!(r=a()).done;){var l=r.value;if(oi(o,l,e))return l}}}}function oi(t,n,e){return n=e.type(n),!n||!n.pattern()||n.possibleLengths()&&n.possibleLengths().indexOf(t.length)<0?!1:Dt(t,n.pattern())}function Gf(t,n,e){if(n=n||{},e=new tt(e),e.selectNumberingPlan(t.country,t.countryCallingCode),e.hasTypes())return ii(t,n,e.metadata)!==void 0;var o=n.v2?t.nationalNumber:t.phone;return Dt(o,e.nationalNumberPattern())}function Wf(t,n,e){var o=new tt(e),a=o.getCountryCodesForCallingCode(t);return a?a.filter(function(r){return Yf(n,r,e)}):[]}function Yf(t,n,e){var o=new tt(e);return o.selectNumberingPlan(n),o.numberingPlan.possibleLengths().indexOf(t.length)>=0}function Zf(t){return t.replace(new RegExp("[".concat(cr,"]+"),"g")," ").trim()}var Jf=/(\$\d)/;function Xf(t,n,e){var o=e.useInternationalFormat,a=e.withNationalPrefix;e.carrierCode,e.metadata;var r=t.replace(new RegExp(n.pattern()),o?n.internationalFormat():a&&n.nationalPrefixFormattingRule()?n.format().replace(Jf,n.nationalPrefixFormattingRule()):n.format());return o?Zf(r):r}var Qf=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function eh(t,n,e){var o=new tt(e);if(o.selectNumberingPlan(t,n),o.defaultIDDPrefix())return o.defaultIDDPrefix();if(Qf.test(o.IDDPrefix()))return o.IDDPrefix()}function th(t){var n=t.number,e=t.ext;if(!n)return"";if(n[0]!=="+")throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(n).concat(e?";ext="+e:"")}function nh(t,n){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=rh(t))||n&&t&&typeof t.length=="number"){e&&(t=e);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
87
87
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rh(t,n){if(t){if(typeof t=="string")return ia(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return ia(t,n)}}function ia(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,o=new Array(n);e<n;e++)o[e]=t[e];return o}function oa(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,o)}return e}function aa(t){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?oa(Object(e),!0).forEach(function(o){ih(t,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):oa(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})}return t}function ih(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}var la={formatExtension:function(t,n,e){return"".concat(t).concat(e.ext()).concat(n)}};function oh(t,n,e,o){if(e?e=aa(aa({},la),e):e=la,o=new tt(o),t.country&&t.country!=="001"){if(!o.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));o.country(t.country)}else if(t.countryCallingCode)o.selectNumberingPlan(t.countryCallingCode);else return t.phone||"";var a=o.countryCallingCode(),r=e.v2?t.nationalNumber:t.phone,l;switch(n){case"NATIONAL":return r?(l=pr(r,t.carrierCode,"NATIONAL",o,e),ai(l,t.ext,o,e.formatExtension)):"";case"INTERNATIONAL":return r?(l=pr(r,null,"INTERNATIONAL",o,e),l="+".concat(a," ").concat(l),ai(l,t.ext,o,e.formatExtension)):"+".concat(a);case"E.164":return"+".concat(a).concat(r);case"RFC3966":return th({number:"+".concat(a).concat(r),ext:t.ext});case"IDD":if(!e.fromCountry)return;var s=lh(r,t.carrierCode,a,e.fromCountry,o);return ai(s,t.ext,o,e.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(n,'"'))}}function pr(t,n,e,o,a){var r=ah(o.formats(),t);return r?Xf(t,r,{useInternationalFormat:e==="INTERNATIONAL",withNationalPrefix:!(r.nationalPrefixIsOptionalWhenFormattingInNationalFormat()&&a&&a.nationalPrefix===!1),carrierCode:n,metadata:o}):t}function ah(t,n){for(var e=nh(t),o;!(o=e()).done;){var a=o.value;if(a.leadingDigitsPatterns().length>0){var r=a.leadingDigitsPatterns()[a.leadingDigitsPatterns().length-1];if(n.search(r)!==0)continue}if(Dt(n,a.pattern()))return a}}function ai(t,n,e,o){return n?o(t,n,e):t}function lh(t,n,e,o,a){var r=ni(o,a.metadata);if(r===e){var l=pr(t,n,"NATIONAL",a);return e==="1"?e+" "+l:l}var s=eh(o,void 0,a.metadata);if(s)return"".concat(s," ").concat(e," ").concat(pr(t,null,"INTERNATIONAL",a))}function sa(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,o)}return e}function da(t){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?sa(Object(e),!0).forEach(function(o){sh(t,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):sa(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})}return t}function sh(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function dh(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function ca(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function ch(t,n,e){return n&&ca(t.prototype,n),e&&ca(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var uh=function(){function t(n,e,o){if(dh(this,t),!n)throw new TypeError("`country` or `countryCallingCode` not passed");if(!e)throw new TypeError("`nationalNumber` not passed");if(!o)throw new TypeError("`metadata` not passed");var a=hh(n,o),r=a.country,l=a.countryCallingCode;this.country=r,this.countryCallingCode=l,this.nationalNumber=e,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return o}}return ch(t,[{key:"setExt",value:function(n){this.ext=n}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:Wf(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return Hf(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return Gf(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){var n=new tt(this.getMetadata());return n.isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(n){return this.number===n.number&&this.ext===n.ext}},{key:"getType",value:function(){return ii(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(n,e){return oh(this,n,e?da(da({},e),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(n){return this.format("NATIONAL",n)}},{key:"formatInternational",value:function(n){return this.format("INTERNATIONAL",n)}},{key:"getURI",value:function(n){return this.format("RFC3966",n)}}]),t}(),fh=function(t){return/^[A-Z]{2}$/.test(t)};function hh(t,n){var e,o,a=new tt(n);return fh(t)?(e=t,a.selectNumberingPlan(e),o=a.countryCallingCode()):o=t,{country:e,countryCallingCode:o}}var ph=new RegExp("(["+gt+"])");function mh(t,n,e,o){if(n){var a=new tt(o);a.selectNumberingPlan(n,e);var r=new RegExp(a.IDDPrefix());if(t.search(r)===0){t=t.slice(t.match(r)[0].length);var l=t.match(ph);if(!(l&&l[1]!=null&&l[1].length>0&&l[1]==="0"))return t}}}function gh(t,n){if(t&&n.numberingPlan.nationalPrefixForParsing()){var e=new RegExp("^(?:"+n.numberingPlan.nationalPrefixForParsing()+")"),o=e.exec(t);if(o){var a,r,l=o.length-1,s=l>0&&o[l];if(n.nationalPrefixTransformRule()&&s)a=t.replace(e,n.nationalPrefixTransformRule()),l>1&&(r=o[1]);else{var u=o[0];a=t.slice(u.length),s&&(r=o[1])}var c;if(s){var p=t.indexOf(o[1]),h=t.slice(0,p);h===n.numberingPlan.nationalPrefix()&&(c=n.numberingPlan.nationalPrefix())}else c=o[0];return{nationalNumber:a,nationalPrefix:c,carrierCode:r}}}return{nationalNumber:t}}function li(t,n){var e=gh(t,n),o=e.carrierCode,a=e.nationalNumber;if(a!==t){if(!yh(t,a,n))return{nationalNumber:t};if(n.possibleLengths()&&!vh(a,n))return{nationalNumber:t}}return{nationalNumber:a,carrierCode:o}}function yh(t,n,e){return!(Dt(t,e.nationalNumberPattern())&&!Dt(n,e.nationalNumberPattern()))}function vh(t,n){switch(ri(t,n)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}function bh(t,n,e,o){var a=n?ni(n,o):e;if(t.indexOf(a)===0){o=new tt(o),o.selectNumberingPlan(n,e);var r=t.slice(a.length),l=li(r,o),s=l.nationalNumber,u=li(t,o),c=u.nationalNumber;if(!Dt(c,o.nationalNumberPattern())&&Dt(s,o.nationalNumberPattern())||ri(c,o)==="TOO_LONG")return{countryCallingCode:a,number:r}}return{number:t}}function _h(t,n,e,o){if(!t)return{};var a;if(t[0]!=="+"){var r=mh(t,n,e,o);if(r&&r!==t)a=!0,t="+"+r;else{if(n||e){var l=bh(t,n,e,o),s=l.countryCallingCode,u=l.number;if(s)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:s,number:u}}return{number:t}}}if(t[1]==="0")return{};o=new tt(o);for(var c=2;c-1<=df&&c<=t.length;){var p=t.slice(1,c);if(o.hasCallingCode(p))return o.selectNumberingPlan(p),{countryCallingCodeSource:a?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:p,number:t.slice(c)};c++}return{}}function $h(t,n){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=wh(t))||n&&t&&typeof t.length=="number"){e&&(t=e);var o=0;return function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
88
88
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wh(t,n){if(t){if(typeof t=="string")return ua(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return ua(t,n)}}function ua(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,o=new Array(n);e<n;e++)o[e]=t[e];return o}function kh(t,n){var e=n.countries,o=n.defaultCountry,a=n.metadata;a=new tt(a);for(var r=[],l=$h(e),s;!(s=l()).done;){var u=s.value;if(a.country(u),a.leadingDigits()){if(t&&t.search(a.leadingDigits())===0)return u}else if(ii({phone:t,country:u},void 0,a.metadata))if(o){if(u===o)return u;r.push(u)}else return u}if(r.length>0)return r[0]}function Ch(t,n){var e=n.nationalNumber,o=n.defaultCountry,a=n.metadata,r=a.getCountryCodesForCallingCode(t);if(r)return r.length===1?r[0]:kh(e,{countries:r,defaultCountry:o,metadata:a.metadata})}var fa="+",Oh="[\\-\\.\\(\\)]?",ha="(["+gt+"]|"+Oh+")",Eh="^\\"+fa+ha+"*["+gt+"]"+ha+"*$",Sh=new RegExp(Eh,"g"),si=gt,xh="["+si+"]+((\\-)*["+si+"])*",Th="a-zA-Z",Nh="["+Th+"]+((\\-)*["+si+"])*",Ah="^("+xh+"\\.)*"+Nh+"\\.?$",Dh=new RegExp(Ah,"g"),pa="tel:",di=";phone-context=",Ih=";isub=";function Ph(t){var n=t.indexOf(di);if(n<0)return null;var e=n+di.length;if(e>=t.length)return"";var o=t.indexOf(";",e);return o>=0?t.substring(e,o):t.substring(e)}function Mh(t){return t===null?!0:t.length===0?!1:Sh.test(t)||Dh.test(t)}function Bh(t,n){var e=n.extractFormattedPhoneNumber,o=Ph(t);if(!Mh(o))throw new At("NOT_A_NUMBER");var a;if(o===null)a=e(t)||"";else{a="",o.charAt(0)===fa&&(a+=o);var r=t.indexOf(pa),l;r>=0?l=r+pa.length:l=0;var s=t.indexOf(di);a+=t.substring(l,s)}var u=a.indexOf(Ih);if(u>0&&(a=a.substring(0,u)),a!=="")return a}var Lh=250,Rh=new RegExp("["+ei+gt+"]"),jh=new RegExp("[^"+gt+"#]+$");function Vh(t,n,e){if(n=n||{},e=new tt(e),n.defaultCountry&&!e.hasCountry(n.defaultCountry))throw n.v2?new At("INVALID_COUNTRY"):new Error("Unknown country: ".concat(n.defaultCountry));var o=qh(t,n.v2,n.extract),a=o.number,r=o.ext,l=o.error;if(!a){if(n.v2)throw l==="TOO_SHORT"?new At("TOO_SHORT"):new At("NOT_A_NUMBER");return{}}var s=zh(a,n.defaultCountry,n.defaultCallingCode,e),u=s.country,c=s.nationalNumber,p=s.countryCallingCode,h=s.countryCallingCodeSource,d=s.carrierCode;if(!e.hasSelectedNumberingPlan()){if(n.v2)throw new At("INVALID_COUNTRY");return{}}if(!c||c.length<Qr){if(n.v2)throw new At("TOO_SHORT");return{}}if(c.length>sf){if(n.v2)throw new At("TOO_LONG");return{}}if(n.v2){var f=new uh(p,c,e.metadata);return u&&(f.country=u),d&&(f.carrierCode=d),r&&(f.ext=r),f.__countryCallingCodeSource=h,f}var _=(n.extended?e.hasSelectedNumberingPlan():u)?Dt(c,e.nationalNumberPattern()):!1;return n.extended?{country:u,countryCallingCode:p,carrierCode:d,valid:_,possible:_?!0:!!(n.extended===!0&&e.possibleLengths()&&na(c,e)),phone:c,ext:r}:_?Hh(u,c,r):{}}function Fh(t,n,e){if(t){if(t.length>Lh){if(e)throw new At("TOO_LONG");return}if(n===!1)return t;var o=t.search(Rh);if(!(o<0))return t.slice(o).replace(jh,"")}}function qh(t,n,e){var o=Bh(t,{extractFormattedPhoneNumber:function(r){return Fh(r,e,n)}});if(!o)return{};if(!Df(o))return If(o)?{error:"TOO_SHORT"}:{};var a=Pf(o);return a.ext?a:{number:o}}function Hh(t,n,e){var o={country:t,phone:n};return e&&(o.ext=e),o}function zh(t,n,e,o){var a=_h(Qo(t),n,e,o.metadata),r=a.countryCallingCodeSource,l=a.countryCallingCode,s=a.number,u;if(l)o.selectNumberingPlan(l);else if(s&&(n||e))o.selectNumberingPlan(n,e),n&&(u=n),l=e||ni(n,o.metadata);else return{};if(!s)return{countryCallingCodeSource:r,countryCallingCode:l};var c=li(Qo(s),o),p=c.nationalNumber,h=c.carrierCode,d=Ch(l,{nationalNumber:p,defaultCountry:n,metadata:o});return d&&(u=d,d==="001"||o.country(u)),{country:u,countryCallingCode:l,countryCallingCodeSource:r,nationalNumber:p,carrierCode:h}}function ma(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,o)}return e}function ga(t){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?ma(Object(e),!0).forEach(function(o){Uh(t,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ma(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})}return t}function Uh(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function Kh(t,n,e){return Vh(t,ga(ga({},n),{},{v2:!0}),e)}function ya(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,o)}return e}function Gh(t){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?ya(Object(e),!0).forEach(function(o){Wh(t,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ya(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})}return t}function Wh(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function Yh(t,n){return Qh(t)||Xh(t,n)||Jh(t,n)||Zh()}function Zh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
89
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jh(t,n){if(t){if(typeof t=="string")return va(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return va(t,n)}}function va(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,o=new Array(n);e<n;e++)o[e]=t[e];return o}function Xh(t,n){var e=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e!=null){var o=[],a=!0,r=!1,l,s;try{for(e=e.call(t);!(a=(l=e.next()).done)&&(o.push(l.value),!(n&&o.length===n));a=!0);}catch(u){r=!0,s=u}finally{try{!a&&e.return!=null&&e.return()}finally{if(r)throw s}}return o}}function Qh(t){if(Array.isArray(t))return t}function e1(t){var n=Array.prototype.slice.call(t),e=Yh(n,4),o=e[0],a=e[1],r=e[2],l=e[3],s,u,c;if(typeof o=="string")s=o;else throw new TypeError("A text for parsing must be a string.");if(!a||typeof a=="string")l?(u=r,c=l):(u=void 0,c=r),a&&(u=Gh({defaultCountry:a},u));else if(ur(a))r?(u=a,c=r):c=a;else throw new Error("Invalid second argument: ".concat(a));return{text:s,options:u,metadata:c}}function ba(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,o)}return e}function _a(t){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?ba(Object(e),!0).forEach(function(o){t1(t,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ba(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})}return t}function t1(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function n1(t,n,e){n&&n.defaultCountry&&!Of(n.defaultCountry,e)&&(n=_a(_a({},n),{},{defaultCountry:void 0}));try{return Kh(t,n,e)}catch(o){if(!(o instanceof At))throw o}}function r1(){var t=e1(arguments),n=t.text,e=t.options,o=t.metadata;return n1(n,e,o)}function ci(){return ef(r1,arguments)}const i1={beforeMount(t,n,e){if(typeof n.value!="function"){const o=e.context.name;let a=`[Vue-click-outside:] provided expression ${n.expression} is not a function, but has to be`;o&&(a+=`Found in component ${o}`),console.warn(a)}t.clickOutsideEvent=function(o){const a=o.composedPath?o.composedPath():o.path;t===o.target||t.contains(o.target)||a.includes(t)||n.value(o,t)},document.body.addEventListener("click",t.clickOutsideEvent)},unmounted(t){document.body.removeEventListener("click",t.clickOutsideEvent)}},o1=["aria-expanded","tabindex"],a1={class:"vti__selection"},l1={key:1,class:"vti__country-code"},s1={class:"vti__dropdown-arrow"},d1={key:0,class:"vti__search_box_container"},c1=["placeholder"],u1=["onClick","onMousemove","aria-selected"],f1={key:1},h1=["type","autocomplete","autofocus","disabled","id","maxlength","name","placeholder","readonly","required","tabindex","value","aria-describedby"],p1=i.defineComponent({name:"VueTelInput",directives:{clickOutside:i1},__name:"vue-tel-input",props:i.mergeModels({allCountries:{type:Array,default:()=>et("allCountries")},autoFormat:{type:Boolean,default:()=>et("autoFormat")},customValidate:{type:[Boolean,RegExp],default:()=>et("customValidate")},defaultCountry:{type:[String,Number],default:()=>et("defaultCountry")},disabled:{type:Boolean,default:()=>et("disabled")},autoDefaultCountry:{type:Boolean,default:()=>et("autoDefaultCountry")},dropdownOptions:{type:Object,default:()=>et("dropdownOptions")},ignoredCountries:{type:Array,default:()=>et("ignoredCountries")},inputOptions:{type:Object,default:()=>et("inputOptions")},invalidMsg:{type:String,default:()=>et("invalidMsg")},mode:{type:String,default:()=>et("mode")},onlyCountries:{type:Array,default:()=>et("onlyCountries")},preferredCountries:{type:Array,default:()=>et("preferredCountries")},validCharactersOnly:{type:Boolean,default:()=>et("validCharactersOnly")},styleClasses:{type:[String,Array,Object],default:()=>et("styleClasses")}},{modelValue:{type:String},modelModifiers:{}}),emits:i.mergeModels(["blur","close","country-changed","enter","focus","on-input","open","space","validate"],["update:modelValue"]),setup(t,{expose:n,emit:e}){const o=i.shallowRef(),a=i.shallowRef(),r=i.shallowRef(),l=e,s=t,u=i.useModel(t,"modelValue");i.watch(u,(A,P)=>{S()?c.phone=A??"":i.nextTick(()=>{c.phone=P??"",B()})});const c=i.reactive({phone:"",activeCountryCode:void 0,open:!1,finishMounted:!1,selectedIndex:null,typeToFindInput:"",typeToFindTimer:void 0,dropdownOpenDirection:"below",parsedPlaceholder:s.inputOptions.placeholder,searchQuery:""});i.watch(()=>c.open,A=>{A?(D(),l("open")):l("close")});const p=i.computed(()=>s.onlyCountries.length?s.allCountries.filter(({iso2:A})=>s.onlyCountries.some(P=>Sn(P)===A)):s.ignoredCountries.length?s.allCountries.filter(({iso2:A})=>!s.ignoredCountries.includes(Sn(A))&&!s.ignoredCountries.includes(En(A))):s.allCountries),h=i.computed(()=>g(c.activeCountryCode));i.watch(h,(A,P)=>{if(!A&&P!=null&&P.iso2){c.activeCountryCode=P.iso2;return}A!=null&&A.iso2&&l("country-changed",A)});const d=i.computed(()=>{var A;const P=En(s.mode);return P==="auto"?(A=c.phone)!=null&&A.startsWith("+")?"international":"national":["national","international","e.164","rfc3966","idd"].includes(P)?P:(console.error('Invalid value of prop "mode"'),"international")}),f=i.computed(()=>{const A=[...y(s.preferredCountries).map(U=>({...U,preferred:!0})),...p.value];if(!s.dropdownOptions.showSearchBox)return A;const P=c.searchQuery.toLowerCase().replace(/[~`!@#$%^&*()+={}\[\];:\'\"<>.,\/\\\?-_]/g,"");return A.filter(U=>new RegExp(P,"i").test(U.name)||new RegExp(P,"i").test(U.iso2)||new RegExp(P,"i").test(U.dialCode))}),_=i.computed(()=>{var A;const P=c.phone.startsWith("+")?ci(c.phone):ci(c.phone,c.activeCountryCode),U={country:P==null?void 0:P.country,countryCode:P==null?void 0:P.country,formatted:c.phone,valid:P==null?void 0:P.isValid(),possible:(A=P==null?void 0:P.isPossible)==null?void 0:A.call(P),nationalNumber:P==null?void 0:P.nationalNumber};return U.valid&&(U.formatted=P==null?void 0:P.format(Sn(d.value))),P!=null&&P.country&&(s.ignoredCountries.length||s.onlyCountries.length)&&!g(P.country)&&(U.valid=!1,U.possible=!1,P.country=null),P?{...U,...P}:U});i.watch(()=>_.value.countryCode,A=>{A&&(c.activeCountryCode=A)}),i.watch(()=>_.value.valid,()=>{l("validate",_.value)}),i.watch(()=>_.value.formatted,A=>{!s.autoFormat||s.customValidate||(E(A),i.nextTick(()=>{A&&!u.value&&(c.phone=A)}))}),i.watch(()=>s.inputOptions.placeholder,v),i.onMounted(()=>{u.value&&(c.phone=u.value.trim()),T(),b().then(()=>{var A;!c.phone&&(A=s.inputOptions)!=null&&A.showDialCode&&c.activeCountryCode&&(c.phone=`+${c.activeCountryCode}`),l("validate",_.value)}).catch(console.error).then(()=>{c.finishMounted=!0})});function v(){c.parsedPlaceholder=s.inputOptions.placeholder}function b(){return new Promise(A=>{var P;if(((P=c.phone)==null?void 0:P[0])==="+"){A();return}if(s.defaultCountry){if(typeof s.defaultCountry=="string"){k(s.defaultCountry),A();return}if(typeof s.defaultCountry=="number"){const q=w(s.defaultCountry);if(q){k(q.iso2),A();return}}}const U=s.preferredCountries[0]||p.value[0];s.autoDefaultCountry?Yu().then(q=>{k(q||c.activeCountryCode)}).catch(q=>{console.warn(q),k(U)}).then(()=>{A()}):(k(U),A())})}function y(A=[]){return A.map(g).filter(Boolean)}function g(A=""){return p.value.find(P=>P.iso2===Sn(A))}function w(A){return p.value.find(P=>Number(P.dialCode)===A)}function m(A,P){const U=c.selectedIndex===A,q=A===s.preferredCountries.length-1,L=s.preferredCountries.some(z=>Sn(z)===P);return{highlighted:U,"last-preferred":q,preferred:L}}function k(A){var P,U,q;let L=A;if(typeof L=="string"&&(L=g(L)),!!L){if(((P=c.phone)==null?void 0:P[0])==="+"&&L.iso2&&_.value.nationalNumber){c.activeCountryCode=L.iso2,c.phone=((U=ci(_.value.nationalNumber,L.iso2))==null?void 0:U.formatInternational())??"";return}if((q=s.inputOptions)!=null&&q.showDialCode&&L){c.phone=`+${L.dialCode}`,c.activeCountryCode=L.iso2;return}c.activeCountryCode=L.iso2,E(c.phone)}}function T(){const A=c.phone;if(s.validCharactersOnly){const P=c.phone.match(/[()\-+0-9\s]*/g);c.phone=P.join("")}if(s.customValidate&&s.customValidate instanceof RegExp){const P=c.phone.match(s.customValidate);c.phone=P.join("")}A!==c.phone&&E(c.phone)}function S(){return s.validCharactersOnly&&!/^[()\-+0-9\s]*$/.test(c.phone)?!1:s.customValidate?x():!0}function x(){return s.customValidate instanceof RegExp?s.customValidate.test(c.phone):!1}function B(){var A;(A=r.value)==null||A.setCustomValidity(_.value.valid?"":s.invalidMsg),E(c.phone)}function E(A){u.value=A,l("on-input",A,_.value,r.value)}function C(A){l("blur",A)}function O(A){Zu(r.value,c.phone.length),l("focus",A)}function N(A){l("enter",A)}function R(A){l("space",A)}function F(){var A;(A=r.value)==null||A.focus()}function W(){var A;(A=r.value)==null||A.blur()}function Y(){s.disabled||s.dropdownOptions.disabled||(c.searchQuery="",c.open=!c.open)}function re(){c.open=!1}function K(A){if(A.keyCode===40){A.preventDefault(),c.open=!0,c.selectedIndex===null?c.selectedIndex=0:c.selectedIndex=Math.min(f.value.length-1,c.selectedIndex+1);const P=a.value.children[c.selectedIndex];P.focus(),P.offsetTop+P.clientHeight>a.value.scrollTop+a.value.clientHeight&&(a.value.scrollTop=P.offsetTop-a.value.clientHeight+P.clientHeight)}else if(A.keyCode===38){A.preventDefault(),c.open=!0,c.selectedIndex===null?c.selectedIndex=f.value.length-1:c.selectedIndex=Math.max(0,c.selectedIndex-1);const P=a.value.children[c.selectedIndex];P.focus(),P.offsetTop<a.value.scrollTop&&(a.value.scrollTop=P.offsetTop)}else if(A.keyCode===13)c.selectedIndex!==null&&k(f.value[c.selectedIndex]),c.open=!c.open;else if(c.open){c.typeToFindInput+=A.key,clearTimeout(c.typeToFindTimer),c.typeToFindTimer=setTimeout(()=>{c.typeToFindInput=""},700);const P=f.value.slice(s.preferredCountries.length).findIndex(U=>En(U.name).startsWith(c.typeToFindInput));if(P>=0){c.selectedIndex=s.preferredCountries.length+P;const U=a.value.children[c.selectedIndex],q=U.offsetTop<a.value.scrollTop,L=U.offsetTop+U.clientHeight>a.value.scrollTop+a.value.clientHeight;(q||L)&&(a.value.scrollTop=U.offsetTop-a.value.clientHeight/2)}}}function V(){c.selectedIndex=f.value.map(A=>A.iso2).indexOf(c.activeCountryCode),c.open=!1}function D(){window.innerHeight-o.value.getBoundingClientRect().bottom>200?c.dropdownOpenDirection="below":c.dropdownOpenDirection="above"}return n({focus:F,blur:W}),(A,P)=>{const U=i.resolveDirective("click-outside");return i.openBlock(),i.createElementBlock("div",{ref_key:"refRoot",ref:o,class:i.normalizeClass(["vue-tel-input",t.styleClasses,{disabled:t.disabled}])},[i.withDirectives((i.openBlock(),i.createElementBlock("div",{"aria-label":"Country Code Selector","aria-haspopup":"listbox","aria-expanded":c.open,role:"button",class:i.normalizeClass(["vti__dropdown",{open:c.open,disabled:t.dropdownOptions.disabled}]),tabindex:t.dropdownOptions.tabindex,onKeydown:[K,i.withKeys(Y,["space"]),i.withKeys(V,["esc"]),i.withKeys(V,["tab"])],onClick:Y},[i.createElementVNode("span",a1,[t.dropdownOptions.showFlags?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["vti__flag",i.unref(En)(c.activeCountryCode)])},null,2)):i.createCommentVNode("",!0),t.dropdownOptions.showDialCodeInSelection?(i.openBlock(),i.createElementBlock("span",l1," +"+i.toDisplayString(h.value&&h.value.dialCode),1)):i.createCommentVNode("",!0),i.renderSlot(A.$slots,"arrow-icon",{open:c.open},()=>[i.createElementVNode("span",s1,i.toDisplayString(c.open?"▲":"▼"),1)])]),c.open?(i.openBlock(),i.createElementBlock("ul",{key:0,ref_key:"refList",ref:a,class:i.normalizeClass(["vti__dropdown-list",c.dropdownOpenDirection]),role:"listbox"},[t.dropdownOptions.showSearchBox?(i.openBlock(),i.createElementBlock("div",d1,[i.renderSlot(A.$slots,"search-icon"),i.withDirectives(i.createElementVNode("input",{class:i.normalizeClass(["vti__input","vti__search_box"]),"aria-label":"Search by country name or country code",placeholder:t.dropdownOptions.searchBoxPlaceholder||(f.value.length?f.value[0].name:""),type:"text","onUpdate:modelValue":P[0]||(P[0]=q=>c.searchQuery=q),onClick:P[1]||(P[1]=i.withModifiers(()=>{},["stop"]))},null,8,c1),[[i.vModelText,c.searchQuery]])])):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(f.value,(q,L)=>(i.openBlock(),i.createElementBlock("li",{role:"option",class:i.normalizeClass(["vti__dropdown-item",m(L,q.iso2)]),key:q.iso2+(q.preferred?"-preferred":""),tabindex:"-1",onClick:z=>k(q),onMousemove:z=>c.selectedIndex=L,"aria-selected":c.activeCountryCode===q.iso2&&!q.preferred},[t.dropdownOptions.showFlags?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["vti__flag",i.unref(En)(q.iso2)])},null,2)):i.createCommentVNode("",!0),i.createElementVNode("strong",null,i.toDisplayString(q.name),1),t.dropdownOptions.showDialCodeInList?(i.openBlock(),i.createElementBlock("span",f1," +"+i.toDisplayString(q.dialCode),1)):i.createCommentVNode("",!0)],42,u1))),128))],2)):i.createCommentVNode("",!0)],42,o1)),[[U,re]]),i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":P[2]||(P[2]=q=>c.phone=q),ref_key:"refInput",ref:r,type:t.inputOptions.type,autocomplete:t.inputOptions.autocomplete,autofocus:t.inputOptions.autofocus,class:i.normalizeClass(["vti__input","vti__phone",t.inputOptions.styleClasses]),disabled:t.disabled,id:t.inputOptions.id,maxlength:t.inputOptions.maxlength,name:t.inputOptions.name,placeholder:c.parsedPlaceholder,readonly:t.inputOptions.readonly,required:t.inputOptions.required,tabindex:t.inputOptions.tabindex,value:u.value,"aria-describedby":t.inputOptions["aria-describedby"],onBlur:C,onFocus:O,onInput:B,onKeyup:[i.withKeys(N,["enter"]),i.withKeys(R,["space"])]},null,42,h1),[[i.vModelDynamic,c.phone]]),i.renderSlot(A.$slots,"icon-right")],2)}}}),gp="",yp="",m1={directives:{Outside:er},props:{modelValue:{type:String},value:String,inputName:{type:String,default:"phone"},autoDefaultCountry:{type:Boolean,default:!0},ignoredCountries:{type:Array,default:()=>[]},error:{type:Boolean,default:!1},errorMessage:{type:String,default:""}},emits:["update:modelValue"],components:{VueTelInput:p1,IbAlert:qt,IbIcon:Be},data(){return{vueTel:null,phone:"",dialCode:"",defaultCountry:"US",allowChange:!1}},mounted(){this.vueTel=this.$refs.vueTel,this.value?this.phone=this.value[0]==="+"?this.value:"+"+this.value:this.modelValue&&(this.phone=this.modelValue[0]==="+"?this.modelValue:"+"+this.modelValue)},watch:{phone(t){this.$emit("update:modelValue",t)}},methods:{countryChanged(t){this.$globalEvents.$on("countrySelectValue",n=>{this.vueTel.choose(n)}),!this.phone||this.phone.length-1<this.dialCode.length?this.phone="+"+t.dialCode:this.dialCode&&(this.phone=this.phone.replace(this.dialCode,t.dialCode)),this.dialCode=t.dialCode},clickOutside(){this.vueTel.open&&this.vueTel.clickedOutside()}}};function g1(t,n,e,o,a,r){const l=i.resolveComponent("ib-alert"),s=i.resolveComponent("ib-icon"),u=i.resolveComponent("vue-tel-input"),c=i.resolveDirective("outside");return i.openBlock(),i.createElementBlock(i.Fragment,null,[e.errorMessage.length?(i.openBlock(),i.createBlock(l,{key:0,class:"ib-phone-error-message"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(e.errorMessage),1)]),_:1})):i.createCommentVNode("",!0),i.withDirectives((i.openBlock(),i.createBlock(u,i.mergeProps({modelValue:a.phone,"onUpdate:modelValue":n[0]||(n[0]=p=>a.phone=p)},t.$attrs,{onCountryChanged:r.countryChanged,"input-options":{name:e.inputName,id:e.inputName},"auto-default-country":e.autoDefaultCountry,"dropdown-options":{showSearchBox:!0,showFlags:!0},defaultCountry:a.defaultCountry,ignoredCountries:e.ignoredCountries,class:{error:e.error||e.errorMessage.length},"style-classes":"ib-phone-input",ref:"vueTel"}),{"arrow-icon":i.withCtx(()=>[i.createVNode(s,{name:"chevron-down-outline"})]),_:1},16,["modelValue","onCountryChanged","input-options","auto-default-country","defaultCountry","ignoredCountries","class"])),[[c,r.clickOutside]])],64)}const y1=_e(m1,[["render",g1]]);var $a={exports:{}};/*!
|
|
89
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jh(t,n){if(t){if(typeof t=="string")return va(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);if(e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set")return Array.from(t);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return va(t,n)}}function va(t,n){(n==null||n>t.length)&&(n=t.length);for(var e=0,o=new Array(n);e<n;e++)o[e]=t[e];return o}function Xh(t,n){var e=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e!=null){var o=[],a=!0,r=!1,l,s;try{for(e=e.call(t);!(a=(l=e.next()).done)&&(o.push(l.value),!(n&&o.length===n));a=!0);}catch(u){r=!0,s=u}finally{try{!a&&e.return!=null&&e.return()}finally{if(r)throw s}}return o}}function Qh(t){if(Array.isArray(t))return t}function e1(t){var n=Array.prototype.slice.call(t),e=Yh(n,4),o=e[0],a=e[1],r=e[2],l=e[3],s,u,c;if(typeof o=="string")s=o;else throw new TypeError("A text for parsing must be a string.");if(!a||typeof a=="string")l?(u=r,c=l):(u=void 0,c=r),a&&(u=Gh({defaultCountry:a},u));else if(ur(a))r?(u=a,c=r):c=a;else throw new Error("Invalid second argument: ".concat(a));return{text:s,options:u,metadata:c}}function ba(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);n&&(o=o.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),e.push.apply(e,o)}return e}function _a(t){for(var n=1;n<arguments.length;n++){var e=arguments[n]!=null?arguments[n]:{};n%2?ba(Object(e),!0).forEach(function(o){t1(t,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ba(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})}return t}function t1(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function n1(t,n,e){n&&n.defaultCountry&&!Of(n.defaultCountry,e)&&(n=_a(_a({},n),{},{defaultCountry:void 0}));try{return Kh(t,n,e)}catch(o){if(!(o instanceof At))throw o}}function r1(){var t=e1(arguments),n=t.text,e=t.options,o=t.metadata;return n1(n,e,o)}function ci(){return ef(r1,arguments)}const i1={beforeMount(t,n,e){if(typeof n.value!="function"){const o=e.context.name;let a=`[Vue-click-outside:] provided expression ${n.expression} is not a function, but has to be`;o&&(a+=`Found in component ${o}`),console.warn(a)}t.clickOutsideEvent=function(o){const a=o.composedPath?o.composedPath():o.path;t===o.target||t.contains(o.target)||a.includes(t)||n.value(o,t)},document.body.addEventListener("click",t.clickOutsideEvent)},unmounted(t){document.body.removeEventListener("click",t.clickOutsideEvent)}},o1=["aria-expanded","tabindex"],a1={class:"vti__selection"},l1={key:1,class:"vti__country-code"},s1={class:"vti__dropdown-arrow"},d1={key:0,class:"vti__search_box_container"},c1=["placeholder"],u1=["onClick","onMousemove","aria-selected"],f1={key:1},h1=["type","autocomplete","autofocus","disabled","id","maxlength","name","placeholder","readonly","required","tabindex","value","aria-describedby"],p1=i.defineComponent({name:"VueTelInput",directives:{clickOutside:i1},__name:"vue-tel-input",props:i.mergeModels({allCountries:{type:Array,default:()=>et("allCountries")},autoFormat:{type:Boolean,default:()=>et("autoFormat")},customValidate:{type:[Boolean,RegExp],default:()=>et("customValidate")},defaultCountry:{type:[String,Number],default:()=>et("defaultCountry")},disabled:{type:Boolean,default:()=>et("disabled")},autoDefaultCountry:{type:Boolean,default:()=>et("autoDefaultCountry")},dropdownOptions:{type:Object,default:()=>et("dropdownOptions")},ignoredCountries:{type:Array,default:()=>et("ignoredCountries")},inputOptions:{type:Object,default:()=>et("inputOptions")},invalidMsg:{type:String,default:()=>et("invalidMsg")},mode:{type:String,default:()=>et("mode")},onlyCountries:{type:Array,default:()=>et("onlyCountries")},preferredCountries:{type:Array,default:()=>et("preferredCountries")},validCharactersOnly:{type:Boolean,default:()=>et("validCharactersOnly")},styleClasses:{type:[String,Array,Object],default:()=>et("styleClasses")}},{modelValue:{type:String},modelModifiers:{}}),emits:i.mergeModels(["blur","close","country-changed","enter","focus","on-input","open","space","validate"],["update:modelValue"]),setup(t,{expose:n,emit:e}){const o=i.shallowRef(),a=i.shallowRef(),r=i.shallowRef(),l=e,s=t,u=i.useModel(t,"modelValue");i.watch(u,(A,P)=>{S()?c.phone=A??"":i.nextTick(()=>{c.phone=P??"",B()})});const c=i.reactive({phone:"",activeCountryCode:void 0,open:!1,finishMounted:!1,selectedIndex:null,typeToFindInput:"",typeToFindTimer:void 0,dropdownOpenDirection:"below",parsedPlaceholder:s.inputOptions.placeholder,searchQuery:""});i.watch(()=>c.open,A=>{A?(D(),l("open")):l("close")});const p=i.computed(()=>s.onlyCountries.length?s.allCountries.filter(({iso2:A})=>s.onlyCountries.some(P=>Sn(P)===A)):s.ignoredCountries.length?s.allCountries.filter(({iso2:A})=>!s.ignoredCountries.includes(Sn(A))&&!s.ignoredCountries.includes(En(A))):s.allCountries),h=i.computed(()=>g(c.activeCountryCode));i.watch(h,(A,P)=>{if(!A&&P!=null&&P.iso2){c.activeCountryCode=P.iso2;return}A!=null&&A.iso2&&l("country-changed",A)});const d=i.computed(()=>{var A;const P=En(s.mode);return P==="auto"?(A=c.phone)!=null&&A.startsWith("+")?"international":"national":["national","international","e.164","rfc3966","idd"].includes(P)?P:(console.error('Invalid value of prop "mode"'),"international")}),f=i.computed(()=>{const A=[...y(s.preferredCountries).map(U=>({...U,preferred:!0})),...p.value];if(!s.dropdownOptions.showSearchBox)return A;const P=c.searchQuery.toLowerCase().replace(/[~`!@#$%^&*()+={}\[\];:\'\"<>.,\/\\\?-_]/g,"");return A.filter(U=>new RegExp(P,"i").test(U.name)||new RegExp(P,"i").test(U.iso2)||new RegExp(P,"i").test(U.dialCode))}),_=i.computed(()=>{var A;const P=c.phone.startsWith("+")?ci(c.phone):ci(c.phone,c.activeCountryCode),U={country:P==null?void 0:P.country,countryCode:P==null?void 0:P.country,formatted:c.phone,valid:P==null?void 0:P.isValid(),possible:(A=P==null?void 0:P.isPossible)==null?void 0:A.call(P),nationalNumber:P==null?void 0:P.nationalNumber};return U.valid&&(U.formatted=P==null?void 0:P.format(Sn(d.value))),P!=null&&P.country&&(s.ignoredCountries.length||s.onlyCountries.length)&&!g(P.country)&&(U.valid=!1,U.possible=!1,P.country=null),P?{...U,...P}:U});i.watch(()=>_.value.countryCode,A=>{A&&(c.activeCountryCode=A)}),i.watch(()=>_.value.valid,()=>{l("validate",_.value)}),i.watch(()=>_.value.formatted,A=>{!s.autoFormat||s.customValidate||(E(A),i.nextTick(()=>{A&&!u.value&&(c.phone=A)}))}),i.watch(()=>s.inputOptions.placeholder,v),i.onMounted(()=>{u.value&&(c.phone=u.value.trim()),T(),b().then(()=>{var A;!c.phone&&(A=s.inputOptions)!=null&&A.showDialCode&&c.activeCountryCode&&(c.phone=`+${c.activeCountryCode}`),l("validate",_.value)}).catch(console.error).then(()=>{c.finishMounted=!0})});function v(){c.parsedPlaceholder=s.inputOptions.placeholder}function b(){return new Promise(A=>{var P;if(((P=c.phone)==null?void 0:P[0])==="+"){A();return}if(s.defaultCountry){if(typeof s.defaultCountry=="string"){k(s.defaultCountry),A();return}if(typeof s.defaultCountry=="number"){const q=w(s.defaultCountry);if(q){k(q.iso2),A();return}}}const U=s.preferredCountries[0]||p.value[0];s.autoDefaultCountry?Yu().then(q=>{k(q||c.activeCountryCode)}).catch(q=>{console.warn(q),k(U)}).then(()=>{A()}):(k(U),A())})}function y(A=[]){return A.map(g).filter(Boolean)}function g(A=""){return p.value.find(P=>P.iso2===Sn(A))}function w(A){return p.value.find(P=>Number(P.dialCode)===A)}function m(A,P){const U=c.selectedIndex===A,q=A===s.preferredCountries.length-1,L=s.preferredCountries.some(z=>Sn(z)===P);return{highlighted:U,"last-preferred":q,preferred:L}}function k(A){var P,U,q;let L=A;if(typeof L=="string"&&(L=g(L)),!!L){if(((P=c.phone)==null?void 0:P[0])==="+"&&L.iso2&&_.value.nationalNumber){c.activeCountryCode=L.iso2,c.phone=((U=ci(_.value.nationalNumber,L.iso2))==null?void 0:U.formatInternational())??"";return}if((q=s.inputOptions)!=null&&q.showDialCode&&L){c.phone=`+${L.dialCode}`,c.activeCountryCode=L.iso2;return}c.activeCountryCode=L.iso2,E(c.phone)}}function T(){const A=c.phone;if(s.validCharactersOnly){const P=c.phone.match(/[()\-+0-9\s]*/g);c.phone=P.join("")}if(s.customValidate&&s.customValidate instanceof RegExp){const P=c.phone.match(s.customValidate);c.phone=P.join("")}A!==c.phone&&E(c.phone)}function S(){return s.validCharactersOnly&&!/^[()\-+0-9\s]*$/.test(c.phone)?!1:s.customValidate?x():!0}function x(){return s.customValidate instanceof RegExp?s.customValidate.test(c.phone):!1}function B(){var A;(A=r.value)==null||A.setCustomValidity(_.value.valid?"":s.invalidMsg),E(c.phone)}function E(A){u.value=A,l("on-input",A,_.value,r.value)}function C(A){l("blur",A)}function O(A){Zu(r.value,c.phone.length),l("focus",A)}function N(A){l("enter",A)}function R(A){l("space",A)}function F(){var A;(A=r.value)==null||A.focus()}function W(){var A;(A=r.value)==null||A.blur()}function Y(){s.disabled||s.dropdownOptions.disabled||(c.searchQuery="",c.open=!c.open)}function re(){c.open=!1}function K(A){if(A.keyCode===40){A.preventDefault(),c.open=!0,c.selectedIndex===null?c.selectedIndex=0:c.selectedIndex=Math.min(f.value.length-1,c.selectedIndex+1);const P=a.value.children[c.selectedIndex];P.focus(),P.offsetTop+P.clientHeight>a.value.scrollTop+a.value.clientHeight&&(a.value.scrollTop=P.offsetTop-a.value.clientHeight+P.clientHeight)}else if(A.keyCode===38){A.preventDefault(),c.open=!0,c.selectedIndex===null?c.selectedIndex=f.value.length-1:c.selectedIndex=Math.max(0,c.selectedIndex-1);const P=a.value.children[c.selectedIndex];P.focus(),P.offsetTop<a.value.scrollTop&&(a.value.scrollTop=P.offsetTop)}else if(A.keyCode===13)c.selectedIndex!==null&&k(f.value[c.selectedIndex]),c.open=!c.open;else if(c.open){c.typeToFindInput+=A.key,clearTimeout(c.typeToFindTimer),c.typeToFindTimer=setTimeout(()=>{c.typeToFindInput=""},700);const P=f.value.slice(s.preferredCountries.length).findIndex(U=>En(U.name).startsWith(c.typeToFindInput));if(P>=0){c.selectedIndex=s.preferredCountries.length+P;const U=a.value.children[c.selectedIndex],q=U.offsetTop<a.value.scrollTop,L=U.offsetTop+U.clientHeight>a.value.scrollTop+a.value.clientHeight;(q||L)&&(a.value.scrollTop=U.offsetTop-a.value.clientHeight/2)}}}function V(){c.selectedIndex=f.value.map(A=>A.iso2).indexOf(c.activeCountryCode),c.open=!1}function D(){window.innerHeight-o.value.getBoundingClientRect().bottom>200?c.dropdownOpenDirection="below":c.dropdownOpenDirection="above"}return n({focus:F,blur:W}),(A,P)=>{const U=i.resolveDirective("click-outside");return i.openBlock(),i.createElementBlock("div",{ref_key:"refRoot",ref:o,class:i.normalizeClass(["vue-tel-input",t.styleClasses,{disabled:t.disabled}])},[i.withDirectives((i.openBlock(),i.createElementBlock("div",{"aria-label":"Country Code Selector","aria-haspopup":"listbox","aria-expanded":c.open,role:"button",class:i.normalizeClass(["vti__dropdown",{open:c.open,disabled:t.dropdownOptions.disabled}]),tabindex:t.dropdownOptions.tabindex,onKeydown:[K,i.withKeys(Y,["space"]),i.withKeys(V,["esc"]),i.withKeys(V,["tab"])],onClick:Y},[i.createElementVNode("span",a1,[t.dropdownOptions.showFlags?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["vti__flag",i.unref(En)(c.activeCountryCode)])},null,2)):i.createCommentVNode("",!0),t.dropdownOptions.showDialCodeInSelection?(i.openBlock(),i.createElementBlock("span",l1," +"+i.toDisplayString(h.value&&h.value.dialCode),1)):i.createCommentVNode("",!0),i.renderSlot(A.$slots,"arrow-icon",{open:c.open},()=>[i.createElementVNode("span",s1,i.toDisplayString(c.open?"▲":"▼"),1)])]),c.open?(i.openBlock(),i.createElementBlock("ul",{key:0,ref_key:"refList",ref:a,class:i.normalizeClass(["vti__dropdown-list",c.dropdownOpenDirection]),role:"listbox"},[t.dropdownOptions.showSearchBox?(i.openBlock(),i.createElementBlock("div",d1,[i.renderSlot(A.$slots,"search-icon"),i.withDirectives(i.createElementVNode("input",{class:i.normalizeClass(["vti__input","vti__search_box"]),"aria-label":"Search by country name or country code",placeholder:t.dropdownOptions.searchBoxPlaceholder||(f.value.length?f.value[0].name:""),type:"text","onUpdate:modelValue":P[0]||(P[0]=q=>c.searchQuery=q),onClick:P[1]||(P[1]=i.withModifiers(()=>{},["stop"]))},null,8,c1),[[i.vModelText,c.searchQuery]])])):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(f.value,(q,L)=>(i.openBlock(),i.createElementBlock("li",{role:"option",class:i.normalizeClass(["vti__dropdown-item",m(L,q.iso2)]),key:q.iso2+(q.preferred?"-preferred":""),tabindex:"-1",onClick:z=>k(q),onMousemove:z=>c.selectedIndex=L,"aria-selected":c.activeCountryCode===q.iso2&&!q.preferred},[t.dropdownOptions.showFlags?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["vti__flag",i.unref(En)(q.iso2)])},null,2)):i.createCommentVNode("",!0),i.createElementVNode("strong",null,i.toDisplayString(q.name),1),t.dropdownOptions.showDialCodeInList?(i.openBlock(),i.createElementBlock("span",f1," +"+i.toDisplayString(q.dialCode),1)):i.createCommentVNode("",!0)],42,u1))),128))],2)):i.createCommentVNode("",!0)],42,o1)),[[U,re]]),i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":P[2]||(P[2]=q=>c.phone=q),ref_key:"refInput",ref:r,type:t.inputOptions.type,autocomplete:t.inputOptions.autocomplete,autofocus:t.inputOptions.autofocus,class:i.normalizeClass(["vti__input","vti__phone",t.inputOptions.styleClasses]),disabled:t.disabled,id:t.inputOptions.id,maxlength:t.inputOptions.maxlength,name:t.inputOptions.name,placeholder:c.parsedPlaceholder,readonly:t.inputOptions.readonly,required:t.inputOptions.required,tabindex:t.inputOptions.tabindex,value:u.value,"aria-describedby":t.inputOptions["aria-describedby"],onBlur:C,onFocus:O,onInput:B,onKeyup:[i.withKeys(N,["enter"]),i.withKeys(R,["space"])]},null,42,h1),[[i.vModelDynamic,c.phone]]),i.renderSlot(A.$slots,"icon-right")],2)}}}),gp="",yp="",m1={directives:{Outside:er},props:{modelValue:{type:String},value:String,inputName:{type:String,default:"phone"},autoDefaultCountry:{type:Boolean,default:!0},ignoredCountries:{type:Array,default:()=>[]},error:{type:Boolean,default:!1},errorMessage:{type:String,default:""}},emits:["update:modelValue","onReady"],components:{VueTelInput:p1,IbAlert:qt,IbIcon:Be},data(){return{vueTel:null,dialCode:"",defaultCountry:"US",allowChange:!1}},mounted(){this.vueTel=this.$refs.vueTel,this.$emit("onReady")},computed:{phone:{get(){return this.modelValue},set(t){this.$emit("update:modelValue",t)}}},methods:{countryChanged(t){this.$globalEvents.$on("countrySelectValue",n=>{this.vueTel.choose(n)}),!this.phone||this.phone.length-1<this.dialCode.length?this.phone="+"+t.dialCode:this.dialCode&&(this.phone=this.phone.replace(this.dialCode,t.dialCode)),this.dialCode=t.dialCode},clickOutside(){this.vueTel.open&&this.vueTel.clickedOutside()}}};function g1(t,n,e,o,a,r){const l=i.resolveComponent("ib-alert"),s=i.resolveComponent("ib-icon"),u=i.resolveComponent("vue-tel-input"),c=i.resolveDirective("outside");return i.openBlock(),i.createElementBlock(i.Fragment,null,[e.errorMessage.length?(i.openBlock(),i.createBlock(l,{key:0,class:"ib-phone-error-message"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(e.errorMessage),1)]),_:1})):i.createCommentVNode("",!0),i.withDirectives((i.openBlock(),i.createBlock(u,i.mergeProps({modelValue:r.phone,"onUpdate:modelValue":n[0]||(n[0]=p=>r.phone=p)},t.$attrs,{onCountryChanged:r.countryChanged,"input-options":{name:e.inputName,id:e.inputName},"auto-default-country":e.autoDefaultCountry,"dropdown-options":{showSearchBox:!0,showFlags:!0},defaultCountry:a.defaultCountry,ignoredCountries:e.ignoredCountries,class:{error:e.error||e.errorMessage.length},"style-classes":"ib-phone-input",ref:"vueTel"}),{"arrow-icon":i.withCtx(()=>[i.createVNode(s,{name:"chevron-down-outline"})]),_:1},16,["modelValue","onCountryChanged","input-options","auto-default-country","defaultCountry","ignoredCountries","class"])),[[c,r.clickOutside]])],64)}const y1=_e(m1,[["render",g1]]);var $a={exports:{}};/*!
|
|
90
90
|
* Quill Editor v1.3.7
|
|
91
91
|
* https://quilljs.com/
|
|
92
92
|
* Copyright (c) 2014, Jason Chen
|
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -6,10 +6,7 @@
|
|
|
6
6
|
</template>
|
|
7
7
|
</ib-select>
|
|
8
8
|
|
|
9
|
-
<ib-phone-input v-model="phone"></ib-phone-input>
|
|
10
|
-
|
|
11
|
-
<pre>{{phone}}</pre>
|
|
12
|
-
|
|
9
|
+
<ib-phone-input v-model="phone" @on-ready="test"></ib-phone-input>
|
|
13
10
|
|
|
14
11
|
</template>
|
|
15
12
|
|
|
@@ -71,9 +68,14 @@ export default {
|
|
|
71
68
|
return {
|
|
72
69
|
opt: testData1,
|
|
73
70
|
checked: '1',
|
|
74
|
-
phone: '
|
|
71
|
+
phone: ''
|
|
75
72
|
}
|
|
76
73
|
},
|
|
77
|
-
components: {IbToggle, IbSelect, IbCheckboxGroup, IbRadio, IbPhoneInput}
|
|
74
|
+
components: {IbToggle, IbSelect, IbCheckboxGroup, IbRadio, IbPhoneInput},
|
|
75
|
+
methods: {
|
|
76
|
+
test() {
|
|
77
|
+
this.phone = '+47 4723 37223223'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
78
80
|
}
|
|
79
81
|
</script>
|
|
@@ -57,7 +57,7 @@ export default {
|
|
|
57
57
|
default: "",
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
|
-
emits: ['update:modelValue'],
|
|
60
|
+
emits: ['update:modelValue', 'onReady'],
|
|
61
61
|
components: {
|
|
62
62
|
VueTelInput,
|
|
63
63
|
IbAlert,
|
|
@@ -66,7 +66,6 @@ export default {
|
|
|
66
66
|
data() {
|
|
67
67
|
return {
|
|
68
68
|
vueTel: null,
|
|
69
|
-
phone: "",
|
|
70
69
|
dialCode: "",
|
|
71
70
|
defaultCountry: "US",
|
|
72
71
|
allowChange: false
|
|
@@ -75,15 +74,16 @@ export default {
|
|
|
75
74
|
mounted() {
|
|
76
75
|
this.vueTel = this.$refs.vueTel;
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
this.phone = this.value[0] === "+" ? this.value : "+" + this.value;
|
|
80
|
-
} else if (this.modelValue) {
|
|
81
|
-
this.phone = this.modelValue[0] === "+" ? this.modelValue : "+" + this.modelValue;
|
|
82
|
-
}
|
|
77
|
+
this.$emit('onReady');
|
|
83
78
|
},
|
|
84
|
-
|
|
85
|
-
phone
|
|
86
|
-
|
|
79
|
+
computed: {
|
|
80
|
+
phone: {
|
|
81
|
+
get() {
|
|
82
|
+
return this.modelValue
|
|
83
|
+
},
|
|
84
|
+
set(value) {
|
|
85
|
+
this.$emit('update:modelValue', value)
|
|
86
|
+
}
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
methods: {
|