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.
@@ -5506,12 +5506,23 @@ var allProps = [{
5506
5506
  type: Boolean,
5507
5507
  description: 'Show flags in the dropdown selection and list',
5508
5508
  inDemo: true
5509
+ }, {
5510
+ name: 'dropdownOptions.showSearchBox',
5511
+ default: false,
5512
+ type: Boolean,
5513
+ description: 'Show country search box',
5514
+ inDemo: true
5509
5515
  }, {
5510
5516
  name: 'dropdownOptions.tabindex',
5511
5517
  default: 0,
5512
5518
  type: Number,
5513
5519
  description: 'Native dropdown <code>tabindex</code> attribute',
5514
5520
  inDemo: false
5521
+ }, {
5522
+ name: 'dropdownOptions.width',
5523
+ default: '390px',
5524
+ type: String,
5525
+ description: 'Specify dropdown width'
5515
5526
  }, {
5516
5527
  name: 'ignoredCountries',
5517
5528
  default: [],
@@ -5566,6 +5577,12 @@ var allProps = [{
5566
5577
  type: String,
5567
5578
  description: 'Native input <code>name</code> attribute',
5568
5579
  inDemo: false
5580
+ }, {
5581
+ name: 'inputOptions.showDialCode',
5582
+ default: false,
5583
+ type: Boolean,
5584
+ description: 'Show dial code in input',
5585
+ inDemo: false
5569
5586
  }, {
5570
5587
  name: 'inputOptions.placeholder',
5571
5588
  default: 'Enter a phone number',
@@ -5661,8 +5678,8 @@ var defaultOptions = [].concat(allProps).reduce(function (prv, crr) {
5661
5678
  /* harmony default export */ const utils = ({
5662
5679
  options: _objectSpread2({}, defaultOptions)
5663
5680
  });
5664
- ;// 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&
5665
- 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)}
5681
+ ;// 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&
5682
+ 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)}
5666
5683
  var staticRenderFns = []
5667
5684
 
5668
5685
 
@@ -8768,6 +8785,33 @@ var _excluded = ["metadata"];
8768
8785
  //
8769
8786
  //
8770
8787
  //
8788
+ //
8789
+ //
8790
+ //
8791
+ //
8792
+ //
8793
+ //
8794
+ //
8795
+ //
8796
+ //
8797
+ //
8798
+ //
8799
+ //
8800
+ //
8801
+ //
8802
+ //
8803
+ //
8804
+ //
8805
+ //
8806
+ //
8807
+ //
8808
+ //
8809
+ //
8810
+ //
8811
+ //
8812
+ //
8813
+ //
8814
+ //
8771
8815
 
8772
8816
 
8773
8817
 
@@ -8907,7 +8951,8 @@ function getDefault(key) {
8907
8951
  typeToFindInput: '',
8908
8952
  typeToFindTimer: null,
8909
8953
  dropdownOpenDirection: 'below',
8910
- parsedPlaceholder: this.inputOptions.placeholder
8954
+ parsedPlaceholder: this.inputOptions.placeholder,
8955
+ searchQuery: ''
8911
8956
  };
8912
8957
  },
8913
8958
  computed: {
@@ -8953,13 +8998,23 @@ function getDefault(key) {
8953
8998
  return this.allCountries;
8954
8999
  },
8955
9000
  sortedCountries: function sortedCountries() {
9001
+ var _this2 = this;
9002
+
8956
9003
  // Sort the list countries: from preferred countries to all countries
8957
9004
  var preferredCountries = this.getCountries(this.preferredCountries).map(function (country) {
8958
9005
  return _objectSpread2(_objectSpread2({}, country), {}, {
8959
9006
  preferred: true
8960
9007
  });
8961
9008
  });
8962
- return [].concat(_toConsumableArray(preferredCountries), _toConsumableArray(this.filteredCountries));
9009
+ var countriesList = [].concat(_toConsumableArray(preferredCountries), _toConsumableArray(this.filteredCountries));
9010
+
9011
+ if (!this.dropdownOptions.showSearchBox) {
9012
+ return countriesList;
9013
+ }
9014
+
9015
+ return countriesList.filter(function (c) {
9016
+ 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);
9017
+ });
8963
9018
  },
8964
9019
  phoneObject: function phoneObject() {
8965
9020
  var _this$phone, _result$isValid, _result2;
@@ -9021,7 +9076,7 @@ function getDefault(key) {
9021
9076
  this.$emit('validate', this.phoneObject);
9022
9077
  },
9023
9078
  'phoneObject.formatted': function phoneObjectFormatted(value) {
9024
- var _this2 = this;
9079
+ var _this3 = this;
9025
9080
 
9026
9081
  if (!this.autoFormat || this.customValidate) {
9027
9082
  return;
@@ -9030,8 +9085,8 @@ function getDefault(key) {
9030
9085
  this.emitInput(value);
9031
9086
  this.$nextTick(function () {
9032
9087
  // In case `v-model` is not set, we need to update the `phone` to be new formatted value
9033
- if (value && !_this2.value) {
9034
- _this2.phone = value;
9088
+ if (value && !_this3.value) {
9089
+ _this3.phone = value;
9035
9090
  }
9036
9091
  });
9037
9092
  },
@@ -9042,13 +9097,13 @@ function getDefault(key) {
9042
9097
  this.resetPlaceholder();
9043
9098
  },
9044
9099
  value: function value(_value, oldValue) {
9045
- var _this3 = this;
9100
+ var _this4 = this;
9046
9101
 
9047
9102
  if (!this.testCharacters()) {
9048
9103
  this.$nextTick(function () {
9049
- _this3.phone = oldValue;
9104
+ _this4.phone = oldValue;
9050
9105
 
9051
- _this3.onInput();
9106
+ _this4.onInput();
9052
9107
  });
9053
9108
  } else {
9054
9109
  this.phone = _value;
@@ -9065,7 +9120,7 @@ function getDefault(key) {
9065
9120
  }
9066
9121
  },
9067
9122
  mounted: function mounted() {
9068
- var _this4 = this;
9123
+ var _this5 = this;
9069
9124
 
9070
9125
  if (this.value) {
9071
9126
  this.phone = this.value.trim();
@@ -9073,15 +9128,15 @@ function getDefault(key) {
9073
9128
 
9074
9129
  this.cleanInvalidCharacters();
9075
9130
  this.initializeCountry().then(function () {
9076
- var _this4$inputOptions;
9131
+ var _this5$inputOptions;
9077
9132
 
9078
- if (!_this4.phone && (_this4$inputOptions = _this4.inputOptions) !== null && _this4$inputOptions !== void 0 && _this4$inputOptions.showDialCode && _this4.activeCountryCode) {
9079
- _this4.phone = "+".concat(_this4.activeCountryCode);
9133
+ if (!_this5.phone && (_this5$inputOptions = _this5.inputOptions) !== null && _this5$inputOptions !== void 0 && _this5$inputOptions.showDialCode && _this5.activeCountryCode) {
9134
+ _this5.phone = "+".concat(_this5.activeCountryCode);
9080
9135
  }
9081
9136
 
9082
- _this4.$emit('validate', _this4.phoneObject);
9137
+ _this5.$emit('validate', _this5.phoneObject);
9083
9138
  }).catch(console.error).then(function () {
9084
- _this4.finishMounted = true;
9139
+ _this5.finishMounted = true;
9085
9140
  });
9086
9141
  },
9087
9142
  methods: {
@@ -9100,15 +9155,15 @@ function getDefault(key) {
9100
9155
  // .catch(console.error);
9101
9156
  },
9102
9157
  initializeCountry: function initializeCountry() {
9103
- var _this5 = this;
9158
+ var _this6 = this;
9104
9159
 
9105
9160
  return new Promise(function (resolve) {
9106
- var _this5$phone;
9161
+ var _this6$phone;
9107
9162
 
9108
9163
  /**
9109
9164
  * 1. If the phone included prefix (i.e. +12), try to get the country and set it
9110
9165
  */
9111
- if (((_this5$phone = _this5.phone) === null || _this5$phone === void 0 ? void 0 : _this5$phone[0]) === '+') {
9166
+ if (((_this6$phone = _this6.phone) === null || _this6$phone === void 0 ? void 0 : _this6$phone[0]) === '+') {
9112
9167
  resolve();
9113
9168
  return;
9114
9169
  }
@@ -9117,19 +9172,19 @@ function getDefault(key) {
9117
9172
  */
9118
9173
 
9119
9174
 
9120
- if (_this5.defaultCountry) {
9121
- if (typeof _this5.defaultCountry === 'string') {
9122
- _this5.choose(_this5.defaultCountry);
9175
+ if (_this6.defaultCountry) {
9176
+ if (typeof _this6.defaultCountry === 'string') {
9177
+ _this6.choose(_this6.defaultCountry);
9123
9178
 
9124
9179
  resolve();
9125
9180
  return;
9126
9181
  }
9127
9182
 
9128
- if (typeof _this5.defaultCountry === 'number') {
9129
- var country = _this5.findCountryByDialCode(_this5.defaultCountry);
9183
+ if (typeof _this6.defaultCountry === 'number') {
9184
+ var country = _this6.findCountryByDialCode(_this6.defaultCountry);
9130
9185
 
9131
9186
  if (country) {
9132
- _this5.choose(country.iso2);
9187
+ _this6.choose(country.iso2);
9133
9188
 
9134
9189
  resolve();
9135
9190
  return;
@@ -9137,21 +9192,21 @@ function getDefault(key) {
9137
9192
  }
9138
9193
  }
9139
9194
 
9140
- var fallbackCountry = _this5.preferredCountries[0] || _this5.filteredCountries[0];
9195
+ var fallbackCountry = _this6.preferredCountries[0] || _this6.filteredCountries[0];
9141
9196
  /**
9142
9197
  * 3. Check if fetching country based on user's IP is allowed, set it as the default country
9143
9198
  */
9144
9199
 
9145
- if (_this5.autoDefaultCountry) {
9200
+ if (_this6.autoDefaultCountry) {
9146
9201
  getCountry().then(function (res) {
9147
- _this5.choose(res || _this5.activeCountryCode);
9202
+ _this6.choose(res || _this6.activeCountryCode);
9148
9203
  }).catch(function (error) {
9149
9204
  console.warn(error);
9150
9205
  /**
9151
9206
  * 4. Use the first country from preferred list (if available) or all countries list
9152
9207
  */
9153
9208
 
9154
- _this5.choose(fallbackCountry);
9209
+ _this6.choose(fallbackCountry);
9155
9210
  }).then(function () {
9156
9211
  resolve();
9157
9212
  });
@@ -9159,7 +9214,7 @@ function getDefault(key) {
9159
9214
  /**
9160
9215
  * 4. Use the first country from preferred list (if available) or all countries list
9161
9216
  */
9162
- _this5.choose(fallbackCountry);
9217
+ _this6.choose(fallbackCountry);
9163
9218
 
9164
9219
  resolve();
9165
9220
  }
@@ -9170,11 +9225,11 @@ function getDefault(key) {
9170
9225
  * Get the list of countries from the list of iso2 code
9171
9226
  */
9172
9227
  getCountries: function getCountries() {
9173
- var _this6 = this;
9228
+ var _this7 = this;
9174
9229
 
9175
9230
  var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
9176
9231
  return list.map(function (countryCode) {
9177
- return _this6.findCountry(countryCode);
9232
+ return _this7.findCountry(countryCode);
9178
9233
  }).filter(Boolean);
9179
9234
  },
9180
9235
  findCountry: function findCountry() {
@@ -9223,6 +9278,7 @@ function getDefault(key) {
9223
9278
  if ((_this$inputOptions = this.inputOptions) !== null && _this$inputOptions !== void 0 && _this$inputOptions.showDialCode && parsedCountry) {
9224
9279
  // Reset phone if the showDialCode is set
9225
9280
  this.phone = "+".concat(parsedCountry.dialCode);
9281
+ this.activeCountryCode = parsedCountry.iso2 || '';
9226
9282
  return;
9227
9283
  } // update value, even if international mode is NOT used
9228
9284
 
@@ -9292,18 +9348,21 @@ function getDefault(key) {
9292
9348
  focus: function focus() {
9293
9349
  this.$refs.input.focus();
9294
9350
  },
9295
- toggleDropdown: function toggleDropdown() {
9296
- if (this.disabled || this.dropdownOptions.disabled) {
9351
+ toggleDropdown: function toggleDropdown(e) {
9352
+ var _e$path, _e$path$;
9353
+
9354
+ 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') {
9297
9355
  return;
9298
9356
  }
9299
9357
 
9358
+ this.searchQuery = '';
9300
9359
  this.open = !this.open;
9301
9360
  },
9302
9361
  clickedOutside: function clickedOutside() {
9303
9362
  this.open = false;
9304
9363
  },
9305
9364
  keyboardNav: function keyboardNav(e) {
9306
- var _this7 = this;
9365
+ var _this8 = this;
9307
9366
 
9308
9367
  if (e.keyCode === 40) {
9309
9368
  // down arrow
@@ -9317,6 +9376,7 @@ function getDefault(key) {
9317
9376
  }
9318
9377
 
9319
9378
  var selEle = this.$refs.list.children[this.selectedIndex];
9379
+ selEle.focus();
9320
9380
 
9321
9381
  if (selEle.offsetTop + selEle.clientHeight > this.$refs.list.scrollTop + this.$refs.list.clientHeight) {
9322
9382
  this.$refs.list.scrollTop = selEle.offsetTop - this.$refs.list.clientHeight + selEle.clientHeight;
@@ -9334,6 +9394,8 @@ function getDefault(key) {
9334
9394
 
9335
9395
  var _selEle = this.$refs.list.children[this.selectedIndex];
9336
9396
 
9397
+ _selEle.focus();
9398
+
9337
9399
  if (_selEle.offsetTop < this.$refs.list.scrollTop) {
9338
9400
  this.$refs.list.scrollTop = _selEle.offsetTop;
9339
9401
  }
@@ -9349,11 +9411,11 @@ function getDefault(key) {
9349
9411
  this.typeToFindInput += e.key;
9350
9412
  clearTimeout(this.typeToFindTimer);
9351
9413
  this.typeToFindTimer = setTimeout(function () {
9352
- _this7.typeToFindInput = '';
9414
+ _this8.typeToFindInput = '';
9353
9415
  }, 700); // don't include preferred countries so we jump to the right place in the alphabet
9354
9416
 
9355
9417
  var typedCountryI = this.sortedCountries.slice(this.preferredCountries.length).findIndex(function (c) {
9356
- return c.name.toLowerCase().startsWith(_this7.typeToFindInput);
9418
+ return c.name.toLowerCase().startsWith(_this8.typeToFindInput);
9357
9419
  });
9358
9420
 
9359
9421
  if (typedCountryI >= 0) {