vue-tel-input 6.0.0-beta.2 → 6.0.0-beta.6

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.
@@ -355,6 +355,12 @@ var allProps = [{
355
355
  type: Object,
356
356
  description: 'Options for dropdown, see below',
357
357
  inDemo: false
358
+ }, {
359
+ name: 'dropdownOptions.disabled',
360
+ default: false,
361
+ type: Boolean,
362
+ description: 'Disable dropdown',
363
+ inDemo: false
358
364
  }, {
359
365
  name: 'dropdownOptions.showDialCodeInList',
360
366
  default: true,
@@ -410,6 +416,12 @@ var allProps = [{
410
416
  // inDemo: false,
411
417
  // },
412
418
  {
419
+ name: 'inputOptions.aria-describedby',
420
+ default: '',
421
+ type: String,
422
+ description: 'Native input <code>aria-describedby</code> attribute',
423
+ inDemo: false
424
+ }, {
413
425
  name: 'inputOptions.id',
414
426
  default: '',
415
427
  type: String,
@@ -427,6 +439,12 @@ var allProps = [{
427
439
  type: String,
428
440
  description: 'Native input <code>name</code> attribute',
429
441
  inDemo: false
442
+ }, {
443
+ name: 'inputOptions.showDialCode',
444
+ default: false,
445
+ type: Boolean,
446
+ description: 'Show dial code in input',
447
+ inDemo: false
430
448
  }, {
431
449
  name: 'inputOptions.placeholder',
432
450
  default: 'Enter a phone number',
@@ -5151,7 +5169,7 @@ var es_function_name = __webpack_require__("b0c0");
5151
5169
  // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
5152
5170
  var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
5153
5171
 
5154
- // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader-v16/dist??ref--0-1!./src/components/vue-tel-input.vue?vue&type=template&id=7c6f2bec
5172
+ // CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader-v16/dist??ref--0-1!./src/components/vue-tel-input.vue?vue&type=template&id=e63ac01c
5155
5173
 
5156
5174
 
5157
5175
  var _hoisted_1 = {
@@ -5175,19 +5193,28 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
5175
5193
  disabled: $props.disabled
5176
5194
  }]
5177
5195
  }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])("div", {
5196
+ "aria-label": "Country Code Selector",
5197
+ "aria-haspopup": "listbox",
5198
+ "aria-expanded": $data.open,
5199
+ role: "button",
5178
5200
  class: ['vti__dropdown', {
5179
- open: $data.open
5201
+ open: $data.open,
5202
+ disabled: $props.dropdownOptions.disabled
5180
5203
  }],
5181
5204
  tabindex: $props.dropdownOptions.tabindex,
5182
- onKeydown: [_cache[2] || (_cache[2] = function () {
5205
+ onKeydown: [_cache[1] || (_cache[1] = function () {
5183
5206
  return $options.keyboardNav && $options.keyboardNav.apply($options, arguments);
5184
- }), _cache[4] || (_cache[4] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5207
+ }), _cache[3] || (_cache[3] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5208
+ return $options.toggleDropdown && $options.toggleDropdown.apply($options, arguments);
5209
+ }, ["space"])), _cache[4] || (_cache[4] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5210
+ return $options.reset && $options.reset.apply($options, arguments);
5211
+ }, ["esc"])), _cache[5] || (_cache[5] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5185
5212
  return $options.reset && $options.reset.apply($options, arguments);
5186
- }, ["esc"]))],
5187
- onClick: _cache[3] || (_cache[3] = function () {
5213
+ }, ["tab"]))],
5214
+ onClick: _cache[2] || (_cache[2] = function () {
5188
5215
  return $options.toggleDropdown && $options.toggleDropdown.apply($options, arguments);
5189
5216
  })
