@intl-tel-input/react 29.4.0 → 29.5.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/dist/IntlTelInput.js +43 -7
- package/dist/IntlTelInputWithUtils.js +43 -7
- package/package.json +2 -2
package/dist/IntlTelInput.js
CHANGED
|
@@ -1772,6 +1772,7 @@ var ITI_SLOTS = [
|
|
|
1772
1772
|
"selectedDialCode",
|
|
1773
1773
|
"countrySelector",
|
|
1774
1774
|
"countrySelectorContainer",
|
|
1775
|
+
"closeButton",
|
|
1775
1776
|
"searchWrapper",
|
|
1776
1777
|
"searchIcon",
|
|
1777
1778
|
"searchInput",
|
|
@@ -1926,6 +1927,7 @@ var interfaceTranslations = {
|
|
|
1926
1927
|
countryListAriaLabel: "List of countries",
|
|
1927
1928
|
searchPlaceholder: "Search",
|
|
1928
1929
|
clearSearchAriaLabel: "Clear search",
|
|
1930
|
+
closeCountrySelectorAriaLabel: "Close",
|
|
1929
1931
|
searchEmptyState: "No results found",
|
|
1930
1932
|
searchSummaryAria(count) {
|
|
1931
1933
|
if (count === 0) {
|
|
@@ -2351,6 +2353,11 @@ var buildClearIcon = (id) => {
|
|
|
2351
2353
|
]]
|
|
2352
2354
|
);
|
|
2353
2355
|
};
|
|
2356
|
+
var buildCloseIcon = () => buildSvg(
|
|
2357
|
+
["svg", { class: "iti__close-button-svg", width: 20, height: 20, viewBox: "0 0 16 16", focusable: "false", [ARIA.HIDDEN]: "true" }, [
|
|
2358
|
+
["path", { d: "M3 3 L13 13 M13 3 L3 13" }]
|
|
2359
|
+
]]
|
|
2360
|
+
);
|
|
2354
2361
|
var buildCheckIcon = () => buildSvg(
|
|
2355
2362
|
["svg", { class: "iti__country-check-svg", width: 14, height: 14, viewBox: "0 0 16 16", fill: "currentColor", focusable: "false", [ARIA.HIDDEN]: "true" }, [
|
|
2356
2363
|
["path", { d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z" }]
|
|
@@ -2524,6 +2531,7 @@ var UI = class {
|
|
|
2524
2531
|
#selectedDialCodeEl;
|
|
2525
2532
|
#arrowEl;
|
|
2526
2533
|
#countrySelectorEl;
|
|
2534
|
+
#closeButtonEl;
|
|
2527
2535
|
#searchIconEl;
|
|
2528
2536
|
#searchInputEl;
|
|
2529
2537
|
#searchClearButtonEl;
|
|
@@ -2723,6 +2731,9 @@ var UI = class {
|
|
|
2723
2731
|
if (this.#isRTL) {
|
|
2724
2732
|
this.#countrySelectorEl.setAttribute("dir", "rtl");
|
|
2725
2733
|
}
|
|
2734
|
+
if (isFullscreen) {
|
|
2735
|
+
this.#buildCloseButton();
|
|
2736
|
+
}
|
|
2726
2737
|
if (countrySearch) {
|
|
2727
2738
|
this.#buildSearchUI();
|
|
2728
2739
|
}
|
|
@@ -2771,6 +2782,21 @@ var UI = class {
|
|
|
2771
2782
|
}
|
|
2772
2783
|
return null;
|
|
2773
2784
|
}
|
|
2785
|
+
//* Fullscreen popup only: a close button, as the backdrop (tap to close) is not discoverable, and is unreachable for screen reader users.
|
|
2786
|
+
//* It lives inside the country selector (role=dialog, aria-modal) so assistive tech can reach it, but the CSS positions it out in the corner of the backdrop.
|
|
2787
|
+
#buildCloseButton() {
|
|
2788
|
+
this.#closeButtonEl = createEl(
|
|
2789
|
+
"button",
|
|
2790
|
+
{
|
|
2791
|
+
type: "button",
|
|
2792
|
+
class: this.#withSlotClass("closeButton", "iti__close-button"),
|
|
2793
|
+
[ARIA.LABEL]: this.#options.uiTranslations.closeCountrySelectorAriaLabel,
|
|
2794
|
+
tabindex: "-1"
|
|
2795
|
+
},
|
|
2796
|
+
this.#countrySelectorEl
|
|
2797
|
+
);
|
|
2798
|
+
this.#closeButtonEl.appendChild(buildCloseIcon());
|
|
2799
|
+
}
|
|
2774
2800
|
#buildSearchUI() {
|
|
2775
2801
|
const { uiTranslations, searchInputClass } = this.#options;
|
|
2776
2802
|
const searchWrapper = createEl(
|
|
@@ -3216,7 +3242,7 @@ var UI = class {
|
|
|
3216
3242
|
this.#bindCountrySelectorOpenListeners(onSelect, onClose);
|
|
3217
3243
|
}
|
|
3218
3244
|
//* Wire up all listeners needed while the country selector is open: list-item hover (highlight),
|
|
3219
|
-
//* list-item click & enter key (select), click-off & escape (close), search input (filter),
|
|
3245
|
+
//* list-item click & enter key (select), click-off, close button & escape (close), search input (filter),
|
|
3220
3246
|
//* (when countrySearch disabled) typed-char hidden search, and (when the country selector is in an
|
|
3221
3247
|
//* external container) update (fixed) position on scroll/resize.
|
|
3222
3248
|
#bindCountrySelectorOpenListeners(onSelect, onClose) {
|
|
@@ -3227,6 +3253,14 @@ var UI = class {
|
|
|
3227
3253
|
this.#bindOutsideClickToClose(signal, onClose);
|
|
3228
3254
|
}
|
|
3229
3255
|
this.#bindCountrySelectorKeydownListener(signal, onSelect, onClose);
|
|
3256
|
+
this.#closeButtonEl?.addEventListener(
|
|
3257
|
+
"click",
|
|
3258
|
+
() => {
|
|
3259
|
+
onClose();
|
|
3260
|
+
this.#selectedCountryEl.focus();
|
|
3261
|
+
},
|
|
3262
|
+
{ signal }
|
|
3263
|
+
);
|
|
3230
3264
|
if (this.#options.countrySearch) {
|
|
3231
3265
|
this.#bindSearchInputListener(signal);
|
|
3232
3266
|
}
|
|
@@ -3442,7 +3476,7 @@ var UI = class {
|
|
|
3442
3476
|
this.#detachedCountrySelectorEl.remove();
|
|
3443
3477
|
this.#detachedCountrySelectorEl.style.top = "";
|
|
3444
3478
|
this.#detachedCountrySelectorEl.style.bottom = "";
|
|
3445
|
-
this.#detachedCountrySelectorEl.style.height
|
|
3479
|
+
this.#detachedCountrySelectorEl.style.removeProperty("--iti-virtual-keyboard-height");
|
|
3446
3480
|
this.#detachedCountrySelectorEl.style.paddingLeft = "";
|
|
3447
3481
|
this.#detachedCountrySelectorEl.style.paddingRight = "";
|
|
3448
3482
|
} else {
|
|
@@ -3501,14 +3535,16 @@ var UI = class {
|
|
|
3501
3535
|
this.telInputEl.style.anchorName = existing && existing !== "none" ? `${existing}, ${anchorName}` : anchorName;
|
|
3502
3536
|
this.#detachedCountrySelectorEl.style.positionAnchor = anchorName;
|
|
3503
3537
|
}
|
|
3504
|
-
//
|
|
3505
|
-
//
|
|
3538
|
+
// Tell the CSS how much of the fullscreen popup is covered by the virtual keyboard, so it can fit the
|
|
3539
|
+
// country selector above it, while the popup itself (the dark backdrop) stays fullscreen behind the keyboard.
|
|
3506
3540
|
#adjustFullscreenPopupToViewport() {
|
|
3507
3541
|
const vv = window.visualViewport;
|
|
3508
|
-
|
|
3542
|
+
const popup = this.#detachedCountrySelectorEl;
|
|
3543
|
+
if (!vv || !popup) {
|
|
3509
3544
|
return;
|
|
3510
3545
|
}
|
|
3511
|
-
|
|
3546
|
+
const virtualKeyboardHeight = Math.max(0, popup.offsetHeight - vv.height);
|
|
3547
|
+
popup.style.setProperty("--iti-virtual-keyboard-height", `${virtualKeyboardHeight}px`);
|
|
3512
3548
|
}
|
|
3513
3549
|
// UI: Whether the country selector is currently open (visible).
|
|
3514
3550
|
isCountrySelectorOpen() {
|
|
@@ -4978,7 +5014,7 @@ var intlTelInput = Object.assign(
|
|
|
4978
5014
|
attachUtils,
|
|
4979
5015
|
startedLoadingUtils: false,
|
|
4980
5016
|
startedLoadingAutoCountry: false,
|
|
4981
|
-
version: "29.
|
|
5017
|
+
version: "29.5.0",
|
|
4982
5018
|
NUMBER_FORMAT,
|
|
4983
5019
|
NUMBER_TYPE,
|
|
4984
5020
|
VALIDATION_ERROR,
|
|
@@ -1772,6 +1772,7 @@ var ITI_SLOTS = [
|
|
|
1772
1772
|
"selectedDialCode",
|
|
1773
1773
|
"countrySelector",
|
|
1774
1774
|
"countrySelectorContainer",
|
|
1775
|
+
"closeButton",
|
|
1775
1776
|
"searchWrapper",
|
|
1776
1777
|
"searchIcon",
|
|
1777
1778
|
"searchInput",
|
|
@@ -1926,6 +1927,7 @@ var interfaceTranslations = {
|
|
|
1926
1927
|
countryListAriaLabel: "List of countries",
|
|
1927
1928
|
searchPlaceholder: "Search",
|
|
1928
1929
|
clearSearchAriaLabel: "Clear search",
|
|
1930
|
+
closeCountrySelectorAriaLabel: "Close",
|
|
1929
1931
|
searchEmptyState: "No results found",
|
|
1930
1932
|
searchSummaryAria(count) {
|
|
1931
1933
|
if (count === 0) {
|
|
@@ -2351,6 +2353,11 @@ var buildClearIcon = (id) => {
|
|
|
2351
2353
|
]]
|
|
2352
2354
|
);
|
|
2353
2355
|
};
|
|
2356
|
+
var buildCloseIcon = () => buildSvg(
|
|
2357
|
+
["svg", { class: "iti__close-button-svg", width: 20, height: 20, viewBox: "0 0 16 16", focusable: "false", [ARIA.HIDDEN]: "true" }, [
|
|
2358
|
+
["path", { d: "M3 3 L13 13 M13 3 L3 13" }]
|
|
2359
|
+
]]
|
|
2360
|
+
);
|
|
2354
2361
|
var buildCheckIcon = () => buildSvg(
|
|
2355
2362
|
["svg", { class: "iti__country-check-svg", width: 14, height: 14, viewBox: "0 0 16 16", fill: "currentColor", focusable: "false", [ARIA.HIDDEN]: "true" }, [
|
|
2356
2363
|
["path", { d: "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z" }]
|
|
@@ -2524,6 +2531,7 @@ var UI = class {
|
|
|
2524
2531
|
#selectedDialCodeEl;
|
|
2525
2532
|
#arrowEl;
|
|
2526
2533
|
#countrySelectorEl;
|
|
2534
|
+
#closeButtonEl;
|
|
2527
2535
|
#searchIconEl;
|
|
2528
2536
|
#searchInputEl;
|
|
2529
2537
|
#searchClearButtonEl;
|
|
@@ -2723,6 +2731,9 @@ var UI = class {
|
|
|
2723
2731
|
if (this.#isRTL) {
|
|
2724
2732
|
this.#countrySelectorEl.setAttribute("dir", "rtl");
|
|
2725
2733
|
}
|
|
2734
|
+
if (isFullscreen) {
|
|
2735
|
+
this.#buildCloseButton();
|
|
2736
|
+
}
|
|
2726
2737
|
if (countrySearch) {
|
|
2727
2738
|
this.#buildSearchUI();
|
|
2728
2739
|
}
|
|
@@ -2771,6 +2782,21 @@ var UI = class {
|
|
|
2771
2782
|
}
|
|
2772
2783
|
return null;
|
|
2773
2784
|
}
|
|
2785
|
+
//* Fullscreen popup only: a close button, as the backdrop (tap to close) is not discoverable, and is unreachable for screen reader users.
|
|
2786
|
+
//* It lives inside the country selector (role=dialog, aria-modal) so assistive tech can reach it, but the CSS positions it out in the corner of the backdrop.
|
|
2787
|
+
#buildCloseButton() {
|
|
2788
|
+
this.#closeButtonEl = createEl(
|
|
2789
|
+
"button",
|
|
2790
|
+
{
|
|
2791
|
+
type: "button",
|
|
2792
|
+
class: this.#withSlotClass("closeButton", "iti__close-button"),
|
|
2793
|
+
[ARIA.LABEL]: this.#options.uiTranslations.closeCountrySelectorAriaLabel,
|
|
2794
|
+
tabindex: "-1"
|
|
2795
|
+
},
|
|
2796
|
+
this.#countrySelectorEl
|
|
2797
|
+
);
|
|
2798
|
+
this.#closeButtonEl.appendChild(buildCloseIcon());
|
|
2799
|
+
}
|
|
2774
2800
|
#buildSearchUI() {
|
|
2775
2801
|
const { uiTranslations, searchInputClass } = this.#options;
|
|
2776
2802
|
const searchWrapper = createEl(
|
|
@@ -3216,7 +3242,7 @@ var UI = class {
|
|
|
3216
3242
|
this.#bindCountrySelectorOpenListeners(onSelect, onClose);
|
|
3217
3243
|
}
|
|
3218
3244
|
//* Wire up all listeners needed while the country selector is open: list-item hover (highlight),
|
|
3219
|
-
//* list-item click & enter key (select), click-off & escape (close), search input (filter),
|
|
3245
|
+
//* list-item click & enter key (select), click-off, close button & escape (close), search input (filter),
|
|
3220
3246
|
//* (when countrySearch disabled) typed-char hidden search, and (when the country selector is in an
|
|
3221
3247
|
//* external container) update (fixed) position on scroll/resize.
|
|
3222
3248
|
#bindCountrySelectorOpenListeners(onSelect, onClose) {
|
|
@@ -3227,6 +3253,14 @@ var UI = class {
|
|
|
3227
3253
|
this.#bindOutsideClickToClose(signal, onClose);
|
|
3228
3254
|
}
|
|
3229
3255
|
this.#bindCountrySelectorKeydownListener(signal, onSelect, onClose);
|
|
3256
|
+
this.#closeButtonEl?.addEventListener(
|
|
3257
|
+
"click",
|
|
3258
|
+
() => {
|
|
3259
|
+
onClose();
|
|
3260
|
+
this.#selectedCountryEl.focus();
|
|
3261
|
+
},
|
|
3262
|
+
{ signal }
|
|
3263
|
+
);
|
|
3230
3264
|
if (this.#options.countrySearch) {
|
|
3231
3265
|
this.#bindSearchInputListener(signal);
|
|
3232
3266
|
}
|
|
@@ -3442,7 +3476,7 @@ var UI = class {
|
|
|
3442
3476
|
this.#detachedCountrySelectorEl.remove();
|
|
3443
3477
|
this.#detachedCountrySelectorEl.style.top = "";
|
|
3444
3478
|
this.#detachedCountrySelectorEl.style.bottom = "";
|
|
3445
|
-
this.#detachedCountrySelectorEl.style.height
|
|
3479
|
+
this.#detachedCountrySelectorEl.style.removeProperty("--iti-virtual-keyboard-height");
|
|
3446
3480
|
this.#detachedCountrySelectorEl.style.paddingLeft = "";
|
|
3447
3481
|
this.#detachedCountrySelectorEl.style.paddingRight = "";
|
|
3448
3482
|
} else {
|
|
@@ -3501,14 +3535,16 @@ var UI = class {
|
|
|
3501
3535
|
this.telInputEl.style.anchorName = existing && existing !== "none" ? `${existing}, ${anchorName}` : anchorName;
|
|
3502
3536
|
this.#detachedCountrySelectorEl.style.positionAnchor = anchorName;
|
|
3503
3537
|
}
|
|
3504
|
-
//
|
|
3505
|
-
//
|
|
3538
|
+
// Tell the CSS how much of the fullscreen popup is covered by the virtual keyboard, so it can fit the
|
|
3539
|
+
// country selector above it, while the popup itself (the dark backdrop) stays fullscreen behind the keyboard.
|
|
3506
3540
|
#adjustFullscreenPopupToViewport() {
|
|
3507
3541
|
const vv = window.visualViewport;
|
|
3508
|
-
|
|
3542
|
+
const popup = this.#detachedCountrySelectorEl;
|
|
3543
|
+
if (!vv || !popup) {
|
|
3509
3544
|
return;
|
|
3510
3545
|
}
|
|
3511
|
-
|
|
3546
|
+
const virtualKeyboardHeight = Math.max(0, popup.offsetHeight - vv.height);
|
|
3547
|
+
popup.style.setProperty("--iti-virtual-keyboard-height", `${virtualKeyboardHeight}px`);
|
|
3512
3548
|
}
|
|
3513
3549
|
// UI: Whether the country selector is currently open (visible).
|
|
3514
3550
|
isCountrySelectorOpen() {
|
|
@@ -4978,7 +5014,7 @@ var intlTelInput = Object.assign(
|
|
|
4978
5014
|
attachUtils,
|
|
4979
5015
|
startedLoadingUtils: false,
|
|
4980
5016
|
startedLoadingAutoCountry: false,
|
|
4981
|
-
version: "29.
|
|
5017
|
+
version: "29.5.0",
|
|
4982
5018
|
NUMBER_FORMAT,
|
|
4983
5019
|
NUMBER_TYPE,
|
|
4984
5020
|
VALIDATION_ERROR,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intl-tel-input/react",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.5.0",
|
|
4
4
|
"description": "A React 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.
|
|
37
|
+
"intl-tel-input": "^29.5.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"react": ">=18",
|