diff --git a/types/intl-tel-input/index.d.ts b/types/intl-tel-input/index.d.ts index b0752632c3..424c454bac 100644 --- a/types/intl-tel-input/index.d.ts +++ b/types/intl-tel-input/index.d.ts @@ -21,10 +21,10 @@ export interface IntlTelInputStatic { * initialise the plugin with optional options. * @param options options that can be provided during initialization. */ - (node: Element, options?: IntlTelInputOptions): IntlTelInput; + (node: Element, options?: Options): Plugin; } -export interface IntlTelInput { +export interface Plugin { /** * Remove the plugin from the input, and unbind any event listeners. */ @@ -103,7 +103,7 @@ export interface IntlTelInput { setPlaceholderNumberType(type: NumberType): void; } -export interface IntlTelInputOptions { +export interface Options { /** * Whether or not to allow the dropdown. If disabled, there is no dropdown * arrow, and the selected flag is not clickable. Also we display the diff --git a/types/intl-tel-input/intl-tel-input-tests.ts b/types/intl-tel-input/intl-tel-input-tests.ts index 9a84e98428..fdba2811e1 100644 --- a/types/intl-tel-input/intl-tel-input-tests.ts +++ b/types/intl-tel-input/intl-tel-input-tests.ts @@ -1,4 +1,5 @@ import IntlTelInput = require("intl-tel-input"); +import { NumberFormat } from "intl-tel-input"; const input = document.querySelector("#phone"); window.intlTelInput(input); @@ -41,7 +42,13 @@ window.intlTelInput(input).setCountry('gb'); window.intlTelInput(input).setNumber('+447733123456'); +window.intlTelInput(input).setPlaceholderNumberType(IntlTelInput.NumberType.FIXED_LINE); + const countryData = window.intlTelInput.getCountryData(); +const country = countryData[0]; +const dialCode = country.dialCode; +const iso2 = country.iso2; +const name = country.name; window.intlTelInput.loadUtils('build/js/utils.js'); @@ -67,3 +74,16 @@ window.intlTelInput(input, { onlyCountries: ['al'], utilsScript: '../../build/js/utils.js' }); + +window.intlTelInput(input, { + allowDropdown: false, + autoHideDialCode: false, + autoPlaceholder: "aggressive", + dropdownContainer: document.body, + excludeCountries: [ "us", "uk" ], + formatOnDisplay: false, + hiddenInput: "hidden-input", + localizedCountries: { de: "Deutschland"}, + preferredCountries: ["us", "gb"], + separateDialCode: false +});