Skip to content

Commit

Permalink
Force nationalMode false if no flags and no dial code
Browse files Browse the repository at this point in the history
  • Loading branch information
jackocnr committed May 1, 2024
1 parent ddab20c commit c8ba37c
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions build/js/intlTelInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,9 @@ var factoryOutput = (() => {
this.options.allowDropdown = true;
this.options.nationalMode = false;
}
if (!this.options.showFlags && !this.options.separateDialCode) {
this.options.nationalMode = false;
}
if (this.options.useFullscreenPopup && !this.options.dropdownContainer) {
this.options.dropdownContainer = document.body;
}
Expand Down
2 changes: 1 addition & 1 deletion build/js/intlTelInput.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react/build/IntlTelInput.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion react/build/IntlTelInput.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions react/demo/simple-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -25041,6 +25041,9 @@
this.options.allowDropdown = true;
this.options.nationalMode = false;
}
if (!this.options.showFlags && !this.options.separateDialCode) {
this.options.nationalMode = false;
}
if (this.options.useFullscreenPopup && !this.options.dropdownContainer) {
this.options.dropdownContainer = document.body;
}
Expand Down
3 changes: 3 additions & 0 deletions react/demo/validation-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -25041,6 +25041,9 @@
this.options.allowDropdown = true;
this.options.nationalMode = false;
}
if (!this.options.showFlags && !this.options.separateDialCode) {
this.options.nationalMode = false;
}
if (this.options.useFullscreenPopup && !this.options.dropdownContainer) {
this.options.dropdownContainer = document.body;
}
Expand Down
5 changes: 5 additions & 0 deletions src/js/intl-tel-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,11 @@ export class Iti {
this.options.nationalMode = false;
}

// if no flags, and no dial code, force nationalMode to false, as it doesn't make sense to show a national number placeholder if there's no way to see which country is selected
if (!this.options.showFlags && !this.options.separateDialCode) {
this.options.nationalMode = false;
}

//* On mobile, we want a full screen dropdown, so we must append it to the body.
if (this.options.useFullscreenPopup && !this.options.dropdownContainer) {
this.options.dropdownContainer = document.body;
Expand Down

0 comments on commit c8ba37c

Please sign in to comment.