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.
@@ -29,6 +29,11 @@
29
29
  .vti__dropdown.open {
30
30
  background-color: #f3f3f3;
31
31
  }
32
+ .vti__dropdown.disabled {
33
+ cursor: no-drop;
34
+ outline: none;
35
+ background-color: #f3f3f3;
36
+ }
32
37
  .vti__dropdown:hover {
33
38
  background-color: #f3f3f3;
34
39
  }
@@ -346,6 +346,12 @@ var allProps = [{
346
346
  type: Object,
347
347
  description: 'Options for dropdown, see below',
348
348
  inDemo: false
349
+ }, {
350
+ name: 'dropdownOptions.disabled',
351
+ default: false,
352
+ type: Boolean,
353
+ description: 'Disable dropdown',
354
+ inDemo: false
349
355
  }, {
350
356
  name: 'dropdownOptions.showDialCodeInList',
351
357
  default: true,
@@ -401,6 +407,12 @@ var allProps = [{
401
407
  // inDemo: false,
402
408
  // },
403
409
  {
410
+ name: 'inputOptions.aria-describedby',
411
+ default: '',
412
+ type: String,
413
+ description: 'Native input <code>aria-describedby</code> attribute',
414
+ inDemo: false
415
+ }, {
404
416
  name: 'inputOptions.id',
405
417
  default: '',
406
418
  type: String,
@@ -418,6 +430,12 @@ var allProps = [{
418
430
  type: String,
419
431
  description: 'Native input <code>name</code> attribute',
420
432
  inDemo: false
433
+ }, {
434
+ name: 'inputOptions.showDialCode',
435
+ default: false,
436
+ type: Boolean,
437
+ description: 'Show dial code in input',
438
+ inDemo: false
421
439
  }, {
422
440
  name: 'inputOptions.placeholder',
423
441
  default: 'Enter a phone number',
@@ -5142,7 +5160,7 @@ var es_function_name = __webpack_require__("b0c0");
5142
5160
  // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
5143
5161
  var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf");
5144
5162
 
5145
- // 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
5163
+ // 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
5146
5164
 
5147
5165
 
5148
5166
  var _hoisted_1 = {
@@ -5166,19 +5184,28 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
5166
5184
  disabled: $props.disabled
5167
5185
  }]
5168
5186
  }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])("div", {
5187
+ "aria-label": "Country Code Selector",
5188
+ "aria-haspopup": "listbox",
5189
+ "aria-expanded": $data.open,
5190
+ role: "button",
5169
5191
  class: ['vti__dropdown', {
5170
- open: $data.open
5192
+ open: $data.open,
5193
+ disabled: $props.dropdownOptions.disabled
5171
5194
  }],
5172
5195
  tabindex: $props.dropdownOptions.tabindex,
5173
- onKeydown: [_cache[2] || (_cache[2] = function () {
5196
+ onKeydown: [_cache[1] || (_cache[1] = function () {
5174
5197
  return $options.keyboardNav && $options.keyboardNav.apply($options, arguments);
5175
- }), _cache[4] || (_cache[4] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5198
+ }), _cache[3] || (_cache[3] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5199
+ return $options.toggleDropdown && $options.toggleDropdown.apply($options, arguments);
5200
+ }, ["space"])), _cache[4] || (_cache[4] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5201
+ return $options.reset && $options.reset.apply($options, arguments);
5202
+ }, ["esc"])), _cache[5] || (_cache[5] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5176
5203
  return $options.reset && $options.reset.apply($options, arguments);
5177
- }, ["esc"]))],
5178
- onClick: _cache[3] || (_cache[3] = function () {
5204
+ }, ["tab"]))],
5205
+ onClick: _cache[2] || (_cache[2] = function () {
5179
5206
  return $options.toggleDropdown && $options.toggleDropdown.apply($options, arguments);
5180
5207
  })
5181
- }, [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", {
5208
+ }, [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", {
5182
5209
  key: 0,
5183
5210
  class: ['vti__flag', $data.activeCountryCode.toLowerCase()]
5184
5211
  }, 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", {
@@ -5188,23 +5215,27 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
5188
5215
  })]), $data.open ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("ul", {
5189
5216
  key: 0,
5190
5217
  ref: "list",
5191
- class: ["vti__dropdown-list", $data.dropdownOpenDirection]
5192
- }, [_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) {
5218
+ class: ["vti__dropdown-list", $data.dropdownOpenDirection],
5219
+ role: "listbox"
5220
+ }, [(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) {
5193
5221
  return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("li", {
5222
+ role: "option",
5194
5223
  class: ['vti__dropdown-item', $options.getItemClass(index, pb.iso2)],
5195
5224
  key: pb.iso2 + (pb.preferred ? '-preferred' : ''),
5225
+ tabindex: "-1",
5196
5226
  onClick: function onClick($event) {
5197
5227
  return $options.choose(pb);
5198
5228
  },
5199
5229
  onMousemove: function onMousemove($event) {
5200
5230
  return $data.selectedIndex = index;
5201
- }
5202
- }, [$props.dropdownOptions.showFlags ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("div", {
5231
+ },
5232
+ "aria-selected": $data.activeCountryCode === pb.iso2 && !pb.preferred
5233
+ }, [$props.dropdownOptions.showFlags ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])("span", {
5203
5234
  key: 0,
5204
5235
  class: ['vti__flag', pb.iso2.toLowerCase()]
5205
- }, 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"]);
5206
- }), 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", {
5207
- "onUpdate:modelValue": _cache[5] || (_cache[5] = function ($event) {
5236
+ }, 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"]);
5237
+ }), 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", {
5238
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = function ($event) {
5208
5239
  return $data.phone = $event;
5209
5240
  }),
5210
5241
  ref: "input",
@@ -5221,23 +5252,24 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
5221
5252
  required: $props.inputOptions.required,
5222
5253
  tabindex: $props.inputOptions.tabindex,
5223
5254
  value: $props.modelValue,
5224
- onBlur: _cache[6] || (_cache[6] = function () {
5255
+ "aria-describedby": $props.inputOptions['aria-describedby'],
5256
+ onBlur: _cache[7] || (_cache[7] = function () {
5225
5257
  return $options.onBlur && $options.onBlur.apply($options, arguments);
5226
5258
  }),
5227
- onFocus: _cache[7] || (_cache[7] = function () {
5259
+ onFocus: _cache[8] || (_cache[8] = function () {
5228
5260
  return $options.onFocus && $options.onFocus.apply($options, arguments);
5229
5261
  }),
5230
- onInput: _cache[8] || (_cache[8] = function () {
5262
+ onInput: _cache[9] || (_cache[9] = function () {
5231
5263
  return $options.onInput && $options.onInput.apply($options, arguments);
5232
5264
  }),
5233
- onKeyup: [_cache[9] || (_cache[9] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5265
+ onKeyup: [_cache[10] || (_cache[10] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5234
5266
  return $options.onEnter && $options.onEnter.apply($options, arguments);
5235
- }, ["enter"])), _cache[10] || (_cache[10] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5267
+ }, ["enter"])), _cache[11] || (_cache[11] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withKeys"])(function () {
5236
5268
  return $options.onSpace && $options.onSpace.apply($options, arguments);
5237
5269
  }, ["space"]))]
5238
- }, 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);
5270
+ }, 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);
5239
5271
  }
