vue-tel-input 5.14.0 → 5.14.2

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.
@@ -1429,6 +1429,57 @@ module.exports = function (V, P) {
1429
1429
  };
1430
1430
 
1431
1431
 
1432
+ /***/ }),
1433
+
1434
+ /***/ 647:
1435
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
1436
+
1437
+ var uncurryThis = __webpack_require__(1702);
1438
+ var toObject = __webpack_require__(7908);
1439
+
1440
+ var floor = Math.floor;
1441
+ var charAt = uncurryThis(''.charAt);
1442
+ var replace = uncurryThis(''.replace);
1443
+ var stringSlice = uncurryThis(''.slice);
1444
+ var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
1445
+ var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
1446
+
1447
+ // `GetSubstitution` abstract operation
1448
+ // https://tc39.es/ecma262/#sec-getsubstitution
1449
+ module.exports = function (matched, str, position, captures, namedCaptures, replacement) {
1450
+ var tailPos = position + matched.length;
1451
+ var m = captures.length;
1452
+ var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
1453
+ if (namedCaptures !== undefined) {
1454
+ namedCaptures = toObject(namedCaptures);
1455
+ symbols = SUBSTITUTION_SYMBOLS;
1456
+ }
1457
+ return replace(replacement, symbols, function (match, ch) {
1458
+ var capture;
1459
+ switch (charAt(ch, 0)) {
1460
+ case '$': return '$';
1461
+ case '&': return matched;
1462
+ case '`': return stringSlice(str, 0, position);
1463
+ case "'": return stringSlice(str, tailPos);
1464
+ case '<':
1465
+ capture = namedCaptures[stringSlice(ch, 1, -1)];
1466
+ break;
1467
+ default: // \d\d?
1468
+ var n = +ch;
1469
+ if (n === 0) return match;
1470
+ if (n > m) {
1471
+ var f = floor(n / 10);
1472
+ if (f === 0) return match;
1473
+ if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1);
1474
+ return match;
1475
+ }
1476
+ capture = captures[n - 1];
1477
+ }
1478
+ return capture === undefined ? '' : capture;
1479
+ });
1480
+ };
1481
+
1482
+
1432
1483
  /***/ }),
1433
1484
 
1434
1485
  /***/ 7854:
@@ -5927,6 +5978,151 @@ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa
5927
5978
  });
5928
5979
 
5929
5980
 
