@intl-tel-input/angular 29.3.0 → 29.4.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Angular component for intl-tel-input
2
2
 
3
- For entering, formatting, and validating international telephone numbers.
3
+ For entering, formatting, and validating international telephone numbers. Requires Angular 17 or later.
4
4
 
5
5
  [Explore docs »](https://intl-tel-input.com/docs/angular-component)
6
6
 
@@ -33,6 +33,7 @@ declare class IntlTelInput implements AfterViewInit, OnDestroy, OnChanges, Contr
33
33
  excludeCountries?: AllOptions["excludeCountries"];
34
34
  matchDropdownWidth?: AllOptions["matchDropdownWidth"];
35
35
  formatAsYouType?: AllOptions["formatAsYouType"];
36
+ fullscreenParent?: AllOptions["fullscreenParent"];
36
37
  hiddenInputs?: AllOptions["hiddenInputs"];
37
38
  uiTranslations?: AllOptions["uiTranslations"];
38
39
  initialCountry?: AllOptions["initialCountry"];
@@ -107,6 +108,6 @@ declare class IntlTelInput implements AfterViewInit, OnDestroy, OnChanges, Contr
107
108
  validate(_control: AbstractControl): ValidationErrors | null;
108
109
  registerOnValidatorChange(fn: () => void): void;
109
110
  static ɵfac: i0.ɵɵFactoryDeclaration<IntlTelInput, never>;
110
- static ɵcmp: i0.ɵɵComponentDeclaration<IntlTelInput, "intl-tel-input", never, { "initialValue": { "alias": "initialValue"; "required": false; }; "usePreciseValidation": { "alias": "usePreciseValidation"; "required": false; }; "inputAttributes": { "alias": "inputAttributes"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "countrySelectorMode": { "alias": "countrySelectorMode"; "required": false; }; "allowedNumberTypes": { "alias": "allowedNumberTypes"; "required": false; }; "allowNumberExtensions": { "alias": "allowNumberExtensions"; "required": false; }; "allowPhonewords": { "alias": "allowPhonewords"; "required": false; }; "classNames": { "alias": "classNames"; "required": false; }; "containerClass": { "alias": "containerClass"; "required": false; }; "countryNameLocale": { "alias": "countryNameLocale"; "required": false; }; "countryNameOverrides": { "alias": "countryNameOverrides"; "required": false; }; "countryOrder": { "alias": "countryOrder"; "required": false; }; "countrySearch": { "alias": "countrySearch"; "required": false; }; "customPlaceholder": { "alias": "customPlaceholder"; "required": false; }; "dropdownAlwaysOpen": { "alias": "dropdownAlwaysOpen"; "required": false; }; "dropdownParent": { "alias": "dropdownParent"; "required": false; }; "excludeCountries": { "alias": "excludeCountries"; "required": false; }; "matchDropdownWidth": { "alias": "matchDropdownWidth"; "required": false; }; "formatAsYouType": { "alias": "formatAsYouType"; "required": false; }; "hiddenInputs": { "alias": "hiddenInputs"; "required": false; }; "uiTranslations": { "alias": "uiTranslations"; "required": false; }; "initialCountry": { "alias": "initialCountry"; "required": false; }; "initialCountryLookup": { "alias": "initialCountryLookup"; "required": false; }; "loadUtils": { "alias": "loadUtils"; "required": false; }; "numberDisplayFormat": { "alias": "numberDisplayFormat"; "required": false; }; "onlyCountries": { "alias": "onlyCountries"; "required": false; }; "placeholderNumberPolicy": { "alias": "placeholderNumberPolicy"; "required": false; }; "placeholderNumberType": { "alias": "placeholderNumberType"; "required": false; }; "searchInputClass": { "alias": "searchInputClass"; "required": false; }; "separateDialCode": { "alias": "separateDialCode"; "required": false; }; "showFlags": { "alias": "showFlags"; "required": false; }; "strictMode": { "alias": "strictMode"; "required": false; }; "strictRejectAnimation": { "alias": "strictRejectAnimation"; "required": false; }; }, { "numberChange": "numberChange"; "countryChange": "countryChange"; "validityChange": "validityChange"; "errorCodeChange": "errorCodeChange"; "openCountrySelector": "openCountrySelector"; "closeCountrySelector": "closeCountrySelector"; "strictReject": "strictReject"; "blur": "blur"; "focus": "focus"; "keydown": "keydown"; "keyup": "keyup"; "paste": "paste"; "click": "click"; }, never, never, true, never>;
111
+ static ɵcmp: i0.ɵɵComponentDeclaration<IntlTelInput, "intl-tel-input", never, { "initialValue": { "alias": "initialValue"; "required": false; }; "usePreciseValidation": { "alias": "usePreciseValidation"; "required": false; }; "inputAttributes": { "alias": "inputAttributes"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "countrySelectorMode": { "alias": "countrySelectorMode"; "required": false; }; "allowedNumberTypes": { "alias": "allowedNumberTypes"; "required": false; }; "allowNumberExtensions": { "alias": "allowNumberExtensions"; "required": false; }; "allowPhonewords": { "alias": "allowPhonewords"; "required": false; }; "classNames": { "alias": "classNames"; "required": false; }; "containerClass": { "alias": "containerClass"; "required": false; }; "countryNameLocale": { "alias": "countryNameLocale"; "required": false; }; "countryNameOverrides": { "alias": "countryNameOverrides"; "required": false; }; "countryOrder": { "alias": "countryOrder"; "required": false; }; "countrySearch": { "alias": "countrySearch"; "required": false; }; "customPlaceholder": { "alias": "customPlaceholder"; "required": false; }; "dropdownAlwaysOpen": { "alias": "dropdownAlwaysOpen"; "required": false; }; "dropdownParent": { "alias": "dropdownParent"; "required": false; }; "excludeCountries": { "alias": "excludeCountries"; "required": false; }; "matchDropdownWidth": { "alias": "matchDropdownWidth"; "required": false; }; "formatAsYouType": { "alias": "formatAsYouType"; "required": false; }; "fullscreenParent": { "alias": "fullscreenParent"; "required": false; }; "hiddenInputs": { "alias": "hiddenInputs"; "required": false; }; "uiTranslations": { "alias": "uiTranslations"; "required": false; }; "initialCountry": { "alias": "initialCountry"; "required": false; }; "initialCountryLookup": { "alias": "initialCountryLookup"; "required": false; }; "loadUtils": { "alias": "loadUtils"; "required": false; }; "numberDisplayFormat": { "alias": "numberDisplayFormat"; "required": false; }; "onlyCountries": { "alias": "onlyCountries"; "required": false; }; "placeholderNumberPolicy": { "alias": "placeholderNumberPolicy"; "required": false; }; "placeholderNumberType": { "alias": "placeholderNumberType"; "required": false; }; "searchInputClass": { "alias": "searchInputClass"; "required": false; }; "separateDialCode": { "alias": "separateDialCode"; "required": false; }; "showFlags": { "alias": "showFlags"; "required": false; }; "strictMode": { "alias": "strictMode"; "required": false; }; "strictRejectAnimation": { "alias": "strictRejectAnimation"; "required": false; }; }, { "numberChange": "numberChange"; "countryChange": "countryChange"; "validityChange": "validityChange"; "errorCodeChange": "errorCodeChange"; "openCountrySelector": "openCountrySelector"; "closeCountrySelector": "closeCountrySelector"; "strictReject": "strictReject"; "blur": "blur"; "focus": "focus"; "keydown": "keydown"; "keyup": "keyup"; "paste": "paste"; "click": "click"; }, never, never, true, never>;
111
112
  }
112
113
  export default IntlTelInput;
@@ -1977,7 +1977,7 @@ var defaults = {
1977
1977
  customPlaceholder: null,
1978
1978
  //* Always show the dropdown
1979
1979
  dropdownAlwaysOpen: false,
1980
- //* Optional DOM element to append the dropdown to (used to escape ancestors with overflow:hidden, or to mount in a custom container). Only consulted in dropdown rendering; ignored when the country selector renders as a fullscreen popup.
1980
+ //* Optional DOM element to append the dropdown to (used to escape ancestors with overflow:hidden, or to mount in a custom container). Only consulted in dropdown rendering; ignored when the country selector renders as a fullscreen popup (see fullscreenParent).
1981
1981
  dropdownParent: null,
1982
1982
  //* Don't display these countries.
1983
1983
  excludeCountries: null,
@@ -1985,6 +1985,8 @@ var defaults = {
1985
1985
  matchDropdownWidth: true,
1986
1986
  //* Format the number as the user types
1987
1987
  formatAsYouType: true,
1988
+ //* Optional DOM element to append the fullscreen popup to, instead of document.body (e.g. a modal <dialog>, where a body-mounted popup would be unreachable). Only consulted in fullscreen rendering (see dropdownParent for the dropdown). Null means document.body, which is resolved on open rather than here, as document may not exist yet (e.g. SSR).
1989
+ fullscreenParent: null,
1988
1990
  //* Inject hidden inputs with the names returned from this function, and on submit, populate them with the full number and selected country iso2.
1989
1991
  hiddenInputs: null,
1990
1992
  //* Translations for the core library UI strings e.g. search input placeholder, country names.
@@ -2168,8 +2170,9 @@ var validateOptions = (customOptions) => {
2168
2170
  validatedOptions[key] = value;
2169
2171
  break;
2170
2172
  case "dropdownParent":
2173
+ case "fullscreenParent":
2171
2174
  if (value !== null && !isElLike(value)) {
2172
- warnOption("dropdownParent", "an HTMLElement or null", value);
2175
+ warnOption(key, "an HTMLElement or null", value);
2173
2176
  break;
2174
2177
  }
2175
2178
  validatedOptions[key] = value;
@@ -2733,6 +2736,9 @@ var UI = class {
2733
2736
  },
2734
2737
  this.#countrySelectorEl
2735
2738
  );
2739
+ if (!countrySearch) {
2740
+ this.#countryListEl.setAttribute("tabindex", "0");
2741
+ }
2736
2742
  this.#appendListItems();
2737
2743
  if (countrySearch) {
2738
2744
  this.#updateSearchResultsA11yText();
@@ -2753,11 +2759,12 @@ var UI = class {
2753
2759
  this.#countryContainerEl.appendChild(this.#countrySelectorEl);
2754
2760
  }
2755
2761
  }
2756
- //* Resolve the DOM element to attach the country selector to. Fullscreen always uses document.body; dropdown uses the consumer-supplied dropdownParent (if any); otherwise the country selector renders inline within the input wrapper (no detached element).
2762
+ //* Resolve the DOM element to attach the country selector to. Fullscreen is always detached: it uses the consumer-supplied fullscreenParent, falling back to document.body; dropdown uses the consumer-supplied dropdownParent (if any); otherwise the country selector renders inline within the input wrapper (no detached element).
2763
+ //* NOTE: these are deliberately two separate options. For the dropdown, setting a parent switches it from inline to detached rendering (pos:fixed, positioned against the input), whereas the fullscreen popup is detached regardless, so its parent only relocates it. Sharing one option would force a detached dropdown on anyone who only needs to move the fullscreen popup e.g. into a modal <dialog> (issue #2199).
2757
2764
  #getDetachedParent() {
2758
- const { countrySelectorMode, dropdownParent } = this.#options;
2765
+ const { countrySelectorMode, dropdownParent, fullscreenParent } = this.#options;
2759
2766
  if (countrySelectorMode === COUNTRY_SELECTOR_MODE.FULLSCREEN) {
2760
- return document.body;
2767
+ return fullscreenParent ?? document.body;
2761
2768
  }
2762
2769
  if (countrySelectorMode === COUNTRY_SELECTOR_MODE.DROPDOWN) {
2763
2770
  return dropdownParent;
@@ -2883,7 +2890,6 @@ var UI = class {
2883
2890
  const listItem = createEl("li", {
2884
2891
  id: `iti-${this.#id}__item-${c.iso2}`,
2885
2892
  class: liClass,
2886
- tabindex: "-1",
2887
2893
  role: "option",
2888
2894
  [ARIA.SELECTED]: "false"
2889
2895
  });
@@ -3075,18 +3081,20 @@ var UI = class {
3075
3081
  container.scrollTop = offsetTop - containerRect.height + elementRect.height;
3076
3082
  }
3077
3083
  }
3084
+ //* The element that holds focus while the country selector is open: the search input, or (when countrySearch is disabled) the country list itself.
3085
+ #getOpenFocusEl() {
3086
+ return this.#options.countrySearch ? this.#searchInputEl : this.#countryListEl;
3087
+ }
3078
3088
  //* Remove highlighting from the previous list item and highlight the new one.
3079
3089
  #highlightListItem(listItem, doScroll = true) {
3080
3090
  this.#highlightedListItemEl?.classList.remove(CLASSES.HIGHLIGHT);
3081
3091
  if (listItem) {
3082
3092
  listItem.classList.add(CLASSES.HIGHLIGHT);
3083
- if (this.#options.countrySearch) {
3084
- const activeDescendant = listItem.getAttribute("id") || "";
3085
- this.#searchInputEl.setAttribute(
3086
- ARIA.ACTIVE_DESCENDANT,
3087
- activeDescendant
3088
- );
3089
- }
3093
+ const activeDescendant = listItem.getAttribute("id") || "";
3094
+ this.#getOpenFocusEl().setAttribute(
3095
+ ARIA.ACTIVE_DESCENDANT,
3096
+ activeDescendant
3097
+ );
3090
3098
  if (doScroll) {
3091
3099
  this.#scrollCountryListToItem(listItem);
3092
3100
  }
@@ -3165,7 +3173,7 @@ var UI = class {
3165
3173
  //* Open the country selector: create a fresh AbortController, do the DOM work, and wire up all
3166
3174
  //* open-state listeners (which invoke the caller's onSelect / onClose callbacks).
3167
3175
  openCountrySelector(onSelect, onClose) {
3168
- const { countrySearch, dropdownAlwaysOpen } = this.#options;
3176
+ const { dropdownAlwaysOpen } = this.#options;
3169
3177
  this.#countrySelectorAbortController = new AbortController();
3170
3178
  if (this.#options.countrySelectorMode !== COUNTRY_SELECTOR_MODE.FULLSCREEN) {
3171
3179
  this.#ensureInlineDropdownSizeMeasured();
@@ -3188,10 +3196,11 @@ var UI = class {
3188
3196
  if (itemToHighlight) {
3189
3197
  this.#highlightListItem(itemToHighlight);
3190
3198
  }
3191
- if (countrySearch && !dropdownAlwaysOpen) {
3192
- this.#searchInputEl.focus();
3199
+ if (!dropdownAlwaysOpen) {
3200
+ this.#getOpenFocusEl().focus();
3193
3201
  }
3194
3202
  if (this.#options.countrySelectorMode === COUNTRY_SELECTOR_MODE.FULLSCREEN && this.#detachedCountrySelectorEl && window.visualViewport) {
3203
+ this.#adjustFullscreenPopupToViewport();
3195
3204
  window.visualViewport.addEventListener(
3196
3205
  "resize",
3197
3206
  () => {
@@ -3308,6 +3317,20 @@ var UI = class {
3308
3317
  };
3309
3318
  this.#selectedCountryEl?.addEventListener("keydown", handleKeydown, { signal });
3310
3319
  this.#countrySelectorEl?.addEventListener("keydown", handleKeydown, { signal });
3320
+ if (this.#detachedCountrySelectorEl) {
3321
+ this.#countrySelectorEl?.addEventListener(
3322
+ "keydown",
3323
+ (e) => {
3324
+ if (e.key === KEYS.TAB) {
3325
+ e.preventDefault();
3326
+ onEscape();
3327
+ const focusEl = e.shiftKey ? this.#selectedCountryEl : this.telInputEl;
3328
+ focusEl.focus();
3329
+ }
3330
+ },
3331
+ { signal }
3332
+ );
3333
+ }
3311
3334
  }
3312
3335
  //* Wire up country search input listener: typing filters the list, the clear button resets it.
3313
3336
  #bindSearchInputListener(signal) {
@@ -3405,8 +3428,8 @@ var UI = class {
3405
3428
  this.#countrySelectorAbortController = null;
3406
3429
  this.#countrySelectorEl.classList.add(CLASSES.HIDE);
3407
3430
  this.#selectedCountryEl.setAttribute(ARIA.EXPANDED, "false");
3431
+ this.#getOpenFocusEl().removeAttribute(ARIA.ACTIVE_DESCENDANT);
3408
3432
  if (countrySearch) {
3409
- this.#searchInputEl.removeAttribute(ARIA.ACTIVE_DESCENDANT);
3410
3433
  this.#searchInputEl.value = "";
3411
3434
  this.#applySearchFilter();
3412
3435
  if (this.#highlightedListItemEl) {
@@ -3419,6 +3442,7 @@ var UI = class {
3419
3442
  this.#detachedCountrySelectorEl.remove();
3420
3443
  this.#detachedCountrySelectorEl.style.top = "";
3421
3444
  this.#detachedCountrySelectorEl.style.bottom = "";
3445
+ this.#detachedCountrySelectorEl.style.height = "";
3422
3446
  this.#detachedCountrySelectorEl.style.paddingLeft = "";
3423
3447
  this.#detachedCountrySelectorEl.style.paddingRight = "";
3424
3448
  } else {
@@ -3484,8 +3508,7 @@ var UI = class {
3484
3508
  if (!vv || !this.#detachedCountrySelectorEl) {
3485
3509
  return;
3486
3510
  }
3487
- const virtualKeyboardHeight = window.innerHeight - vv.height;
3488
- this.#detachedCountrySelectorEl.style.bottom = `${virtualKeyboardHeight}px`;
3511
+ this.#detachedCountrySelectorEl.style.height = `${vv.height}px`;
3489
3512
  }
3490
3513
  // UI: Whether the country selector is currently open (visible).
3491
3514
  isCountrySelectorOpen() {
@@ -4955,7 +4978,7 @@ var intlTelInput = Object.assign(
4955
4978
  attachUtils,
4956
4979
  startedLoadingUtils: false,
4957
4980
  startedLoadingAutoCountry: false,
4958
- version: "29.3.0",
4981
+ version: "29.4.0",
4959
4982
  NUMBER_FORMAT,
4960
4983
  NUMBER_TYPE,
4961
4984
  VALIDATION_ERROR,
@@ -4997,6 +5020,7 @@ var IntlTelInput = class _IntlTelInput {
4997
5020
  excludeCountries;
4998
5021
  matchDropdownWidth;
4999
5022
  formatAsYouType;
5023
+ fullscreenParent;
5000
5024
  hiddenInputs;
5001
5025
  uiTranslations;
5002
5026
  initialCountry;
@@ -5069,6 +5093,7 @@ var IntlTelInput = class _IntlTelInput {
5069
5093
  if (this.readonly) {
5070
5094
  this.iti.setReadonly(this.readonly);
5071
5095
  }
5096
+ this.lastEmittedCountry = this.iti.getSelectedCountry()?.iso2 ?? "";
5072
5097
  this.iti.promise.then(() => {
5073
5098
  if (!this.iti?.isActive()) {
5074
5099
  return;
@@ -5105,6 +5130,7 @@ var IntlTelInput = class _IntlTelInput {
5105
5130
  excludeCountries: this.excludeCountries,
5106
5131
  matchDropdownWidth: this.matchDropdownWidth,
5107
5132
  formatAsYouType: this.formatAsYouType,
5133
+ fullscreenParent: this.fullscreenParent,
5108
5134
  hiddenInputs: this.hiddenInputs,
5109
5135
  uiTranslations: this.uiTranslations,
5110
5136
  initialCountry: this.initialCountry,
@@ -5288,7 +5314,7 @@ var IntlTelInput = class _IntlTelInput {
5288
5314
  this.onValidatorChange = fn;
5289
5315
  }
5290
5316
  static \u0275fac = i0.\u0275\u0275ngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: _IntlTelInput, deps: [], target: i0.\u0275\u0275FactoryTarget.Component });
5291
- static \u0275cmp = i0.\u0275\u0275ngDeclareComponent({ minVersion: "14.0.0", version: "21.2.7", type: _IntlTelInput, isStandalone: true, selector: "intl-tel-input", inputs: { initialValue: "initialValue", usePreciseValidation: "usePreciseValidation", inputAttributes: "inputAttributes", disabled: "disabled", readonly: "readonly", countrySelectorMode: "countrySelectorMode", allowedNumberTypes: "allowedNumberTypes", allowNumberExtensions: "allowNumberExtensions", allowPhonewords: "allowPhonewords", classNames: "classNames", containerClass: "containerClass", countryNameLocale: "countryNameLocale", countryNameOverrides: "countryNameOverrides", countryOrder: "countryOrder", countrySearch: "countrySearch", customPlaceholder: "customPlaceholder", dropdownAlwaysOpen: "dropdownAlwaysOpen", dropdownParent: "dropdownParent", excludeCountries: "excludeCountries", matchDropdownWidth: "matchDropdownWidth", formatAsYouType: "formatAsYouType", hiddenInputs: "hiddenInputs", uiTranslations: "uiTranslations", initialCountry: "initialCountry", initialCountryLookup: "initialCountryLookup", loadUtils: "loadUtils", numberDisplayFormat: "numberDisplayFormat", onlyCountries: "onlyCountries", placeholderNumberPolicy: "placeholderNumberPolicy", placeholderNumberType: "placeholderNumberType", searchInputClass: "searchInputClass", separateDialCode: "separateDialCode", showFlags: "showFlags", strictMode: "strictMode", strictRejectAnimation: "strictRejectAnimation" }, outputs: { numberChange: "numberChange", countryChange: "countryChange", validityChange: "validityChange", errorCodeChange: "errorCodeChange", openCountrySelector: "openCountrySelector", closeCountrySelector: "closeCountrySelector", strictReject: "strictReject", blur: "blur", focus: "focus", keydown: "keydown", keyup: "keyup", paste: "paste", click: "click" }, providers: [
5317
+ static \u0275cmp = i0.\u0275\u0275ngDeclareComponent({ minVersion: "14.0.0", version: "21.2.7", type: _IntlTelInput, isStandalone: true, selector: "intl-tel-input", inputs: { initialValue: "initialValue", usePreciseValidation: "usePreciseValidation", inputAttributes: "inputAttributes", disabled: "disabled", readonly: "readonly", countrySelectorMode: "countrySelectorMode", allowedNumberTypes: "allowedNumberTypes", allowNumberExtensions: "allowNumberExtensions", allowPhonewords: "allowPhonewords", classNames: "classNames", containerClass: "containerClass", countryNameLocale: "countryNameLocale", countryNameOverrides: "countryNameOverrides", countryOrder: "countryOrder", countrySearch: "countrySearch", customPlaceholder: "customPlaceholder", dropdownAlwaysOpen: "dropdownAlwaysOpen", dropdownParent: "dropdownParent", excludeCountries: "excludeCountries", matchDropdownWidth: "matchDropdownWidth", formatAsYouType: "formatAsYouType", fullscreenParent: "fullscreenParent", hiddenInputs: "hiddenInputs", uiTranslations: "uiTranslations", initialCountry: "initialCountry", initialCountryLookup: "initialCountryLookup", loadUtils: "loadUtils", numberDisplayFormat: "numberDisplayFormat", onlyCountries: "onlyCountries", placeholderNumberPolicy: "placeholderNumberPolicy", placeholderNumberType: "placeholderNumberType", searchInputClass: "searchInputClass", separateDialCode: "separateDialCode", showFlags: "showFlags", strictMode: "strictMode", strictRejectAnimation: "strictRejectAnimation" }, outputs: { numberChange: "numberChange", countryChange: "countryChange", validityChange: "validityChange", errorCodeChange: "errorCodeChange", openCountrySelector: "openCountrySelector", closeCountrySelector: "closeCountrySelector", strictReject: "strictReject", blur: "blur", focus: "focus", keydown: "keydown", keyup: "keyup", paste: "paste", click: "click" }, providers: [
5292
5318
  {
5293
5319
  provide: NG_VALUE_ACCESSOR,
5294
5320
  useExisting: forwardRef(() => _IntlTelInput),
@@ -5387,6 +5413,8 @@ i0.\u0275\u0275ngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7",
5387
5413
  type: Input
5388
5414
  }], formatAsYouType: [{
5389
5415
  type: Input
5416
+ }], fullscreenParent: [{
5417
+ type: Input
5390
5418
  }], hiddenInputs: [{
5391
5419
  type: Input
5392
5420
  }], uiTranslations: [{
@@ -1977,7 +1977,7 @@ var defaults = {
1977
1977
  customPlaceholder: null,
1978
1978
  //* Always show the dropdown
1979
1979
  dropdownAlwaysOpen: false,
1980
- //* Optional DOM element to append the dropdown to (used to escape ancestors with overflow:hidden, or to mount in a custom container). Only consulted in dropdown rendering; ignored when the country selector renders as a fullscreen popup.
1980
+ //* Optional DOM element to append the dropdown to (used to escape ancestors with overflow:hidden, or to mount in a custom container). Only consulted in dropdown rendering; ignored when the country selector renders as a fullscreen popup (see fullscreenParent).
1981
1981
  dropdownParent: null,
1982
1982
  //* Don't display these countries.
1983
1983
  excludeCountries: null,
@@ -1985,6 +1985,8 @@ var defaults = {
1985
1985
  matchDropdownWidth: true,
1986
1986
  //* Format the number as the user types
1987
1987
  formatAsYouType: true,
1988
+ //* Optional DOM element to append the fullscreen popup to, instead of document.body (e.g. a modal <dialog>, where a body-mounted popup would be unreachable). Only consulted in fullscreen rendering (see dropdownParent for the dropdown). Null means document.body, which is resolved on open rather than here, as document may not exist yet (e.g. SSR).
1989
+ fullscreenParent: null,
1988
1990
  //* Inject hidden inputs with the names returned from this function, and on submit, populate them with the full number and selected country iso2.
1989
1991
  hiddenInputs: null,
1990
1992
  //* Translations for the core library UI strings e.g. search input placeholder, country names.
@@ -2168,8 +2170,9 @@ var validateOptions = (customOptions) => {
2168
2170
  validatedOptions[key] = value;
2169
2171
  break;
2170
2172
  case "dropdownParent":
2173
+ case "fullscreenParent":
2171
2174
  if (value !== null && !isElLike(value)) {
2172
- warnOption("dropdownParent", "an HTMLElement or null", value);
2175
+ warnOption(key, "an HTMLElement or null", value);
2173
2176
  break;
2174
2177
  }
2175
2178
  validatedOptions[key] = value;
@@ -2733,6 +2736,9 @@ var UI = class {
2733
2736
  },
2734
2737
  this.#countrySelectorEl
2735
2738
  );
2739
+ if (!countrySearch) {
2740
+ this.#countryListEl.setAttribute("tabindex", "0");
2741
+ }
2736
2742
  this.#appendListItems();
2737
2743
  if (countrySearch) {
2738
2744
  this.#updateSearchResultsA11yText();
@@ -2753,11 +2759,12 @@ var UI = class {
2753
2759
  this.#countryContainerEl.appendChild(this.#countrySelectorEl);
2754
2760
  }
2755
2761
  }
2756
- //* Resolve the DOM element to attach the country selector to. Fullscreen always uses document.body; dropdown uses the consumer-supplied dropdownParent (if any); otherwise the country selector renders inline within the input wrapper (no detached element).
2762
+ //* Resolve the DOM element to attach the country selector to. Fullscreen is always detached: it uses the consumer-supplied fullscreenParent, falling back to document.body; dropdown uses the consumer-supplied dropdownParent (if any); otherwise the country selector renders inline within the input wrapper (no detached element).
2763
+ //* NOTE: these are deliberately two separate options. For the dropdown, setting a parent switches it from inline to detached rendering (pos:fixed, positioned against the input), whereas the fullscreen popup is detached regardless, so its parent only relocates it. Sharing one option would force a detached dropdown on anyone who only needs to move the fullscreen popup e.g. into a modal <dialog> (issue #2199).
2757
2764
  #getDetachedParent() {
2758
- const { countrySelectorMode, dropdownParent } = this.#options;
2765
+ const { countrySelectorMode, dropdownParent, fullscreenParent } = this.#options;
2759
2766
  if (countrySelectorMode === COUNTRY_SELECTOR_MODE.FULLSCREEN) {
2760
- return document.body;
2767
+ return fullscreenParent ?? document.body;
2761
2768
  }
2762
2769
  if (countrySelectorMode === COUNTRY_SELECTOR_MODE.DROPDOWN) {
2763
2770
  return dropdownParent;
@@ -2883,7 +2890,6 @@ var UI = class {
2883
2890
  const listItem = createEl("li", {
2884
2891
  id: `iti-${this.#id}__item-${c.iso2}`,
2885
2892
  class: liClass,
2886
- tabindex: "-1",
2887
2893
  role: "option",
2888
2894
  [ARIA.SELECTED]: "false"
2889
2895
  });
@@ -3075,18 +3081,20 @@ var UI = class {
3075
3081
  container.scrollTop = offsetTop - containerRect.height + elementRect.height;
3076
3082
  }
3077
3083
  }
3084
+ //* The element that holds focus while the country selector is open: the search input, or (when countrySearch is disabled) the country list itself.
3085
+ #getOpenFocusEl() {
3086
+ return this.#options.countrySearch ? this.#searchInputEl : this.#countryListEl;
3087
+ }
3078
3088
  //* Remove highlighting from the previous list item and highlight the new one.
3079
3089
  #highlightListItem(listItem, doScroll = true) {
3080
3090
  this.#highlightedListItemEl?.classList.remove(CLASSES.HIGHLIGHT);
3081
3091
  if (listItem) {
3082
3092
  listItem.classList.add(CLASSES.HIGHLIGHT);
3083
- if (this.#options.countrySearch) {
3084
- const activeDescendant = listItem.getAttribute("id") || "";
3085
- this.#searchInputEl.setAttribute(
3086
- ARIA.ACTIVE_DESCENDANT,
3087
- activeDescendant
3088
- );
3089
- }
3093
+ const activeDescendant = listItem.getAttribute("id") || "";
3094
+ this.#getOpenFocusEl().setAttribute(
3095
+ ARIA.ACTIVE_DESCENDANT,
3096
+ activeDescendant
3097
+ );
3090
3098
  if (doScroll) {
3091
3099
  this.#scrollCountryListToItem(listItem);
3092
3100
  }
@@ -3165,7 +3173,7 @@ var UI = class {
3165
3173
  //* Open the country selector: create a fresh AbortController, do the DOM work, and wire up all
3166
3174
  //* open-state listeners (which invoke the caller's onSelect / onClose callbacks).
3167
3175
  openCountrySelector(onSelect, onClose) {
3168
- const { countrySearch, dropdownAlwaysOpen } = this.#options;
3176
+ const { dropdownAlwaysOpen } = this.#options;
3169
3177
  this.#countrySelectorAbortController = new AbortController();
3170
3178
  if (this.#options.countrySelectorMode !== COUNTRY_SELECTOR_MODE.FULLSCREEN) {
3171
3179
  this.#ensureInlineDropdownSizeMeasured();
@@ -3188,10 +3196,11 @@ var UI = class {
3188
3196
  if (itemToHighlight) {
3189
3197
  this.#highlightListItem(itemToHighlight);
3190
3198
  }
3191
- if (countrySearch && !dropdownAlwaysOpen) {
3192
- this.#searchInputEl.focus();
3199
+ if (!dropdownAlwaysOpen) {
3200
+ this.#getOpenFocusEl().focus();
3193
3201
  }
3194
3202
  if (this.#options.countrySelectorMode === COUNTRY_SELECTOR_MODE.FULLSCREEN && this.#detachedCountrySelectorEl && window.visualViewport) {
3203
+ this.#adjustFullscreenPopupToViewport();
3195
3204
  window.visualViewport.addEventListener(
3196
3205
  "resize",
3197
3206
  () => {
@@ -3308,6 +3317,20 @@ var UI = class {
3308
3317
  };
3309
3318
  this.#selectedCountryEl?.addEventListener("keydown", handleKeydown, { signal });
3310
3319
  this.#countrySelectorEl?.addEventListener("keydown", handleKeydown, { signal });
3320
+ if (this.#detachedCountrySelectorEl) {
3321
+ this.#countrySelectorEl?.addEventListener(
3322
+ "keydown",
3323
+ (e) => {
3324
+ if (e.key === KEYS.TAB) {
3325
+ e.preventDefault();
3326
+ onEscape();
3327
+ const focusEl = e.shiftKey ? this.#selectedCountryEl : this.telInputEl;
3328
+ focusEl.focus();
3329
+ }
3330
+ },
3331
+ { signal }
3332
+ );
3333
+ }
3311
3334
  }
3312
3335
  //* Wire up country search input listener: typing filters the list, the clear button resets it.
3313
3336
  #bindSearchInputListener(signal) {
@@ -3405,8 +3428,8 @@ var UI = class {
3405
3428
  this.#countrySelectorAbortController = null;
3406
3429
  this.#countrySelectorEl.classList.add(CLASSES.HIDE);
3407
3430
  this.#selectedCountryEl.setAttribute(ARIA.EXPANDED, "false");
3431
+ this.#getOpenFocusEl().removeAttribute(ARIA.ACTIVE_DESCENDANT);
3408
3432
  if (countrySearch) {
3409
- this.#searchInputEl.removeAttribute(ARIA.ACTIVE_DESCENDANT);
3410
3433
  this.#searchInputEl.value = "";
3411
3434
  this.#applySearchFilter();
3412
3435
  if (this.#highlightedListItemEl) {
@@ -3419,6 +3442,7 @@ var UI = class {
3419
3442
  this.#detachedCountrySelectorEl.remove();
3420
3443
  this.#detachedCountrySelectorEl.style.top = "";
3421
3444
  this.#detachedCountrySelectorEl.style.bottom = "";
3445
+ this.#detachedCountrySelectorEl.style.height = "";
3422
3446
  this.#detachedCountrySelectorEl.style.paddingLeft = "";
3423
3447
  this.#detachedCountrySelectorEl.style.paddingRight = "";
3424
3448
  } else {
@@ -3484,8 +3508,7 @@ var UI = class {
3484
3508
  if (!vv || !this.#detachedCountrySelectorEl) {
3485
3509
  return;
3486
3510
  }
3487
- const virtualKeyboardHeight = window.innerHeight - vv.height;
3488
- this.#detachedCountrySelectorEl.style.bottom = `${virtualKeyboardHeight}px`;
3511
+ this.#detachedCountrySelectorEl.style.height = `${vv.height}px`;
3489
3512
  }
3490
3513
  // UI: Whether the country selector is currently open (visible).
3491
3514
  isCountrySelectorOpen() {
@@ -4955,7 +4978,7 @@ var intlTelInput = Object.assign(
4955
4978
  attachUtils,
4956
4979
  startedLoadingUtils: false,
4957
4980
  startedLoadingAutoCountry: false,
4958
- version: "29.3.0",
4981
+ version: "29.4.0",
4959
4982
  NUMBER_FORMAT,
4960
4983
  NUMBER_TYPE,
4961
4984
  VALIDATION_ERROR,
@@ -11231,6 +11254,7 @@ var IntlTelInput = class _IntlTelInput {
11231
11254
  excludeCountries;
11232
11255
  matchDropdownWidth;
11233
11256
  formatAsYouType;
11257
+ fullscreenParent;
11234
11258
  hiddenInputs;
11235
11259
  uiTranslations;
11236
11260
  initialCountry;
@@ -11303,6 +11327,7 @@ var IntlTelInput = class _IntlTelInput {
11303
11327
  if (this.readonly) {
11304
11328
  this.iti.setReadonly(this.readonly);
11305
11329
  }
11330
+ this.lastEmittedCountry = this.iti.getSelectedCountry()?.iso2 ?? "";
11306
11331
  this.iti.promise.then(() => {
11307
11332
  if (!this.iti?.isActive()) {
11308
11333
  return;
@@ -11339,6 +11364,7 @@ var IntlTelInput = class _IntlTelInput {
11339
11364
  excludeCountries: this.excludeCountries,
11340
11365
  matchDropdownWidth: this.matchDropdownWidth,
11341
11366
  formatAsYouType: this.formatAsYouType,
11367
+ fullscreenParent: this.fullscreenParent,
11342
11368
  hiddenInputs: this.hiddenInputs,
11343
11369
  uiTranslations: this.uiTranslations,
11344
11370
  initialCountry: this.initialCountry,
@@ -11522,7 +11548,7 @@ var IntlTelInput = class _IntlTelInput {
11522
11548
  this.onValidatorChange = fn;
11523
11549
  }
11524
11550
  static \u0275fac = i0.\u0275\u0275ngDeclareFactory({ minVersion: "12.0.0", version: "21.2.7", ngImport: i0, type: _IntlTelInput, deps: [], target: i0.\u0275\u0275FactoryTarget.Component });
11525
- static \u0275cmp = i0.\u0275\u0275ngDeclareComponent({ minVersion: "14.0.0", version: "21.2.7", type: _IntlTelInput, isStandalone: true, selector: "intl-tel-input", inputs: { initialValue: "initialValue", usePreciseValidation: "usePreciseValidation", inputAttributes: "inputAttributes", disabled: "disabled", readonly: "readonly", countrySelectorMode: "countrySelectorMode", allowedNumberTypes: "allowedNumberTypes", allowNumberExtensions: "allowNumberExtensions", allowPhonewords: "allowPhonewords", classNames: "classNames", containerClass: "containerClass", countryNameLocale: "countryNameLocale", countryNameOverrides: "countryNameOverrides", countryOrder: "countryOrder", countrySearch: "countrySearch", customPlaceholder: "customPlaceholder", dropdownAlwaysOpen: "dropdownAlwaysOpen", dropdownParent: "dropdownParent", excludeCountries: "excludeCountries", matchDropdownWidth: "matchDropdownWidth", formatAsYouType: "formatAsYouType", hiddenInputs: "hiddenInputs", uiTranslations: "uiTranslations", initialCountry: "initialCountry", initialCountryLookup: "initialCountryLookup", loadUtils: "loadUtils", numberDisplayFormat: "numberDisplayFormat", onlyCountries: "onlyCountries", placeholderNumberPolicy: "placeholderNumberPolicy", placeholderNumberType: "placeholderNumberType", searchInputClass: "searchInputClass", separateDialCode: "separateDialCode", showFlags: "showFlags", strictMode: "strictMode", strictRejectAnimation: "strictRejectAnimation" }, outputs: { numberChange: "numberChange", countryChange: "countryChange", validityChange: "validityChange", errorCodeChange: "errorCodeChange", openCountrySelector: "openCountrySelector", closeCountrySelector: "closeCountrySelector", strictReject: "strictReject", blur: "blur", focus: "focus", keydown: "keydown", keyup: "keyup", paste: "paste", click: "click" }, providers: [
11551
+ static \u0275cmp = i0.\u0275\u0275ngDeclareComponent({ minVersion: "14.0.0", version: "21.2.7", type: _IntlTelInput, isStandalone: true, selector: "intl-tel-input", inputs: { initialValue: "initialValue", usePreciseValidation: "usePreciseValidation", inputAttributes: "inputAttributes", disabled: "disabled", readonly: "readonly", countrySelectorMode: "countrySelectorMode", allowedNumberTypes: "allowedNumberTypes", allowNumberExtensions: "allowNumberExtensions", allowPhonewords: "allowPhonewords", classNames: "classNames", containerClass: "containerClass", countryNameLocale: "countryNameLocale", countryNameOverrides: "countryNameOverrides", countryOrder: "countryOrder", countrySearch: "countrySearch", customPlaceholder: "customPlaceholder", dropdownAlwaysOpen: "dropdownAlwaysOpen", dropdownParent: "dropdownParent", excludeCountries: "excludeCountries", matchDropdownWidth: "matchDropdownWidth", formatAsYouType: "formatAsYouType", fullscreenParent: "fullscreenParent", hiddenInputs: "hiddenInputs", uiTranslations: "uiTranslations", initialCountry: "initialCountry", initialCountryLookup: "initialCountryLookup", loadUtils: "loadUtils", numberDisplayFormat: "numberDisplayFormat", onlyCountries: "onlyCountries", placeholderNumberPolicy: "placeholderNumberPolicy", placeholderNumberType: "placeholderNumberType", searchInputClass: "searchInputClass", separateDialCode: "separateDialCode", showFlags: "showFlags", strictMode: "strictMode", strictRejectAnimation: "strictRejectAnimation" }, outputs: { numberChange: "numberChange", countryChange: "countryChange", validityChange: "validityChange", errorCodeChange: "errorCodeChange", openCountrySelector: "openCountrySelector", closeCountrySelector: "closeCountrySelector", strictReject: "strictReject", blur: "blur", focus: "focus", keydown: "keydown", keyup: "keyup", paste: "paste", click: "click" }, providers: [
11526
11552
  {
11527
11553
  provide: NG_VALUE_ACCESSOR,
11528
11554
  useExisting: forwardRef(() => _IntlTelInput),
@@ -11621,6 +11647,8 @@ i0.\u0275\u0275ngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7",
11621
11647
  type: Input
11622
11648
  }], formatAsYouType: [{
11623
11649
  type: Input
11650
+ }], fullscreenParent: [{
11651
+ type: Input
11624
11652
  }], hiddenInputs: [{
11625
11653
  type: Input
11626
11654
  }], uiTranslations: [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intl-tel-input/angular",
3
- "version": "29.3.0",
3
+ "version": "29.4.0",
4
4
  "description": "An Angular component for intl-tel-input, for entering, formatting, and validating international telephone numbers",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,7 +34,7 @@
34
34
  "README.md"
35
35
  ],
36
36
  "dependencies": {
37
- "intl-tel-input": "^29.3.0"
37
+ "intl-tel-input": "^29.4.0"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@angular/common": ">=17",