vue-tel-input 5.6.3 → 5.10.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/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -87,9 +87,9 @@ Or use the component directly:
87
87
  VueTelInput,
88
88
  },
89
89
  };
90
-
91
- <style src="vue-tel-input/dist/vue-tel-input.css"></style>;
92
90
  </script>
91
+
92
+ <style src="vue-tel-input/dist/vue-tel-input.css"></style>
93
93
  ```
94
94
 
95
95
  ### Browser
@@ -1 +1 @@
1
- .vue-tel-input{border-radius:3px;display:flex;border:1px solid #bbb;text-align:left}.vue-tel-input.disabled .dropdown,.vue-tel-input.disabled .selection,.vue-tel-input.disabled input{cursor:no-drop}.vue-tel-input:focus-within{box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);border-color:#66afe9}.vti__dropdown{display:flex;flex-direction:column;align-content:center;justify-content:center;position:relative;padding:7px;cursor:pointer}.vti__dropdown.show{max-height:300px;overflow:scroll}.vti__dropdown.disabled,.vti__dropdown.open{background-color:#f3f3f3}.vti__dropdown.disabled{cursor:no-drop;outline:none}.vti__dropdown:hover{background-color:#f3f3f3}.vti__selection{font-size:.8em;display:flex;align-items:center}.vti__selection .vti__country-code{color:#666}.vti__flag{margin-right:5px;margin-left:5px}.vti__dropdown-list{z-index:1;padding:0;margin:0;text-align:left;list-style:none;max-height:200px;overflow-y:scroll;position:absolute;left:-1px;background-color:#fff;border:1px solid #ccc;width:390px}.vti__dropdown-list.below{top:33px}.vti__dropdown-list.above{top:auto;bottom:100%}.vti__dropdown-arrow{transform:scaleY(.5);display:inline-block;color:#666}.vti__dropdown-item{cursor:pointer;padding:4px 15px}.vti__dropdown-item.highlighted{background-color:#f3f3f3}.vti__dropdown-item.last-preferred{border-bottom:1px solid #cacaca}.vti__dropdown-item .vti__flag{display:inline-block;margin-right:5px}.vti__input{border:none;border-radius:0 2px 2px 0;width:100%;outline:none;padding-left:7px}
1
+ .vue-tel-input{border-radius:3px;display:flex;border:1px solid #bbb;text-align:left}.vue-tel-input.disabled .dropdown,.vue-tel-input.disabled .selection,.vue-tel-input.disabled input{cursor:no-drop}.vue-tel-input:focus-within{box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);border-color:#66afe9}.vti__dropdown{display:flex;flex-direction:column;align-content:center;justify-content:center;position:relative;padding:7px;cursor:pointer}.vti__dropdown.show{max-height:300px;overflow:scroll}.vti__dropdown.disabled,.vti__dropdown.open{background-color:#f3f3f3}.vti__dropdown.disabled{cursor:no-drop;outline:none}.vti__dropdown:hover{background-color:#f3f3f3}.vti__selection{font-size:.8em;display:flex;align-items:center}.vti__selection .vti__country-code{color:#666}.vti__flag-wrapper{display:inline-block;width:30px;text-align:center}.vti__flag{margin-right:5px;margin-left:5px}.vti__dropdown-list{z-index:1;padding:0;margin:0;text-align:left;list-style:none;max-height:200px;overflow-y:scroll;position:absolute;left:-1px;background-color:#fff;border:1px solid #ccc}.vti__dropdown-list.below{top:33px}.vti__dropdown-list.above{top:auto;bottom:100%}.vti__dropdown-arrow{transform:scaleY(.5);display:inline-block;color:#666}.vti__dropdown-item{cursor:pointer;padding:4px 15px}.vti__dropdown-item.highlighted{background-color:#f3f3f3}.vti__dropdown-item.last-preferred{border-bottom:1px solid #cacaca}.vti__dropdown-item .vti__flag{display:inline-block;margin-right:5px}.vti__input{border:none;border-radius:0 2px 2px 0;width:100%;outline:none;padding-left:7px}.vti__search_box{border:1px solid #ccc;width:94%;padding:7px;margin:2px 2px}
@@ -5496,12 +5496,23 @@ var allProps = [{
5496
5496
  type: Boolean,
5497
5497
  description: 'Show flags in the dropdown selection and list',
5498
5498
  inDemo: true
5499
+ }, {
5500
+ name: 'dropdownOptions.showSearchBox',
5501
+ default: false,
5502
+ type: Boolean,
5503
+ description: 'Show country search box',
5504
+ inDemo: true
5499
5505
  }, {
5500
5506
  name: 'dropdownOptions.tabindex',
5501
5507
  default: 0,
5502
5508
  type: Number,
5503
5509
  description: 'Native dropdown <code>tabindex</code> attribute',
5504
5510
  inDemo: false
5511
+ }, {
5512
+ name: 'dropdownOptions.width',
5513
+ default: '390px',
5514
+ type: String,
5515
+ description: 'Specify dropdown width'
5505
5516
  }, {
5506
5517
  name: 'ignoredCountries',
5507
5518
  default: [],
@@ -5657,8 +5668,8 @@ var defaultOptions = [].concat(allProps).reduce(function (prv, crr) {
5657
5668
  /* harmony default export */ const utils = ({
5658
5669
  options: _objectSpread2({}, defaultOptions)
5659
5670
  });
5660
- ;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"10391616-vue-loader-template"}!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].rules[0].use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/vue-tel-input.vue?vue&type=template&id=fbdc7d32&
5661
- var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:['vue-tel-input', _vm.styleClasses, { disabled: _vm.disabled }]},[_c('div',{directives:[{name:"click-outside",rawName:"v-click-outside",value:(_vm.clickedOutside),expression:"clickedOutside"}],class:['vti__dropdown', { open: _vm.open, disabled: _vm.dropdownOptions.disabled }],attrs:{"tabindex":_vm.dropdownOptions.tabindex},on:{"keydown":[_vm.keyboardNav,function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"esc",27,$event.key,["Esc","Escape"])){ return null; }return _vm.reset.apply(null, arguments)}],"click":_vm.toggleDropdown}},[_c('span',{staticClass:"vti__selection"},[(_vm.dropdownOptions.showFlags)?_c('div',{class:['vti__flag', _vm.activeCountryCode.toLowerCase()]}):_vm._e(),(_vm.dropdownOptions.showDialCodeInSelection)?_c('span',{staticClass:"vti__country-code"},[_vm._v(" +"+_vm._s(_vm.activeCountry && _vm.activeCountry.dialCode)+" ")]):_vm._e(),_vm._t("arrow-icon",function(){return [_c('span',{staticClass:"vti__dropdown-arrow"},[_vm._v(_vm._s(_vm.open ? "▲" : "▼"))])]},{"open":_vm.open})],2),(_vm.open)?_c('ul',{ref:"list",staticClass:"vti__dropdown-list",class:_vm.dropdownOpenDirection},_vm._l((_vm.sortedCountries),function(pb,index){return _c('li',{key:pb.iso2 + (pb.preferred ? '-preferred' : ''),class:['vti__dropdown-item', _vm.getItemClass(index, pb.iso2)],on:{"click":function($event){return _vm.choose(pb)},"mousemove":function($event){_vm.selectedIndex = index}}},[(_vm.dropdownOptions.showFlags)?_c('div',{class:['vti__flag', pb.iso2.toLowerCase()]}):_vm._e(),_c('strong',[_vm._v(_vm._s(pb.name))]),(_vm.dropdownOptions.showDialCodeInList)?_c('span',[_vm._v(" +"+_vm._s(pb.dialCode)+" ")]):_vm._e()])}),0):_vm._e()]),((_vm.inputOptions.type)==='checkbox')?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.phone),expression:"phone"}],ref:"input",class:['vti__input', _vm.inputOptions.styleClasses],attrs:{"autocomplete":_vm.inputOptions.autocomplete,"autofocus":_vm.inputOptions.autofocus,"disabled":_vm.disabled,"id":_vm.inputOptions.id,"maxlength":_vm.inputOptions.maxlength,"name":_vm.inputOptions.name,"placeholder":_vm.parsedPlaceholder,"readonly":_vm.inputOptions.readonly,"required":_vm.inputOptions.required,"tabindex":_vm.inputOptions.tabindex,"aria-describedby":_vm.inputOptions['aria-describedby'],"type":"checkbox"},domProps:{"checked":Array.isArray(_vm.phone)?_vm._i(_vm.phone,null)>-1:(_vm.phone)},on:{"blur":_vm.onBlur,"focus":_vm.onFocus,"input":_vm.onInput,"keyup":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.onEnter.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"space",32,$event.key,[" ","Spacebar"])){ return null; }return _vm.onSpace.apply(null, arguments)}],"change":function($event){var $$a=_vm.phone,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.phone=$$a.concat([$$v]))}else{$$i>-1&&(_vm.phone=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{_vm.phone=$$c}}}}):((_vm.inputOptions.type)==='radio')?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.phone),expression:"phone"}],ref:"input",class:['vti__input', _vm.inputOptions.styleClasses],attrs:{"autocomplete":_vm.inputOptions.autocomplete,"autofocus":_vm.inputOptions.autofocus,"disabled":_vm.disabled,"id":_vm.inputOptions.id,"maxlength":_vm.inputOptions.maxlength,"name":_vm.inputOptions.name,"placeholder":_vm.parsedPlaceholder,"readonly":_vm.inputOptions.readonly,"required":_vm.inputOptions.required,"tabindex":_vm.inputOptions.tabindex,"aria-describedby":_vm.inputOptions['aria-describedby'],"type":"radio"},domProps:{"checked":_vm._q(_vm.phone,null)},on:{"blur":_vm.onBlur,"focus":_vm.onFocus,"input":_vm.onInput,"keyup":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.onEnter.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"space",32,$event.key,[" ","Spacebar"])){ return null; }return _vm.onSpace.apply(null, arguments)}],"change":function($event){_vm.phone=null}}}):_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.phone),expression:"phone"}],ref:"input",class:['vti__input', _vm.inputOptions.styleClasses],attrs:{"autocomplete":_vm.inputOptions.autocomplete,"autofocus":_vm.inputOptions.autofocus,"disabled":_vm.disabled,"id":_vm.inputOptions.id,"maxlength":_vm.inputOptions.maxlength,"name":_vm.inputOptions.name,"placeholder":_vm.parsedPlaceholder,"readonly":_vm.inputOptions.readonly,"required":_vm.inputOptions.required,"tabindex":_vm.inputOptions.tabindex,"aria-describedby":_vm.inputOptions['aria-describedby'],"type":_vm.inputOptions.type},domProps:{"value":(_vm.phone)},on:{"blur":_vm.onBlur,"focus":_vm.onFocus,"input":[function($event){if($event.target.composing){ return; }_vm.phone=$event.target.value},_vm.onInput],"keyup":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.onEnter.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"space",32,$event.key,[" ","Spacebar"])){ return null; }return _vm.onSpace.apply(null, arguments)}]}}),_vm._t("icon-right")],2)}
5671
+ ;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"1dc3e612-vue-loader-template"}!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].rules[0].use[0]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/vue-tel-input.vue?vue&type=template&id=0901b80c&
5672
+ var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:['vue-tel-input', _vm.styleClasses, { disabled: _vm.disabled }]},[_c('div',{directives:[{name:"click-outside",rawName:"v-click-outside",value:(_vm.clickedOutside),expression:"clickedOutside"}],class:['vti__dropdown', { open: _vm.open, disabled: _vm.dropdownOptions.disabled }],attrs:{"aria-label":"Country Code Selector","aria-haspopup":"listbox","aria-expanded":_vm.open,"role":"button","tabindex":_vm.dropdownOptions.tabindex},on:{"keydown":[_vm.keyboardNav,function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"space",32,$event.key,[" ","Spacebar"])){ return null; }return _vm.toggleDropdown.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"esc",27,$event.key,["Esc","Escape"])){ return null; }return _vm.reset.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"tab",9,$event.key,"Tab")){ return null; }return _vm.reset.apply(null, arguments)}],"click":_vm.toggleDropdown}},[_c('span',{staticClass:"vti__selection"},[(_vm.dropdownOptions.showFlags)?_c('span',{class:['vti__flag', _vm.activeCountryCode.toLowerCase()]}):_vm._e(),(_vm.dropdownOptions.showDialCodeInSelection)?_c('span',{staticClass:"vti__country-code"},[_vm._v(" +"+_vm._s(_vm.activeCountry && _vm.activeCountry.dialCode)+" ")]):_vm._e(),_vm._t("arrow-icon",function(){return [_c('span',{staticClass:"vti__dropdown-arrow"},[_vm._v(_vm._s(_vm.open ? "▲" : "▼"))])]},{"open":_vm.open})],2),(_vm.open)?_c('ul',{ref:"list",staticClass:"vti__dropdown-list",class:_vm.dropdownOpenDirection,style:({ width: _vm.dropdownOptions.width }),attrs:{"role":"listbox"}},[(_vm.dropdownOptions.showSearchBox)?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.searchQuery),expression:"searchQuery"}],staticClass:"vti__input vti__search_box",attrs:{"aria-label":"Search by country name or country code","placeholder":_vm.sortedCountries[0].name,"type":"text"},domProps:{"value":(_vm.searchQuery)},on:{"input":function($event){if($event.target.composing){ return; }_vm.searchQuery=$event.target.value}}}):_vm._e(),_vm._l((_vm.sortedCountries),function(pb,index){return _c('li',{key:pb.iso2 + (pb.preferred ? '-preferred' : ''),class:['vti__dropdown-item', _vm.getItemClass(index, pb.iso2)],attrs:{"role":"option","tabindex":"-1","aria-selected":_vm.activeCountryCode === pb.iso2 && !pb.preferred},on:{"click":function($event){return _vm.choose(pb)},"mousemove":function($event){_vm.selectedIndex = index}}},[_c('div',{staticClass:"vti__flag-wrapper"},[(_vm.dropdownOptions.showFlags)?_c('span',{class:['vti__flag', pb.iso2.toLowerCase()]}):_vm._e()]),_c('strong',[_vm._v(_vm._s(pb.name))]),(_vm.dropdownOptions.showDialCodeInList)?_c('span',[_vm._v(" +"+_vm._s(pb.dialCode)+" ")]):_vm._e()])})],2):_vm._e()]),((_vm.inputOptions.type)==='checkbox')?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.phone),expression:"phone"}],ref:"input",class:['vti__input', _vm.inputOptions.styleClasses],attrs:{"autocomplete":_vm.inputOptions.autocomplete,"autofocus":_vm.inputOptions.autofocus,"disabled":_vm.disabled,"id":_vm.inputOptions.id,"maxlength":_vm.inputOptions.maxlength,"name":_vm.inputOptions.name,"placeholder":_vm.parsedPlaceholder,"readonly":_vm.inputOptions.readonly,"required":_vm.inputOptions.required,"tabindex":_vm.inputOptions.tabindex,"aria-describedby":_vm.inputOptions['aria-describedby'],"type":"checkbox"},domProps:{"checked":Array.isArray(_vm.phone)?_vm._i(_vm.phone,null)>-1:(_vm.phone)},on:{"blur":_vm.onBlur,"focus":_vm.onFocus,"input":_vm.onInput,"keyup":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.onEnter.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"space",32,$event.key,[" ","Spacebar"])){ return null; }return _vm.onSpace.apply(null, arguments)}],"change":function($event){var $$a=_vm.phone,$$el=$event.target,$$c=$$el.checked?(true):(false);if(Array.isArray($$a)){var $$v=null,$$i=_vm._i($$a,$$v);if($$el.checked){$$i<0&&(_vm.phone=$$a.concat([$$v]))}else{$$i>-1&&(_vm.phone=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{_vm.phone=$$c}}}}):((_vm.inputOptions.type)==='radio')?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.phone),expression:"phone"}],ref:"input",class:['vti__input', _vm.inputOptions.styleClasses],attrs:{"autocomplete":_vm.inputOptions.autocomplete,"autofocus":_vm.inputOptions.autofocus,"disabled":_vm.disabled,"id":_vm.inputOptions.id,"maxlength":_vm.inputOptions.maxlength,"name":_vm.inputOptions.name,"placeholder":_vm.parsedPlaceholder,"readonly":_vm.inputOptions.readonly,"required":_vm.inputOptions.required,"tabindex":_vm.inputOptions.tabindex,"aria-describedby":_vm.inputOptions['aria-describedby'],"type":"radio"},domProps:{"checked":_vm._q(_vm.phone,null)},on:{"blur":_vm.onBlur,"focus":_vm.onFocus,"input":_vm.onInput,"keyup":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.onEnter.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"space",32,$event.key,[" ","Spacebar"])){ return null; }return _vm.onSpace.apply(null, arguments)}],"change":function($event){_vm.phone=null}}}):_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.phone),expression:"phone"}],ref:"input",class:['vti__input', _vm.inputOptions.styleClasses],attrs:{"autocomplete":_vm.inputOptions.autocomplete,"autofocus":_vm.inputOptions.autofocus,"disabled":_vm.disabled,"id":_vm.inputOptions.id,"maxlength":_vm.inputOptions.maxlength,"name":_vm.inputOptions.name,"placeholder":_vm.parsedPlaceholder,"readonly":_vm.inputOptions.readonly,"required":_vm.inputOptions.required,"tabindex":_vm.inputOptions.tabindex,"aria-describedby":_vm.inputOptions['aria-describedby'],"type":_vm.inputOptions.type},domProps:{"value":(_vm.phone)},on:{"blur":_vm.onBlur,"focus":_vm.onFocus,"input":[function($event){if($event.target.composing){ return; }_vm.phone=$event.target.value},_vm.onInput],"keyup":[function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"enter",13,$event.key,"Enter")){ return null; }return _vm.onEnter.apply(null, arguments)},function($event){if(!$event.type.indexOf('key')&&_vm._k($event.keyCode,"space",32,$event.key,[" ","Spacebar"])){ return null; }return _vm.onSpace.apply(null, arguments)}]}}),_vm._t("icon-right")],2)}
5662
5673
  var staticRenderFns = []
5663
5674
 
5664
5675
 
@@ -8764,6 +8775,35 @@ var _excluded = ["metadata"];
8764
8775
  //
8765
8776
  //
8766
8777
  //
8778
+ //
8779
+ //
8780
+ //
8781
+ //
8782
+ //
8783
+ //
8784
+ //
8785
+ //
8786
+ //
8787
+ //
8788
+ //
8789
+ //
8790
+ //
8791
+ //
8792
+ //
8793
+ //
8794
+ //
8795
+ //
8796
+ //
8797
+ //
8798
+ //
8799
+ //
8800
+ //
8801
+ //
8802
+ //
8803
+ //
8804
+ //
8805
+ //
8806
+ //
8767
8807
 
8768
8808
 
8769
8809
 
@@ -8903,7 +8943,8 @@ function getDefault(key) {
8903
8943
  typeToFindInput: '',
8904
8944
  typeToFindTimer: null,
8905
8945
  dropdownOpenDirection: 'below',
8906
- parsedPlaceholder: this.inputOptions.placeholder
8946
+ parsedPlaceholder: this.inputOptions.placeholder,
8947
+ searchQuery: ''
8907
8948
  };
8908
8949
  },
8909
8950
  computed: {
@@ -8949,13 +8990,23 @@ function getDefault(key) {
8949
8990
  return this.allCountries;
8950
8991
  },
8951
8992
  sortedCountries: function sortedCountries() {
8993
+ var _this2 = this;
8994
+
8952
8995
  // Sort the list countries: from preferred countries to all countries
8953
8996
  var preferredCountries = this.getCountries(this.preferredCountries).map(function (country) {
8954
8997
  return _objectSpread2(_objectSpread2({}, country), {}, {
8955
8998
  preferred: true
8956
8999
  });
8957
9000
  });
8958
- return [].concat(_toConsumableArray(preferredCountries), _toConsumableArray(this.filteredCountries));
9001
+ var countriesList = [].concat(_toConsumableArray(preferredCountries), _toConsumableArray(this.filteredCountries));
9002
+
9003
+ if (!this.dropdownOptions.showSearchBox) {
9004
+ return countriesList;
9005
+ }
9006
+
9007
+ return countriesList.filter(function (c) {
9008
+ return new RegExp(_this2.searchQuery, 'i').test(c.name) || new RegExp(_this2.searchQuery, 'i').test(c.iso2) || new RegExp(_this2.searchQuery, 'i').test(c.dialCode);
9009
+ });
8959
9010
  },
8960
9011
  phoneObject: function phoneObject() {
8961
9012
  var _this$phone, _result$isValid, _result2;
@@ -9017,7 +9068,7 @@ function getDefault(key) {
9017
9068
  this.$emit('validate', this.phoneObject);
9018
9069
  },
9019
9070
  'phoneObject.formatted': function phoneObjectFormatted(value) {
9020
- var _this2 = this;
9071
+ var _this3 = this;
9021
9072
 
9022
9073
  if (!this.autoFormat || this.customValidate) {
9023
9074
  return;
@@ -9026,8 +9077,8 @@ function getDefault(key) {
9026
9077
  this.emitInput(value);
9027
9078
  this.$nextTick(function () {
9028
9079
  // In case `v-model` is not set, we need to update the `phone` to be new formatted value
9029
- if (value && !_this2.value) {
9030
- _this2.phone = value;
9080
+ if (value && !_this3.value) {
9081
+ _this3.phone = value;
9031
9082
  }
9032
9083
  });
9033
9084
  },
@@ -9038,13 +9089,13 @@ function getDefault(key) {
9038
9089
  this.resetPlaceholder();
9039
9090
  },
9040
9091
  value: function value(_value, oldValue) {
9041
- var _this3 = this;
9092
+ var _this4 = this;
9042
9093
 
9043
9094
  if (!this.testCharacters()) {
9044
9095
  this.$nextTick(function () {
9045
- _this3.phone = oldValue;
9096
+ _this4.phone = oldValue;
9046
9097
 
9047
- _this3.onInput();
9098
+ _this4.onInput();
9048
9099
  });
9049
9100
  } else {
9050
9101
  this.phone = _value;
@@ -9061,7 +9112,7 @@ function getDefault(key) {
9061
9112
  }
9062
9113
  },
9063
9114
  mounted: function mounted() {
9064
- var _this4 = this;
9115
+ var _this5 = this;
9065
9116
 
9066
9117
  if (this.value) {
9067
9118
  this.phone = this.value.trim();
@@ -9069,15 +9120,15 @@ function getDefault(key) {
9069
9120
 
9070
9121
  this.cleanInvalidCharacters();
9071
9122
  this.initializeCountry().then(function () {
9072
- var _this4$inputOptions;
9123
+ var _this5$inputOptions;
9073
9124
 
9074
- if (!_this4.phone && (_this4$inputOptions = _this4.inputOptions) !== null && _this4$inputOptions !== void 0 && _this4$inputOptions.showDialCode && _this4.activeCountryCode) {
9075
- _this4.phone = "+".concat(_this4.activeCountryCode);
9125
+ if (!_this5.phone && (_this5$inputOptions = _this5.inputOptions) !== null && _this5$inputOptions !== void 0 && _this5$inputOptions.showDialCode && _this5.activeCountryCode) {
9126
+ _this5.phone = "+".concat(_this5.activeCountryCode);
9076
9127
  }
9077
9128
 
9078
- _this4.$emit('validate', _this4.phoneObject);
9129
+ _this5.$emit('validate', _this5.phoneObject);
9079
9130
  }).catch(console.error).then(function () {
9080
- _this4.finishMounted = true;
9131
+ _this5.finishMounted = true;
9081
9132
  });
9082
9133
  },
9083
9134
  methods: {
@@ -9096,15 +9147,15 @@ function getDefault(key) {
9096
9147
  // .catch(console.error);
9097
9148
  },
9098
9149
  initializeCountry: function initializeCountry() {
9099
- var _this5 = this;
9150
+ var _this6 = this;
9100
9151
 
9101
9152
  return new Promise(function (resolve) {
9102
- var _this5$phone;
9153
+ var _this6$phone;
9103
9154
 
9104
9155
  /**
9105
9156
  * 1. If the phone included prefix (i.e. +12), try to get the country and set it
9106
9157
  */
9107
- if (((_this5$phone = _this5.phone) === null || _this5$phone === void 0 ? void 0 : _this5$phone[0]) === '+') {
9158
+ if (((_this6$phone = _this6.phone) === null || _this6$phone === void 0 ? void 0 : _this6$phone[0]) === '+') {
9108
9159
  resolve();
9109
9160
  return;
9110
9161
  }
@@ -9113,19 +9164,19 @@ function getDefault(key) {
9113
9164
  */
9114
9165
 
9115
9166
 
9116
- if (_this5.defaultCountry) {
9117
- if (typeof _this5.defaultCountry === 'string') {
9118
- _this5.choose(_this5.defaultCountry);
9167
+ if (_this6.defaultCountry) {
9168
+ if (typeof _this6.defaultCountry === 'string') {
9169
+ _this6.choose(_this6.defaultCountry);
9119
9170
 
9120
9171
  resolve();
9121
9172
  return;
9122
9173
  }
9123
9174
 
9124
- if (typeof _this5.defaultCountry === 'number') {
9125
- var country = _this5.findCountryByDialCode(_this5.defaultCountry);
9175
+ if (typeof _this6.defaultCountry === 'number') {
9176
+ var country = _this6.findCountryByDialCode(_this6.defaultCountry);
9126
9177
 
9127
9178
  if (country) {
9128
- _this5.choose(country.iso2);
9179
+ _this6.choose(country.iso2);
9129
9180
 
9130
9181
  resolve();
9131
9182
  return;
@@ -9133,21 +9184,21 @@ function getDefault(key) {
9133
9184
  }
9134
9185
  }
9135
9186
 
9136
- var fallbackCountry = _this5.preferredCountries[0] || _this5.filteredCountries[0];
9187
+ var fallbackCountry = _this6.preferredCountries[0] || _this6.filteredCountries[0];
9137
9188
  /**
9138
9189
  * 3. Check if fetching country based on user's IP is allowed, set it as the default country
9139
9190
  */
9140
9191
 
9141
- if (_this5.autoDefaultCountry) {
9192
+ if (_this6.autoDefaultCountry) {
9142
9193
  getCountry().then(function (res) {
9143
- _this5.choose(res || _this5.activeCountryCode);
9194
+ _this6.choose(res || _this6.activeCountryCode);
9144
9195
  }).catch(function (error) {
9145
9196
  console.warn(error);
9146
9197
  /**
9147
9198
  * 4. Use the first country from preferred list (if available) or all countries list
9148
9199
  */
9149
9200
 
9150
- _this5.choose(fallbackCountry);
9201
+ _this6.choose(fallbackCountry);
9151
9202
  }).then(function () {
9152
9203
  resolve();
9153
9204
  });
@@ -9155,7 +9206,7 @@ function getDefault(key) {
9155
9206
  /**
9156
9207
  * 4. Use the first country from preferred list (if available) or all countries list
9157
9208
  */
9158
- _this5.choose(fallbackCountry);
9209
+ _this6.choose(fallbackCountry);
9159
9210
 
9160
9211
  resolve();
9161
9212
  }
@@ -9166,11 +9217,11 @@ function getDefault(key) {
9166
9217
  * Get the list of countries from the list of iso2 code
9167
9218
  */
9168
9219
  getCountries: function getCountries() {
9169
- var _this6 = this;
9220
+ var _this7 = this;
9170
9221
 
9171
9222
  var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
9172
9223
  return list.map(function (countryCode) {
9173
- return _this6.findCountry(countryCode);
9224
+ return _this7.findCountry(countryCode);
9174
9225
  }).filter(Boolean);
9175
9226
  },
9176
9227
  findCountry: function findCountry() {
@@ -9289,18 +9340,21 @@ function getDefault(key) {
9289
9340
  focus: function focus() {
9290
9341
  this.$refs.input.focus();
9291
9342
  },
9292
- toggleDropdown: function toggleDropdown() {
9293
- if (this.disabled || this.dropdownOptions.disabled) {
9343
+ toggleDropdown: function toggleDropdown(e) {
9344
+ var _e$path, _e$path$;
9345
+
9346
+ if (this.disabled || this.dropdownOptions.disabled || (e === null || e === void 0 ? void 0 : (_e$path = e.path) === null || _e$path === void 0 ? void 0 : (_e$path$ = _e$path[0]) === null || _e$path$ === void 0 ? void 0 : _e$path$.type) === 'text') {
9294
9347
  return;
9295
9348
  }
9296
9349
 
9350
+ this.searchQuery = '';
9297
9351
  this.open = !this.open;
9298
9352
  },
9299
9353
  clickedOutside: function clickedOutside() {
9300
9354
  this.open = false;
9301
9355
  },
9302
9356
  keyboardNav: function keyboardNav(e) {
9303
- var _this7 = this;
9357
+ var _this8 = this;
9304
9358
 
9305
9359
  if (e.keyCode === 40) {
9306
9360
  // down arrow
@@ -9314,6 +9368,7 @@ function getDefault(key) {
9314
9368
  }
9315
9369
 
9316
9370
  var selEle = this.$refs.list.children[this.selectedIndex];
9371
+ selEle.focus();
9317
9372
 
9318
9373
  if (selEle.offsetTop + selEle.clientHeight > this.$refs.list.scrollTop + this.$refs.list.clientHeight) {
9319
9374
  this.$refs.list.scrollTop = selEle.offsetTop - this.$refs.list.clientHeight + selEle.clientHeight;
@@ -9331,6 +9386,8 @@ function getDefault(key) {
9331
9386
 
9332
9387
  var _selEle = this.$refs.list.children[this.selectedIndex];
9333
9388
 
9389
+ _selEle.focus();
9390
+
9334
9391
  if (_selEle.offsetTop < this.$refs.list.scrollTop) {
9335
9392
  this.$refs.list.scrollTop = _selEle.offsetTop;
9336
9393
  }
@@ -9346,11 +9403,11 @@ function getDefault(key) {
9346
9403
  this.typeToFindInput += e.key;
9347
9404
  clearTimeout(this.typeToFindTimer);
9348
9405
  this.typeToFindTimer = setTimeout(function () {
9349
- _this7.typeToFindInput = '';
9406
+ _this8.typeToFindInput = '';
9350
9407
  }, 700); // don't include preferred countries so we jump to the right place in the alphabet
9351
9408
 
9352
9409
  var typedCountryI = this.sortedCountries.slice(this.preferredCountries.length).findIndex(function (c) {
9353
- return c.name.toLowerCase().startsWith(_this7.typeToFindInput);
9410
+ return c.name.toLowerCase().startsWith(_this8.typeToFindInput);
9354
9411
  });
9355
9412
 
9356
9413
  if (typedCountryI >= 0) {