vue-tel-input 5.6.3 → 5.7.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,6 +5506,12 @@ 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,
@@ -5667,8 +5673,8 @@ var defaultOptions = [].concat(allProps).reduce(function (prv, crr) {
5667
5673
  /* harmony default export */ const utils = ({
5668
5674
  options: _objectSpread2({}, defaultOptions)
5669
5675
  });
5670
- ;// 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&
5671
- 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)}
5676
+ ;// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"2f9a4d83-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=33071b52&
5677
+ 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.dropdownOptions.showSearchBox)?_c('input',{directives:[{name:"model",rawName:"v-model",value:(_vm.searchQuery),expression:"searchQuery"}],staticClass:"vti__input vti__search_box",attrs:{"placeholder":"Search by country name or country code","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)],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()])})],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)}
5672
5678
  var staticRenderFns = []
5673
5679
 
5674
5680
 
@@ -8774,6 +8780,13 @@ var _excluded = ["metadata"];
8774
8780
  //
8775
8781
  //
8776
8782
  //
8783
+ //
8784
+ //
8785
+ //
8786
+ //
8787
+ //
8788
+ //
8789
+ //
8777
8790
 
8778
8791
 
8779
8792
 
@@ -8913,7 +8926,8 @@ function getDefault(key) {
8913
8926
  typeToFindInput: '',
8914
8927
  typeToFindTimer: null,
8915
8928
  dropdownOpenDirection: 'below',
8916
- parsedPlaceholder: this.inputOptions.placeholder
8929
+ parsedPlaceholder: this.inputOptions.placeholder,
8930
+ searchQuery: ''
8917
8931
  };
8918
8932
  },
8919
8933
  computed: {
@@ -8959,13 +8973,23 @@ function getDefault(key) {
8959
8973
  return this.allCountries;
8960
8974
  },
8961
8975
  sortedCountries: function sortedCountries() {
8976
+ var _this2 = this;
8977
+
8962
8978
  // Sort the list countries: from preferred countries to all countries
8963
8979
  var preferredCountries = this.getCountries(this.preferredCountries).map(function (country) {
8964
8980
  return _objectSpread2(_objectSpread2({}, country), {}, {
8965
8981
  preferred: true
8966
8982
  });
8967
8983
  });
8968
- return [].concat(_toConsumableArray(preferredCountries), _toConsumableArray(this.filteredCountries));
8984
+ var countriesList = [].concat(_toConsumableArray(preferredCountries), _toConsumableArray(this.filteredCountries));
8985
+
8986
+ if (!this.dropdownOptions.showSearchBox) {
8987
+ return countriesList;
8988
+ }
8989
+
8990
+ return countriesList.filter(function (c) {
8991
+ 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);
8992
+ });
8969
8993
  },
8970
8994
  phoneObject: function phoneObject() {
8971
8995
  var _this$phone, _result$isValid, _result2;
@@ -9027,7 +9051,7 @@ function getDefault(key) {
9027
9051
  this.$emit('validate', this.phoneObject);
9028
9052
  },
9029
9053
  'phoneObject.formatted': function phoneObjectFormatted(value) {
9030
- var _this2 = this;
9054
+ var _this3 = this;
9031
9055
 
9032
9056
  if (!this.autoFormat || this.customValidate) {
9033
9057
  return;
@@ -9036,8 +9060,8 @@ function getDefault(key) {
9036
9060
  this.emitInput(value);
9037
9061
  this.$nextTick(function () {
9038
9062
  // In case `v-model` is not set, we need to update the `phone` to be new formatted value
9039
- if (value && !_this2.value) {
9040
- _this2.phone = value;
9063
+ if (value && !_this3.value) {
9064
+ _this3.phone = value;
9041
9065
  }
9042
9066
  });
9043
9067
  },
@@ -9048,13 +9072,13 @@ function getDefault(key) {
9048
9072
  this.resetPlaceholder();
9049
9073
  },
9050
9074
  value: function value(_value, oldValue) {
9051
- var _this3 = this;
9075
+ var _this4 = this;
9052
9076
 
9053
9077
  if (!this.testCharacters()) {
9054
9078
  this.$nextTick(function () {
9055
- _this3.phone = oldValue;
9079
+ _this4.phone = oldValue;
9056
9080
 
9057
- _this3.onInput();
9081
+ _this4.onInput();
9058
9082
  });
9059
9083
  } else {
9060
9084
  this.phone = _value;
@@ -9071,7 +9095,7 @@ function getDefault(key) {
9071
9095
  }
9072
9096
  },
9073
9097
  mounted: function mounted() {
9074
- var _this4 = this;
9098
+ var _this5 = this;
9075
9099
 
9076
9100
  if (this.value) {
9077
9101
  this.phone = this.value.trim();
@@ -9079,15 +9103,15 @@ function getDefault(key) {
9079
9103
 
9080
9104
  this.cleanInvalidCharacters();
9081
9105
  this.initializeCountry().then(function () {
9082
- var _this4$inputOptions;
9106
+ var _this5$inputOptions;
9083
9107
 
9084
- if (!_this4.phone && (_this4$inputOptions = _this4.inputOptions) !== null && _this4$inputOptions !== void 0 && _this4$inputOptions.showDialCode && _this4.activeCountryCode) {
9085
- _this4.phone = "+".concat(_this4.activeCountryCode);
9108
+ if (!_this5.phone && (_this5$inputOptions = _this5.inputOptions) !== null && _this5$inputOptions !== void 0 && _this5$inputOptions.showDialCode && _this5.activeCountryCode) {
9109
+ _this5.phone = "+".concat(_this5.activeCountryCode);
9086
9110
  }
9087
9111
 
9088
- _this4.$emit('validate', _this4.phoneObject);
9112
+ _this5.$emit('validate', _this5.phoneObject);
9089
9113
  }).catch(console.error).then(function () {
9090
- _this4.finishMounted = true;
9114
+ _this5.finishMounted = true;
9091
9115
  });
9092
9116
  },
9093
9117
  methods: {
@@ -9106,15 +9130,15 @@ function getDefault(key) {
9106
9130
  // .catch(console.error);
9107
9131
  },
9108
9132
  initializeCountry: function initializeCountry() {
9109
- var _this5 = this;
9133
+ var _this6 = this;
9110
9134
 
9111
9135
  return new Promise(function (resolve) {
9112
- var _this5$phone;
9136
+ var _this6$phone;
9113
9137
 
9114
9138
  /**
9115
9139
  * 1. If the phone included prefix (i.e. +12), try to get the country and set it
9116
9140
  */
9117
- if (((_this5$phone = _this5.phone) === null || _this5$phone === void 0 ? void 0 : _this5$phone[0]) === '+') {
9141
+ if (((_this6$phone = _this6.phone) === null || _this6$phone === void 0 ? void 0 : _this6$phone[0]) === '+') {
9118
9142
  resolve();
9119
9143
  return;
9120
9144
  }
@@ -9123,19 +9147,19 @@ function getDefault(key) {
9123
9147
  */
9124
9148
 
9125
9149
 
9126
- if (_this5.defaultCountry) {
9127
- if (typeof _this5.defaultCountry === 'string') {
9128
- _this5.choose(_this5.defaultCountry);
9150
+ if (_this6.defaultCountry) {
9151
+ if (typeof _this6.defaultCountry === 'string') {
9152
+ _this6.choose(_this6.defaultCountry);
9129
9153
 
9130
9154
  resolve();
9131
9155
  return;
9132
9156
  }
9133
9157
 
9134
- if (typeof _this5.defaultCountry === 'number') {
9135
- var country = _this5.findCountryByDialCode(_this5.defaultCountry);
9158
+ if (typeof _this6.defaultCountry === 'number') {
9159
+ var country = _this6.findCountryByDialCode(_this6.defaultCountry);
9136
9160
 
9137
9161
  if (country) {
9138
- _this5.choose(country.iso2);
9162
+ _this6.choose(country.iso2);
9139
9163
 
9140
9164
  resolve();
9141
9165
  return;
@@ -9143,21 +9167,21 @@ function getDefault(key) {
9143
9167
  }
9144
9168
  }
9145
9169
 
9146
- var fallbackCountry = _this5.preferredCountries[0] || _this5.filteredCountries[0];
9170
+ var fallbackCountry = _this6.preferredCountries[0] || _this6.filteredCountries[0];
9147
9171
  /**
9148
9172
  * 3. Check if fetching country based on user's IP is allowed, set it as the default country
9149
9173
  */
9150
9174
 
9151
- if (_this5.autoDefaultCountry) {
9175
+ if (_this6.autoDefaultCountry) {
9152
9176
  getCountry().then(function (res) {
9153
- _this5.choose(res || _this5.activeCountryCode);
9177
+ _this6.choose(res || _this6.activeCountryCode);
9154
9178
  }).catch(function (error) {
9155
9179
  console.warn(error);
9156
9180
  /**
9157
9181
  * 4. Use the first country from preferred list (if available) or all countries list
9158
9182
  */
9159
9183
 
9160
- _this5.choose(fallbackCountry);
9184
+ _this6.choose(fallbackCountry);
9161
9185
  }).then(function () {
9162
9186
  resolve();
9163
9187
  });
@@ -9165,7 +9189,7 @@ function getDefault(key) {
9165
9189
  /**
9166
9190
  * 4. Use the first country from preferred list (if available) or all countries list
9167
9191
  */
9168
- _this5.choose(fallbackCountry);
9192
+ _this6.choose(fallbackCountry);
9169
9193
 
9170
9194
  resolve();
9171
9195
  }
@@ -9176,11 +9200,11 @@ function getDefault(key) {
9176
9200
  * Get the list of countries from the list of iso2 code
9177
9201
  */
9178
9202
  getCountries: function getCountries() {
9179
- var _this6 = this;
9203
+ var _this7 = this;
9180
9204
 
9181
9205
  var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
9182
9206
  return list.map(function (countryCode) {
9183
- return _this6.findCountry(countryCode);
9207
+ return _this7.findCountry(countryCode);
9184
9208
  }).filter(Boolean);
9185
9209
  },
9186
9210
  findCountry: function findCountry() {
@@ -9299,18 +9323,21 @@ function getDefault(key) {
9299
9323
  focus: function focus() {
9300
9324
  this.$refs.input.focus();
9301
9325
  },
9302
- toggleDropdown: function toggleDropdown() {
9303
- if (this.disabled || this.dropdownOptions.disabled) {
9326
+ toggleDropdown: function toggleDropdown(e) {
9327
+ var _e$path, _e$path$;
9328
+
9329
+ 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') {
9304
9330
  return;
9305
9331
  }
9306
9332
 
9333
+ this.searchQuery = '';
9307
9334
  this.open = !this.open;
9308
9335
  },
9309
9336
  clickedOutside: function clickedOutside() {
9310
9337
  this.open = false;
9311
9338
  },
9312
9339
  keyboardNav: function keyboardNav(e) {
9313
- var _this7 = this;
9340
+ var _this8 = this;
9314
9341
 
9315
9342
  if (e.keyCode === 40) {
9316
9343
  // down arrow
@@ -9356,11 +9383,11 @@ function getDefault(key) {
9356
9383
  this.typeToFindInput += e.key;
9357
9384
  clearTimeout(this.typeToFindTimer);
9358
9385
  this.typeToFindTimer = setTimeout(function () {
9359
- _this7.typeToFindInput = '';
9386
+ _this8.typeToFindInput = '';
9360
9387
  }, 700); // don't include preferred countries so we jump to the right place in the alphabet
9361
9388
 
9362
9389
  var typedCountryI = this.sortedCountries.slice(this.preferredCountries.length).findIndex(function (c) {
9363
- return c.name.toLowerCase().startsWith(_this7.typeToFindInput);
9390
+ return c.name.toLowerCase().startsWith(_this8.typeToFindInput);
9364
9391
  });
9365
9392
 
9366
9393
  if (typedCountryI >= 0) {