5190
- }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])("span", _hoisted_1, [$props.dropdownOptions.showFlags ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("div", {
5217
+ }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])("span", _hoisted_1, [$props.dropdownOptions.showFlags ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("span", {
5191
5218
  key: 0,
5192
5219
  class: ['vti__flag', $data.activeCountryCode.toLowerCase()]
5193
5220
  }, null, 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), $props.dropdownOptions.showDialCodeInSelection ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("span", _hoisted_2, " +" + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])($options.activeCountry && $options.activeCountry.dialCode), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderSlot"])(_ctx.$slots, "arrow-icon", {
@@ -5197,23 +5224,27 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
5197
5224
  })]), $data.open ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("ul", {
5198
5225
  key: 0,
5199
5226
  ref: "list",
5200
- class: ["vti__dropdown-list", $data.dropdownOpenDirection]
5201
- }, [_cache[1] || (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["setBlockTracking"])(-1), _cache[1] = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])($options.sortedCountries, function (pb, index) {
5227
+ class: ["vti__dropdown-list", $data.dropdownOpenDirection],
5228
+ role: "listbox"
5229
+ }, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])($options.sortedCountries, function (pb, index) {
5202
5230
  return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("li", {
5231
+ role: "option",
5203
5232
  class: ['vti__dropdown-item', $options.getItemClass(index, pb.iso2)],
5204
5233
  key: pb.iso2 + (pb.preferred ? '-preferred' : ''),
5234
+ tabindex: "-1",
5205
5235
  onClick: function onClick($event) {
5206
5236
  return $options.choose(pb);
5207
5237
  },
5208
5238
  onMousemove: function onMousemove($event) {
5209
5239
  return $data.selectedIndex = index;
5210
- }
5211
- }, [$props.dropdownOptions.showFlags ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("div", {
5240
+ },
5241
+ "aria-selected": $data.activeCountryCode === pb.iso2 && !pb.preferred
5242
+ }, [$props.dropdownOptions.showFlags ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("span", {
5212
5243
  key: 0,
5213
5244
  class: ['vti__flag', pb.iso2.toLowerCase()]
5214
- }, null, 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(pb.name), 1), $props.dropdownOptions.showDialCodeInList ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("span", _hoisted_4, " +" + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(pb.dialCode), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 42, ["onClick", "onMousemove"]);
5215
- }), 128)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["setBlockTracking"])(1), _cache[1])], 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 42, ["tabindex"]), [[_directive_click_outside, $options.clickedOutside]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])("input", {
5216
- "onUpdate:modelValue": _cache[5] || (_cache[5] = function ($event) {
5245
+ }, null, 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(pb.name), 1), $props.dropdownOptions.showDialCodeInList ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("span", _hoisted_4, " +" + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(pb.dialCode), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 42, ["onClick", "onMousemove", "aria-selected"]);
5246
+ }), 128))], 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 42, ["aria-expanded", "tabindex"]), [[_directive_click_outside, $options.clickedOutside]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])("input", {
5247
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = function ($event) {
5217
5248
  return $data.phone = $event;
5218
5249
  }),
5219
5250
  ref: "input",
@@ -5230,23 +5261,24 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
5230
5261
  required: $props.inputOptions.required,
5231
5262
  tabindex: $props.inputOptions.tabindex,
5232
5263
  value: $props.modelValue,
5233
- onBlur: _cache[6] || (_cache[6] = function () {
5264
+ "aria-describedby": $props.inputOptions['aria-describedby'],
5265
+ onBlur: _cache[7] || (_cache[7] = function () {
5234
5266
  return $options.onBlur && $options.onBlur.apply($options, arguments);
5235
5267
  }),
5236
- onFocus: _cache[7] || (_cache[7] = function () {
5268
+ onFocus: _cache[8] || (_cache[8] = function () {
5237
5269
  return $options.onFocus && $options.onFocus.apply($options, arguments);
5238
5270
  }),
5239
- onInput: _cache[8] || (_cache[8] = function () {
5271
+ onInput: _cache[9] || (_cache[9] = function () {
5240
5272
  return $options.onInput && $options.onInput.apply($options, arguments);
5241
5273
  }),
5242
- onKeyup: [_cache[9] || (_cache[9] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5274
+ onKeyup: [_cache[10] || (_cache[10] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5243
5275
  return $options.onEnter && $options.onEnter.apply($options, arguments);
5244
- }, ["enter"])), _cache[10] || (_cache[10] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5276
+ }, ["enter"])), _cache[11] || (_cache[11] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5245
5277
  return $options.onSpace && $options.onSpace.apply($options, arguments);
5246
5278
  }, ["space"]))]
5247
- }, null, 42, ["type", "autocomplete", "autofocus", "disabled", "id", "maxlength", "name", "placeholder", "readonly", "required", "tabindex", "value"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vModelDynamic"], $data.phone]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderSlot"])(_ctx.$slots, "icon-right")], 2);
5279
+ }, null, 42, ["type", "autocomplete", "autofocus", "disabled", "id", "maxlength", "name", "placeholder", "readonly", "required", "tabindex", "value", "aria-describedby"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vModelDynamic"], $data.phone]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderSlot"])(_ctx.$slots, "icon-right")], 2);
5248
5280
  }