5240
- // CONCATENATED MODULE: ./src/components/vue-tel-input.vue?vue&type=template&id=7c6f2bec
5272
+ // CONCATENATED MODULE: ./src/components/vue-tel-input.vue?vue&type=template&id=e63ac01c
5241
5273
 
5242
5274
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules
5243
5275
  var objectWithoutProperties = __webpack_require__("15fd");
@@ -8584,7 +8616,7 @@ function getDefault(key) {
8584
8616
  }
8585
8617
  },
8586
8618
  'phoneObject.countryCode': function phoneObjectCountryCode(value) {
8587
- this.activeCountryCode = value;
8619
+ this.activeCountryCode = value || '';
8588
8620
  },
8589
8621
  'phoneObject.valid': function phoneObjectValid() {
8590
8622
  this.$emit('validate', this.phoneObject);
@@ -8675,8 +8707,8 @@ function getDefault(key) {
8675
8707
  var _this5$phone;
8676
8708
 
8677
8709
  /**
8678
- * 1. If the phone included prefix (i.e. +12), try to get the country and set it
8679
- */
8710
+ * 1. If the phone included prefix (i.e. +12), try to get the country and set it
8711
+ */
8680
8712
  if (((_this5$phone = _this5.phone) === null || _this5$phone === void 0 ? void 0 : _this5$phone[0]) === '+') {
8681
8713
  resolve();
8682
8714
  return;
@@ -8726,8 +8758,8 @@ function getDefault(key) {
8726
8758
  });
8727
8759
  } else {
8728
8760
  /**
8729
- * 4. Use the first country from preferred list (if available) or all countries list
8730
- */
8761
+ * 4. Use the first country from preferred list (if available) or all countries list
8762
+ */
8731
8763
  _this5.choose(fallbackCountry);
8732
8764
 
8733
8765
  resolve();
@@ -8792,11 +8824,12 @@ function getDefault(key) {
8792
8824
  if ((_this$inputOptions = this.inputOptions) !== null && _this$inputOptions !== void 0 && _this$inputOptions.showDialCode && parsedCountry) {
8793
8825
  // Reset phone if the showDialCode is set
8794
8826
  this.phone = "+".concat(parsedCountry.dialCode);
8827
+ this.activeCountryCode = parsedCountry.iso2 || '';
8795
8828
  return;
8796
8829
  } // update value, even if international mode is NOT used
8797
8830
 
8798
8831
 
8799
- this.activeCountryCode = parsedCountry.iso2;
8832
+ this.activeCountryCode = parsedCountry.iso2 || '';
8800
8833
  this.emitInput(this.phone);
8801
8834
  },
8802
8835
  cleanInvalidCharacters: function cleanInvalidCharacters() {
@@ -8863,7 +8896,7 @@ function getDefault(key) {
8863
8896
  this.$refs.input.focus();
8864
8897
  },
8865
8898
  toggleDropdown: function toggleDropdown() {
8866
- if (this.disabled) {
8899
+ if (this.disabled || this.dropdownOptions.disabled) {
8867
8900
  return;
8868
8901
  }
8869
8902
 
@@ -8887,6 +8920,7 @@ function getDefault(key) {
8887
8920
  }
8888
8921
 
8889
8922
  var selEle = this.$refs.list.children[this.selectedIndex];
8923
+ selEle.focus();
8890
8924
 
8891
8925
  if (selEle.offsetTop + selEle.clientHeight > this.$refs.list.scrollTop + this.$refs.list.clientHeight) {
8892
8926
  this.$refs.list.scrollTop = selEle.offsetTop - this.$refs.list.clientHeight + selEle.clientHeight;
@@ -8904,6 +8938,8 @@ function getDefault(key) {
8904
8938
 
8905
8939
  var _selEle = this.$refs.list.children[this.selectedIndex];
8906
8940
 
8941
+ _selEle.focus();
8942
+
8907
8943
  if (_selEle.offsetTop < this.$refs.list.scrollTop) {
8908
8944
  this.$refs.list.scrollTop = _selEle.offsetTop;
8909
8945
  }