Skip to content

Commit

Permalink
Remove added input padding in destroy method
Browse files Browse the repository at this point in the history
  • Loading branch information
jackocnr committed Jul 17, 2024
1 parent a2a848f commit 947a8b2
Show file tree
Hide file tree
Showing 14 changed files with 171 additions and 12 deletions.
2 changes: 2 additions & 0 deletions build/js/intlTelInput.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,8 @@ declare module "intl-tel-input" {
private hiddenInputCountry;
private maxCoreNumberLength;
private defaultCountry;
private originalPaddingRight;
private originalPaddingLeft;
private _handleHiddenInputSubmit;
private _handleLabelClick;
private _handleClickSelectedCountry;
Expand Down
17 changes: 16 additions & 1 deletion build/js/intlTelInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -1536,6 +1536,13 @@ var factoryOutput = (() => {
}
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
this.isRTL = !!this.telInput.closest("[dir=rtl]");
if (this.options.separateDialCode) {
if (this.isRTL) {
this.originalPaddingRight = this.telInput.style.paddingRight;
} else {
this.originalPaddingLeft = this.telInput.style.paddingLeft;
}
}
this.options.i18n = { ...en_default, ...this.options.i18n };
const autoCountryPromise = new Promise((resolve, reject) => {
this.resolveAutoCountryPromise = resolve;
Expand Down Expand Up @@ -2653,7 +2660,8 @@ var factoryOutput = (() => {
//********************
//* Remove plugin.
destroy() {
if (this.options.allowDropdown) {
const { allowDropdown, separateDialCode } = this.options;
if (allowDropdown) {
this._closeDropdown();
this.selectedCountry.removeEventListener(
"click",
Expand All @@ -2677,6 +2685,13 @@ var factoryOutput = (() => {
this.telInput.removeEventListener("keydown", this._handleKeydownEvent);
}
this.telInput.removeAttribute("data-intl-tel-input-id");
if (separateDialCode) {
if (this.isRTL) {
this.telInput.style.paddingRight = this.originalPaddingRight;
} else {
this.telInput.style.paddingLeft = this.originalPaddingLeft;
}
}
const wrapper = this.telInput.parentNode;
wrapper?.parentNode?.insertBefore(this.telInput, wrapper);
wrapper?.parentNode?.removeChild(wrapper);
Expand Down
2 changes: 1 addition & 1 deletion build/js/intlTelInput.min.js

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion build/js/intlTelInputWithUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1535,6 +1535,13 @@ var factoryOutput = (() => {
}
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
this.isRTL = !!this.telInput.closest("[dir=rtl]");
if (this.options.separateDialCode) {
if (this.isRTL) {
this.originalPaddingRight = this.telInput.style.paddingRight;
} else {
this.originalPaddingLeft = this.telInput.style.paddingLeft;
}
}
this.options.i18n = { ...en_default, ...this.options.i18n };
const autoCountryPromise = new Promise((resolve, reject) => {
this.resolveAutoCountryPromise = resolve;
Expand Down Expand Up @@ -2652,7 +2659,8 @@ var factoryOutput = (() => {
//********************
//* Remove plugin.
destroy() {
if (this.options.allowDropdown) {
const { allowDropdown, separateDialCode } = this.options;
if (allowDropdown) {
this._closeDropdown();
this.selectedCountry.removeEventListener(
"click",
Expand All @@ -2676,6 +2684,13 @@ var factoryOutput = (() => {
this.telInput.removeEventListener("keydown", this._handleKeydownEvent);
}
this.telInput.removeAttribute("data-intl-tel-input-id");
if (separateDialCode) {
if (this.isRTL) {
this.telInput.style.paddingRight = this.originalPaddingRight;
} else {
this.telInput.style.paddingLeft = this.originalPaddingLeft;
}
}
const wrapper = this.telInput.parentNode;
wrapper?.parentNode?.insertBefore(this.telInput, wrapper);
wrapper?.parentNode?.removeChild(wrapper);
Expand Down
2 changes: 1 addition & 1 deletion build/js/intlTelInputWithUtils.min.js

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion react/build/IntlTelInput.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,13 @@ var Iti = class {
}
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
this.isRTL = !!this.telInput.closest("[dir=rtl]");
if (this.options.separateDialCode) {
if (this.isRTL) {
this.originalPaddingRight = this.telInput.style.paddingRight;
} else {
this.originalPaddingLeft = this.telInput.style.paddingLeft;
}
}
this.options.i18n = { ...en_default, ...this.options.i18n };
const autoCountryPromise = new Promise((resolve, reject) => {
this.resolveAutoCountryPromise = resolve;
Expand Down Expand Up @@ -2648,7 +2655,8 @@ var Iti = class {
//********************
//* Remove plugin.
destroy() {
if (this.options.allowDropdown) {
const { allowDropdown, separateDialCode } = this.options;
if (allowDropdown) {
this._closeDropdown();
this.selectedCountry.removeEventListener(
"click",
Expand All @@ -2672,6 +2680,13 @@ var Iti = class {
this.telInput.removeEventListener("keydown", this._handleKeydownEvent);
}
this.telInput.removeAttribute("data-intl-tel-input-id");
if (separateDialCode) {
if (this.isRTL) {
this.telInput.style.paddingRight = this.originalPaddingRight;
} else {
this.telInput.style.paddingLeft = this.originalPaddingLeft;
}
}
const wrapper = this.telInput.parentNode;
wrapper?.parentNode?.insertBefore(this.telInput, wrapper);
wrapper?.parentNode?.removeChild(wrapper);
Expand Down
2 changes: 2 additions & 0 deletions react/build/IntlTelInput.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,8 @@ declare module "intl-tel-input" {
private hiddenInputCountry;
private maxCoreNumberLength;
private defaultCountry;
private originalPaddingRight;
private originalPaddingLeft;
private _handleHiddenInputSubmit;
private _handleLabelClick;
private _handleClickSelectedCountry;
Expand Down
17 changes: 16 additions & 1 deletion react/build/IntlTelInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,13 @@ var Iti = class {
}
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
this.isRTL = !!this.telInput.closest("[dir=rtl]");
if (this.options.separateDialCode) {
if (this.isRTL) {
this.originalPaddingRight = this.telInput.style.paddingRight;
} else {
this.originalPaddingLeft = this.telInput.style.paddingLeft;
}
}
this.options.i18n = { ...en_default, ...this.options.i18n };
const autoCountryPromise = new Promise((resolve, reject) => {
this.resolveAutoCountryPromise = resolve;
Expand Down Expand Up @@ -2612,7 +2619,8 @@ var Iti = class {
//********************
//* Remove plugin.
destroy() {
if (this.options.allowDropdown) {
const { allowDropdown, separateDialCode } = this.options;
if (allowDropdown) {
this._closeDropdown();
this.selectedCountry.removeEventListener(
"click",
Expand All @@ -2636,6 +2644,13 @@ var Iti = class {
this.telInput.removeEventListener("keydown", this._handleKeydownEvent);
}
this.telInput.removeAttribute("data-intl-tel-input-id");
if (separateDialCode) {
if (this.isRTL) {
this.telInput.style.paddingRight = this.originalPaddingRight;
} else {
this.telInput.style.paddingLeft = this.originalPaddingLeft;
}
}
const wrapper = this.telInput.parentNode;
wrapper?.parentNode?.insertBefore(this.telInput, wrapper);
wrapper?.parentNode?.removeChild(wrapper);
Expand Down
17 changes: 16 additions & 1 deletion react/build/IntlTelInputWithUtils.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,13 @@ var Iti = class {
}
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
this.isRTL = !!this.telInput.closest("[dir=rtl]");
if (this.options.separateDialCode) {
if (this.isRTL) {
this.originalPaddingRight = this.telInput.style.paddingRight;
} else {
this.originalPaddingLeft = this.telInput.style.paddingLeft;
}
}
this.options.i18n = { ...en_default, ...this.options.i18n };
const autoCountryPromise = new Promise((resolve, reject) => {
this.resolveAutoCountryPromise = resolve;
Expand Down Expand Up @@ -2648,7 +2655,8 @@ var Iti = class {
//********************
//* Remove plugin.
destroy() {
if (this.options.allowDropdown) {
const { allowDropdown, separateDialCode } = this.options;
if (allowDropdown) {
this._closeDropdown();
this.selectedCountry.removeEventListener(
"click",
Expand All @@ -2672,6 +2680,13 @@ var Iti = class {
this.telInput.removeEventListener("keydown", this._handleKeydownEvent);
}
this.telInput.removeAttribute("data-intl-tel-input-id");
if (separateDialCode) {
if (this.isRTL) {
this.telInput.style.paddingRight = this.originalPaddingRight;
} else {
this.telInput.style.paddingLeft = this.originalPaddingLeft;
}
}
const wrapper = this.telInput.parentNode;
wrapper?.parentNode?.insertBefore(this.telInput, wrapper);
wrapper?.parentNode?.removeChild(wrapper);
Expand Down
17 changes: 16 additions & 1 deletion react/build/IntlTelInputWithUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,13 @@ var Iti = class {
}
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
this.isRTL = !!this.telInput.closest("[dir=rtl]");
if (this.options.separateDialCode) {
if (this.isRTL) {
this.originalPaddingRight = this.telInput.style.paddingRight;
} else {
this.originalPaddingLeft = this.telInput.style.paddingLeft;
}
}
this.options.i18n = { ...en_default, ...this.options.i18n };
const autoCountryPromise = new Promise((resolve, reject) => {
this.resolveAutoCountryPromise = resolve;
Expand Down Expand Up @@ -2612,7 +2619,8 @@ var Iti = class {
//********************
//* Remove plugin.
destroy() {
if (this.options.allowDropdown) {
const { allowDropdown, separateDialCode } = this.options;
if (allowDropdown) {
this._closeDropdown();
this.selectedCountry.removeEventListener(
"click",
Expand All @@ -2636,6 +2644,13 @@ var Iti = class {
this.telInput.removeEventListener("keydown", this._handleKeydownEvent);
}
this.telInput.removeAttribute("data-intl-tel-input-id");
if (separateDialCode) {
if (this.isRTL) {
this.telInput.style.paddingRight = this.originalPaddingRight;
} else {
this.telInput.style.paddingLeft = this.originalPaddingLeft;
}
}
const wrapper = this.telInput.parentNode;
wrapper?.parentNode?.insertBefore(this.telInput, wrapper);
wrapper?.parentNode?.removeChild(wrapper);
Expand Down
17 changes: 16 additions & 1 deletion react/demo/set-number-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -25024,6 +25024,13 @@
}
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
this.isRTL = !!this.telInput.closest("[dir=rtl]");
if (this.options.separateDialCode) {
if (this.isRTL) {
this.originalPaddingRight = this.telInput.style.paddingRight;
} else {
this.originalPaddingLeft = this.telInput.style.paddingLeft;
}
}
this.options.i18n = { ...en_default, ...this.options.i18n };
const autoCountryPromise = new Promise((resolve, reject) => {
this.resolveAutoCountryPromise = resolve;
Expand Down Expand Up @@ -26141,7 +26148,8 @@
//********************
//* Remove plugin.
destroy() {
if (this.options.allowDropdown) {
const { allowDropdown, separateDialCode } = this.options;
if (allowDropdown) {
this._closeDropdown();
this.selectedCountry.removeEventListener(
"click",
Expand All @@ -26165,6 +26173,13 @@
this.telInput.removeEventListener("keydown", this._handleKeydownEvent);
}
this.telInput.removeAttribute("data-intl-tel-input-id");
if (separateDialCode) {
if (this.isRTL) {
this.telInput.style.paddingRight = this.originalPaddingRight;
} else {
this.telInput.style.paddingLeft = this.originalPaddingLeft;
}
}
const wrapper = this.telInput.parentNode;
wrapper?.parentNode?.insertBefore(this.telInput, wrapper);
wrapper?.parentNode?.removeChild(wrapper);
Expand Down
17 changes: 16 additions & 1 deletion react/demo/simple-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -25024,6 +25024,13 @@
}
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
this.isRTL = !!this.telInput.closest("[dir=rtl]");
if (this.options.separateDialCode) {
if (this.isRTL) {
this.originalPaddingRight = this.telInput.style.paddingRight;
} else {
this.originalPaddingLeft = this.telInput.style.paddingLeft;
}
}
this.options.i18n = { ...en_default, ...this.options.i18n };
const autoCountryPromise = new Promise((resolve, reject) => {
this.resolveAutoCountryPromise = resolve;
Expand Down Expand Up @@ -26141,7 +26148,8 @@
//********************
//* Remove plugin.
destroy() {
if (this.options.allowDropdown) {
const { allowDropdown, separateDialCode } = this.options;
if (allowDropdown) {
this._closeDropdown();
this.selectedCountry.removeEventListener(
"click",
Expand All @@ -26165,6 +26173,13 @@
this.telInput.removeEventListener("keydown", this._handleKeydownEvent);
}
this.telInput.removeAttribute("data-intl-tel-input-id");
if (separateDialCode) {
if (this.isRTL) {
this.telInput.style.paddingRight = this.originalPaddingRight;
} else {
this.telInput.style.paddingLeft = this.originalPaddingLeft;
}
}
const wrapper = this.telInput.parentNode;
wrapper?.parentNode?.insertBefore(this.telInput, wrapper);
wrapper?.parentNode?.removeChild(wrapper);
Expand Down
17 changes: 16 additions & 1 deletion react/demo/validation-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -25024,6 +25024,13 @@
}
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
this.isRTL = !!this.telInput.closest("[dir=rtl]");
if (this.options.separateDialCode) {
if (this.isRTL) {
this.originalPaddingRight = this.telInput.style.paddingRight;
} else {
this.originalPaddingLeft = this.telInput.style.paddingLeft;
}
}
this.options.i18n = { ...en_default, ...this.options.i18n };
const autoCountryPromise = new Promise((resolve, reject) => {
this.resolveAutoCountryPromise = resolve;
Expand Down Expand Up @@ -26141,7 +26148,8 @@
//********************
//* Remove plugin.
destroy() {
if (this.options.allowDropdown) {
const { allowDropdown, separateDialCode } = this.options;
if (allowDropdown) {
this._closeDropdown();
this.selectedCountry.removeEventListener(
"click",
Expand All @@ -26165,6 +26173,13 @@
this.telInput.removeEventListener("keydown", this._handleKeydownEvent);
}
this.telInput.removeAttribute("data-intl-tel-input-id");
if (separateDialCode) {
if (this.isRTL) {
this.telInput.style.paddingRight = this.originalPaddingRight;
} else {
this.telInput.style.paddingLeft = this.originalPaddingLeft;
}
}
const wrapper = this.telInput.parentNode;
wrapper?.parentNode?.insertBefore(this.telInput, wrapper);
wrapper?.parentNode?.removeChild(wrapper);
Expand Down
Loading

0 comments on commit 947a8b2

Please sign in to comment.