vue-tel-input 5.6.2 → 5.9.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{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: [],
@@ -5556,6 +5567,12 @@ var allProps = [{
5556
5567
  type: String,
5557
5568
  description: 'Native input <code>name</code> attribute',
5558
5569
  inDemo: false
5570
+ }, {
5571
+ name: 'inputOptions.showDialCode',
5572
+ default: false,
5573
+ type: Boolean,
5574
+ description: 'Show dial code in input',
5575
+ inDemo: false
5559
5576
  }, {
5560
5577
  name: 'inputOptions.placeholder',
5561
5578
  default: 'Enter a phone number',
@@ -5651,8 +5668,8 @@ var defaultOptions = [].concat(allProps).reduce(function (prv, crr) {
5651
5668
  /* harmony default export */ const utils = ({
5652
5669
  options: _objectSpread2({}, defaultOptions)
5653
5670
  });
5654
- ;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"a667ccea-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=35e93aac&
5655
- 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":"0279cef7-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=d662fd8a&
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}}},[(_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)}
5656
5673
  var staticRenderFns = []
5657
5674
 
5658
5675
 
@@ -8758,6 +8775,33 @@ var _excluded = ["metadata"];
8758
8775
  //
8759
8776
  //
8760
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
+ //
8761
8805
 
8762
8806
 
8763
8807
 
@@ -8897,7 +8941,8 @@ function getDefault(key) {
8897
8941
  typeToFindInput: '',
8898
8942
  typeToFindTimer: null,
8899
8943
  dropdownOpenDirection: 'below',
8900
- parsedPlaceholder: this.inputOptions.placeholder
8944
+ parsedPlaceholder: this.inputOptions.placeholder,
8945
+ searchQuery: ''
8901
8946
  };
8902
8947
  },
8903
8948
  computed: {
@@ -8943,13 +8988,23 @@ function getDefault(key) {
8943
8988
  return this.allCountries;
8944
8989
  },
8945
8990
  sortedCountries: function sortedCountries() {
8991
+ var _this2 = this;
8992
+
8946
8993
  // Sort the list countries: from preferred countries to all countries
8947
8994
  var preferredCountries = this.getCountries(this.preferredCountries).map(function (country) {
8948
8995
  return _objectSpread2(_objectSpread2({}, country), {}, {
8949
8996
  preferred: true
8950
8997
  });
8951
8998
  });
8952
- return [].concat(_toConsumableArray(preferredCountries), _toConsumableArray(this.filteredCountries));
8999
+ var countriesList = [].concat(_toConsumableArray(preferredCountries), _toConsumableArray(this.filteredCountries));
9000
+
9001
+ if (!this.dropdownOptions.showSearchBox) {
9002
+ return countriesList;
9003
+ }
9004
+
9005
+ return countriesList.filter(function (c) {
9006
+ 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);
9007
+ });
8953
9008
  },
8954
9009
  phoneObject: function phoneObject() {
8955
9010
  var _this$phone, _result$isValid, _result2;
@@ -9011,7 +9066,7 @@ function getDefault(key) {
9011
9066
  this.$emit('validate', this.phoneObject);
9012
9067
  },
9013
9068
  'phoneObject.formatted': function phoneObjectFormatted(value) {
9014
- var _this2 = this;
9069
+ var _this3 = this;
9015
9070
 
9016
9071
  if (!this.autoFormat || this.customValidate) {
9017
9072
  return;
@@ -9020,8 +9075,8 @@ function getDefault(key) {
9020
9075
  this.emitInput(value);
9021
9076
  this.$nextTick(function () {
9022
9077
  // In case `v-model` is not set, we need to update the `phone` to be new formatted value
9023
- if (value && !_this2.value) {
9024
- _this2.phone = value;
9078
+ if (value && !_this3.value) {
9079
+ _this3.phone = value;
9025
9080
  }
9026
9081
  });
9027
9082
  },
@@ -9032,13 +9087,13 @@ function getDefault(key) {
9032
9087
  this.resetPlaceholder();
9033
9088
  },
9034
9089
  value: function value(_value, oldValue) {
9035
- var _this3 = this;
9090
+ var _this4 = this;
9036
9091
 
9037
9092
  if (!this.testCharacters()) {
9038
9093
  this.$nextTick(function () {
9039
- _this3.phone = oldValue;
9094
+ _this4.phone = oldValue;
9040
9095
 
9041
- _this3.onInput();
9096
+ _this4.onInput();
9042
9097
  });
9043
9098
  } else {
9044
9099
  this.phone = _value;
@@ -9055,7 +9110,7 @@ function getDefault(key) {
9055
9110
  }
9056
9111
  },
9057
9112
  mounted: function mounted() {
9058
- var _this4 = this;
9113
+ var _this5 = this;
9059
9114
 
9060
9115
  if (this.value) {
9061
9116
  this.phone = this.value.trim();
@@ -9063,15 +9118,15 @@ function getDefault(key) {
9063
9118
 
9064
9119
  this.cleanInvalidCharacters();
9065
9120
  this.initializeCountry().then(function () {
9066
- var _this4$inputOptions;
9121
+ var _this5$inputOptions;
9067
9122
 
9068
- if (!_this4.phone && (_this4$inputOptions = _this4.inputOptions) !== null && _this4$inputOptions !== void 0 && _this4$inputOptions.showDialCode && _this4.activeCountryCode) {
9069
- _this4.phone = "+".concat(_this4.activeCountryCode);
9123
+ if (!_this5.phone && (_this5$inputOptions = _this5.inputOptions) !== null && _this5$inputOptions !== void 0 && _this5$inputOptions.showDialCode && _this5.activeCountryCode) {
9124
+ _this5.phone = "+".concat(_this5.activeCountryCode);
9070
9125
  }
9071
9126
 
9072
- _this4.$emit('validate', _this4.phoneObject);
9127
+ _this5.$emit('validate', _this5.phoneObject);
9073
9128
  }).catch(console.error).then(function () {
9074
- _this4.finishMounted = true;
9129
+ _this5.finishMounted = true;
9075
9130
  });
9076
9131
  },
9077
9132
  methods: {
@@ -9090,15 +9145,15 @@ function getDefault(key) {
9090
9145
  // .catch(console.error);
9091
9146
  },
9092
9147
  initializeCountry: function initializeCountry() {
9093
- var _this5 = this;
9148
+ var _this6 = this;
9094
9149
 
9095
9150
  return new Promise(function (resolve) {
9096
- var _this5$phone;
9151
+ var _this6$phone;
9097
9152
 
9098
9153
  /**
9099
9154
  * 1. If the phone included prefix (i.e. +12), try to get the country and set it
9100
9155
  */
9101
- if (((_this5$phone = _this5.phone) === null || _this5$phone === void 0 ? void 0 : _this5$phone[0]) === '+') {
9156
+ if (((_this6$phone = _this6.phone) === null || _this6$phone === void 0 ? void 0 : _this6$phone[0]) === '+') {
9102
9157
  resolve();
9103
9158
  return;
9104
9159
  }
@@ -9107,19 +9162,19 @@ function getDefault(key) {
9107
9162
  */
9108
9163
 
9109
9164
 
9110
- if (_this5.defaultCountry) {
9111
- if (typeof _this5.defaultCountry === 'string') {
9112
- _this5.choose(_this5.defaultCountry);
9165
+ if (_this6.defaultCountry) {
9166
+ if (typeof _this6.defaultCountry === 'string') {
9167
+ _this6.choose(_this6.defaultCountry);
9113
9168
 
9114
9169
  resolve();
9115
9170
  return;
9116
9171
  }
9117
9172
 
9118
- if (typeof _this5.defaultCountry === 'number') {
9119
- var country = _this5.findCountryByDialCode(_this5.defaultCountry);
9173
+ if (typeof _this6.defaultCountry === 'number') {
9174
+ var country = _this6.findCountryByDialCode(_this6.defaultCountry);
9120
9175
 
9121
9176
  if (country) {
9122
- _this5.choose(country.iso2);
9177
+ _this6.choose(country.iso2);
9123
9178
 
9124
9179
  resolve();
9125
9180
  return;
@@ -9127,21 +9182,21 @@ function getDefault(key) {
9127
9182
  }
9128
9183
  }
9129
9184
 
9130
- var fallbackCountry = _this5.preferredCountries[0] || _this5.filteredCountries[0];
9185
+ var fallbackCountry = _this6.preferredCountries[0] || _this6.filteredCountries[0];
9131
9186
  /**
9132
9187
  * 3. Check if fetching country based on user's IP is allowed, set it as the default country
9133
9188
  */
9134
9189
 
9135
- if (_this5.autoDefaultCountry) {
9190
+ if (_this6.autoDefaultCountry) {
9136
9191
  getCountry().then(function (res) {
9137
- _this5.choose(res || _this5.activeCountryCode);
9192
+ _this6.choose(res || _this6.activeCountryCode);
9138
9193
  }).catch(function (error) {
9139
9194
  console.warn(error);
9140
9195
  /**
9141
9196
  * 4. Use the first country from preferred list (if available) or all countries list
9142
9197
  */
9143
9198
 
9144
- _this5.choose(fallbackCountry);
9199
+ _this6.choose(fallbackCountry);
9145
9200
  }).then(function () {
9146
9201
  resolve();
9147
9202
  });
@@ -9149,7 +9204,7 @@ function getDefault(key) {
9149
9204
  /**
9150
9205
  * 4. Use the first country from preferred list (if available) or all countries list
9151
9206
  */
9152
- _this5.choose(fallbackCountry);
9207
+ _this6.choose(fallbackCountry);
9153
9208
 
9154
9209
  resolve();
9155
9210
  }
@@ -9160,11 +9215,11 @@ function getDefault(key) {
9160
9215
  * Get the list of countries from the list of iso2 code
9161
9216
  */
9162
9217
  getCountries: function getCountries() {
9163
- var _this6 = this;
9218
+ var _this7 = this;
9164
9219
 
9165
9220
  var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
9166
9221
  return list.map(function (countryCode) {
9167
- return _this6.findCountry(countryCode);
9222
+ return _this7.findCountry(countryCode);
9168
9223
  }).filter(Boolean);
9169
9224
  },
9170
9225
  findCountry: function findCountry() {
@@ -9213,6 +9268,7 @@ function getDefault(key) {
9213
9268
  if ((_this$inputOptions = this.inputOptions) !== null && _this$inputOptions !== void 0 && _this$inputOptions.showDialCode && parsedCountry) {
9214
9269
  // Reset phone if the showDialCode is set
9215
9270
  this.phone = "+".concat(parsedCountry.dialCode);
9271
+ this.activeCountryCode = parsedCountry.iso2 || '';
9216
9272
  return;
9217
9273
  } // update value, even if international mode is NOT used
9218
9274
 
@@ -9282,18 +9338,21 @@ function getDefault(key) {
9282
9338
  focus: function focus() {
9283
9339
  this.$refs.input.focus();
9284
9340
  },
9285
- toggleDropdown: function toggleDropdown() {
9286
- if (this.disabled || this.dropdownOptions.disabled) {
9341
+ toggleDropdown: function toggleDropdown(e) {
9342
+ var _e$path, _e$path$;
9343
+
9344
+ 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') {
9287
9345
  return;
9288
9346
  }
9289
9347
 
9348
+ this.searchQuery = '';
9290
9349
  this.open = !this.open;
9291
9350
  },
9292
9351
  clickedOutside: function clickedOutside() {
9293
9352
  this.open = false;
9294
9353
  },
9295
9354
  keyboardNav: function keyboardNav(e) {
9296
- var _this7 = this;
9355
+ var _this8 = this;
9297
9356
 
9298
9357
  if (e.keyCode === 40) {
9299
9358
  // down arrow
@@ -9307,6 +9366,7 @@ function getDefault(key) {
9307
9366
  }
9308
9367
 
9309
9368
  var selEle = this.$refs.list.children[this.selectedIndex];
9369
+ selEle.focus();
9310
9370
 
9311
9371
  if (selEle.offsetTop + selEle.clientHeight > this.$refs.list.scrollTop + this.$refs.list.clientHeight) {
9312
9372
  this.$refs.list.scrollTop = selEle.offsetTop - this.$refs.list.clientHeight + selEle.clientHeight;
@@ -9324,6 +9384,8 @@ function getDefault(key) {
9324
9384
 
9325
9385
  var _selEle = this.$refs.list.children[this.selectedIndex];
9326
9386
 
9387
+ _selEle.focus();
9388
+
9327
9389
  if (_selEle.offsetTop < this.$refs.list.scrollTop) {
9328
9390
  this.$refs.list.scrollTop = _selEle.offsetTop;
9329
9391
  }
@@ -9339,11 +9401,11 @@ function getDefault(key) {
9339
9401
  this.typeToFindInput += e.key;
9340
9402
  clearTimeout(this.typeToFindTimer);
9341
9403
  this.typeToFindTimer = setTimeout(function () {
9342
- _this7.typeToFindInput = '';
9404
+ _this8.typeToFindInput = '';
9343
9405
  }, 700); // don't include preferred countries so we jump to the right place in the alphabet
9344
9406
 
9345
9407
  var typedCountryI = this.sortedCountries.slice(this.preferredCountries.length).findIndex(function (c) {
9346
- return c.name.toLowerCase().startsWith(_this7.typeToFindInput);
9408
+ return c.name.toLowerCase().startsWith(_this8.typeToFindInput);
9347
9409
  });
9348
9410
 
9349
9411
  if (typedCountryI >= 0) {