5981
+ /***/ }),
5982
+
5983
+ /***/ 5306:
5984
+ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
5985
+
5986
+ "use strict";
5987
+
5988
+ var apply = __webpack_require__(2104);
5989
+ var call = __webpack_require__(6916);
5990
+ var uncurryThis = __webpack_require__(1702);
5991
+ var fixRegExpWellKnownSymbolLogic = __webpack_require__(7007);
5992
+ var fails = __webpack_require__(7293);
5993
+ var anObject = __webpack_require__(9670);
5994
+ var isCallable = __webpack_require__(614);
5995
+ var isNullOrUndefined = __webpack_require__(8554);
5996
+ var toIntegerOrInfinity = __webpack_require__(9303);
5997
+ var toLength = __webpack_require__(7466);
5998
+ var toString = __webpack_require__(1340);
5999
+ var requireObjectCoercible = __webpack_require__(4488);
6000
+ var advanceStringIndex = __webpack_require__(1530);
6001
+ var getMethod = __webpack_require__(8173);
6002
+ var getSubstitution = __webpack_require__(647);
6003
+ var regExpExec = __webpack_require__(7651);
6004
+ var wellKnownSymbol = __webpack_require__(5112);
6005
+
6006
+ var REPLACE = wellKnownSymbol('replace');
6007
+ var max = Math.max;
6008
+ var min = Math.min;
6009
+ var concat = uncurryThis([].concat);
6010
+ var push = uncurryThis([].push);
6011
+ var stringIndexOf = uncurryThis(''.indexOf);
6012
+ var stringSlice = uncurryThis(''.slice);
6013
+
6014
+ var maybeToString = function (it) {
6015
+ return it === undefined ? it : String(it);
6016
+ };
6017
+
6018
+ // IE <= 11 replaces $0 with the whole match, as if it was $&
6019
+ // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
6020
+ var REPLACE_KEEPS_$0 = (function () {
6021
+ // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
6022
+ return 'a'.replace(/./, '$0') === '$0';
6023
+ })();
6024
+
6025
+ // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
6026
+ var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
6027
+ if (/./[REPLACE]) {
6028
+ return /./[REPLACE]('a', '$0') === '';
6029
+ }
6030
+ return false;
6031
+ })();
6032
+
6033
+ var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
6034
+ var re = /./;
6035
+ re.exec = function () {
6036
+ var result = [];
6037
+ result.groups = { a: '7' };
6038
+ return result;
6039
+ };
6040
+ // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
6041
+ return ''.replace(re, '$<a>') !== '7';
6042
+ });
6043
+
6044
+ // @@replace logic
6045
+ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
6046
+ var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
6047
+
6048
+ return [
6049
+ // `String.prototype.replace` method
6050
+ // https://tc39.es/ecma262/#sec-string.prototype.replace
6051
+ function replace(searchValue, replaceValue) {
6052
+ var O = requireObjectCoercible(this);
6053
+ var replacer = isNullOrUndefined(searchValue) ? undefined : getMethod(searchValue, REPLACE);
6054
+ return replacer
6055
+ ? call(replacer, searchValue, O, replaceValue)
6056
+ : call(nativeReplace, toString(O), searchValue, replaceValue);
6057
+ },
6058
+ // `RegExp.prototype[@@replace]` method
6059
+ // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
6060
+ function (string, replaceValue) {
6061
+ var rx = anObject(this);
6062
+ var S = toString(string);
6063
+
6064
+ if (
6065
+ typeof replaceValue == 'string' &&
6066
+ stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
6067
+ stringIndexOf(replaceValue, '$<') === -1
6068
+ ) {
6069
+ var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
6070
+ if (res.done) return res.value;
6071
+ }
6072
+
6073
+ var functionalReplace = isCallable(replaceValue);
6074
+ if (!functionalReplace) replaceValue = toString(replaceValue);
6075
+
6076
+ var global = rx.global;
6077
+ if (global) {
6078
+ var fullUnicode = rx.unicode;
6079
+ rx.lastIndex = 0;
6080
+ }
6081
+ var results = [];
6082
+ while (true) {
6083
+ var result = regExpExec(rx, S);
6084
+ if (result === null) break;
6085
+
6086
+ push(results, result);
6087
+ if (!global) break;
6088
+
6089
+ var matchStr = toString(result[0]);
6090
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
6091
+ }
6092
+
6093
+ var accumulatedResult = '';
6094
+ var nextSourcePosition = 0;
6095
+ for (var i = 0; i < results.length; i++) {
6096
+ result = results[i];
6097
+
6098
+ var matched = toString(result[0]);
6099
+ var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
6100
+ var captures = [];
6101
+ // NOTE: This is equivalent to
6102
+ // captures = result.slice(1).map(maybeToString)
6103
+ // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
6104
+ // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
6105
+ // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
6106
+ for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
6107
+ var namedCaptures = result.groups;
6108
+ if (functionalReplace) {
6109
+ var replacerArgs = concat([matched], captures, position, S);
6110
+ if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
6111
+ var replacement = toString(apply(replaceValue, undefined, replacerArgs));
6112
+ } else {
6113
+ replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
6114
+ }
6115
+ if (position >= nextSourcePosition) {
6116
+ accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement;
6117
+ nextSourcePosition = position + matched.length;
6118
+ }
6119
+ }
6120
+ return accumulatedResult + stringSlice(S, nextSourcePosition);
6121
+ }
6122
+ ];
6123
+ }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
6124
+
6125
+
5930
6126
  /***/ }),
5931
6127
 
5932
6128
  /***/ 3123:
