mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-30 18:43:21 +08:00
Merge pull request #16561 from humrochagf/master
Add type definitions for country-select-js
This commit is contained in:
7
types/country-select-js/country-select-js-tests.ts
Normal file
7
types/country-select-js/country-select-js-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
$('#country').countrySelect();
|
||||
|
||||
$('#country').countrySelect({
|
||||
defaultCountry: 'gb'
|
||||
});
|
||||
|
||||
$('#country').countrySelect('destroy');
|
||||
57
types/country-select-js/index.d.ts
vendored
Normal file
57
types/country-select-js/index.d.ts
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
// Type definitions for country-select-js 1.0
|
||||
// Project: https://github.com/mrmarkfrench/country-select-js
|
||||
// Definitions by: Humberto Rocha <https://github.com/humrochagf>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
declare namespace CountrySelectJs {
|
||||
interface Options {
|
||||
/**
|
||||
* Set the default country by it's country code. Otherwise it will just be
|
||||
* the first country in the list.
|
||||
*/
|
||||
defaultCountry?: string;
|
||||
|
||||
/**
|
||||
* Display only the countries you specify. Takes an array of country codes.
|
||||
*/
|
||||
onlyCountries?: string[];
|
||||
|
||||
/**
|
||||
* Specify the countries to appear at the top of the list. Defaults to
|
||||
* ["us", "gb"]
|
||||
*/
|
||||
preferredCountries?: string[];
|
||||
|
||||
/**
|
||||
* Set the dropdown's width to be the same as the input. This is
|
||||
* automatically enabled for small screens.
|
||||
*/
|
||||
responsiveDropdown?: boolean;
|
||||
}
|
||||
|
||||
interface CountryData {
|
||||
name: string;
|
||||
iso2: string;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Remove the plugin from the input, and unbind any event listeners.
|
||||
*/
|
||||
countrySelect(method: 'destroy'): void;
|
||||
|
||||
/**
|
||||
* Get the country data for the currently selected flag.
|
||||
*/
|
||||
countrySelect(method: 'getSelectedCountryData'): CountrySelectJs.CountryData;
|
||||
|
||||
countrySelect(method: string, value: string): void;
|
||||
|
||||
/**
|
||||
* initialize the plugin with optional options.
|
||||
*/
|
||||
countrySelect(options?: CountrySelectJs.Options): JQueryDeferred<any>;
|
||||
}
|
||||
23
types/country-select-js/tsconfig.json
Normal file
23
types/country-select-js/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"country-select-js-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/country-select-js/tslint.json
Normal file
1
types/country-select-js/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user