5249
- // CONCATENATED MODULE: ./src/components/vue-tel-input.vue?vue&type=template&id=7c6f2bec
5281
+ // CONCATENATED MODULE: ./src/components/vue-tel-input.vue?vue&type=template&id=e63ac01c
5250
5282
 
5251
5283
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules
5252
5284
  var objectWithoutProperties = __webpack_require__("15fd");
@@ -8593,7 +8625,7 @@ function getDefault(key) {
8593
8625
  }
8594
8626
  },
8595
8627
  'phoneObject.countryCode': function phoneObjectCountryCode(value) {
8596
- this.activeCountryCode = value;
8628
+ this.activeCountryCode = value || '';
8597
8629
  },
8598
8630
  'phoneObject.valid': function phoneObjectValid() {
8599
8631
  this.$emit('validate', this.phoneObject);
@@ -8684,8 +8716,8 @@ function getDefault(key) {
8684
8716
  var _this5$phone;
8685
8717
 
8686
8718
  /**
8687
- * 1. If the phone included prefix (i.e. +12), try to get the country and set it
8688
- */
8719
+ * 1. If the phone included prefix (i.e. +12), try to get the country and set it
8720
+ */
8689
8721
  if (((_this5$phone = _this5.phone) === null || _this5$phone === void 0 ? void 0 : _this5$phone[0]) === '+') {
8690
8722
  resolve();
8691
8723
  return;
@@ -8735,8 +8767,8 @@ function getDefault(key) {
8735
8767
  });
8736
8768
  } else {
8737
8769
  /**
8738
- * 4. Use the first country from preferred list (if available) or all countries list
8739
- */
8770
+ * 4. Use the first country from preferred list (if available) or all countries list
8771
+ */
8740
8772
  _this5.choose(fallbackCountry);
8741
8773
 
8742
8774
  resolve();
@@ -8801,11 +8833,12 @@ function getDefault(key) {
8801
8833
  if ((_this$inputOptions = this.inputOptions) !== null && _this$inputOptions !== void 0 && _this$inputOptions.showDialCode && parsedCountry) {
8802
8834
  // Reset phone if the showDialCode is set
8803
8835
  this.phone = "+".concat(parsedCountry.dialCode);
8836
+ this.activeCountryCode = parsedCountry.iso2 || '';
8804
8837
  return;
8805
8838
  } // update value, even if international mode is NOT used
8806
8839
 
8807
8840
 
8808
- this.activeCountryCode = parsedCountry.iso2;
8841
+ this.activeCountryCode = parsedCountry.iso2 || '';
8809
8842
  this.emitInput(this.phone);
8810
8843
  },
8811
8844
  cleanInvalidCharacters: function cleanInvalidCharacters() {
@@ -8872,7 +8905,7 @@ function getDefault(key) {
8872
8905
  this.$refs.input.focus();
8873
8906
  },
8874
8907
  toggleDropdown: function toggleDropdown() {
8875
- if (this.disabled) {
8908
+ if (this.disabled || this.dropdownOptions.disabled) {
8876
8909
  return;
8877
8910
  }
8878
8911
 
@@ -8896,6 +8929,7 @@ function getDefault(key) {
8896
8929
  }
8897
8930
 
8898
8931
  var selEle = this.$refs.list.children[this.selectedIndex];
8932
+ selEle.focus();
8899
8933
 
8900
8934
  if (selEle.offsetTop + selEle.clientHeight > this.$refs.list.scrollTop + this.$refs.list.clientHeight) {
8901
8935
  this.$refs.list.scrollTop = selEle.offsetTop - this.$refs.list.clientHeight + selEle.clientHeight;
@@ -8913,6 +8947,8 @@ function getDefault(key) {
8913
8947
 
8914
8948
  var _selEle = this.$refs.list.children[this.selectedIndex];
8915
8949
 
8950
+ _selEle.focus();
8951
+
8916
8952
  if (_selEle.offsetTop < this.$refs.list.scrollTop) {
8917
8953
  this.$refs.list.scrollTop = _selEle.offsetTop;
8918
8954
  }