@@ -7289,7 +7485,7 @@ var defaultOptions = [].concat(allProps).reduce(function (prv, crr) {
7289
7485
  /* harmony default export */ var utils = ({
7290
7486
  options: _objectSpread2({}, defaultOptions)
7291
7487
  });
7292
- ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/vue-tel-input.vue?vue&type=template&id=68d31ada&
7488
+ ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/vue-tel-input.vue?vue&type=template&id=2da290d5&
7293
7489
 
7294
7490
 
7295
7491
 
@@ -7375,6 +7571,9 @@ var render = function render() {
7375
7571
  "click": function click($event) {
7376
7572
  $event.stopPropagation();
7377
7573
  },
7574
+ "keydown": function keydown($event) {
7575
+ $event.stopPropagation();
7576
+ },
7378
7577
  "input": function input($event) {
7379
7578
  if ($event.target.composing) return;
7380
7579
  _vm.searchQuery = $event.target.value;
@@ -7545,7 +7744,7 @@ var render = function render() {
7545
7744
 
7546
7745
  var staticRenderFns = [];
7547
7746
 
7548
- ;// CONCATENATED MODULE: ./src/components/vue-tel-input.vue?vue&type=template&id=68d31ada&
7747
+ ;// CONCATENATED MODULE: ./src/components/vue-tel-input.vue?vue&type=template&id=2da290d5&
7549
7748
 
7550
7749
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
7551
7750
 
@@ -7577,6 +7776,8 @@ function _nonIterableSpread() {
7577
7776
  function _toConsumableArray(arr) {
7578
7777
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
7579
7778
  }
7779
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.replace.js
7780
+ var es_string_replace = __webpack_require__(5306);
7580
7781
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.string.trim.js
7581
7782
  var es_string_trim = __webpack_require__(3210);
7582
7783
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.array.find.js
@@ -10688,6 +10889,7 @@ var _excluded = ["metadata"];
10688
10889
 
10689
10890
 
10690
10891
 
10892
+
10691
10893
 
10692
10894
 
10693
10895
  function getDefault(key) {
@@ -10872,8 +11074,6 @@ function getDefault(key) {
10872
11074
  return this.allCountries;
10873
11075
  },
10874
11076
  sortedCountries: function sortedCountries() {
10875
- var _this2 = this;
10876
-
10877
11077
  // Sort the list countries: from preferred countries to all countries
10878
11078
  var preferredCountries = this.getCountries(this.preferredCountries).map(function (country) {
10879
11079
  return _objectSpread2(_objectSpread2({}, country), {}, {
@@ -10886,8 +11086,10 @@ function getDefault(key) {
10886
11086
  return countriesList;
10887
11087
  }
10888
11088
 
11089
+ var userInput = this.searchQuery;
11090
+ var cleanInput = userInput.replace(/[~`!@#$%^&*()+={}\[\];:\'\"<>.,\/\\\?-_]|^0{2,}/g, '');
10889
11091
  return countriesList.filter(function (c) {
10890
- 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);
11092
+ return new RegExp(cleanInput, 'i').test(c.name) || new RegExp(cleanInput, 'i').test(c.iso2) || new RegExp(cleanInput, 'i').test(c.dialCode);
10891
11093
  });
10892
11094
  },
10893
11095
  phoneObject: function phoneObject() {
@@ -10964,7 +11166,7 @@ function getDefault(key) {
10964
11166
  this.$emit('validate', this.phoneObject);
10965
11167
  },
10966
11168
  'phoneObject.formatted': function phoneObjectFormatted(value) {
10967
- var _this3 = this;
11169
+ var _this2 = this;
10968
11170
 
10969
11171
  if (!this.autoFormat || this.customValidate) {
10970
11172
  return;
@@ -10973,8 +11175,8 @@ function getDefault(key) {
10973
11175
  this.emitInput(value);
10974
11176
  this.$nextTick(function () {
10975
11177
  // In case `v-model` is not set, we need to update the `phone` to be new formatted value
10976
- if (value && !_this3.value) {
10977
- _this3.phone = value;
11178
+ if (value && !_this2.value) {
11179
+ _this2.phone = value;
10978
11180
  }
10979
11181
  });
10980
11182
  },
@@ -10985,13 +11187,13 @@ function getDefault(key) {
10985
11187
  this.resetPlaceholder();
10986
11188
  },
10987
11189
  value: function value(_value, oldValue) {
10988
- var _this4 = this;
11190
+ var _this3 = this;
10989
11191
 
10990
11192
  if (!this.testCharacters()) {
10991
11193
  this.$nextTick(function () {
10992
- _this4.phone = oldValue;
11194
+ _this3.phone = oldValue;
10993
11195
 
10994
- _this4.onInput();
11196
+ _this3.onInput();
10995
11197
  });
10996
11198
  } else {
10997
11199
  this.phone = _value;
@@ -11008,7 +11210,7 @@ function getDefault(key) {
11008
11210
  }
11009
11211
  },
11010
11212
  mounted: function mounted() {
11011
- var _this5 = this;
11213
+ var _this4 = this;
11012
11214
 
11013
11215
  if (this.value) {
11014
11216
  this.phone = this.value.trim();
@@ -11016,15 +11218,15 @@ function getDefault(key) {
11016
11218
 
11017
11219
  this.cleanInvalidCharacters();
11018
11220
  this.initializeCountry().then(function () {
11019
- var _this5$inputOptions;
11221
+ var _this4$inputOptions;
11020
11222
 
11021
- if (!_this5.phone && (_this5$inputOptions = _this5.inputOptions) !== null && _this5$inputOptions !== void 0 && _this5$inputOptions.showDialCode && _this5.activeCountryCode) {
11022
- _this5.phone = "+".concat(_this5.activeCountryCode);
11223
+ if (!_this4.phone && (_this4$inputOptions = _this4.inputOptions) !== null && _this4$inputOptions !== void 0 && _this4$inputOptions.showDialCode && _this4.activeCountryCode) {
11224
+ _this4.phone = "+".concat(_this4.activeCountryCode);
11023
11225
  }
11024
11226
 
11025
- _this5.$emit('validate', _this5.phoneObject);
11227
+ _this4.$emit('validate', _this4.phoneObject);
11026
11228
  }).catch(console.error).then(function () {
11027
- _this5.finishMounted = true;
11229
+ _this4.finishMounted = true;
11028
11230
  });
11029
11231
  },
11030
11232
  methods: {
@@ -11043,15 +11245,15 @@ function getDefault(key) {
11043
11245
  // .catch(console.error);
11044
11246
  },
11045
11247
  initializeCountry: function initializeCountry() {
11046
- var _this6 = this;
11248
+ var _this5 = this;
11047
11249
 
11048
11250
  return new Promise(function (resolve) {
11049
- var _this6$phone;
11251
+ var _this5$phone;
11050
11252
 
11051
11253
  /**
11052
11254
  * 1. If the phone included prefix (i.e. +12), try to get the country and set it
11053
11255
  */
11054
- if (((_this6$phone = _this6.phone) === null || _this6$phone === void 0 ? void 0 : _this6$phone[0]) === '+') {
11256
+ if (((_this5$phone = _this5.phone) === null || _this5$phone === void 0 ? void 0 : _this5$phone[0]) === '+') {
11055
11257
  resolve();
11056
11258
  return;
11057
11259
  }
@@ -11060,19 +11262,19 @@ function getDefault(key) {
11060
11262
  */
11061
11263
 
11062
11264
 
11063
- if (_this6.defaultCountry) {
11064
- if (typeof _this6.defaultCountry === 'string') {
11065
- _this6.choose(_this6.defaultCountry);
11265
+ if (_this5.defaultCountry) {
11266
+ if (typeof _this5.defaultCountry === 'string') {
11267
+ _this5.choose(_this5.defaultCountry);
11066
11268
 
11067
11269
  resolve();
11068
11270
  return;
11069
11271
  }
11070
11272
 
11071
- if (typeof _this6.defaultCountry === 'number') {
11072
- var country = _this6.findCountryByDialCode(_this6.defaultCountry);
11273
+ if (typeof _this5.defaultCountry === 'number') {
11274
+ var country = _this5.findCountryByDialCode(_this5.defaultCountry);
11073
11275
 
11074
11276
  if (country) {
11075
- _this6.choose(country.iso2);
11277
+ _this5.choose(country.iso2);
11076
11278
 
11077
11279
  resolve();
11078
11280
  return;
@@ -11080,21 +11282,21 @@ function getDefault(key) {
11080
11282
  }
11081
11283
  }
11082
11284
 
11083
- var fallbackCountry = _this6.preferredCountries[0] || _this6.filteredCountries[0];
11285
+ var fallbackCountry = _this5.preferredCountries[0] || _this5.filteredCountries[0];
11084
11286
  /**
11085
11287
  * 3. Check if fetching country based on user's IP is allowed, set it as the default country
11086
11288
  */
11087
11289
 
11088
- if (_this6.autoDefaultCountry) {
11290
+ if (_this5.autoDefaultCountry) {
11089
11291
  getCountry().then(function (res) {
11090
- _this6.choose(res || _this6.activeCountryCode);
11292
+ _this5.choose(res || _this5.activeCountryCode);
11091
11293
  }).catch(function (error) {
11092
11294
  console.warn(error);
11093
11295
  /**
11094
11296
  * 4. Use the first country from preferred list (if available) or all countries list
11095
11297
  */
11096
11298
 
11097
- _this6.choose(fallbackCountry);
11299
+ _this5.choose(fallbackCountry);
11098
11300
  }).then(function () {
11099
11301
  resolve();
11100
11302
  });
@@ -11102,7 +11304,7 @@ function getDefault(key) {
11102
11304
  /**
11103
11305
  * 4. Use the first country from preferred list (if available) or all countries list
11104
11306
  */
11105
- _this6.choose(fallbackCountry);
11307
+ _this5.choose(fallbackCountry);
11106
11308
 
11107
11309
  resolve();
11108
11310
  }
@@ -11113,11 +11315,11 @@ function getDefault(key) {
11113
11315
  * Get the list of countries from the list of iso2 code
11114
11316
  */
11115
11317
  getCountries: function getCountries() {
11116
- var _this7 = this;
11318
+ var _this6 = this;
11117
11319
 
11118
11320
  var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
11119
11321
  return list.map(function (countryCode) {
11120
- return _this7.findCountry(countryCode);
11322
+ return _this6.findCountry(countryCode);
11121
11323
  }).filter(Boolean);
11122
11324
  },
11123
11325
  findCountry: function findCountry() {
@@ -11250,7 +11452,7 @@ function getDefault(key) {
11250
11452
  this.open = false;
11251
11453
  },
11252
11454
  keyboardNav: function keyboardNav(e) {
11253
- var _this8 = this;
11455
+ var _this7 = this;
11254
11456
 
11255
11457
  if (e.keyCode === 40) {
11256
11458
  // down arrow
@@ -11299,11 +11501,11 @@ function getDefault(key) {
11299
11501
  this.typeToFindInput += e.key;
11300
11502
  clearTimeout(this.typeToFindTimer);
11301
11503
  this.typeToFindTimer = setTimeout(function () {
11302
- _this8.typeToFindInput = '';
11504
+ _this7.typeToFindInput = '';
11303
11505
  }, 700); // don't include preferred countries so we jump to the right place in the alphabet
11304
11506
 
11305
11507
  var typedCountryI = this.sortedCountries.slice(this.preferredCountries.length).findIndex(function (c) {
11306
- return c.name.toLowerCase().startsWith(_this8.typeToFindInput);
11508
+ return c.name.toLowerCase().startsWith(_this7.typeToFindInput);
11307
11509
  });
11308
11510
 
11309
11511
  if (typedCountryI >= 0) {